]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Nuke fancification (#25297)
authorPieter-Jan Briers <pieterjan.briers+git@gmail.com>
Fri, 16 Feb 2024 00:26:45 +0000 (01:26 +0100)
committerGitHub <noreply@github.com>
Fri, 16 Feb 2024 00:26:45 +0000 (16:26 -0800)
Actually use more icon states for deployed/armed/about to explode

Also unlit layer.

Also examine text

Content.Server/Nuke/NukeSystem.cs
Content.Shared/Nuke/SharedNuke.cs
Resources/Locale/en-US/nuke/nuke-component.ftl
Resources/Prototypes/Entities/Objects/Devices/nuke.yml
Resources/Textures/Objects/Devices/nuke.rsi/meta.json
Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed.png
Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed_unlit.png [new file with mode: 0644]
Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_exploding.png
Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_timing.png

index 77689c4e2b1082a7a0fa273d98044f258fae0614..652852ece288d3514d22de5067903f9201cf72a2 100644 (file)
@@ -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!;
 
     /// <summary>
     ///     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<NukeComponent, MapInitEvent>(OnMapInit);
         SubscribeLocalEvent<NukeComponent, EntInsertedIntoContainerMessage>(OnItemSlotChanged);
         SubscribeLocalEvent<NukeComponent, EntRemovedFromContainerMessage>(OnItemSlotChanged);
+        SubscribeLocalEvent<NukeComponent, ExaminedEvent>(OnExaminedEvent);
 
         // Shouldn't need re-anchoring.
         SubscribeLocalEvent<NukeComponent, AnchorStateChangedEvent>(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);
     }
 
     /// <summary>
@@ -514,6 +521,7 @@ public sealed class NukeSystem : EntitySystem
         component.CooldownTime = component.Cooldown;
 
         UpdateUserInterface(uid, component);
+        UpdateAppearance(uid, component);
     }
 
     /// <summary>
@@ -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
index 1c471e11c66b9996a84b27eb43c24d98d4d708f7..c845ed6c2a6abdddb88fe92df711f628c4a7c2fd 100644 (file)
@@ -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
     {
index 4a44ae88eac096c66e425ebcf9a89a555fb88fef..b2a61dfcc2cd86e285a3d7ecbb97589542ae4e7f 100644 (file)
@@ -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.
index d12062155909fbf21ca2eeeb59c334f3fe19107f..811210d429e78b6a7ad4267bd2a0ce35195675d7 100644 (file)
     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
       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
index 2828b13ddba8033e50d3501fdc290fc7c68fe1bd..4bc62a96b2db6a6c9b304667c9dc4714622bf2e8 100644 (file)
@@ -10,6 +10,9 @@
     {
       "name": "nuclearbomb_deployed"
     },
+    {
+      "name": "nuclearbomb_deployed_unlit"
+    },
     {
       "name": "nukefestive",
       "delays": [
index fa39a744cdd5f07aa3637736286dd29ffeecd20e..4a01cf2d68fcba38e737bc652d4bc17c9199de74 100644 (file)
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 (file)
index 0000000..bcc758b
Binary files /dev/null and b/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_deployed_unlit.png differ
index ac5c5d9654ff5a545b508efe26f5687251b3d7a7..c5861c43bcbb07bb152b4d475afe9b9cb180b53b 100644 (file)
Binary files a/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_exploding.png and b/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_exploding.png differ
index ee674e57dbab6224861ef747620f9486b53d2be0..b59fac42b86cb3f6ffb4a2aa447f569aa9edac96 100644 (file)
Binary files a/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_timing.png and b/Resources/Textures/Objects/Devices/nuke.rsi/nuclearbomb_timing.png differ