Fix storage destruction/deletion bug (#24882)
This commit is contained in:
@@ -198,6 +198,9 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
if (!ResolveStorage(uid, ref component))
|
||||
return;
|
||||
|
||||
if (component.Open)
|
||||
return;
|
||||
|
||||
var beforeev = new StorageBeforeOpenEvent();
|
||||
RaiseLocalEvent(uid, ref beforeev);
|
||||
component.Open = true;
|
||||
@@ -216,6 +219,16 @@ public abstract class SharedEntityStorageSystem : EntitySystem
|
||||
if (!ResolveStorage(uid, ref component))
|
||||
return;
|
||||
|
||||
if (!component.Open)
|
||||
return;
|
||||
|
||||
// Prevent the container from closing if it is queued for deletion. This is so that the container-emptying
|
||||
// behaviour of DestructionEventArgs is respected. This exists because malicious players were using
|
||||
// destructible boxes to delete entities by having two players simultaneously destroy and close the box in
|
||||
// the same tick.
|
||||
if (EntityManager.IsQueuedForDeletion(uid))
|
||||
return;
|
||||
|
||||
component.Open = false;
|
||||
Dirty(uid, component);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user