Files
OldThink/Content.Server/Light/EntitySystems/MatchboxSystem.cs

27 lines
863 B
C#
Raw Normal View History

using Content.Server.Light.Components;
using Content.Shared.Interaction;
using Content.Shared.Smoking;
namespace Content.Server.Light.EntitySystems
{
public sealed class MatchboxSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<MatchboxComponent, InteractUsingEvent>(OnInteractUsing);
}
private void OnInteractUsing(EntityUid uid, MatchboxComponent component, InteractUsingEvent args)
{
if (!args.Handled
2021-12-08 19:39:03 +01:00
&& EntityManager.TryGetComponent<MatchstickComponent?>(args.Used, out var matchstick)
&& matchstick.CurrentState == SmokableState.Unlit)
{
Get<MatchstickSystem>().Ignite(matchstick, args.User);
args.Handled = true;
}
}
}
}