Remove some obsolete AppearanceComponent method usages (#13726)

This commit is contained in:
Visne
2023-02-02 17:34:53 +01:00
committed by GitHub
parent 23b90de34d
commit 5a5a3afbb1
111 changed files with 428 additions and 349 deletions

View File

@@ -14,6 +14,7 @@ namespace Content.Server.Light.EntitySystems
public sealed class UnpoweredFlashlightSystem : EntitySystem
{
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize()
{
@@ -30,7 +31,7 @@ namespace Content.Server.Light.EntitySystems
if (args.Handled)
return;
ToggleLight(component);
ToggleLight(uid, component);
args.Handled = true;
}
@@ -48,7 +49,7 @@ namespace Content.Server.Light.EntitySystems
ActivationVerb verb = new();
verb.Text = Loc.GetString("toggle-flashlight-verb-get-data-text");
verb.IconTexture = "/Textures/Interface/VerbIcons/light.svg.192dpi.png";
verb.Act = () => ToggleLight(component);
verb.Act = () => ToggleLight(uid, component);
verb.Priority = -1; // For things like PDA's, Open-UI and other verbs that should be higher priority.
args.Verbs.Add(verb);
@@ -58,7 +59,7 @@ namespace Content.Server.Light.EntitySystems
{
_actionsSystem.AddAction(uid, component.ToggleAction, null);
}
public void ToggleLight(UnpoweredFlashlightComponent flashlight)
public void ToggleLight(EntityUid uid, UnpoweredFlashlightComponent flashlight)
{
if (!EntityManager.TryGetComponent(flashlight.Owner, out PointLightComponent? light))
return;
@@ -67,7 +68,7 @@ namespace Content.Server.Light.EntitySystems
light.Enabled = flashlight.LightOn;
if (EntityManager.TryGetComponent(flashlight.Owner, out AppearanceComponent? appearance))
appearance.SetData(UnpoweredFlashlightVisuals.LightOn, flashlight.LightOn);
_appearance.SetData(uid, UnpoweredFlashlightVisuals.LightOn, flashlight.LightOn, appearance);
SoundSystem.Play(flashlight.ToggleSound.GetSound(), Filter.Pvs(light.Owner), flashlight.Owner);