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,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);
}
}
}