fix match-matchbox interaction (#8715)

This commit is contained in:
Leon Friedrich
2022-06-09 14:39:29 +12:00
committed by GitHub
parent 1e5da87262
commit 2f0c85f1f8

View File

@@ -1,4 +1,5 @@
using Content.Server.Light.Components; using Content.Server.Light.Components;
using Content.Server.Storage.EntitySystems;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Smoking; using Content.Shared.Smoking;
@@ -6,10 +7,12 @@ namespace Content.Server.Light.EntitySystems
{ {
public sealed class MatchboxSystem : EntitySystem public sealed class MatchboxSystem : EntitySystem
{ {
[Dependency] private readonly MatchstickSystem _stickSystem = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
SubscribeLocalEvent<MatchboxComponent, InteractUsingEvent>(OnInteractUsing); SubscribeLocalEvent<MatchboxComponent, InteractUsingEvent>(OnInteractUsing, before: new[] { typeof(StorageSystem) });
} }
private void OnInteractUsing(EntityUid uid, MatchboxComponent component, InteractUsingEvent args) private void OnInteractUsing(EntityUid uid, MatchboxComponent component, InteractUsingEvent args)
@@ -18,7 +21,7 @@ namespace Content.Server.Light.EntitySystems
&& EntityManager.TryGetComponent<MatchstickComponent?>(args.Used, out var matchstick) && EntityManager.TryGetComponent<MatchstickComponent?>(args.Used, out var matchstick)
&& matchstick.CurrentState == SmokableState.Unlit) && matchstick.CurrentState == SmokableState.Unlit)
{ {
Get<MatchstickSystem>().Ignite(matchstick, args.User); _stickSystem.Ignite(matchstick, args.User);
args.Handled = true; args.Handled = true;
} }
} }