]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
[Hotfix] Wizard Rod doesn't gib the wizard. (#40041)
authorPrincess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
Sat, 6 Sep 2025 09:18:17 +0000 (02:18 -0700)
committerPrincess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Sat, 6 Sep 2025 09:19:20 +0000 (02:19 -0700)
* Title

* Tired

* That shit did nothing goddamn

* Fix for real

* Use og code

* Hmmm borgaer

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Content.Server/Polymorph/Components/PolymorphedEntityComponent.cs
Content.Server/Polymorph/Systems/PolymorphSystem.cs

index 7e3437a908cf5c0ec93627fd5b8c45d15c9c3a6e..03ab7b6c1fda4a1d3bb42ab67647974ab1e7a5dc 100644 (file)
@@ -20,6 +20,12 @@ public sealed partial class PolymorphedEntityComponent : Component
     [DataField(required: true)]
     public EntityUid? Parent;
 
+    /// <summary>
+    /// Whether this polymorph has been reverted.
+    /// </summary>
+    [DataField]
+    public bool Reverted;
+
     /// <summary>
     /// The amount of time that has passed since the entity was created
     /// used for tracking the duration
index ee7fdf2b22cfbd9e987626cee2bb1771df1784e0..b9453d2924b518c253e238e2a95636d6c8976c90 100644 (file)
@@ -128,12 +128,11 @@ public sealed partial class PolymorphSystem : EntitySystem
 
     private void OnBeforeFullySliced(Entity<PolymorphedEntityComponent> ent, ref BeforeFullySlicedEvent args)
     {
-        var (_, comp) = ent;
-        if (comp.Configuration.RevertOnEat)
-        {
-            args.Cancel();
-            Revert((ent, ent));
-        }
+        if (ent.Comp.Reverted || !ent.Comp.Configuration.RevertOnEat)
+            return;
+
+        args.Cancel();
+        Revert((ent, ent));
     }
 
     /// <summary>
@@ -142,14 +141,17 @@ public sealed partial class PolymorphSystem : EntitySystem
     /// </summary>
     private void OnDestruction(Entity<PolymorphedEntityComponent> ent, ref DestructionEventArgs args)
     {
-        if (ent.Comp.Configuration.RevertOnDeath)
-        {
-            Revert((ent, ent));
-        }
+        if (ent.Comp.Reverted || !ent.Comp.Configuration.RevertOnDeath)
+            return;
+
+        Revert((ent, ent));
     }
 
     private void OnPolymorphedTerminating(Entity<PolymorphedEntityComponent> ent, ref EntityTerminatingEvent args)
     {
+        if (ent.Comp.Reverted)
+            return;
+
         if (ent.Comp.Configuration.RevertOnDelete)
             Revert(ent.AsNullable());
 
@@ -298,8 +300,6 @@ public sealed partial class PolymorphSystem : EntitySystem
         if (component.Parent is not { } parent)
             return null;
 
-        // Clear our reference to the original entity
-        component.Parent = null;
         if (Deleted(parent))
             return null;
 
@@ -316,6 +316,8 @@ public sealed partial class PolymorphSystem : EntitySystem
         _transform.SetParent(parent, parentXform, uidXform.ParentUid);
         _transform.SetCoordinates(parent, parentXform, uidXform.Coordinates, uidXform.LocalRotation);
 
+        component.Reverted = true;
+
         if (component.Configuration.TransferDamage &&
             TryComp<DamageableComponent>(parent, out var damageParent) &&
             _mobThreshold.GetScaledDamage(uid, parent, out var damage) &&