From 80bb8e3bf6685e0467a4d446d138387638ccdda6 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 24 Nov 2022 18:31:17 +1100 Subject: [PATCH] Aurora Australis (#12356) --- Content.Client/Light/RgbLightControllerSystem.cs | 11 +++++++++-- .../Light/SharedRgbLightControllerSystem.cs | 4 ++-- Resources/engineCommandPerms.yml | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Content.Client/Light/RgbLightControllerSystem.cs b/Content.Client/Light/RgbLightControllerSystem.cs index 6e27f47e84..2f29c9d405 100644 --- a/Content.Client/Light/RgbLightControllerSystem.cs +++ b/Content.Client/Light/RgbLightControllerSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Light; using Content.Shared.Light.Component; using Robust.Client.GameObjects; using Robust.Shared.GameStates; +using Robust.Shared.Map.Components; using Robust.Shared.Timing; using static Robust.Client.GameObjects.SpriteComponent; @@ -14,8 +15,8 @@ namespace Content.Client.Light { public sealed class RgbLightControllerSystem : SharedRgbLightControllerSystem { - [Dependency] private IGameTiming _gameTiming = default!; - [Dependency] private ItemSystem _itemSystem = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly ItemSystem _itemSystem = default!; public override void Initialize() { @@ -190,6 +191,12 @@ namespace Content.Client.Light holderSprite.LayerSetColor(layer, color); } } + + foreach (var (rgb, map) in EntityQuery()) + { + var color = GetCurrentRgbColor(_gameTiming.RealTime, rgb.CreationTick.Value * _gameTiming.TickPeriod, rgb); + map.AmbientLightColor = color; + } } public static Color GetCurrentRgbColor(TimeSpan curTime, TimeSpan offset, RgbLightControllerComponent rgb) diff --git a/Content.Shared/Light/SharedRgbLightControllerSystem.cs b/Content.Shared/Light/SharedRgbLightControllerSystem.cs index d294e8a052..7ac2b85a50 100644 --- a/Content.Shared/Light/SharedRgbLightControllerSystem.cs +++ b/Content.Shared/Light/SharedRgbLightControllerSystem.cs @@ -23,7 +23,7 @@ public abstract class SharedRgbLightControllerSystem : EntitySystem return; rgb.Layers = layers; - rgb.Dirty(); + Dirty(rgb); } public void SetCycleRate(EntityUid uid, float rate, RgbLightControllerComponent? rgb = null) @@ -32,6 +32,6 @@ public abstract class SharedRgbLightControllerSystem : EntitySystem return; rgb.CycleRate = Math.Clamp(0.01f, rate, 1); // lets not give people seizures - rgb.Dirty(); + Dirty(rgb); } } diff --git a/Resources/engineCommandPerms.yml b/Resources/engineCommandPerms.yml index b83e580003..05793d11e9 100644 --- a/Resources/engineCommandPerms.yml +++ b/Resources/engineCommandPerms.yml @@ -78,6 +78,7 @@ - mapinit - savegrid - savemap + - setambientlight - tpgrid - gridtc - togglespritenetsync