diff --git a/Content.Client/Light/HandheldLightSystem.cs b/Content.Client/Light/HandheldLightSystem.cs index d8a04aa5a1..a4bb32f9cd 100644 --- a/Content.Client/Light/HandheldLightSystem.cs +++ b/Content.Client/Light/HandheldLightSystem.cs @@ -10,6 +10,8 @@ namespace Content.Client.Light; public sealed class HandheldLightSystem : SharedHandheldLightSystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() { base.Initialize(); @@ -30,13 +32,12 @@ public sealed class HandheldLightSystem : SharedHandheldLightSystem return; } - if (!args.Component.TryGetData(ToggleableLightVisuals.Enabled, out bool enabled)) + if (!_appearance.TryGetData(uid, ToggleableLightVisuals.Enabled, out bool enabled, args.Component)) { return; } - if (!args.Component.TryGetData(HandheldLightVisuals.Power, - out HandheldLightPowerStates state)) + if (!_appearance.TryGetData(uid, HandheldLightVisuals.Power, out HandheldLightPowerStates state, args.Component)) { return; } diff --git a/Content.Server/Light/EntitySystems/HandheldLightSystem.cs b/Content.Server/Light/EntitySystems/HandheldLightSystem.cs index f66460d52f..cf3bc77f56 100644 --- a/Content.Server/Light/EntitySystems/HandheldLightSystem.cs +++ b/Content.Server/Light/EntitySystems/HandheldLightSystem.cs @@ -26,6 +26,8 @@ namespace Content.Server.Light.EntitySystems [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly PowerCellSystem _powerCell = default!; [Dependency] private readonly IPrototypeManager _proto = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; // TODO: Ideally you'd be able to subscribe to power stuff to get events at certain percentages.. or something? // But for now this will be better anyway. @@ -209,7 +211,7 @@ namespace Content.Server.Light.EntitySystems if (!_powerCell.TryGetBatteryFromSlot(component.Owner, out var battery) && !TryComp(component.Owner, out battery)) { - SoundSystem.Play(component.TurnOnFailSound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner); + _audio.PlayPvs(_audio.GetSound(component.TurnOnFailSound), component.Owner); _popup.PopupEntity(Loc.GetString("handheld-light-component-cell-missing-message"), component.Owner, user); return false; } @@ -219,7 +221,7 @@ namespace Content.Server.Light.EntitySystems // Simple enough. if (component.Wattage > battery.CurrentCharge) { - SoundSystem.Play(component.TurnOnFailSound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner); + _audio.PlayPvs(_audio.GetSound(component.TurnOnFailSound), component.Owner); _popup.PopupEntity(Loc.GetString("handheld-light-component-cell-dead-message"), component.Owner, user); return false; } @@ -245,15 +247,15 @@ namespace Content.Server.Light.EntitySystems var fraction = battery.CurrentCharge / battery.MaxCharge; if (fraction >= 0.30) { - appearanceComponent.SetData(HandheldLightVisuals.Power, HandheldLightPowerStates.FullPower); + _appearance.SetData(component.Owner, HandheldLightVisuals.Power, HandheldLightPowerStates.FullPower, appearanceComponent); } else if (fraction >= 0.10) { - appearanceComponent.SetData(HandheldLightVisuals.Power, HandheldLightPowerStates.LowPower); + _appearance.SetData(component.Owner, HandheldLightVisuals.Power, HandheldLightPowerStates.LowPower, appearanceComponent); } else { - appearanceComponent.SetData(HandheldLightVisuals.Power, HandheldLightPowerStates.Dying); + _appearance.SetData(component.Owner, HandheldLightVisuals.Power, HandheldLightPowerStates.Dying, appearanceComponent); ; } if (component.Activated && !battery.TryUseCharge(component.Wattage * frameTime))