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

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