Nuke fancification (#25297)

Actually use more icon states for deployed/armed/about to explode

Also unlit layer.

Also examine text
This commit is contained in:
Pieter-Jan Briers
2024-02-16 01:26:45 +01:00
committed by GitHub
parent 7e44c50d19
commit 3a45d519dc
9 changed files with 83 additions and 0 deletions

View 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

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

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

View File

@@ -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

View File

@@ -10,6 +10,9 @@
{
"name": "nuclearbomb_deployed"
},
{
"name": "nuclearbomb_deployed_unlit"
},
{
"name": "nukefestive",
"delays": [

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 113 B