Kick mines (real) (#8056)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
committed by
GitHub
parent
2f604ce05c
commit
ebfe5e888f
40
Content.Server/LandMines/LandMineSystem.cs
Normal file
40
Content.Server/LandMines/LandMineSystem.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.StepTrigger;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.LandMines;
|
||||
|
||||
public sealed class LandMineSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly TriggerSystem _trigger = default!;
|
||||
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<LandMineComponent, StepTriggeredEvent>(HandleTriggered);
|
||||
SubscribeLocalEvent<LandMineComponent, StepTriggerAttemptEvent>(HandleTriggerAttempt);
|
||||
}
|
||||
|
||||
private static void HandleTriggerAttempt(
|
||||
EntityUid uid,
|
||||
LandMineComponent component,
|
||||
ref StepTriggerAttemptEvent args)
|
||||
{
|
||||
args.Continue = true;
|
||||
}
|
||||
|
||||
private void HandleTriggered(EntityUid uid, LandMineComponent component, ref StepTriggeredEvent args)
|
||||
{
|
||||
_popupSystem.PopupCoordinates(
|
||||
Loc.GetString("land-mine-triggered", ("mine", uid)),
|
||||
Transform(uid).Coordinates,
|
||||
Filter.Entities(args.Tripper));
|
||||
|
||||
_trigger.Trigger(uid, args.Tripper);
|
||||
|
||||
QueueDel(uid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user