]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix chairs deleting players (#37261)
authorTayrtahn <tayrtahn@gmail.com>
Wed, 7 May 2025 23:25:17 +0000 (19:25 -0400)
committerGitHub <noreply@github.com>
Wed, 7 May 2025 23:25:17 +0000 (19:25 -0400)
Unbuckle entities when a strap is about to be deleted

Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs
Content.Shared/Buckle/SharedBuckleSystem.Strap.cs

index 3d2d263652a4be6dd32a8483e50e0f20cf39d058..85d7698ff0c12cf139c46b701ce73704590b4de8 100644 (file)
@@ -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;
index bfb0cd9cd6fdfd3d0e3407e63a5f395533bf972a..c101340421a63c06fccdd5a3893c13a9cfbb2671 100644 (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.