Remove lights compref (#19531)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user