Fix chairs deleting players (#37261)

Unbuckle entities when a strap is about to be deleted
This commit is contained in:
Tayrtahn
2025-05-07 19:25:17 -04:00
committed by GitHub
parent 47258651a3
commit ef79373904
2 changed files with 7 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ public abstract partial class SharedBuckleSystem
{
SubscribeLocalEvent<StrapComponent, ComponentStartup>(OnStrapStartup);
SubscribeLocalEvent<StrapComponent, ComponentShutdown>(OnStrapShutdown);
SubscribeLocalEvent<StrapComponent, EntityTerminatingEvent>(OnStrapTerminating);
SubscribeLocalEvent<StrapComponent, ComponentRemove>((e, c, _) => StrapRemoveAll(e, c));
SubscribeLocalEvent<StrapComponent, ContainerGettingInsertedAttemptEvent>(OnStrapContainerGettingInsertedAttempt);
@@ -35,6 +36,11 @@ public abstract partial class SharedBuckleSystem
StrapRemoveAll(uid, component);
}
private void OnStrapTerminating(Entity<StrapComponent> entity, ref EntityTerminatingEvent args)
{
StrapRemoveAll(entity, entity.Comp);
}
private void OnStrapContainerGettingInsertedAttempt(EntityUid uid, StrapComponent component, ContainerGettingInsertedAttemptEvent args)
{
// If someone is attempting to put this item inside of a backpack, ensure that it has no entities strapped to it.