Files
wwdpublic/Content.Client/Light/LightCycleSystem.cs
sleepyyapril f7681d4bc3 v246.0.0 + Planet Lighting (#1802)
will do map refactor tomorrow, for now, planet lighting

🆑
* add: Ported planet lighting for indoor / outdoor areas.
* add: Ported day-night cycle functionality.
* add: Ported some Storage UI v2 fixes.

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: DoutorWhite <thedoctorwhite@gmail.com>
Co-authored-by: Janet Blackquill <uhhadd@gmail.com>
(cherry picked from commit 4efb0b3b328dd4eba3095cc3f0a95fad88b49661)
2025-02-28 16:23:01 +03:00

34 lines
1.0 KiB
C#

using Content.Client.GameTicking.Managers;
using Content.Shared;
using Content.Shared.Light.Components;
using Robust.Shared.Map.Components;
using Robust.Shared.Timing;
namespace Content.Client.Light;
/// <inheritdoc/>
public sealed class LightCycleSystem : SharedLightCycleSystem
{
[Dependency] private readonly ClientGameTicker _ticker = default!;
[Dependency] private readonly IGameTiming _timing = default!;
public override void Update(float frameTime)
{
base.Update(frameTime);
var mapQuery = AllEntityQuery<LightCycleComponent, MapLightComponent>();
while (mapQuery.MoveNext(out var uid, out var cycle, out var map))
{
if (!cycle.Running)
continue;
var time = (float) _timing.CurTime
.Add(cycle.Offset)
.Subtract(_ticker.RoundStartTimeSpan)
.TotalSeconds;
var color = GetColor((uid, cycle), cycle.OriginalColor, time);
map.AmbientLightColor = color;
}
}
}