More sanity checks to make sure clients aren't doing something they're not allowed to:
- AICharacter, hull, structure and submarine updates from clients are ignored - character updates from anyone else than the client controlling the character are ignored - players can't pick/drop items from anyone else's inventory (unless the target is unconscious/stunned/cuffed) - server has authority over reactor temperature
This commit is contained in:
@@ -526,8 +526,7 @@ namespace Barotrauma
|
||||
if (Items[i] != null)
|
||||
{
|
||||
droppedItems.Add(Items[i]);
|
||||
Items[i].Drop(character, false);
|
||||
|
||||
Items[i].Drop(character, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -538,6 +537,17 @@ namespace Barotrauma
|
||||
//item already in the right slot, no need to do anything
|
||||
if (Items[i] == item) continue;
|
||||
|
||||
//if the item is in the inventory of some other character and said character isn't dead/unconscious,
|
||||
//don't let this character pick it up
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
var owner = item.ParentInventory == null ? null : item.ParentInventory.Owner as Character;
|
||||
if (owner != null && owner != character)
|
||||
{
|
||||
if (!character.CanAccessItem(item)) return;
|
||||
}
|
||||
}
|
||||
|
||||
//some other item already in the slot -> drop it
|
||||
if (Items[i] != null) Items[i].Drop(character, false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user