Resolving Wizard casting recall on nuke disk making it impossible to disarm (#38661)

* 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.
This commit is contained in:
Andrew Malcolm O'Neill
2025-07-02 21:50:22 +01:00
committed by GitHub
parent a6c58aba12
commit 80d733a152
2 changed files with 17 additions and 10 deletions

View 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)