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

@@ -13,10 +13,12 @@ namespace Content.Server.Light.EntitySystems
{
public sealed class MatchstickSystem : EntitySystem
{
private HashSet<MatchstickComponent> _litMatches = new();
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly SharedItemSystem _item = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
private HashSet<MatchstickComponent> _litMatches = new();
public override void Initialize()
{
@@ -61,7 +63,7 @@ namespace Content.Server.Light.EntitySystems
if (!isHotEvent.IsHot)
return;
Ignite(component, args.User);
Ignite(uid, component, args.User);
args.Handled = true;
}
@@ -70,23 +72,23 @@ namespace Content.Server.Light.EntitySystems
args.IsHot = component.CurrentState == SmokableState.Lit;
}
public void Ignite(MatchstickComponent component, EntityUid user)
public void Ignite(EntityUid uid, MatchstickComponent component, EntityUid user)
{
// Play Sound
SoundSystem.Play(component.IgniteSound.GetSound(), Filter.Pvs(component.Owner),
component.Owner, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
// Change state
SetState(component, SmokableState.Lit);
SetState(uid, component, SmokableState.Lit);
_litMatches.Add(component);
component.Owner.SpawnTimer(component.Duration * 1000, delegate
{
SetState(component, SmokableState.Burnt);
SetState(uid, component, SmokableState.Burnt);
_litMatches.Remove(component);
});
}
private void SetState(MatchstickComponent component, SmokableState value)
private void SetState(EntityUid uid, MatchstickComponent component, SmokableState value)
{
component.CurrentState = value;
@@ -110,7 +112,7 @@ namespace Content.Server.Light.EntitySystems
if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance))
{
appearance.SetData(SmokingVisuals.Smoking, component.CurrentState);
_appearance.SetData(uid, SmokingVisuals.Smoking, component.CurrentState, appearance);
}
}
}