Hacked clients can't send chat messages from other characters anymore

Also added sendername as userdata in chat messages, for now it's not used for anything but we'll probably find something where this is useful
This commit is contained in:
juanjp600
2016-08-30 17:35:58 -03:00
parent 07398be97e
commit 52270e3a35
7 changed files with 73 additions and 45 deletions
+18 -18
View File
@@ -864,12 +864,12 @@ namespace Barotrauma
return owner.isDead || owner.IsUnconscious || owner.Stun > 0.0f || owner.LockHands;
}
if (inventory.Owner is Item)
if (inventory.Owner is Item)
{
var owner = (Item)inventory.Owner;
if (!CanAccessItem(owner))
{
return false;
if (!CanAccessItem(owner))
{
return false;
}
}
return true;
@@ -878,22 +878,22 @@ namespace Barotrauma
public bool CanAccessItem(Item item)
{
if (item.ParentInventory != null)
{
{
return CanAccessInventory(item.ParentInventory);
}
}
float maxDist = item.PickDistance * 1.2f;
if (maxDist <= 0.01f)
{
maxDist = 150.0f;
}
if (Vector2.Distance(WorldPosition, item.WorldPosition) < maxDist ||
item.IsInsideTrigger(WorldPosition))
{
return true;
}
if (maxDist <= 0.01f)
{
maxDist = 150.0f;
}
if (Vector2.Distance(WorldPosition, item.WorldPosition) < maxDist ||
item.IsInsideTrigger(WorldPosition))
{
return true;
}
return item.GetComponent<Items.Components.Ladder>() != null;
}