Networking bugfixes & improvements:

- fixed server not sending kill-events when a monster dies
- some interpolation when correcting character positions
- physicsbody position lerping improvements
- sending AICharacter Dir instead of TargetDir
This commit is contained in:
Regalis
2016-03-09 16:49:56 +02:00
parent 37f70a1028
commit a1c728d207
13 changed files with 126 additions and 95 deletions
@@ -415,16 +415,15 @@ namespace Barotrauma
Item item = Entity.FindEntityByID(itemId) as Item;
if (item == null) continue;
Inventory existingInventory = item.ParentInventory;
//item already in the right slot, no need to do anything
if (Items[i] == item) continue;
if (Items[i] != item && Items[i] != null) Items[i].Drop(character, false);
//some other item already in the slot -> drop it
if (Items[i] != null) Items[i].Drop(character, false);
if (TryPutItem(item, i, false, false))
{
if (droppedItems.Contains(item))
{
droppedItems.Remove(item);
}
if (droppedItems.Contains(item)) droppedItems.Remove(item);
}
}
}
@@ -195,33 +195,35 @@ namespace Barotrauma.Items.Components
if (picker == null)
{
picker = dropper;
//foreach (Character c in Character.characterList)
//{
// if (c.Inventory == null) continue;
// if (c.Inventory.FindIndex(item) == -1) continue;
// picker = c;
// break;
//}
}
if (picker == null || picker.Inventory == null) return;
Vector2 bodyDropPos = Vector2.Zero;
DropConnectedWires(picker);
item.Submarine = picker.Submarine;
if (item.body!= null && !item.body.Enabled)
if (picker == null || picker.Inventory == null)
{
Limb rightHand = picker.AnimController.GetLimb(LimbType.RightHand);
item.SetTransform(rightHand.SimPosition, 0.0f);
item.body.Enabled = true;
if (item.ParentInventory!=null && item.ParentInventory.Owner!=null)
{
bodyDropPos = item.ParentInventory.Owner.SimPosition;
}
}
else
{
DropConnectedWires(picker);
item.Submarine = picker.Submarine;
Limb rightHand = picker.AnimController.GetLimb(LimbType.RightHand);
bodyDropPos = rightHand.SimPosition;
picker.Inventory.RemoveItem(item);
picker = null;
}
if (item.body != null && !item.body.Enabled)
{
item.SetTransform(bodyDropPos, 0.0f);
item.body.Enabled = true;
}
picker.Inventory.RemoveItem(item);
picker = null;
}
}