Skip to content

Commit

Permalink
Nuke Now Requires the Disk to be Inserted to Toggle Anchor (#29565)
Browse files Browse the repository at this point in the history
* Nuke Now Requires the Disk to be Inserted to Toggle Anchor

* message stating you need the disk to toggle floor bolts
  • Loading branch information
Cojoke-dot authored and deltanedas committed Sep 14, 2024
1 parent fa33476 commit 283eacd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Content.Client/Nuke/NukeMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void UpdateState(NukeUiState state)
FirstStatusLabel.Text = firstMsg;
SecondStatusLabel.Text = secondMsg;

EjectButton.Disabled = !state.DiskInserted || state.Status == NukeStatus.ARMED;
EjectButton.Disabled = !state.DiskInserted || state.Status == NukeStatus.ARMED || !state.IsAnchored;
AnchorButton.Disabled = state.Status == NukeStatus.ARMED;
AnchorButton.Pressed = state.IsAnchored;
ArmButton.Disabled = !state.AllowArm || !state.IsAnchored;
Expand Down
10 changes: 10 additions & 0 deletions Content.Server/Nuke/NukeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,21 @@ private async void OnAnchorButtonPressed(EntityUid uid, NukeComponent component,
if (component.Status == NukeStatus.ARMED)
return;

// Nuke has to have the disk in it to be moved
if (!component.DiskSlot.HasItem)
{
var msg = Loc.GetString("nuke-component-cant-anchor-toggle");
_popups.PopupEntity(msg, uid, args.Actor, PopupType.MediumCaution);
return;
}

// manually set transform anchor (bypassing anchorable)
// todo: it will break pullable system
var xform = Transform(uid);
if (xform.Anchored)
{
_transform.Unanchor(uid, xform);
_itemSlots.SetLock(uid, component.DiskSlot, true);
}
else
{
Expand All @@ -194,6 +203,7 @@ private async void OnAnchorButtonPressed(EntityUid uid, NukeComponent component,

_transform.SetCoordinates(uid, xform, xform.Coordinates.SnapToGrid());
_transform.AnchorEntity(uid, xform);
_itemSlots.SetLock(uid, component.DiskSlot, false);
}

UpdateUserInterface(uid, component);
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/nuke/nuke-component.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
nuke-component-cant-anchor-floor = The anchoring bolts fail to lock into the floor!
nuke-component-cant-anchor-toggle = The nuclear authentication disk is required to toggle the floor bolts!
nuke-component-announcement-sender = Nuclear Fission Explosive
nuke-component-announcement-armed = Attention! The station's self-destruct mechanism has been engaged {$location}. {$time} seconds until detonation. If this was made in error, the mechanism may still be disarmed.
nuke-component-announcement-unarmed = The station's self-destruct was deactivated! Have a nice day!
Expand Down

0 comments on commit 283eacd

Please sign in to comment.