2021-08-18 23:17:47 +02:00
|
|
|
using Content.Server.Light.Components;
|
|
|
|
|
using Content.Shared.Interaction;
|
|
|
|
|
using Content.Shared.Smoking;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Light.EntitySystems
|
|
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class MatchboxSystem : EntitySystem
|
2021-08-18 23:17:47 +02:00
|
|
|
{
|
|
|
|
|
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)
|
2021-09-26 15:19:00 +02:00
|
|
|
&& matchstick.CurrentState == SmokableState.Unlit)
|
2021-08-18 23:17:47 +02:00
|
|
|
{
|
|
|
|
|
Get<MatchstickSystem>().Ignite(matchstick, args.User);
|
|
|
|
|
args.Handled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|