PickItem networkevents include whether the item was selected instead of toggling selected/deselected, items can be picked when inside their trigger even if the position of the item isn't visible (i.e. ladders in Nehalennia can be climbed again)

This commit is contained in:
Regalis
2016-08-13 18:33:42 +03:00
parent 66df9c1dd0
commit aa2dbab579
2 changed files with 19 additions and 20 deletions

View File

@@ -1479,6 +1479,10 @@ namespace Barotrauma
message.Write((ushort)pickData[0]);
message.Write((int)pickData[1] == 1);
message.Write((int)pickData[2] == 1);
var pickedItem = Entity.FindEntityByID((ushort)pickData[0]);
message.Write(pickedItem != null && selectedConstruction == pickedItem);
message.WritePadBits();
return true;
@@ -1613,6 +1617,8 @@ namespace Barotrauma
bool pickHit = message.ReadBoolean();
bool actionHit = message.ReadBoolean();
bool isSelected = message.ReadBoolean();
data = new int[] { (int)itemId, pickHit ? 1 : 0, actionHit ? 1: 0 };
System.Diagnostics.Debug.WriteLine("item id: "+itemId);
@@ -1629,7 +1635,7 @@ namespace Barotrauma
GameServer.Log(Name + " selected " + pickedItem.Name, Color.Orange);
}
pickedItem.Pick(this, false, pickHit, actionHit);
selectedConstruction = isSelected ? pickedItem : null;
}
return;