diff --git a/Content.Server/Nuke/NukeSystem.cs b/Content.Server/Nuke/NukeSystem.cs index 77689c4e2b..652852ece2 100644 --- a/Content.Server/Nuke/NukeSystem.cs +++ b/Content.Server/Nuke/NukeSystem.cs @@ -9,6 +9,7 @@ using Content.Shared.Audio; using Content.Shared.Containers.ItemSlots; using Content.Shared.Coordinates.Helpers; using Content.Shared.DoAfter; +using Content.Shared.Examine; using Content.Shared.Maps; using Content.Shared.Nuke; using Content.Shared.Popups; @@ -40,6 +41,7 @@ public sealed class NukeSystem : EntitySystem [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly UserInterfaceSystem _ui = default!; + [Dependency] private readonly AppearanceSystem _appearance = default!; /// /// Used to calculate when the nuke song should start playing for maximum kino with the nuke sfx @@ -60,6 +62,7 @@ public sealed class NukeSystem : EntitySystem SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnItemSlotChanged); SubscribeLocalEvent(OnItemSlotChanged); + SubscribeLocalEvent(OnExaminedEvent); // Shouldn't need re-anchoring. SubscribeLocalEvent(OnAnchorChanged); @@ -148,6 +151,8 @@ public sealed class NukeSystem : EntitySystem // 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. DisarmBomb(uid, component); } + + UpdateAppearance(uid, component); } #endregion @@ -299,6 +304,7 @@ public sealed class NukeSystem : EntitySystem _sound.PlayGlobalOnStation(uid, _audio.GetSound(nuke.AlertSound), new AudioParams{Volume = -5f}); _sound.StopStationEventMusic(uid, StationEventMusicType.Nuke); nuke.PlayedAlertSound = true; + UpdateAppearance(uid, nuke); } if (nuke.RemainingTime <= 0) @@ -473,6 +479,7 @@ public sealed class NukeSystem : EntitySystem component.Status = NukeStatus.ARMED; UpdateUserInterface(uid, component); + UpdateAppearance(uid, component); } /// @@ -514,6 +521,7 @@ public sealed class NukeSystem : EntitySystem component.CooldownTime = component.Cooldown; UpdateUserInterface(uid, component); + UpdateAppearance(uid, component); } /// @@ -589,6 +597,36 @@ public sealed class NukeSystem : EntitySystem _popups.PopupEntity(Loc.GetString("nuke-component-doafter-warning"), user, user, PopupType.LargeCaution); } + + private void UpdateAppearance(EntityUid uid, NukeComponent nuke) + { + var xform = Transform(uid); + + _appearance.SetData(uid, NukeVisuals.Deployed, xform.Anchored); + + NukeVisualState state; + if (nuke.PlayedAlertSound) + state = NukeVisualState.YoureFucked; + else if (nuke.Status == NukeStatus.ARMED) + state = NukeVisualState.Armed; + else + state = NukeVisualState.Idle; + + _appearance.SetData(uid, NukeVisuals.State, state); + } + + private void OnExaminedEvent(EntityUid uid, NukeComponent component, ExaminedEvent args) + { + if (component.PlayedAlertSound) + args.PushMarkup(Loc.GetString("nuke-examine-exploding")); + else if (component.Status == NukeStatus.ARMED) + args.PushMarkup(Loc.GetString("nuke-examine-armed")); + + if (Transform(uid).Anchored) + args.PushMarkup(Loc.GetString("examinable-anchored")); + else + args.PushMarkup(Loc.GetString("examinable-unanchored")); + } } public sealed class NukeExplodedEvent : EntityEventArgs diff --git a/Content.Shared/Nuke/SharedNuke.cs b/Content.Shared/Nuke/SharedNuke.cs index 1c471e11c6..c845ed6c2a 100644 --- a/Content.Shared/Nuke/SharedNuke.cs +++ b/Content.Shared/Nuke/SharedNuke.cs @@ -3,6 +3,27 @@ using Robust.Shared.Serialization; namespace Content.Shared.Nuke { + public enum NukeVisualLayers + { + Base, + Unlit + } + + [NetSerializable, Serializable] + public enum NukeVisuals + { + Deployed, + State, + } + + [NetSerializable, Serializable] + public enum NukeVisualState + { + Idle, + Armed, + YoureFucked + } + [Serializable, NetSerializable] public enum NukeUiKey : byte { diff --git a/Resources/Locale/en-US/nuke/nuke-component.ftl b/Resources/Locale/en-US/nuke/nuke-component.ftl index 4a44ae88ea..b2a61dfcc2 100644 --- a/Resources/Locale/en-US/nuke/nuke-component.ftl +++ b/Resources/Locale/en-US/nuke/nuke-component.ftl @@ -41,3 +41,7 @@ nuke-codes-fax-paper-name = nuclear authentication codes # Nuke disk slot nuke-slot-component-slot-name-disk = Disk + +## Examine +nuke-examine-armed = Hey uh, why's that [color=red]red light[/color] blinking? +nuke-examine-exploding = Yeah... I think it's too late buddy. diff --git a/Resources/Prototypes/Entities/Objects/Devices/nuke.yml b/Resources/Prototypes/Entities/Objects/Devices/nuke.yml index d120621559..811210d429 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/nuke.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/nuke.yml @@ -11,6 +11,11 @@ noRot: true layers: - state: nuclearbomb_base + map: ["enum.NukeVisualLayers.Base"] + - state: nuclearbomb_deployed_unlit + map: ["enum.NukeVisualLayers.Unlit"] + shader: unshaded + visible: false - state: nukefestive map: ["christmas"] visible: false @@ -24,6 +29,18 @@ enum.HolidayVisuals.Holiday: christmas: festive: { visible: true } + enum.NukeVisuals.Deployed: + enum.NukeVisualLayers.Base: + False: { state: nuclearbomb_base } + True: { state: nuclearbomb_deployed } + enum.NukeVisualLayers.Unlit: + True: { visible: true } + False: { visible: false } + enum.NukeVisuals.State: + enum.NukeVisualLayers.Unlit: + Idle: { state: nuclearbomb_deployed_unlit } + Armed: { state: nuclearbomb_timing } + YoureFucked: { state: nuclearbomb_exploding } - type: Physics bodyType: Static - type: Fixtures diff --git a/Resources/Textures/Objects/Devices/nuke.rsi/meta.json b/Resources/Textures/Objects/Devices/nuke.rsi/meta.json index 2828b13ddb..4bc62a96b2 100644 --- a/Resources/Textures/Objects/Devices/nuke.rsi/meta.json +++ b/Resources/Textures/Objects/Devices/nuke.rsi/meta.json @@ -10,6 +10,9 @@ { "name": "nuclearbomb_deployed" }, + { + "name": "nuclearbomb_deployed_unlit" + }, { "name": "nukefestive", "delays": [ diff --git a/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed.png b/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed.png index fa39a744cd..4a01cf2d68 100644 Binary files a/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed.png and b/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed.png differ diff --git a/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed_unlit.png b/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed_unlit.png new file mode 100644 index 0000000000..bcc758ba58 Binary files /dev/null and b/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed_unlit.png differ diff --git a/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_exploding.png b/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_exploding.png index ac5c5d9654..c5861c43bc 100644 Binary files a/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_exploding.png and b/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_exploding.png differ diff --git a/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_timing.png b/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_timing.png index ee674e57db..b59fac42b8 100644 Binary files a/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_timing.png and b/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_timing.png differ