Push horn (#36009)
* Empty commit * epic super duper cool fr push horn draft * whoops turns out theres a system that does that thingi already x.x * bunch of like fixis and generalization * general progress * most stuffies done * last thingi hopefully * small fixies, mostly preventing bypassing the delay by spamming * rename to fit better * rename for real i forgor to add * weird fixie but last commit didn workie * oki shold be fine now * lastish cleanup * fixies * missed a space * removed unnecessary component check * getting the typos out of the way first * moved the component to shared * rest of fixies
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using Content.Shared.Explosion.Components.OnTrigger;
|
||||
using Content.Shared.Explosion.EntitySystems;
|
||||
using Content.Shared.RepulseAttract;
|
||||
using Content.Shared.Timing;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems;
|
||||
|
||||
public sealed class RepulseAttractOnTriggerSystem : SharedRepulseAttractOnTriggerSystem
|
||||
{
|
||||
[Dependency] private readonly RepulseAttractSystem _repulse = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly UseDelaySystem _delay = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SharedRepulseAttractOnTriggerComponent, TriggerEvent>(OnTrigger);
|
||||
}
|
||||
|
||||
private void OnTrigger(Entity<SharedRepulseAttractOnTriggerComponent> ent, ref TriggerEvent args)
|
||||
{
|
||||
if (_delay.IsDelayed(ent.Owner))
|
||||
return;
|
||||
|
||||
var position = _transform.GetMapCoordinates(ent);
|
||||
_repulse.TryRepulseAttract(position, args.User, ent.Comp.Speed, ent.Comp.Range, ent.Comp.Whitelist, ent.Comp.CollisionMask);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user