Kick mines (real) (#8056)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Pieter-Jan Briers
2022-05-18 06:07:35 +02:00
committed by GitHub
parent 2f604ce05c
commit ebfe5e888f
29 changed files with 635 additions and 220 deletions

View 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);
}
}