mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
using Content.Shared.Clock;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Clock;
|
|
|
|
public sealed partial class ClockSystem : SharedClockSystem
|
|
{
|
|
[Dependency] private SpriteSystem _sprite = default!;
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
var query = EntityQueryEnumerator<ClockComponent, SpriteComponent>();
|
|
while (query.MoveNext(out var uid, out var comp, out var sprite))
|
|
{
|
|
if (!_sprite.LayerMapTryGet((uid, sprite), ClockVisualLayers.HourHand, out var hourLayer, false) ||
|
|
!_sprite.LayerMapTryGet((uid, sprite), ClockVisualLayers.MinuteHand, out var minuteLayer, false))
|
|
continue;
|
|
|
|
var time = GetClockTime((uid, comp));
|
|
var hourState = $"{comp.HoursBase}{time.Hours % 12}";
|
|
var minuteState = $"{comp.MinutesBase}{time.Minutes / 5}";
|
|
_sprite.LayerSetRsiState((uid, sprite), hourLayer, hourState);
|
|
_sprite.LayerSetRsiState((uid, sprite), minuteLayer, minuteState);
|
|
}
|
|
}
|
|
}
|