From ef7937390452133d6fc6fc8b38c05678b5722f24 Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Wed, 7 May 2025 19:25:17 -0400 Subject: [PATCH] Fix chairs deleting players (#37261) Unbuckle entities when a strap is about to be deleted --- Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs | 2 +- Content.Shared/Buckle/SharedBuckleSystem.Strap.cs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs index 3d2d263652..85d7698ff0 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs @@ -458,7 +458,7 @@ public abstract partial class SharedBuckleSystem var buckleXform = Transform(buckle); var oldBuckledXform = Transform(strap); - if (buckleXform.ParentUid == strap.Owner && !Terminating(buckleXform.ParentUid)) + if (buckleXform.ParentUid == strap.Owner && !Terminating(oldBuckledXform.ParentUid)) { _transform.PlaceNextTo((buckle, buckleXform), (strap.Owner, oldBuckledXform)); buckleXform.ActivelyLerping = false; diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs b/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs index bfb0cd9cd6..c101340421 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs @@ -14,6 +14,7 @@ public abstract partial class SharedBuckleSystem { SubscribeLocalEvent(OnStrapStartup); SubscribeLocalEvent(OnStrapShutdown); + SubscribeLocalEvent(OnStrapTerminating); SubscribeLocalEvent((e, c, _) => StrapRemoveAll(e, c)); SubscribeLocalEvent(OnStrapContainerGettingInsertedAttempt); @@ -35,6 +36,11 @@ public abstract partial class SharedBuckleSystem StrapRemoveAll(uid, component); } + private void OnStrapTerminating(Entity 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. -- 2.51.2