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

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