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:
Regalis
2016-08-16 17:56:33 +03:00
parent 8a2ad8eb64
commit 6c5452570e
11 changed files with 175 additions and 106 deletions
+12 -2
View File
@@ -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);