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:
committed by
GitHub
parent
a6c58aba12
commit
80d733a152
@@ -56,7 +56,7 @@ namespace Content.Server.Nuke
|
|||||||
/// How long a user must wait to disarm the bomb.
|
/// How long a user must wait to disarm the bomb.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("disarmDoafterLength")]
|
[DataField("disarmDoafterLength")]
|
||||||
public float DisarmDoafterLength = 30.0f;
|
public float DisarmDoAfterLength = 30.0f;
|
||||||
|
|
||||||
[DataField("alertLevelOnActivate")] public string AlertLevelOnActivate = default!;
|
[DataField("alertLevelOnActivate")] public string AlertLevelOnActivate = default!;
|
||||||
[DataField("alertLevelOnDeactivate")] public string AlertLevelOnDeactivate = default!;
|
[DataField("alertLevelOnDeactivate")] public string AlertLevelOnDeactivate = default!;
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ public sealed class NukeSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
UpdateUserInterface(uid, component);
|
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
|
// 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.
|
// 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
|
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
|
// do nothing, wait for arm button to be pressed
|
||||||
break;
|
break;
|
||||||
case NukeStatus.ARMED:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,7 +414,7 @@ public sealed class NukeSystem : EntitySystem
|
|||||||
AllowArm = allowArm,
|
AllowArm = allowArm,
|
||||||
EnteredCodeLength = component.EnteredCode.Length,
|
EnteredCodeLength = component.EnteredCode.Length,
|
||||||
MaxCodeLength = component.CodeLength,
|
MaxCodeLength = component.CodeLength,
|
||||||
CooldownTime = (int) component.CooldownTime
|
CooldownTime = (int) component.CooldownTime,
|
||||||
};
|
};
|
||||||
|
|
||||||
_ui.SetUiState(uid, NukeUiKey.Key, state);
|
_ui.SetUiState(uid, NukeUiKey.Key, state);
|
||||||
@@ -436,7 +441,7 @@ public sealed class NukeSystem : EntitySystem
|
|||||||
8 => 9,
|
8 => 9,
|
||||||
9 => 10,
|
9 => 10,
|
||||||
0 => component.LastPlayedKeypadSemitones + 12,
|
0 => component.LastPlayedKeypadSemitones + 12,
|
||||||
_ => 0
|
_ => 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Don't double-dip on the octave shifting
|
// Don't double-dip on the octave shifting
|
||||||
@@ -617,9 +622,9 @@ public sealed class NukeSystem : EntitySystem
|
|||||||
|
|
||||||
#endregion
|
#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,
|
BreakOnDamage = true,
|
||||||
BreakOnMove = true,
|
BreakOnMove = true,
|
||||||
@@ -629,8 +634,10 @@ public sealed class NukeSystem : EntitySystem
|
|||||||
if (!_doAfter.TryStartDoAfter(doAfter))
|
if (!_doAfter.TryStartDoAfter(doAfter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_popups.PopupEntity(Loc.GetString("nuke-component-doafter-warning"), user,
|
_popups.PopupEntity(Loc.GetString("nuke-component-doafter-warning"),
|
||||||
user, PopupType.LargeCaution);
|
user,
|
||||||
|
user,
|
||||||
|
PopupType.LargeCaution);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateAppearance(EntityUid uid, NukeComponent nuke)
|
private void UpdateAppearance(EntityUid uid, NukeComponent nuke)
|
||||||
|
|||||||
Reference in New Issue
Block a user