mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* APC: breaker/channel state * Remove unfilled param tags * revert ApcLockState.LogWidth change * Remove local trigger var (unneeded) * Fix blue pixel in channel-disconnected.png * clown ops * DataField attribute cleanup, 4-space meta.json * Denser APC meta.json * APC visuals: lock is kill! * APCVisuals cleanup & comments * comment public API * Fix meta.json * APC changes suggested by Pok27 Co-authored-by: Pok27 <113675512+Pok27@users.noreply.github.com> * actually readable ApcVisualLayers comments * goober * "ApcVisualsComponent", better null description * SPACE * finish incomplete SharedApc comments, inheritdocs * fix tripped east-facing light * fix APC screen offsets * Apply AJCM's suggestions * SPACE * MORE SPACE * a million line constructor --------- Co-authored-by: Pok27 <113675512+Pok27@users.noreply.github.com>
53 lines
2.4 KiB
C#
53 lines
2.4 KiB
C#
using Content.Shared.APC;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Power.APC;
|
|
|
|
/// <summary>
|
|
/// A system to update the screen and the channel indicators for an APC.
|
|
/// </summary>
|
|
public sealed partial class ApcVisualizerSystem : VisualizerSystem<ApcVisualsComponent>
|
|
{
|
|
[Dependency] private SharedPointLightSystem _lights = default!;
|
|
|
|
[Dependency] private EntityQuery<PointLightComponent> _pointLightQuery = default!;
|
|
|
|
/// <inheritdoc/>
|
|
protected override void OnAppearanceChange(EntityUid uid, ApcVisualsComponent comp, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null)
|
|
return;
|
|
|
|
// Handle APC screen overlay and channel markers.
|
|
if (!AppearanceSystem.TryGetData<ApcChargeState>(uid, ApcVisuals.ChargeState, out var chargeState, args.Component))
|
|
chargeState = ApcChargeState.Lack;
|
|
|
|
if (chargeState < ApcChargeState.NumStates)
|
|
{
|
|
var screenState = comp.ScreenStateSuffixes[(byte)chargeState] is { } screenSuffix ? $"{comp.ScreenStatePrefix}-{screenSuffix}" : null;
|
|
SpriteSystem.LayerSetRsiState((uid, args.Sprite), ApcVisualLayers.ChargeState, screenState);
|
|
|
|
// Unlike the charge state, we don't have an emag with special visuals, everything's in the array.
|
|
if (!AppearanceSystem.TryGetData<ApcChannelState>(uid, ApcVisuals.ChannelState, out var channelState, args.Component)
|
|
|| channelState >= ApcChannelState.NumStates)
|
|
{
|
|
channelState = ApcChannelState.Off;
|
|
}
|
|
|
|
var state = comp.ChannelIndicatorSuffixes[(byte)channelState] is { } channelSuffix ? $"{comp.ChannelIndicatorPrefix}-{channelSuffix}" : null;
|
|
SpriteSystem.LayerSetRsiState((uid, args.Sprite), ApcVisualLayers.Equipment, state);
|
|
SpriteSystem.LayerSetVisible((uid, args.Sprite), ApcVisualLayers.Equipment, true);
|
|
|
|
if (_pointLightQuery.TryComp(uid, out var light))
|
|
_lights.SetColor(uid, comp.ScreenColors[(byte)chargeState], light);
|
|
}
|
|
else
|
|
{
|
|
SpriteSystem.LayerSetRsiState((uid, args.Sprite), ApcVisualLayers.ChargeState, comp.EmaggedScreenState);
|
|
SpriteSystem.LayerSetVisible((uid, args.Sprite), ApcVisualLayers.Equipment, false);
|
|
|
|
if (_pointLightQuery.TryComp(uid, out var light))
|
|
_lights.SetColor(uid, comp.EmaggedScreenColor, light);
|
|
}
|
|
}
|
|
}
|