]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Remove lights compref (#19531)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Mon, 11 Sep 2023 09:18:06 +0000 (19:18 +1000)
committerGitHub <noreply@github.com>
Mon, 11 Sep 2023 09:18:06 +0000 (19:18 +1000)
64 files changed:
Content.Client/Arcade/BlockGameMenu.cs
Content.Client/Atmos/EntitySystems/FireVisualizerSystem.cs
Content.Client/Atmos/Overlays/GasTileOverlay.cs
Content.Client/Atmos/UI/GasAnalyzerWindow.xaml.cs
Content.Client/Clickable/ClickMapManager.cs
Content.Client/Clickable/ClickableComponent.cs
Content.Client/CombatMode/CombatModeIndicatorsOverlay.cs
Content.Client/Construction/UI/ConstructionMenu.xaml.cs
Content.Client/Construction/UI/ConstructionMenuPresenter.cs
Content.Client/Crayon/UI/CrayonWindow.xaml.cs
Content.Client/Decals/UI/DecalPlacerWindow.xaml.cs
Content.Client/DoAfter/DoAfterOverlay.cs
Content.Client/Dragon/DragonSystem.cs
Content.Client/Examine/ExamineSystem.cs
Content.Client/Explosion/ExplosionOverlaySystem.cs
Content.Client/Explosion/ExplosionVisualsTexturesComponent.cs
Content.Client/Flash/FlashOverlay.cs
Content.Client/Hands/ShowHandItemOverlay.cs
Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs
Content.Client/Lathe/UI/RecipeControl.xaml.cs
Content.Client/Light/Components/LightBehaviourComponent.cs
Content.Client/Light/RgbLightControllerSystem.cs
Content.Client/Parallax/Data/GeneratedParallaxTextureSource.cs
Content.Client/Parallax/Data/IParallaxTextureSource.cs
Content.Client/Parallax/Data/ImageParallaxTextureSource.cs
Content.Client/Parallax/ParallaxLayerPrepared.cs
Content.Client/Power/APC/ApcVisualizerSystem.cs
Content.Client/Power/PowerMonitoringWindow.xaml.cs
Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs
Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
Content.Client/Resources/ResourceCacheExtensions.cs
Content.Client/Revenant/RevenantOverloadedLightsSystem.cs
Content.Client/SprayPainter/SprayPainterSystem.cs
Content.Client/Storage/UI/StorageWindow.cs
Content.Client/Store/Ui/StoreListingControl.xaml.cs
Content.Client/Stylesheets/StyleNano.cs
Content.Client/Toggleable/ToggleableLightVisualsSystem.cs
Content.Client/UserInterface/Controls/DirectionIcon.cs
Content.Client/UserInterface/Controls/FancyTree/FancyTree.xaml.cs
Content.Client/UserInterface/Controls/MenuButton.cs
Content.Client/UserInterface/Systems/Actions/ActionUIController.cs
Content.Client/UserInterface/Systems/Actions/Controls/ActionButton.cs
Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.AmmoCounter.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Content.Client/Weather/WeatherOverlay.cs
Content.Server/Anomaly/AnomalySystem.Vessel.cs
Content.Server/Botany/Systems/BotanySystem.Seed.cs
Content.Server/Botany/Systems/PlantHolderSystem.cs
Content.Server/Gravity/GravityGeneratorSystem.cs
Content.Server/Light/EntitySystems/EmergencyLightSystem.cs
Content.Server/Light/EntitySystems/HandheldLightSystem.cs
Content.Server/Light/EntitySystems/LitOnPoweredSystem.cs
Content.Server/Light/EntitySystems/MatchstickSystem.cs
Content.Server/Light/EntitySystems/PoweredLightSystem.cs
Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs
Content.Server/Power/Generation/Teg/TegSystem.cs
Content.Server/Shuttles/Systems/ThrusterSystem.cs
Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs
Content.Server/Tools/ToolSystem.Welder.cs
Content.Server/Tools/ToolSystem.cs
Content.Shared/Medical/Cryogenics/SharedCryoPodSystem.cs
Content.Shared/Revenant/EntitySystems/SharedRevenantOverloadedLightsSystem.cs
Content.Shared/Security/Systems/DeployableBarrierSystem.cs

index abb587ce7f96d18663fb57673ea529888d97183f..eeda2a31020988be629f0b101b42e2d0e7633426 100644 (file)
@@ -12,6 +12,7 @@ using Robust.Client.ResourceManagement;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.CustomControls;
+using Robust.Shared.Graphics;
 using Robust.Shared.IoC;
 using Robust.Shared.Localization;
 using Robust.Shared.Maths;
index 7799a6deab5e9667465d64d2b6f3a5b904b9d445..08522d1a429a685c2d128c2a0b83194394978d87 100644 (file)
@@ -10,6 +10,8 @@ namespace Content.Client.Atmos.EntitySystems;
 /// </summary>
 public sealed class FireVisualizerSystem : VisualizerSystem<FireVisualsComponent>
 {
+    [Dependency] private readonly PointLightSystem _lights = default!;
+
     public override void Initialize()
     {
         base.Initialize();
@@ -83,11 +85,11 @@ public sealed class FireVisualizerSystem : VisualizerSystem<FireVisualsComponent
         component.LightEntity ??= Spawn(null, new EntityCoordinates(uid, default));
         var light = EnsureComp<PointLightComponent>(component.LightEntity.Value);
 
-        light.Color = component.LightColor;
+        _lights.SetColor(component.LightEntity.Value, component.LightColor, light);
 
         // light needs a minimum radius to be visible at all, hence the + 1.5f
-        light.Radius = Math.Clamp(1.5f + component.LightRadiusPerStack * fireStacks, 0f, component.MaxLightRadius);
-        light.Energy = Math.Clamp(1 + component.LightEnergyPerStack * fireStacks, 0f, component.MaxLightEnergy);
+        _lights.SetRadius(component.LightEntity.Value, Math.Clamp(1.5f + component.LightRadiusPerStack * fireStacks, 0f, component.MaxLightRadius), light);
+        _lights.SetEnergy(component.LightEntity.Value, Math.Clamp(1 + component.LightEnergyPerStack * fireStacks, 0f, component.MaxLightEnergy), light);
 
         // TODO flickering animation? Or just add a noise mask to the light? But that requires an engine PR.
     }
index d3e6dbc8dec91198b5f426aeb94737a0d1087ab1..ef65d43fe85ecaa019955524eb1013323b61de9b 100644 (file)
@@ -8,6 +8,8 @@ using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Client.ResourceManagement;
 using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
+using Robust.Shared.Graphics.RSI;
 using Robust.Shared.Map;
 using Robust.Shared.Map.Components;
 using Robust.Shared.Prototypes;
@@ -79,7 +81,7 @@ namespace Content.Client.Atmos.Overlays
 
                         if (!rsi.TryGetState(stateId, out var state)) continue;
 
-                        _frames[i] = state.GetFrames(RSI.State.Direction.South);
+                        _frames[i] = state.GetFrames(RsiDirection.South);
                         _frameDelays[i] = state.GetDelays();
                         _frameCounter[i] = 0;
                         break;
@@ -97,7 +99,7 @@ namespace Content.Client.Atmos.Overlays
                 if (!fire.TryGetState((i + 1).ToString(), out var state))
                     throw new ArgumentOutOfRangeException($"Fire RSI doesn't have state \"{i}\"!");
 
-                _fireFrames[i] = state.GetFrames(RSI.State.Direction.South);
+                _fireFrames[i] = state.GetFrames(RsiDirection.South);
                 _fireFrameDelays[i] = state.GetDelays();
                 _fireFrameCounter[i] = 0;
             }
index 48c3b6f978aeaba5d7276bcb4c247f121710191c..ccf9e370e3cf1b7a06be2ba99425545ade407962 100644 (file)
@@ -9,6 +9,7 @@ using Robust.Client.UserInterface.CustomControls;
 using Robust.Client.AutoGenerated;
 using Robust.Client.UserInterface.XAML;
 using static Content.Shared.Atmos.Components.GasAnalyzerComponent;
+using Direction = Robust.Shared.Maths.Direction;
 
 namespace Content.Client.Atmos.UI
 {
index 6f34f4453c5c7a85c5dd22dfad97aa3ba759e681..6a77c7e05436a1133433237bba86345dbd76f0b7 100644 (file)
@@ -2,6 +2,8 @@ using System.Text;
 using Robust.Client.Graphics;
 using Robust.Client.ResourceManagement;
 using Robust.Client.Utility;
+using Robust.Shared.Graphics;
+using Robust.Shared.Graphics.RSI;
 using SixLabors.ImageSharp;
 using SixLabors.ImageSharp.PixelFormats;
 
@@ -71,7 +73,7 @@ namespace Content.Client.Clickable
             return SampleClickMap(clickMap, pos, clickMap.Size, Vector2i.Zero);
         }
 
-        public bool IsOccluding(RSI rsi, RSI.StateId state, RSI.State.Direction dir, int frame, Vector2i pos)
+        public bool IsOccluding(RSI rsi, RSI.StateId state, RsiDirection dir, int frame, Vector2i pos)
         {
             if (!_rsiMaps.TryGetValue(rsi, out var rsiData))
             {
@@ -210,6 +212,6 @@ namespace Content.Client.Clickable
     {
         public bool IsOccluding(Texture texture, Vector2i pos);
 
-        public bool IsOccluding(RSI rsi, RSI.StateId state, RSI.State.Direction dir, int frame, Vector2i pos);
+        public bool IsOccluding(RSI rsi, RSI.StateId state, RsiDirection dir, int frame, Vector2i pos);
     }
 }
index f436715d5e098f750e3ab4cfe908cf434fc5def2..cfbd1a99d69b40eda42e3de022e5d1436a7ef455 100644 (file)
@@ -4,6 +4,7 @@ using Robust.Client.Graphics;
 using Robust.Client.Utility;
 using Robust.Shared.Graphics;
 using static Robust.Client.GameObjects.SpriteComponent;
+using Direction = Robust.Shared.Maths.Direction;
 
 namespace Content.Client.Clickable
 {
@@ -74,7 +75,7 @@ namespace Content.Client.Clickable
                 if (layer.ActualRsi is not { } rsi || !rsi.TryGetState(layer.State, out var rsiState))
                     continue;
 
-                var dir = Layer.GetDirection(rsiState.Directions, relativeRotation);
+                var dir = Layer.GetDirection(rsiState.RsiDirections, relativeRotation);
 
                 // convert to layer-local coordinates
                 layer.GetLayerDrawMatrix(dir, out var matrix);
@@ -87,7 +88,7 @@ namespace Content.Client.Clickable
                 // Next, to get the right click map we need the "direction" of this layer that is actually being used to draw the sprite on the screen.
                 // This **can** differ from the dir defined before, but can also just be the same.
                 if (sprite.EnableDirectionOverride)
-                    dir = sprite.DirectionOverride.Convert(rsiState.Directions);
+                    dir = sprite.DirectionOverride.Convert(rsiState.RsiDirections);
                 dir = dir.OffsetRsiDir(layer.DirOffset);
 
                 if (_clickMapManager.IsOccluding(layer.ActualRsi!, layer.State, dir, layer.AnimationFrame, layerImagePos))
index e3a61fe3be23d1aec69786b85c7dd1d0b4b8e418..9732a677535fdea63f3fe65fdb2a5e9114336805 100644 (file)
@@ -6,6 +6,7 @@ using Robust.Client.Graphics;
 using Robust.Client.Input;
 using Robust.Client.UserInterface;
 using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
 using Robust.Shared.Utility;
 
 namespace Content.Client.CombatMode;
index 2187a5266e6a65ab59ebe4e7a5585e6c131f9626..8fce1dbbda0f95c7c63e37affcdfd25e1eea768e 100644 (file)
@@ -5,6 +5,7 @@ using Robust.Client.Graphics;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.CustomControls;
 using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
 using Robust.Shared.IoC;
 using Robust.Shared.Localization;
 
index 657892e21629d527272213882da77fa37b004cd2..cdc9044a40f88aa40f0dea6c20b6326f9ea2b9de 100644 (file)
@@ -8,6 +8,7 @@ using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.Utility;
 using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
 using Robust.Shared.Prototypes;
 using static Robust.Client.UserInterface.Controls.BaseButton;
 
index 4e21016196ce68b297d9253e2a800cc488e9d535..2a5801ccf2d106abc34657bc5bffb4132f2608ae 100644 (file)
@@ -8,6 +8,7 @@ using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.CustomControls;
 using Robust.Client.UserInterface.XAML;
 using Robust.Client.Utility;
+using Robust.Shared.Graphics;
 using Robust.Shared.Maths;
 using Robust.Shared.Utility;
 using static Robust.Client.UserInterface.Controls.BaseButton;
index 00bfd7ec6520295efda324922f74ba0fed63310c..199b4f5c1f8d5923c3240525f03d7b88d744936f 100644 (file)
@@ -7,6 +7,7 @@ using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.CustomControls;
 using Robust.Client.UserInterface.XAML;
 using Robust.Client.Utility;
+using Robust.Shared.Graphics;
 using static Robust.Client.UserInterface.Controls.BaseButton;
 
 namespace Content.Client.Decals.UI;
index bc3902cc5358246ead6b334643d6242d0d68ab69..1fc00a81b94b9ed6e95fc75f8e794cb27a09206e 100644 (file)
@@ -3,6 +3,7 @@ using Content.Shared.DoAfter;
 using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Timing;
 using Robust.Shared.Utility;
index d11fac8de7a82bf4219c3b4e2d693f61e2b577d4..e164798c1eb4becb3b5e9c45eaa3d61c08395c46 100644 (file)
@@ -6,6 +6,8 @@ namespace Content.Client.Dragon;
 
 public sealed class DragonSystem : EntitySystem
 {
+    [Dependency] private readonly SharedPointLightSystem _lights = default!;
+
     public override void Initialize()
     {
         base.Initialize();
@@ -32,19 +34,25 @@ public sealed class DragonSystem : EntitySystem
                 sprite?.LayerSetColor(0, Color.FromHex("#569fff"));
 
                 if (light != null)
-                    light.Color = Color.FromHex("#366db5");
+                {
+                    _lights.SetColor(uid, Color.FromHex("#366db5"), light);
+                }
                 break;
             case DragonRiftState.AlmostFinished:
                 sprite?.LayerSetColor(0, Color.FromHex("#cf4cff"));
 
                 if (light != null)
-                    light.Color = Color.FromHex("#9e2fc1");
+                {
+                    _lights.SetColor(uid, Color.FromHex("#9e2fc1"), light);
+                }
                 break;
             case DragonRiftState.Finished:
                 sprite?.LayerSetColor(0, Color.FromHex("#edbc36"));
 
                 if (light != null)
-                    light.Color = Color.FromHex("#cbaf20");
+                {
+                    _lights.SetColor(uid, Color.FromHex("#cbaf20"), light);
+                }
                 break;
         }
     }
index 914ec215274cd89a735a50349eb2f54539edf1d2..59460cec561694084891851d77ae7fe5b50c294e 100644 (file)
@@ -22,6 +22,7 @@ using static Content.Shared.Interaction.SharedInteractionSystem;
 using static Robust.Client.UserInterface.Controls.BoxContainer;
 using Content.Shared.Interaction.Events;
 using Content.Shared.Item;
+using Direction = Robust.Shared.Maths.Direction;
 
 namespace Content.Client.Examine
 {
index 289d2172020273e15338ae72eda5b443b8274701..60208ea1a0d1414a6bbf3537785efd4f21ff4910 100644 (file)
@@ -1,8 +1,8 @@
 using Content.Shared.Explosion;
-using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Client.ResourceManagement;
 using Robust.Shared.GameStates;
+using Robust.Shared.Graphics.RSI;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Utility;
 
@@ -17,6 +17,7 @@ public sealed class ExplosionOverlaySystem : EntitySystem
     [Dependency] private readonly IPrototypeManager _protoMan = default!;
     [Dependency] private readonly IResourceCache _resCache = default!;
     [Dependency] private readonly IOverlayManager _overlayMan = default!;
+    [Dependency] private readonly SharedPointLightSystem _lights = default!;
 
     /// <summary>
     ///     For how many seconds should an explosion stay on-screen once it has finished expanding?
@@ -71,9 +72,11 @@ public sealed class ExplosionOverlaySystem : EntitySystem
 
         // spawn in a client-side light source at the epicenter
         var lightEntity = Spawn("ExplosionLight", component.Epicenter);
-        var light = EnsureComp<PointLightComponent>(lightEntity);
-        light.Energy = light.Radius = component.Intensity.Count;
-        light.Color = type.LightColor;
+        var light = _lights.EnsureLight(lightEntity);
+
+        _lights.SetRadius(lightEntity, component.Intensity.Count, light);
+        _lights.SetEnergy(lightEntity, component.Intensity.Count, light);
+        _lights.SetColor(lightEntity, type.LightColor, light);
 
         textures.LightEntity = lightEntity;
         textures.FireColor = type.FireColor;
@@ -82,7 +85,7 @@ public sealed class ExplosionOverlaySystem : EntitySystem
         var fireRsi = _resCache.GetResource<RSIResource>(type.TexturePath).RSI;
         foreach (var state in fireRsi)
         {
-            textures.FireFrames.Add(state.GetFrames(RSI.State.Direction.South));
+            textures.FireFrames.Add(state.GetFrames(RsiDirection.South));
             if (textures.FireFrames.Count == type.FireStates)
                 break;
         }
index bbc7e66ef281cd85b2a3928900853eecbae75301..b8641e6cee45ff83d20522ae9179da32069b1978 100644 (file)
@@ -1,4 +1,5 @@
 using Robust.Client.Graphics;
+using Robust.Shared.Graphics;
 
 namespace Content.Client.Explosion;
 
index f12ab3f5c92f1170c3b4173cf6fa4394076e9b0f..433ee95e1cbfb1587fd3906d0de360847969cd0e 100644 (file)
@@ -4,6 +4,7 @@ using Robust.Client.Graphics;
 using Robust.Client.State;
 using Robust.Client.Player;
 using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
 using Robust.Shared.IoC;
 using Robust.Shared.Maths;
 using Robust.Shared.Prototypes;
index aa9ccbf4be6e38dc65fad0fb5d381b8af2c67f72..3cb0cd58fff2e558b3570dd51c2be4a25f7c4f1c 100644 (file)
@@ -7,7 +7,9 @@ using Robust.Client.Input;
 using Robust.Client.UserInterface;
 using Robust.Shared.Configuration;
 using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
 using Robust.Shared.Map;
+using Direction = Robust.Shared.Maths.Direction;
 
 namespace Content.Client.Hands
 {
index deadff91fc49671a0a4195426b8d156711f6a048..518fbe095e19ad4ad122bab4c66a240764c29138 100644 (file)
@@ -5,6 +5,7 @@ using JetBrains.Annotations;
 using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Client.UserInterface.Controls;
+using Robust.Shared.Graphics;
 
 namespace Content.Client.Kitchen.UI
 {
index 2a17b52c66cb0080b6db60658ddd6a7e82e9634d..87ebd6e338e3a5c1c183b9398f6df3e60ddfa4ea 100644 (file)
@@ -3,6 +3,7 @@ using Robust.Client.AutoGenerated;
 using Robust.Client.Graphics;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
 
 namespace Content.Client.Lathe.UI;
 
index a7961347e30a1fdb80dea7f251d4bb43ccab5c85..a89ddda1089faa188d41a5c005b68da922007aae 100644 (file)
@@ -53,7 +53,7 @@ namespace Content.Client.Light.Components
 
             if (Enabled && _entMan.TryGetComponent(_parent, out PointLightComponent? light))
             {
-                light.Enabled = true;
+                _entMan.System<PointLightSystem>().SetEnabled(_parent, true, light);
             }
 
             OnInitialize();
@@ -63,7 +63,7 @@ namespace Content.Client.Light.Components
         {
             if (_entMan.TryGetComponent(_parent, out PointLightComponent? light))
             {
-                light.Enabled = true;
+                _entMan.System<PointLightSystem>().SetEnabled(_parent, true, light);
             }
 
             if (MinDuration > 0)
index ccea86013d5613a0ad6ad4746b44ea4bf0ac8f52..a9ba34ca7d0485dc80e091a7b5fdb86eb9c97d41 100644 (file)
@@ -17,6 +17,7 @@ namespace Content.Client.Light
     {
         [Dependency] private readonly IGameTiming _gameTiming = default!;
         [Dependency] private readonly ItemSystem _itemSystem = default!;
+        [Dependency] private readonly SharedPointLightSystem _lights = default!;
 
         public override void Initialize()
         {
@@ -156,7 +157,7 @@ namespace Content.Client.Light
             if (!Resolve(uid, ref rgb, ref sprite, ref light, false))
                 return;
 
-            light.Color = rgb.OriginalLightColor;
+            _lights.SetColor(uid, rgb.OriginalLightColor, light);
 
             if (rgb.Layers == null || rgb.OriginalLayerColors == null)
                 return;
@@ -173,7 +174,7 @@ namespace Content.Client.Light
             {
                 var color = GetCurrentRgbColor(_gameTiming.RealTime, rgb.CreationTick.Value * _gameTiming.TickPeriod, rgb);
 
-                light.Color = color;
+                _lights.SetColor(light.Owner, color, light);
 
                 if (rgb.Layers != null)
                 {
index 72b5d0155b1442920ed24a22c5e784d35f178cb9..81f012d93c6927262b7944ca4ab66cf458ef42ba 100644 (file)
@@ -9,6 +9,7 @@ using Robust.Client.Graphics;
 using Robust.Shared.Utility;
 using Robust.Shared.Configuration;
 using Robust.Shared.ContentPack;
+using Robust.Shared.Graphics;
 using SixLabors.ImageSharp;
 using SixLabors.ImageSharp.PixelFormats;
 
index a18d63fe76d2c8f66f9bfc792b00a213e61dd2ca..dc514c1304bfbb49c471adbcf6b9a69eca6619bb 100644 (file)
@@ -1,6 +1,7 @@
 using System.Threading;
 using System.Threading.Tasks;
 using Robust.Client.Graphics;
+using Robust.Shared.Graphics;
 
 namespace Content.Client.Parallax.Data
 {
index 4672559741c9c94ebdd368407bef1bfbc5a658df..cec57b83a522aab76af5cd2030e39b887c907a90 100644 (file)
@@ -4,6 +4,7 @@ using JetBrains.Annotations;
 using Content.Client.Resources;
 using Content.Client.IoC;
 using Robust.Client.Graphics;
+using Robust.Shared.Graphics;
 using Robust.Shared.Utility;
 
 namespace Content.Client.Parallax.Data;
index 4bd186033a610939422c497b3b2d04862ef2c81e..a04bfa4d1a9863d30b46b0c286cc04174d53a86b 100644 (file)
@@ -1,6 +1,7 @@
 using System;
 using Robust.Client.Graphics;
 using Content.Client.Parallax.Data;
+using Robust.Shared.Graphics;
 
 namespace Content.Client.Parallax;
 
index 6322117f444d2dd8a976d804f007e0f9e865c1ca..23b9157ea37308f824b6ba356ee577430db4fff9 100644 (file)
@@ -6,6 +6,8 @@ namespace Content.Client.Power.APC;
 
 public sealed class ApcVisualizerSystem : VisualizerSystem<ApcVisualsComponent>
 {
+    [Dependency] private readonly SharedPointLightSystem _lights = default!;
+
     protected override void OnAppearanceChange(EntityUid uid, ApcVisualsComponent comp, ref AppearanceChangeEvent args)
     {
         if (args.Sprite == null)
@@ -43,8 +45,10 @@ public sealed class ApcVisualizerSystem : VisualizerSystem<ApcVisualsComponent>
                 }
             }
 
-            if (TryComp<SharedPointLightComponent>(uid, out var light))
-                light.Color = comp.ScreenColors[(sbyte)chargeState];
+            if (TryComp<PointLightComponent>(uid, out var light))
+            {
+                _lights.SetColor(uid, comp.ScreenColors[(sbyte)chargeState], light);
+            }
         }
         else
         {
@@ -61,8 +65,10 @@ public sealed class ApcVisualizerSystem : VisualizerSystem<ApcVisualsComponent>
                 args.Sprite.LayerSetVisible(layer, false);
             }
 
-            if (TryComp<SharedPointLightComponent>(uid, out var light))
-                light.Color = comp.EmaggedScreenColor;
+            if (TryComp<PointLightComponent>(uid, out var light))
+            {
+                _lights.SetColor(uid, comp.EmaggedScreenColor, light);
+            }
         }
     }
 }
index 6629433598efdd1576957bc3bbb4323589653a8e..5cc48395a33e7dca863220b96fa2b5654fe056bb 100644 (file)
@@ -9,6 +9,8 @@ using Robust.Client.Graphics;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.CustomControls;
 using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
+using Robust.Shared.Graphics.RSI;
 using Robust.Shared.Prototypes;
 
 namespace Content.Client.Power;
@@ -64,7 +66,7 @@ public sealed partial class PowerMonitoringWindow : DefaultWindow, IComputerWind
             IRsiStateLike? iconState = null;
             if (entityPrototype != null)
                 iconState = _spriteSystem.GetPrototypeIcon(entityPrototype);
-            var icon = iconState?.GetFrame(RSI.State.Direction.South, 0);
+            var icon = iconState?.GetFrame(RsiDirection.South, 0);
             var item = list[i];
             item.Text = $"{ent.NameLocalized} {Loc.GetString("power-monitoring-window-value", ("value", ent.Size))}";
             item.Icon = icon;
index e63a811f0e66ef6194bd2c75c6be84952b951af7..138614641437b84a78c8c4c48dac171a042b2fc3 100644 (file)
@@ -25,6 +25,7 @@ using Robust.Shared.Map;
 using Robust.Shared.Maths;
 using Robust.Shared.Prototypes;
 using static Robust.Client.UserInterface.Controls.BoxContainer;
+using Direction = Robust.Shared.Maths.Direction;
 
 namespace Content.Client.Preferences.UI
 {
index 076e4805c8c0e11c8254886b02d360d1233968d8..b40b30f5b08c7943f0f364fc5bd14c563b7f9c86 100644 (file)
@@ -32,6 +32,7 @@ using Robust.Shared.Random;
 using Robust.Shared.Timing;
 using Robust.Shared.Utility;
 using static Robust.Client.UserInterface.Controls.BoxContainer;
+using Direction = Robust.Shared.Maths.Direction;
 
 namespace Content.Client.Preferences.UI
 {
index b2808e007e76d371948303ea4d3058d0211d44c1..be8b8fed3b3a667dd991a44886bda953dee439ec 100644 (file)
@@ -1,6 +1,7 @@
 using JetBrains.Annotations;
 using Robust.Client.Graphics;
 using Robust.Client.ResourceManagement;
+using Robust.Shared.Graphics;
 using Robust.Shared.Utility;
 
 namespace Content.Client.Resources
index 2d7b8d3a62902bf1e094792410a5f089ab3bc540..9fd4e4f068f36137d79e462cc2171678ad3ab07d 100644 (file)
@@ -6,6 +6,8 @@ namespace Content.Client.Revenant;
 
 public sealed class RevenantOverloadedLightsSystem : SharedRevenantOverloadedLightsSystem
 {
+    [Dependency] private readonly SharedPointLightSystem _lights = default!;
+
     public override void Initialize()
     {
         base.Initialize();
@@ -20,37 +22,37 @@ public sealed class RevenantOverloadedLightsSystem : SharedRevenantOverloadedLig
 
         var enumerator = EntityQueryEnumerator<RevenantOverloadedLightsComponent, PointLightComponent>();
 
-        while (enumerator.MoveNext(out var comp, out var light))
+        while (enumerator.MoveNext(out var uid, out var comp, out var light))
         {
             //this looks cool :HECK:
-            light.Energy = 2f * Math.Abs((float) Math.Sin(0.25 * Math.PI * comp.Accumulator));
+            _lights.SetEnergy(uid, 2f * Math.Abs((float) Math.Sin(0.25 * Math.PI * comp.Accumulator)), light);
         }
     }
 
     private void OnStartup(EntityUid uid, RevenantOverloadedLightsComponent component, ComponentStartup args)
     {
-        var light = EnsureComp<PointLightComponent>(uid);
+        var light = _lights.EnsureLight(uid);
         component.OriginalEnergy = light.Energy;
         component.OriginalEnabled = light.Enabled;
 
-        light.Enabled = component.OriginalEnabled;
-        Dirty(light);
+        _lights.SetEnabled(uid, component.OriginalEnabled, light);
+        Dirty(uid, light);
     }
 
     private void OnShutdown(EntityUid uid, RevenantOverloadedLightsComponent component, ComponentShutdown args)
     {
-        if (!TryComp<PointLightComponent>(component.Owner, out var light))
+        if (!_lights.TryGetLight(uid, out var light))
             return;
 
         if (component.OriginalEnergy == null)
         {
-            RemComp<PointLightComponent>(component.Owner);
+            RemComp(uid, light);
             return;
         }
 
-        light.Energy = component.OriginalEnergy.Value;
-        light.Enabled = component.OriginalEnabled;
-        Dirty(light);
+        _lights.SetEnergy(uid, component.OriginalEnergy.Value, light);
+        _lights.SetEnabled(uid, component.OriginalEnabled, light);
+        Dirty(uid, light);
     }
 
     protected override void OnZap(RevenantOverloadedLightsComponent component)
index b625f4a667f3c3288b1c10404b79e396707a4e42..4476e2a90ae0a79947fefdff5f77c72cdddd33a6 100644 (file)
@@ -4,6 +4,7 @@ using Robust.Client.ResourceManagement;
 using Robust.Shared.Serialization.TypeSerializers.Implementations;
 using Robust.Shared.Utility;
 using System.Linq;
+using Robust.Shared.Graphics;
 
 namespace Content.Client.SprayPainter;
 
index 1819f65860f07e5965af8a1c63f0f5510ea986c9..9ea60aa03ce9e49b6e19946d6157bec7babfc57a 100644 (file)
@@ -11,6 +11,7 @@ using Content.Shared.Stacks;
 using Robust.Client.UserInterface;
 using static Robust.Client.UserInterface.Controls.BoxContainer;
 using static Content.Shared.Storage.SharedStorageComponent;
+using Direction = Robust.Shared.Maths.Direction;
 
 namespace Content.Client.Storage.UI
 {
index 073d6274394a704accfd3a51307951370a22583e..bb600588e042becc4f8e95a6d5b3d61b2f9c1ccd 100644 (file)
@@ -2,6 +2,7 @@ using Robust.Client.AutoGenerated;
 using Robust.Client.Graphics;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
 
 namespace Content.Client.Store.Ui;
 
index 78dbf9007eb996fc6cbabe83e30de8fa637c9a2e..a61eef97b8cc3fc65e93f281746e4ff11def8772 100644 (file)
@@ -14,6 +14,7 @@ using Robust.Client.ResourceManagement;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.CustomControls;
+using Robust.Shared.Graphics;
 using static Robust.Client.UserInterface.StylesheetHelpers;
 
 namespace Content.Client.Stylesheets
index 47c0157499afb182a02f407c56f742a65928b1b7..e3c17a4fd5991aac7563f024ee2a273bf52814f7 100644 (file)
@@ -13,6 +13,7 @@ namespace Content.Client.Toggleable;
 public sealed class ToggleableLightVisualsSystem : VisualizerSystem<ToggleableLightVisualsComponent>
 {
     [Dependency] private readonly SharedItemSystem _itemSys = default!;
+    [Dependency] private readonly SharedPointLightSystem _lights = default!;
 
     public override void Initialize()
     {
@@ -40,9 +41,11 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem<ToggleableLi
         if (TryComp(uid, out PointLightComponent? light))
         {
             DebugTools.Assert(!light.NetSyncEnabled, "light visualizers require point lights without net-sync");
-            light.Enabled = enabled;
+            _lights.SetEnabled(uid, enabled, light);
             if (enabled && modulate)
-                light.Color = color;
+            {
+                _lights.SetColor(uid, color, light);
+            }
         }
 
         // update clothing & in-hand visuals.
index c1c17bdbcb0cb5e24bd89054aaa060e2e4d80263..a6cc428091acdb5a57af9e4c4c7883ec8b090a19 100644 (file)
@@ -1,6 +1,7 @@
 using System.Numerics;
 using Robust.Client.Graphics;
 using Robust.Client.UserInterface.Controls;
+using Direction = Robust.Shared.Maths.Direction;
 
 namespace Content.Client.UserInterface.Controls;
 
index 64e482f37ec88aafdbb747eca2766d621b50d729..6cf7622ea4e8a65038d8069573a28a03a5c34b11 100644 (file)
@@ -7,6 +7,7 @@ using Robust.Client.ResourceManagement;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
 using Robust.Shared.Timing;
 using Robust.Shared.Utility;
 
index c4ce4b3151606e9b1991c513f54fee1d54716317..540a8ecb579a268c473186adc07c0ced51ac9b53 100644 (file)
@@ -3,6 +3,7 @@ using System.Numerics;
 using Robust.Client.Graphics;
 using Robust.Client.Input;
 using Robust.Client.UserInterface.Controls;
+using Robust.Shared.Graphics;
 using Robust.Shared.Input;
 using Robust.Shared.Utility;
 
index 3e9a01e77063bdfc80f8c503e0a4b21a38b5b01d..57ec0c40d5edcf2afedbf35edd7b811128fdb9d1 100644 (file)
@@ -20,6 +20,7 @@ using Robust.Client.Player;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controllers;
 using Robust.Client.UserInterface.Controls;
+using Robust.Shared.Graphics.RSI;
 using Robust.Shared.Input;
 using Robust.Shared.Input.Binding;
 using Robust.Shared.Timing;
@@ -748,7 +749,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
             if (entIcon != null)
             {
                 _dragShadow.Texture = EntityManager.GetComponent<SpriteComponent>(entIcon.Value).Icon?
-                    .GetFrame(RSI.State.Direction.South, 0);
+                    .GetFrame(RsiDirection.South, 0);
             }
             else if (action.Icon != null)
             {
index 4bc09278181e1baa3abd5dd007785defe2e0f07c..2af079ccce4ea049bc1fa239d0a4b0c40ba5d3d7 100644 (file)
@@ -9,11 +9,13 @@ using Robust.Client.Graphics;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.Utility;
+using Robust.Shared.Graphics;
 using Robust.Shared.Input;
 using Robust.Shared.Timing;
 using Robust.Shared.Utility;
 using static Robust.Client.UserInterface.Controls.BoxContainer;
 using static Robust.Client.UserInterface.Controls.TextureRect;
+using Direction = Robust.Shared.Maths.Direction;
 
 namespace Content.Client.UserInterface.Systems.Actions.Controls;
 
index d0d21e4a6ed0b04f30866b8266118b9d9ae69dca..3f878d1383f2ec94608037164741415ba7484b86 100644 (file)
@@ -6,6 +6,7 @@ using Robust.Client.Graphics;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.CustomControls;
 using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Graphics;
 using Robust.Shared.Prototypes;
 
 namespace Content.Client.VendingMachines.UI
index 288c730c4166b5a04db723d19b8d42eea841c0e2..dfb5418f116583b468c036e6ea07fc639aad135d 100644 (file)
@@ -8,6 +8,7 @@ using Robust.Client.Animations;
 using Robust.Client.Graphics;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controls;
+using Robust.Shared.Graphics;
 
 namespace Content.Client.Weapons.Ranged.Systems;
 
index 422d97c5b2185ab14bac0b159a8062b3fb8c8e87..743ca562d21d35815cdeffcd329ab2aa490b334f 100644 (file)
@@ -312,8 +312,8 @@ public sealed partial class GunSystem : SharedGunSystem
         light.NetSyncEnabled = false;
         Lights.SetEnabled(uid, true, light);
         Lights.SetRadius(uid, 2f, light);
-        light.Color = Color.FromHex("#cc8e2b");
-        light.Energy = 5f;
+        Lights.SetColor(uid, Color.FromHex("#cc8e2b"), light);
+        Lights.SetEnergy(uid, 5f, light);
 
         var animTwo = new Animation()
         {
index 60571938e75a4cb82b722e1eb357fe032ce51979..bd5627292accee58be5a4dc4b8535a30a6826b8e 100644 (file)
@@ -7,6 +7,8 @@ using Robust.Client.Graphics;
 using Robust.Client.ResourceManagement;
 using Robust.Client.Utility;
 using Robust.Shared.Enums;
+using Robust.Shared.Graphics;
+using Robust.Shared.Graphics.RSI;
 using Robust.Shared.Map;
 using Robust.Shared.Physics.Components;
 using Robust.Shared.Prototypes;
@@ -131,7 +133,7 @@ public sealed class WeatherOverlay : Overlay
             case SpriteSpecifier.Rsi rsi:
                 var rsiActual = _cache.GetResource<RSIResource>(rsi.RsiPath).RSI;
                 rsiActual.TryGetState(rsi.RsiState, out var state);
-                var frames = state!.GetFrames(RSI.State.Direction.South);
+                var frames = state!.GetFrames(RsiDirection.South);
                 var delays = state.GetDelays();
                 var totalDelay = delays.Sum();
                 var time = curTime.TotalSeconds % totalDelay;
index 893a9682584e460c4c32c64c6696e09600173d23..02c435d242508453342f10688d5a5e0bd31254b8 100644 (file)
@@ -156,7 +156,7 @@ public sealed partial class AnomalySystem
             return;
 
         Appearance.SetData(uid, AnomalyVesselVisuals.HasAnomaly, on, appearanceComponent);
-        if (TryComp<SharedPointLightComponent>(uid, out var pointLightComponent))
+        if (_pointLight.TryGetLight(uid, out var pointLightComponent))
             _pointLight.SetEnabled(uid, on, pointLightComponent);
 
         // arbitrary value for the generic visualizer to use.
index a1291b85d2919fbbcd9a28408a58dc5ff5794f35..b2cad7e01205034f0af8073a6127ac556dad1753 100644 (file)
@@ -26,11 +26,12 @@ namespace Content.Server.Botany.Systems;
 
 public sealed partial class BotanySystem : EntitySystem
 {
-    [Dependency] private readonly AppearanceSystem _appearance = default!;
-    [Dependency] private readonly SharedHandsSystem _hands = default!;
     [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
-    [Dependency] private readonly PopupSystem _popupSystem = default!;
     [Dependency] private readonly IRobustRandom _robustRandom = default!;
+    [Dependency] private readonly AppearanceSystem _appearance = default!;
+    [Dependency] private readonly PopupSystem _popupSystem = default!;
+    [Dependency] private readonly SharedHandsSystem _hands = default!;
+    [Dependency] private readonly SharedPointLightSystem _light = default!;
     [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
     [Dependency] private readonly MetaDataSystem _metaData = default!;
     [Dependency] private readonly FixtureSystem _fixtureSystem = default!;
@@ -181,17 +182,17 @@ public sealed partial class BotanySystem : EntitySystem
 
             if (proto.Bioluminescent)
             {
-                var light = EnsureComp<PointLightComponent>(entity);
-                light.Radius = proto.BioluminescentRadius;
-                light.Color = proto.BioluminescentColor;
-                light.CastShadows = false; // this is expensive, and botanists make lots of plants
-                Dirty(light);
+                var light = _light.EnsureLight(entity);
+                _light.SetRadius(entity, proto.BioluminescentRadius, light);
+                _light.SetColor(entity, proto.BioluminescentColor, light);
+                // TODO: Ayo why you copy-pasting code between here and plantholder?
+                _light.SetCastShadows(entity, false, light); // this is expensive, and botanists make lots of plants
             }
 
             if (proto.Slip)
             {
                 var slippery = EnsureComp<SlipperyComponent>(entity);
-                EntityManager.Dirty(slippery);
+                Dirty(entity, slippery);
                 EnsureComp<StepTriggerComponent>(entity);
                 // Need a fixture with a slip layer in order to actually do the slipping
                 var fixtures = EnsureComp<FixturesComponent>(entity);
index a59dddb71265e07359bab2fc7ef8c52a56901363..275b80dd7fe03f0701e1f9571d83114e50b5d377 100644 (file)
@@ -29,6 +29,7 @@ namespace Content.Server.Botany.Systems;
 
 public sealed class PlantHolderSystem : EntitySystem
 {
+    [Dependency] private readonly AtmosphereSystem _atmosphere = default!;
     [Dependency] private readonly BotanySystem _botany = default!;
     [Dependency] private readonly IPrototypeManager _prototype = default!;
     [Dependency] private readonly MutationSystem _mutation = default!;
@@ -36,10 +37,11 @@ public sealed class PlantHolderSystem : EntitySystem
     [Dependency] private readonly SharedAudioSystem _audio = default!;
     [Dependency] private readonly PopupSystem _popup = default!;
     [Dependency] private readonly IGameTiming _gameTiming = default!;
-    [Dependency] private readonly TagSystem _tagSystem = default!;
+    [Dependency] private readonly SharedPointLightSystem _pointLight = default!;
     [Dependency] private readonly SolutionContainerSystem _solutionSystem = default!;
+    [Dependency] private readonly TagSystem _tagSystem = default!;
     [Dependency] private readonly IRobustRandom _random = default!;
-    [Dependency] private readonly AtmosphereSystem _atmosphere = default!;
+
 
     public const float HydroponicsSpeedMultiplier = 1f;
     public const float HydroponicsConsumptionMultiplier = 2f;
@@ -856,9 +858,9 @@ public sealed class PlantHolderSystem : EntitySystem
         if (component.Seed != null && component.Seed.Bioluminescent)
         {
             var light = EnsureComp<PointLightComponent>(uid);
-            light.Radius = component.Seed.BioluminescentRadius;
-            light.Color = component.Seed.BioluminescentColor;
-            light.CastShadows = false; // this is expensive, and botanists make lots of plants
+            _pointLight.SetRadius(uid, component.Seed.BioluminescentRadius, light);
+            _pointLight.SetColor(uid, component.Seed.BioluminescentColor, light);
+            _pointLight.SetCastShadows(uid, false, light);
             Dirty(uid, light);
         }
         else
index ad745ffa5d7605e8bf41399ab918295ebc59c830..1a9b2ad6e9972f10e2d5d68edeface42259b0269 100644 (file)
@@ -17,6 +17,7 @@ namespace Content.Server.Gravity
         [Dependency] private readonly AmbientSoundSystem _ambientSoundSystem = default!;
         [Dependency] private readonly GravitySystem _gravitySystem = default!;
         [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+        [Dependency] private readonly SharedPointLightSystem _lights = default!;
         [Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
 
         public override void Initialize()
@@ -233,10 +234,10 @@ namespace Content.Server.Gravity
             var appearance = EntityManager.GetComponentOrNull<AppearanceComponent>(uid);
             _appearance.SetData(uid, GravityGeneratorVisuals.Charge, grav.Charge, appearance);
 
-            if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLight))
+            if (_lights.TryGetLight(uid, out var pointLight))
             {
-                pointLight.Enabled = grav.Charge > 0;
-                pointLight.Radius = MathHelper.Lerp(grav.LightRadiusMin, grav.LightRadiusMax, grav.Charge);
+                _lights.SetEnabled(uid, grav.Charge > 0, pointLight);
+                _lights.SetRadius(uid, MathHelper.Lerp(grav.LightRadiusMin, grav.LightRadiusMax, grav.Charge), pointLight);
             }
 
             if (!grav.Intact)
index 22a27dc8c4eb60165ed17db4025717430a06c9af..bc3e7e83e282932607f0e710502d51c3fd1c8fe1 100644 (file)
@@ -9,7 +9,6 @@ using Content.Shared.Examine;
 using Content.Shared.Light;
 using Content.Shared.Light.Components;
 using Robust.Server.GameObjects;
-using Robust.Shared.GameStates;
 using Color = Robust.Shared.Maths.Color;
 
 namespace Content.Server.Light.EntitySystems;
@@ -103,7 +102,7 @@ public sealed class EmergencyLightSystem : SharedEmergencyLightSystem
             if (CompOrNull<StationMemberComponent>(xform.GridUid)?.Station != ev.Station)
                 continue;
 
-            pointLight.Color = details.EmergencyLightColor;
+            _pointLight.SetColor(uid, details.EmergencyLightColor, pointLight);
             _appearance.SetData(uid, EmergencyLightVisuals.Color, details.EmergencyLightColor, appearance);
 
             if (details.ForceEnableEmergencyLights && !light.ForciblyEnabled)
index e74585f0b2fcd2a3bc31dee9f942ffb75e7d6024..3ff115d14e657fa3d9f07524df78a390c5a3c071 100644 (file)
@@ -13,18 +13,20 @@ using JetBrains.Annotations;
 using Robust.Server.GameObjects;
 using Robust.Shared.Containers;
 using Robust.Shared.GameStates;
+using Robust.Shared.Prototypes;
 using Robust.Shared.Utility;
 
 namespace Content.Server.Light.EntitySystems
 {
-    [UsedImplicitly]
     public sealed class HandheldLightSystem : SharedHandheldLightSystem
     {
+        [Dependency] private readonly IPrototypeManager _proto = default!;
         [Dependency] private readonly ActionsSystem _actions = default!;
         [Dependency] private readonly PopupSystem _popup = default!;
         [Dependency] private readonly PowerCellSystem _powerCell = default!;
-        [Dependency] private readonly SharedAudioSystem _audio = default!;
         [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+        [Dependency] private readonly SharedAudioSystem _audio = default!;
+        [Dependency] private readonly SharedPointLightSystem _lights = default!;
 
         // TODO: Ideally you'd be able to subscribe to power stuff to get events at certain percentages.. or something?
         // But for now this will be better anyway.
@@ -196,12 +198,12 @@ namespace Content.Server.Light.EntitySystems
 
         public bool TurnOff(EntityUid uid, HandheldLightComponent component, bool makeNoise = true)
         {
-            if (!component.Activated || !TryComp<PointLightComponent>(uid, out var pointLightComponent))
+            if (!component.Activated || !_lights.TryGetLight(uid, out var pointLightComponent))
             {
                 return false;
             }
 
-            pointLightComponent.Enabled = false;
+            _lights.SetEnabled(uid, false, pointLightComponent);
             SetActivated(uid, false, component, makeNoise);
             component.Level = null;
             _activeLights.Remove(component);
@@ -210,7 +212,7 @@ namespace Content.Server.Light.EntitySystems
 
         public bool TurnOn(EntityUid user, EntityUid uid, HandheldLightComponent component)
         {
-            if (component.Activated || !TryComp<PointLightComponent>(uid, out var pointLightComponent))
+            if (component.Activated || !_lights.TryGetLight(uid, out var pointLightComponent))
             {
                 return false;
             }
@@ -233,7 +235,7 @@ namespace Content.Server.Light.EntitySystems
                 return false;
             }
 
-            pointLightComponent.Enabled = true;
+            _lights.SetEnabled(uid, true, pointLightComponent);
             SetActivated(uid, true, component, true);
             _activeLights.Add(component);
 
index b3961b15f980deb0391f560c8353ddc257213a02..752fb8f5fe6a33391f13c8b873739c0518f34185 100644 (file)
@@ -1,12 +1,13 @@
 using Content.Server.Light.Components;
 using Content.Server.Power.Components;
 using Content.Server.Power.EntitySystems;
-using Robust.Server.GameObjects;
 
 namespace Content.Server.Light.EntitySystems
 {
     public sealed class LitOnPoweredSystem : EntitySystem
     {
+        [Dependency] private readonly SharedPointLightSystem _lights = default!;
+
         public override void Initialize()
         {
             base.Initialize();
@@ -16,17 +17,17 @@ namespace Content.Server.Light.EntitySystems
 
         private void OnPowerChanged(EntityUid uid, LitOnPoweredComponent component, ref PowerChangedEvent args)
         {
-            if (EntityManager.TryGetComponent<PointLightComponent>(uid, out var light))
+            if (_lights.TryGetLight(uid, out var light))
             {
-                light.Enabled = args.Powered;
+                _lights.SetEnabled(uid, args.Powered, light);
             }
         }
 
         private void OnPowerSupply(EntityUid uid, LitOnPoweredComponent component, ref PowerNetBatterySupplyEvent args)
         {
-            if (EntityManager.TryGetComponent<PointLightComponent>(uid, out var light))
+            if (_lights.TryGetLight(uid, out var light))
             {
-                light.Enabled = args.Supply;
+                _lights.SetEnabled(uid, args.Supply, light);
             }
         }
     }
index b705fabce43f0a89222e17047599c4526c9e9c74..7fe8aa92376601a32ede8db244ccfa067380d948 100644 (file)
@@ -14,9 +14,10 @@ namespace Content.Server.Light.EntitySystems
     public sealed class MatchstickSystem : EntitySystem
     {
         [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
-        [Dependency] private readonly TransformSystem _transformSystem = default!;
-        [Dependency] private readonly SharedItemSystem _item = default!;
         [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+        [Dependency] private readonly SharedItemSystem _item = default!;
+        [Dependency] private readonly SharedPointLightSystem _lights = default!;
+        [Dependency] private readonly TransformSystem _transformSystem = default!;
 
         private HashSet<MatchstickComponent> _litMatches = new();
 
@@ -92,25 +93,25 @@ namespace Content.Server.Light.EntitySystems
         {
             component.CurrentState = value;
 
-            if (TryComp<PointLightComponent>(component.Owner, out var pointLightComponent))
+            if (_lights.TryGetLight(uid, out var pointLightComponent))
             {
-                pointLightComponent.Enabled = component.CurrentState == SmokableState.Lit;
+                _lights.SetEnabled(uid, component.CurrentState == SmokableState.Lit, pointLightComponent);
             }
 
-            if (EntityManager.TryGetComponent(component.Owner, out ItemComponent? item))
+            if (EntityManager.TryGetComponent(uid, out ItemComponent? item))
             {
                 switch (component.CurrentState)
                 {
                     case SmokableState.Lit:
-                        _item.SetHeldPrefix(component.Owner, "lit", item);
+                        _item.SetHeldPrefix(uid, "lit", item);
                         break;
                     default:
-                        _item.SetHeldPrefix(component.Owner, "unlit", item);
+                        _item.SetHeldPrefix(uid, "unlit", item);
                         break;
                 }
             }
 
-            if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance))
+            if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
             {
                 _appearance.SetData(uid, SmokingVisuals.Smoking, component.CurrentState, appearance);
             }
index b84a2688e57afc9c78d09cbaf9093d7d2568923e..eb079ebbb657b2ac5bb7a26cb034fd77775815a1 100644 (file)
@@ -41,6 +41,7 @@ namespace Content.Server.Light.EntitySystems
         [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
         [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
         [Dependency] private readonly SharedAudioSystem _audio = default!;
+        [Dependency] private readonly PointLightSystem _pointLight = default!;
         [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
 
         private static readonly TimeSpan ThunkDelay = TimeSpan.FromSeconds(2);
@@ -74,9 +75,10 @@ namespace Content.Server.Light.EntitySystems
 
         private void OnMapInit(EntityUid uid, PoweredLightComponent light, MapInitEvent args)
         {
+            // TODO: Use ContainerFill dog
             if (light.HasLampOnSpawn != null)
             {
-                var entity = EntityManager.SpawnEntity(light.HasLampOnSpawn, EntityManager.GetComponent<TransformComponent>(light.Owner).Coordinates);
+                var entity = EntityManager.SpawnEntity(light.HasLampOnSpawn, EntityManager.GetComponent<TransformComponent>(uid).Coordinates);
                 light.LightBulbContainer.Insert(entity);
             }
             // need this to update visualizers
@@ -386,16 +388,16 @@ namespace Content.Server.Light.EntitySystems
 
             if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLight))
             {
-                pointLight.Enabled = value;
+                _pointLight.SetEnabled(uid, value, pointLight);
 
                 if (color != null)
-                    pointLight.Color = color.Value;
+                    _pointLight.SetColor(uid, color.Value, pointLight);
                 if (radius != null)
-                    pointLight.Radius = (float) radius;
+                    _pointLight.SetRadius(uid, (float) radius, pointLight);
                 if (energy != null)
-                    pointLight.Energy = (float) energy;
+                    _pointLight.SetEnergy(uid, (float) energy, pointLight);
                 if (softness != null)
-                    pointLight.Softness = (float) softness;
+                    _pointLight.SetSoftness(uid, (float) softness, pointLight);
             }
         }
 
index 6a7e7ba8a0ade5461844d813a55048aaad1ddc8b..2be870ff0da4c6cd5a07a112d235ad5532769a63 100644 (file)
@@ -7,7 +7,6 @@ using Content.Shared.Light.Components;
 using Content.Shared.Mind.Components;
 using Content.Shared.Toggleable;
 using Content.Shared.Verbs;
-using Robust.Server.GameObjects;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Random;
 using Robust.Shared.Utility;
@@ -16,11 +15,12 @@ namespace Content.Server.Light.EntitySystems
 {
     public sealed class UnpoweredFlashlightSystem : EntitySystem
     {
+        [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
         [Dependency] private readonly IRobustRandom _random = default!;
         [Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
         [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
-        [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
         [Dependency] private readonly SharedAudioSystem _audioSystem = default!;
+        [Dependency] private readonly SharedPointLightSystem _light = default!;
 
         public override void Initialize()
         {
@@ -71,13 +71,13 @@ namespace Content.Server.Light.EntitySystems
 
         private void OnGotEmagged(EntityUid uid, UnpoweredFlashlightComponent component, ref GotEmaggedEvent args)
         {
-            if (!TryComp<PointLightComponent>(uid, out var light))
+            if (!_light.TryGetLight(uid, out var light))
                 return;
 
             if (_prototypeManager.TryIndex<ColorPalettePrototype>(component.EmaggedColorsPrototype, out var possibleColors))
             {
                 var pick = _random.Pick(possibleColors.Colors.Values);
-                light.Color = pick;
+                _light.SetColor(uid, pick, light);
             }
 
             args.Repeatable = true;
@@ -86,11 +86,11 @@ namespace Content.Server.Light.EntitySystems
 
         public void ToggleLight(EntityUid uid, UnpoweredFlashlightComponent flashlight)
         {
-            if (!TryComp<PointLightComponent>(uid, out var light))
+            if (!_light.TryGetLight(uid, out var light))
                 return;
 
             flashlight.LightOn = !flashlight.LightOn;
-            light.Enabled = flashlight.LightOn;
+            _light.SetEnabled(uid, flashlight.LightOn, light);
 
             _appearance.SetData(uid, UnpoweredFlashlightVisuals.LightOn, flashlight.LightOn);
 
index 4bd1c0a14c9ae26240f2ace0143104f9d95e4f37..9219f5f73cfa29d6d6f3d6b1977de98e2de13b5c 100644 (file)
@@ -270,10 +270,10 @@ public sealed class TegSystem : EntitySystem
         _appearance.SetData(uid, TegVisuals.CirculatorSpeed, speed);
         _appearance.SetData(uid, TegVisuals.CirculatorPower, powered);
 
-        if (TryComp(uid, out PointLightComponent? pointLight))
+        if (_pointLight.TryGetLight(uid, out var pointLight))
         {
             _pointLight.SetEnabled(uid, powered, pointLight);
-            pointLight.Color = speed == TegCirculatorSpeed.SpeedFast ? circ.LightColorFast : circ.LightColorSlow;
+            _pointLight.SetColor(uid, speed == TegCirculatorSpeed.SpeedFast ? circ.LightColorFast : circ.LightColorSlow, pointLight);
         }
     }
 
index 24d326c94e102b5ef98f4cfa4fd29cf9c41d5753..1fd9fabb803288809d1003737e8f86a907422be6 100644 (file)
@@ -1,4 +1,3 @@
-using System.Linq;
 using System.Numerics;
 using Content.Server.Audio;
 using Content.Server.Construction;
@@ -12,9 +11,7 @@ using Content.Shared.Maps;
 using Content.Shared.Physics;
 using Content.Shared.Shuttles.Components;
 using Content.Shared.Temperature;
-using Robust.Server.GameObjects;
 using Robust.Shared.Map;
-using Robust.Shared.Map.Components;
 using Robust.Shared.Physics.Collision.Shapes;
 using Robust.Shared.Physics.Components;
 using Robust.Shared.Physics.Events;
@@ -32,6 +29,7 @@ public sealed class ThrusterSystem : EntitySystem
     [Dependency] private readonly AmbientSoundSystem _ambient = default!;
     [Dependency] private readonly FixtureSystem _fixtureSystem = default!;
     [Dependency] private readonly DamageableSystem _damageable = default!;
+    [Dependency] private readonly SharedPointLightSystem _light = default!;
     [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
 
     // Essentially whenever thruster enables we update the shuttle's available impulses which are used for movement.
@@ -287,9 +285,9 @@ public sealed class ThrusterSystem : EntitySystem
             _appearance.SetData(uid, ThrusterVisualState.State, true, appearance);
         }
 
-        if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLightComponent))
+        if (_light.TryGetLight(uid, out var pointLightComponent))
         {
-            pointLightComponent.Enabled = true;
+            _light.SetEnabled(uid, true, pointLightComponent);
         }
 
         _ambient.SetAmbience(uid, true);
@@ -376,9 +374,9 @@ public sealed class ThrusterSystem : EntitySystem
             _appearance.SetData(uid, ThrusterVisualState.State, false, appearance);
         }
 
-        if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLightComponent))
+        if (_light.TryGetLight(uid, out var pointLightComponent))
         {
-            pointLightComponent.Enabled = false;
+            _light.SetEnabled(uid, false, pointLightComponent);
         }
 
         _ambient.SetAmbience(uid, false);
index ac213423760d7e795b5a1b830296df80835f66ed..a0621ef63defa450dcdd52fb10761ba252c2228b 100644 (file)
@@ -18,10 +18,11 @@ namespace Content.Server.Singularity.EntitySystems;
 public sealed class ContainmentFieldGeneratorSystem : EntitySystem
 {
     [Dependency] private readonly IAdminLogManager _adminLogger = default!;
-    [Dependency] private readonly TagSystem _tags = default!;
-    [Dependency] private readonly PopupSystem _popupSystem = default!;
-    [Dependency] private readonly PhysicsSystem _physics = default!;
     [Dependency] private readonly AppearanceSystem _visualizer = default!;
+    [Dependency] private readonly PhysicsSystem _physics = default!;
+    [Dependency] private readonly PopupSystem _popupSystem = default!;
+    [Dependency] private readonly SharedPointLightSystem _light = default!;
+    [Dependency] private readonly TagSystem _tags = default!;
 
     public override void Initialize()
     {
@@ -325,9 +326,9 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
     /// </summary>
     public void UpdateConnectionLights(ContainmentFieldGeneratorComponent component)
     {
-        if (EntityManager.TryGetComponent<PointLightComponent>(component.Owner, out var pointLightComponent))
+        if (_light.TryGetLight(component.Owner, out var pointLightComponent))
         {
-            pointLightComponent.Enabled = component.Connections.Count > 0;
+            _light.SetEnabled(component.Owner, component.Connections.Count > 0, pointLightComponent);
         }
     }
 
index 7097bc4dc9ef550b11fdbc5c23a3a1b9749756ff..7e9c7181c5143ce568c417bd0c505d294bf78d61 100644 (file)
@@ -22,11 +22,6 @@ namespace Content.Server.Tools
 {
     public sealed partial class ToolSystem
     {
-        [Dependency] private readonly IEntityManager _entityManager = default!;
-
-        [Dependency] private readonly AppearanceSystem _appearanceSystem = default!;
-        [Dependency] private readonly SharedAudioSystem _audioSystem = default!;
-
         private readonly HashSet<EntityUid> _activeWelders = new();
 
         private const float WelderUpdateTimer = 1f;
@@ -65,7 +60,7 @@ namespace Content.Server.Tools
             WelderComponent? welder = null,
             SolutionContainerManagerComponent? solutionContainer = null,
             ItemComponent? item = null,
-            PointLightComponent? light = null,
+            SharedPointLightComponent? light = null,
             AppearanceComponent? appearance = null)
         {
             // Right now, we only need the welder.
@@ -82,7 +77,7 @@ namespace Content.Server.Tools
             WelderComponent? welder = null,
             SolutionContainerManagerComponent? solutionContainer = null,
             ItemComponent? item = null,
-            PointLightComponent? light = null,
+            SharedPointLightComponent? light = null,
             AppearanceComponent? appearance = null,
             TransformComponent? transform = null)
         {
@@ -90,7 +85,9 @@ namespace Content.Server.Tools
                 return false;
 
             // Optional components.
-            Resolve(uid, ref item, ref light, ref appearance, false);
+            Resolve(uid, ref item,ref appearance, false);
+
+            _light.ResolveLight(uid, ref light);
 
             if (!_solutionContainerSystem.TryGetSolution(uid, welder.FuelSolution, out var solution, solutionContainer))
                 return false;
@@ -125,7 +122,9 @@ namespace Content.Server.Tools
             _appearanceSystem.SetData(uid, ToggleableLightVisuals.Enabled, true);
 
             if (light != null)
-                light.Enabled = true;
+            {
+                _light.SetEnabled(uid, true, light);
+            }
 
             _audioSystem.PlayPvs(welder.WelderOnSounds, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(-5f));
 
@@ -135,7 +134,7 @@ namespace Content.Server.Tools
                 _atmosphereSystem.HotspotExpose(gridUid, position, 700, 50, uid, true);
             }
 
-            _entityManager.Dirty(welder);
+            Dirty(uid, welder);
 
             _activeWelders.Add(uid);
             return true;
@@ -144,7 +143,7 @@ namespace Content.Server.Tools
         public bool TryTurnWelderOff(EntityUid uid, EntityUid? user,
             WelderComponent? welder = null,
             ItemComponent? item = null,
-            PointLightComponent? light = null,
+            SharedPointLightComponent? light = null,
             AppearanceComponent? appearance = null)
         {
             if (!Resolve(uid, ref welder))
@@ -162,7 +161,7 @@ namespace Content.Server.Tools
                 _adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(uid):welder} toggled off");
 
             var ev = new WelderToggledEvent(false);
-            RaiseLocalEvent(welder.Owner, ev, false);
+            RaiseLocalEvent(uid, ev, false);
 
             var hotEvent = new IsHotEvent() {IsHot = false};
             RaiseLocalEvent(uid, hotEvent);
@@ -172,11 +171,13 @@ namespace Content.Server.Tools
             _appearanceSystem.SetData(uid, ToggleableLightVisuals.Enabled, false);
 
             if (light != null)
-                light.Enabled = false;
+            {
+                _light.SetEnabled(uid, false, light);
+            }
 
             _audioSystem.PlayPvs(welder.WelderOffSounds, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(-5f));
 
-            _entityManager.Dirty(welder);
+            Dirty(uid, welder);
 
             _activeWelders.Remove(uid);
             return true;
@@ -184,7 +185,8 @@ namespace Content.Server.Tools
 
         private void OnWelderStartup(EntityUid uid, WelderComponent welder, ComponentStartup args)
         {
-            _entityManager.Dirty(welder);
+            // TODO: Delete this shit what
+            Dirty(welder);
         }
 
         private void OnWelderIsHotEvent(EntityUid uid, WelderComponent welder, IsHotEvent args)
@@ -217,7 +219,9 @@ namespace Content.Server.Tools
 
         private void OnWelderSolutionChange(EntityUid uid, WelderComponent welder, SolutionChangedEvent args)
         {
-            _entityManager.Dirty(welder);
+            // TODO what
+            // ????
+            Dirty(welder);
         }
 
         private void OnWelderActivate(EntityUid uid, WelderComponent welder, ActivateInWorldEvent args)
@@ -310,7 +314,7 @@ namespace Content.Server.Tools
                 if (solution.GetTotalPrototypeQuantity(welder.FuelReagent) <= FixedPoint2.Zero)
                     TryTurnWelderOff(tool, null, welder);
 
-                _entityManager.Dirty(welder);
+                Dirty(welder);
             }
 
             _welderTimer -= WelderUpdateTimer;
index dde6fd81753bd870e6d9c67fdd00daab3fbf8e6e..a56dabaf8b74d76a702e281af170278c74dc330e 100644 (file)
@@ -12,11 +12,14 @@ namespace Content.Server.Tools
     // TODO move tool system to shared, and make it a friend of Tool Component.
     public sealed partial class ToolSystem : SharedToolSystem
     {
-        [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
         [Dependency] private readonly IMapManager _mapManager = default!;
-        [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
+        [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
+        [Dependency] private readonly AppearanceSystem _appearanceSystem = default!;
         [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
         [Dependency] private readonly PopupSystem _popupSystem = default!;
+        [Dependency] private readonly SharedAudioSystem _audioSystem = default!;
+        [Dependency] private readonly SharedPointLightSystem _light = default!;
+        [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
         [Dependency] private readonly TransformSystem _transformSystem = default!;
         [Dependency] private readonly TurfSystem _turf = default!;
 
index 3d5df87e68de4b37ed60d991cba2c0f89caebca4..03577d53ac8dfe5f1223134ef620dda494537023 100644 (file)
@@ -23,6 +23,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
     [Dependency] private readonly MobStateSystem _mobStateSystem = default!;
     [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
     [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
+    [Dependency] private readonly SharedPointLightSystem _light = default!;
     [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
 
     public override void Initialize()
@@ -51,14 +52,17 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
     {
         if (!Resolve(uid, ref cryoPod))
             return;
+
         var cryoPodEnabled = HasComp<ActiveCryoPodComponent>(uid);
-        if (TryComp<SharedPointLightComponent>(uid, out var light))
+
+        if (_light.TryGetLight(uid, out var light))
         {
-            light.Enabled = cryoPodEnabled && cryoPod.BodyContainer.ContainedEntity != null;
+            _light.SetEnabled(uid, cryoPodEnabled && cryoPod.BodyContainer.ContainedEntity != null, light);
         }
 
         if (!Resolve(uid, ref appearance))
             return;
+
         _appearanceSystem.SetData(uid, CryoPodComponent.CryoPodVisuals.ContainsEntity, cryoPod.BodyContainer.ContainedEntity == null, appearance);
         _appearanceSystem.SetData(uid, CryoPodComponent.CryoPodVisuals.IsOn, cryoPodEnabled, appearance);
     }
index 4cb5b9dc96f7173b1c6ea574d869622aaee80baa..40e6a53a00d4733fa21cd497c295f03ca0c98537 100644 (file)
@@ -13,7 +13,7 @@ public abstract class SharedRevenantOverloadedLightsSystem : EntitySystem
 
         var enumerator = EntityQueryEnumerator<RevenantOverloadedLightsComponent>();
 
-        while (enumerator.MoveNext(out var comp))
+        while (enumerator.MoveNext(out var uid, out var comp))
         {
             comp.Accumulator += frameTime;
 
@@ -21,7 +21,7 @@ public abstract class SharedRevenantOverloadedLightsSystem : EntitySystem
                 continue;
 
             OnZap(comp);
-            RemComp(comp.Owner, comp);
+            RemCompDeferred(uid, comp);
         }
     }
 
index 699889586a5dc05a81ed6a8efb6f4f3c0c888d91..9d021c52194d452dca6ad5e84bc0030e29d3b7b8 100644 (file)
@@ -61,7 +61,10 @@ public sealed class DeployableBarrierSystem : EntitySystem
         if (TryComp(uid, out SharedPullableComponent? pullable))
             _pulling.TryStopPull(pullable);
 
-        if (TryComp(uid, out SharedPointLightComponent? light))
-            _pointLight.SetEnabled(uid, isDeployed, light);
+        SharedPointLightComponent? pointLight = null;
+        if (_pointLight.ResolveLight(uid, ref pointLight))
+        {
+            _pointLight.SetEnabled(uid, isDeployed, pointLight);
+        }
     }
 }