Stop Item EntityStorages being able to eat people (#5268)
This commit is contained in:
@@ -211,19 +211,44 @@ namespace Content.Server.Storage.Components
|
|||||||
if (entity.IsInContainer())
|
if (entity.IsInContainer())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// only items that can be stored in an inventory, or a mob, can be eaten by a locker
|
// conditions are complicated because of pizzabox-related issues, so follow this guide
|
||||||
if (!entity.HasComponent<SharedItemComponent>() &&
|
// 1. AddToContents can block anything
|
||||||
!entity.HasComponent<SharedBodyComponent>())
|
// 2. maximum item count can block anything
|
||||||
continue;
|
// 3. ghosts can NEVER be eaten
|
||||||
|
// 4. items can always be eaten unless a previous law prevents it
|
||||||
|
// 5. if this is NOT AN ITEM, then mobs can always be eaten unless unless a previous law prevents it
|
||||||
|
|
||||||
// Let's not insert admin ghosts, yeah? This is really a a hack and should be replaced by attempt events
|
// Let's not insert admin ghosts, yeah? This is really a a hack and should be replaced by attempt events
|
||||||
if (entity.HasComponent<GhostComponent>())
|
if (Owner.EntityManager.HasComponent<GhostComponent>(entity.Uid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!AddToContents(entity))
|
// checks
|
||||||
{
|
|
||||||
|
var targetIsItem = Owner.EntityManager.HasComponent<SharedItemComponent>(entity.Uid);
|
||||||
|
var targetIsMob = Owner.EntityManager.HasComponent<SharedBodyComponent>(entity.Uid);
|
||||||
|
var storageIsItem = Owner.EntityManager.HasComponent<SharedItemComponent>(OwnerUid);
|
||||||
|
|
||||||
|
var allowedToEat = false;
|
||||||
|
|
||||||
|
if (targetIsItem)
|
||||||
|
allowedToEat = true;
|
||||||
|
|
||||||
|
// BEFORE REPLACING THIS WITH, I.E. A PROPERTY:
|
||||||
|
// Make absolutely 100% sure you have worked out how to stop people ending up in backpacks.
|
||||||
|
// Seriously, it is insanely hacky and weird to get someone out of a backpack once they end up in there.
|
||||||
|
// And to be clear, they should NOT be in there.
|
||||||
|
// For the record, what you need to do is empty the backpack onto a PlacableSurface (table, rack)
|
||||||
|
if (targetIsMob && !storageIsItem)
|
||||||
|
allowedToEat = true;
|
||||||
|
|
||||||
|
if (!allowedToEat)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
// finally, AddToContents
|
||||||
|
|
||||||
|
if (!AddToContents(entity))
|
||||||
|
continue;
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
if (count >= _storageCapacityMax)
|
if (count >= _storageCapacityMax)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user