* Add temperature and pressure lights to firelocks * Replace sprites with new pressure and temperature light versions * Remove obsolete deny and locked sprites * Add SpriteSync for warning light animation synchronization * Teal lights * Partial animation implementation * fixup! Teal lights * Temperature lights * Adjusted firelock light heights and added final warning light sprites * Fix colors * Testing colors * Update light sprites * updated sprites --------- Co-authored-by: EmoGarbage404 <retron404@gmail.com>
64 lines
2.5 KiB
C#
64 lines
2.5 KiB
C#
using Content.Shared.Doors.Components;
|
|
using Content.Shared.Doors.Systems;
|
|
using Robust.Client.Animations;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Doors;
|
|
|
|
public sealed class FirelockSystem : SharedFirelockSystem
|
|
{
|
|
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
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)
|
|
return;
|
|
|
|
var boltedVisible = false;
|
|
var unlitVisible = false;
|
|
|
|
if (!_appearanceSystem.TryGetData<DoorState>(uid, DoorVisuals.State, out var state, args.Component))
|
|
state = DoorState.Closed;
|
|
|
|
boltedVisible = _appearanceSystem.TryGetData<bool>(uid, DoorVisuals.BoltLights, out var lights, args.Component) && lights;
|
|
unlitVisible =
|
|
state == DoorState.Closing
|
|
|| state == DoorState.Opening
|
|
|| state == DoorState.Denying
|
|
|| (_appearanceSystem.TryGetData<bool>(uid, DoorVisuals.ClosedLights, out var closedLights, args.Component) && closedLights);
|
|
|
|
args.Sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, unlitVisible && !boltedVisible);
|
|
args.Sprite.LayerSetVisible(DoorVisualLayers.BaseBolted, boltedVisible);
|
|
}
|
|
}
|