]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Resolving Wizard casting recall on nuke disk making it impossible to disarm (#38661)
authorAndrew Malcolm O'Neill <105134723+maland1@users.noreply.github.com>
Wed, 2 Jul 2025 20:50:22 +0000 (21:50 +0100)
committerGitHub <noreply@github.com>
Wed, 2 Jul 2025 20:50:22 +0000 (22:50 +0200)
* Resolving Wizard Recall on Nuke disk making it impossible to disarm
- Adding a DisarmBomb case to nuke status update loop
- Changing a few methods and parameters to properly follow formatting standards
- Updating some names to follow camelCase

* Updating missed tag

* Reverting DataField change

Should prevent this preventative bugfix being a breaking change.

Content.Server/Nuke/NukeComponent.cs
Content.Server/Nuke/NukeSystem.cs

index b14ad9c1654e574b2ad49a05d463223863e4d328..cd1c0227eb83c5812afda2314fe79efe7cf7d225 100644 (file)
@@ -56,7 +56,7 @@ namespace Content.Server.Nuke
         ///     How long a user must wait to disarm the bomb.
         /// </summary>
         [DataField("disarmDoafterLength")]
-        public float DisarmDoafterLength = 30.0f;
+        public float DisarmDoAfterLength = 30.0f;
 
         [DataField("alertLevelOnActivate")] public string AlertLevelOnActivate = default!;
         [DataField("alertLevelOnDeactivate")] public string AlertLevelOnDeactivate = default!;
index 81fbf074da8886c15131868e8ac3b0a2a29e4c24..f110734a604bc73655ca61d3d120ccc6a30312ad 100644 (file)
@@ -165,7 +165,7 @@ public sealed class NukeSystem : EntitySystem
     {
         UpdateUserInterface(uid, component);
 
-        if (args.Anchored == false && component.Status == NukeStatus.ARMED && component.RemainingTime > component.DisarmDoafterLength)
+        if (args.Anchored == false && component.Status == NukeStatus.ARMED && component.RemainingTime > component.DisarmDoAfterLength)
         {
             // yes, this means technically if you can find a way to unanchor the nuke, you can disarm it
             // without the doafter. but that takes some effort, and it won't allow you to disarm a nuke that can't be disarmed by the doafter.
@@ -271,7 +271,7 @@ public sealed class NukeSystem : EntitySystem
 
         else
         {
-            DisarmBombDoafter(uid, args.Actor, component);
+            DisarmBombDoAfter(uid, args.Actor, component);
         }
     }
 
@@ -381,7 +381,12 @@ public sealed class NukeSystem : EntitySystem
                 // do nothing, wait for arm button to be pressed
                 break;
             case NukeStatus.ARMED:
-                // do nothing, wait for arm button to be unpressed
+                // handling case of wizard recalling disk out of armed Nuke
+                if (!component.DiskSlot.HasItem)
+                {
+                    DisarmBomb(uid, component);
+                }
+
                 break;
         }
     }
@@ -409,7 +414,7 @@ public sealed class NukeSystem : EntitySystem
             AllowArm = allowArm,
             EnteredCodeLength = component.EnteredCode.Length,
             MaxCodeLength = component.CodeLength,
-            CooldownTime = (int) component.CooldownTime
+            CooldownTime = (int) component.CooldownTime,
         };
 
         _ui.SetUiState(uid, NukeUiKey.Key, state);
@@ -436,7 +441,7 @@ public sealed class NukeSystem : EntitySystem
             8 => 9,
             9 => 10,
             0 => component.LastPlayedKeypadSemitones + 12,
-            _ => 0
+            _ => 0,
         };
 
         // Don't double-dip on the octave shifting
@@ -617,9 +622,9 @@ public sealed class NukeSystem : EntitySystem
 
     #endregion
 
-    private void DisarmBombDoafter(EntityUid uid, EntityUid user, NukeComponent nuke)
+    private void DisarmBombDoAfter(EntityUid uid, EntityUid user, NukeComponent nuke)
     {
-        var doAfter = new DoAfterArgs(EntityManager, user, nuke.DisarmDoafterLength, new NukeDisarmDoAfterEvent(), uid, target: uid)
+        var doAfter = new DoAfterArgs(EntityManager, user, nuke.DisarmDoAfterLength, new NukeDisarmDoAfterEvent(), uid, target: uid)
         {
             BreakOnDamage = true,
             BreakOnMove = true,
@@ -629,8 +634,10 @@ public sealed class NukeSystem : EntitySystem
         if (!_doAfter.TryStartDoAfter(doAfter))
             return;
 
-        _popups.PopupEntity(Loc.GetString("nuke-component-doafter-warning"), user,
-            user, PopupType.LargeCaution);
+        _popups.PopupEntity(Loc.GetString("nuke-component-doafter-warning"),
+            user,
+            user,
+            PopupType.LargeCaution);
     }
 
     private void UpdateAppearance(EntityUid uid, NukeComponent nuke)