Makes Match[sticks/box] ECS, Makes Matchsticks ignite plasma

This commit is contained in:
Paul
2021-08-18 23:17:47 +02:00
parent fb4d7be08e
commit b651ee93d0
4 changed files with 137 additions and 86 deletions

View File

@@ -0,0 +1,27 @@
using Content.Server.Light.Components;
using Content.Shared.Interaction;
using Content.Shared.Smoking;
using Robust.Shared.GameObjects;
namespace Content.Server.Light.EntitySystems
{
public 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
&& args.Used.TryGetComponent<MatchstickComponent>(out var matchstick)
&& matchstick.CurrentState == SharedBurningStates.Unlit)
{
Get<MatchstickSystem>().Ignite(matchstick, args.User);
args.Handled = true;
}
}
}
}