using Content.Shared.Doors.Components;
using Content.Shared.Doors.Systems;
+using Robust.Client.Animations;
using Robust.Client.GameObjects;
namespace Content.Client.Doors;
SubscribeLocalEvent<FirelockComponent, AppearanceChangeEvent>(OnAppearanceChange);
}
+ protected override void OnComponentStartup(Entity<FirelockComponent> ent, ref ComponentStartup args)
+ {
+ base.OnComponentStartup(ent, ref args);
+ if(!TryComp<DoorComponent>(ent.Owner, out var door))
+ return;
+
+ door.ClosedSpriteStates.Add((DoorVisualLayers.BaseUnlit, ent.Comp.WarningLightSpriteState));
+ door.OpenSpriteStates.Add((DoorVisualLayers.BaseUnlit, ent.Comp.WarningLightSpriteState));
+
+ ((Animation)door.OpeningAnimation).AnimationTracks.Add(new AnimationTrackSpriteFlick()
+ {
+ LayerKey = DoorVisualLayers.BaseUnlit,
+ KeyFrames = { new AnimationTrackSpriteFlick.KeyFrame(ent.Comp.OpeningLightSpriteState, 0f) },
+ }
+ );
+
+ ((Animation)door.ClosingAnimation).AnimationTracks.Add(new AnimationTrackSpriteFlick()
+ {
+ LayerKey = DoorVisualLayers.BaseUnlit,
+ KeyFrames = { new AnimationTrackSpriteFlick.KeyFrame(ent.Comp.ClosingLightSpriteState, 0f) },
+ }
+ );
+ }
+
private void OnAppearanceChange(EntityUid uid, FirelockComponent comp, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
_appearance.SetData(uid, DoorVisuals.ClosedLights, fire || pressure, appearance);
firelock.Temperature = fire;
firelock.Pressure = pressure;
+ _appearance.SetData(uid, FirelockVisuals.PressureWarning, pressure, appearance);
+ _appearance.SetData(uid, FirelockVisuals.TemperatureWarning, fire, appearance);
Dirty(uid, firelock);
if (pointLightQuery.TryComp(uid, out var pointLight))
public bool Powered;
#endregion
+
+ #region Client animation
+
+ /// <summary>
+ /// The sprite state used to animate the airlock frame when the airlock opens.
+ /// </summary>
+ [DataField]
+ public string OpeningLightSpriteState = "opening_unlit";
+
+ /// <summary>
+ /// The sprite state used to animate the airlock frame when the airlock closes.
+ /// </summary>
+ [DataField]
+ public string ClosingLightSpriteState = "closing_unlit";
+
+ /// <summary>
+ /// The sprite state used to animate the airlock panel when the airlock opens.
+ /// </summary>
+ [DataField]
+ public string OpeningPanelSpriteState = "panel_opening";
+
+ /// <summary>
+ /// The sprite state used to animate the airlock panel when the airlock closes.
+ /// </summary>
+ [DataField]
+ public string ClosingPanelSpriteState = "panel_closing";
+
+ /// <summary>
+ /// The sprite state used for the open airlock lights.
+ /// </summary>
+ [DataField]
+ public string OpenLightSpriteState = "open_unlit";
+
+ /// <summary>
+ /// The sprite state used for the closed airlock lights.
+ /// </summary>
+ [DataField]
+ public string WarningLightSpriteState = "closed_unlit";
+
+ /// <summary>
+ /// The sprite state used for the 'access denied' lights animation.
+ /// </summary>
+ [DataField]
+ public string DenySpriteState = "deny_unlit";
+
+ #endregion
}
}
using Content.Shared.Examine;
using Content.Shared.Popups;
using Content.Shared.Prying.Components;
+using Robust.Shared.Serialization;
using Robust.Shared.Timing;
namespace Content.Shared.Doors.Systems;
// Visuals
SubscribeLocalEvent<FirelockComponent, MapInitEvent>(UpdateVisuals);
- SubscribeLocalEvent<FirelockComponent, ComponentStartup>(UpdateVisuals);
+ SubscribeLocalEvent<FirelockComponent, ComponentStartup>(OnComponentStartup);
SubscribeLocalEvent<FirelockComponent, ExaminedEvent>(OnExamined);
}
#region Visuals
+ protected virtual void OnComponentStartup(Entity<FirelockComponent> ent, ref ComponentStartup args)
+ {
+ UpdateVisuals(ent.Owner,ent.Comp, args);
+ }
+
private void UpdateVisuals(EntityUid uid, FirelockComponent component, EntityEventArgs args) => UpdateVisuals(uid, component);
private void UpdateVisuals(EntityUid uid,
}
}
}
+
+[Serializable, NetSerializable]
+public enum FirelockVisuals : byte
+{
+ PressureWarning,
+ TemperatureWarning,
+}
+
+[Serializable, NetSerializable]
+public enum FirelockVisualLayersPressure : byte
+{
+ Base
+}
+
+[Serializable, NetSerializable]
+public enum FirelockVisualLayersTemperature : byte
+{
+ Base
+}
firelock-component-is-holding-pressure-message = A gush of air blows in your face... Maybe you should reconsider.
firelock-component-is-holding-fire-message = A gush of warm air blows in your face... Maybe you should reconsider.
-firelock-component-examine-pressure-warning = The [color=red]extreme pressure[/color] differential warning is active.
+firelock-component-examine-pressure-warning = The [color=cyan]extreme pressure[/color] differential warning is active.
firelock-component-examine-temperature-warning = The [color=red]extreme temperature[/color] warning is active.
visible: false
- state: panel_open
map: ["enum.WiresVisualLayers.MaintenancePanel"]
+ - state: pressure_unlit
+ visible: false
+ shader: unshaded
+ map: ["enum.FirelockVisualLayersPressure.Base"]
+ - state: temperature_unlit
+ visible: false
+ shader: unshaded
+ map: ["enum.FirelockVisualLayersTemperature.Base"]
+ - type: GenericVisualizer
+ visuals:
+ enum.FirelockVisuals.PressureWarning:
+ enum.FirelockVisualLayersPressure.Base:
+ True: { visible: true }
+ False: { visible: false }
+ enum.FirelockVisuals.TemperatureWarning:
+ enum.FirelockVisualLayersTemperature.Base:
+ True: { visible: true }
+ False: { visible: false }
- type: AnimationPlayer
- type: Fixtures
fixtures:
- FireAndGasControl
- Fires
- Spacing
+ - type: SyncSprite
- type: entity
id: Firelock
]
]
},
- {
- "name": "deny",
- "delays": [
- [
- 0.1,
- 0.1,
- 0.1
- ]
- ]
- },
{
"name": "deny_unlit",
"delays": [
]
]
},
- {
- "name": "locked"
- },
{
"name": "open"
},
0.4
]
]
+ },
+ {
+ "name": "pressure_unlit",
+ "delays": [
+ [
+ 0.8,
+ 0.4
+ ]
+ ]
+ },
+ {
+ "name": "base_pressure_unlit",
+ "delays": [
+ [
+ 0.8,
+ 0.4
+ ]
+ ]
+ },
+ {
+ "name": "pressure_unlit_flat",
+ "delays": [
+ [
+ 0.8,
+ 0.4
+ ]
+ ]
+ },
+ {
+ "name": "temperature_unlit",
+ "delays": [
+ [
+ 0.8,
+ 0.4
+ ]
+ ]
+ },
+ {
+ "name": "base_temperature_unlit",
+ "delays": [
+ [
+ 0.8,
+ 0.4
+ ]
+ ]
+ },
+ {
+ "name": "temperature_unlit_flat",
+ "delays": [
+ [
+ 0.8,
+ 0.4
+ ]
+ ]
}
]
}
0.4
]
]
+ },
+ {
+ "name": "pressure_unlit",
+ "delays": [
+ [
+ 0.8,
+ 0.4
+ ]
+ ]
+ },
+ {
+ "name": "temperature_unlit",
+ "delays": [
+ [
+ 0.8,
+ 0.4
+ ]
+ ]
}
]
}
{
"name": "welded_open",
"directions": 4
+ },
+ {
+ "name": "pressure_unlit",
+ "directions": 4
+ },
+ {
+ "name": "temperature_unlit",
+ "directions": 4
}
]
}