Server log, ai characters steer away from the abyss

This commit is contained in:
Regalis
2016-02-14 16:47:23 +02:00
parent ea6824a60d
commit bec6d95198
27 changed files with 306 additions and 71 deletions
@@ -158,10 +158,13 @@ namespace Barotrauma.Items.Components
item.SetTransform(rightHand.SimPosition, 0.0f);
}
bool alreadySelected = character.HasSelectedItem(item);
if (picker.TrySelectItem(item))
{
item.body.Enabled = true;
IsActive = true;
if (!alreadySelected) Barotrauma.Networking.GameServer.Log(character.Name+" equipped "+item.Name);
}
}
@@ -171,6 +174,8 @@ namespace Barotrauma.Items.Components
picker.DeselectItem(item);
Barotrauma.Networking.GameServer.Log(character.Name + " unequipped " + item.Name);
item.body.Enabled = false;
IsActive = false;
}
@@ -296,7 +301,7 @@ namespace Barotrauma.Items.Components
return true;
}
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message, float sendingTime)
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message, float sendingTime)
{
Vector2 newPos = Vector2.Zero;
@@ -135,12 +135,12 @@ namespace Barotrauma.Items.Components
leftHand.Disabled = true;
leftHand.pullJoint.Enabled = true;
leftHand.pullJoint.WorldAnchorB = item.SimPosition + Vector2.UnitY * (float)Math.Sin(pickTimer*10.0f)*0.1f;
leftHand.pullJoint.WorldAnchorB = item.SimPosition + Vector2.UnitY * ((pickTimer / 10.0f) % 0.1f);
rightHand.Disabled = true;
rightHand.pullJoint.Enabled = true;
rightHand.pullJoint.WorldAnchorB = item.SimPosition + Vector2.UnitY * (float)Math.Sin(pickTimer*10.0f) * 0.1f;
rightHand.pullJoint.WorldAnchorB = item.SimPosition + Vector2.UnitY * ((pickTimer / 10.0f) % 0.1f);
pickTimer += CoroutineManager.DeltaTime;
yield return CoroutineStatus.Running;
@@ -161,7 +161,7 @@ namespace Barotrauma.Items.Components
protected void DropConnectedWires(Character character)
{
if (character == null) return;
Vector2 pos = character == null ? item.SimPosition : character.SimPosition;
var connectionPanel = item.GetComponent<ConnectionPanel>();
if (connectionPanel == null) return;
@@ -173,7 +173,7 @@ namespace Barotrauma.Items.Components
if (w == null) continue;
w.Item.Drop(character);
w.Item.SetTransform(character.SimPosition, 0.0f);
w.Item.SetTransform(pos, 0.0f);
}
}
}