Disable aiming with holdable items when using a (railgun) controller, syncing ViewTargetID properly between clients, dropping connected wires when a button is picked up, placing large InterestingPositions on the main path through the level

This commit is contained in:
Regalis
2016-02-13 23:26:50 +02:00
parent 9b6dd5da00
commit ea6824a60d
7 changed files with 88 additions and 43 deletions
@@ -110,6 +110,7 @@ namespace Barotrauma.Items.Components
public override void Drop(Character dropper)
{
DropConnectedWires(dropper);
if (body != null) item.body = body;
@@ -246,6 +247,8 @@ namespace Barotrauma.Items.Components
item.Submarine = picker.Submarine;
if (picker.SelectedConstruction != null && picker.SelectedConstruction.GetComponent<Controller>() != null) return;
//item.sprite.Depth = picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.01f;
ac.HoldItem(deltaTime, item, handlePos, holdPos, aimPos, picker.IsKeyDown(InputType.Aim), holdAngle);
@@ -97,20 +97,7 @@ namespace Barotrauma.Items.Components
}
item.linkedTo.Clear();
var connectionPanel = item.GetComponent<ConnectionPanel>();
if (connectionPanel != null)
{
foreach (Connection c in connectionPanel.Connections)
{
foreach (Wire w in c.Wires)
{
if (w == null) continue;
w.Item.Drop(picker);
w.Item.SetTransform(picker.SimPosition, 0.0f);
}
}
}
DropConnectedWires(picker);
ApplyStatusEffects(ActionType.OnPicked, 1.0f, picker);
@@ -134,7 +121,9 @@ namespace Barotrauma.Items.Components
pickTimer = 0.0f;
while (pickTimer < requiredTime)
{
if (picker.IsKeyHit(InputType.Aim) || !item.IsInPickRange(picker.WorldPosition))
if (picker.IsKeyDown(InputType.Aim) ||
!item.IsInPickRange(picker.WorldPosition) ||
picker.Stun > 0.0f || picker.IsDead)
{
StopPicking(picker);
yield return CoroutineStatus.Success;
@@ -159,7 +148,7 @@ namespace Barotrauma.Items.Components
StopPicking(picker);
OnPicked(picker);
if (!picker.IsNetworkPlayer) OnPicked(picker);
yield return CoroutineStatus.Success;
}
@@ -170,6 +159,25 @@ namespace Barotrauma.Items.Components
pickTimer = 0.0f;
}
protected void DropConnectedWires(Character character)
{
if (character == null) return;
var connectionPanel = item.GetComponent<ConnectionPanel>();
if (connectionPanel == null) return;
foreach (Connection c in connectionPanel.Connections)
{
foreach (Wire w in c.Wires)
{
if (w == null) continue;
w.Item.Drop(character);
w.Item.SetTransform(character.SimPosition, 0.0f);
}
}
}
public override void Draw(SpriteBatch spriteBatch, bool editing = false)
{
@@ -198,7 +206,9 @@ namespace Barotrauma.Items.Components
//}
}
if (picker==null || picker.Inventory == null) return;
if (picker == null || picker.Inventory == null) return;
DropConnectedWires(picker);
item.Submarine = picker.Submarine;