Remove lights compref (#19531)

This commit is contained in:
metalgearsloth
2023-09-11 19:18:06 +10:00
committed by GitHub
parent d315ce3c8c
commit 99b77bc2d3
64 changed files with 222 additions and 132 deletions

View 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;
}