Fix skeletons spawning in folded body bags (#37151)

* Fix skeleton spawning

* Add comments

* Fix the comments

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
youtissoum
2025-05-03 21:19:32 +02:00
committed by GitHub
parent 0c8c757a42
commit 07460f9eda
3 changed files with 24 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ public sealed class FoldableSystem : EntitySystem
SubscribeLocalEvent<FoldableComponent, ComponentInit>(OnFoldableInit);
SubscribeLocalEvent<FoldableComponent, ContainerGettingInsertedAttemptEvent>(OnInsertEvent);
SubscribeLocalEvent<FoldableComponent, StorageOpenAttemptEvent>(OnFoldableOpenAttempt);
SubscribeLocalEvent<FoldableComponent, EntityStorageInsertedIntoAttemptEvent>(OnEntityStorageAttemptInsert);
SubscribeLocalEvent<FoldableComponent, StrapAttemptEvent>(OnStrapAttempt);
}
@@ -56,6 +57,13 @@ public sealed class FoldableSystem : EntitySystem
args.Cancelled = true;
}
private void OnEntityStorageAttemptInsert(Entity<FoldableComponent> entity,
ref EntityStorageInsertedIntoAttemptEvent args)
{
if (entity.Comp.IsFolded)
args.Cancelled = true;
}
/// <summary>
/// Returns false if the entity isn't foldable.
/// </summary>