Wizard: Repulse Spell (#35377)
This commit is contained in:
@@ -7,6 +7,7 @@ using Content.Shared.Wieldable;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using System.Numerics;
|
||||
using Content.Shared.RepulseAttract.Events;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
|
||||
namespace Content.Shared.RepulseAttract;
|
||||
@@ -28,7 +29,9 @@ public sealed class RepulseAttractSystem : EntitySystem
|
||||
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
||||
|
||||
SubscribeLocalEvent<RepulseAttractComponent, MeleeHitEvent>(OnMeleeAttempt, before: [typeof(UseDelayOnMeleeHitSystem)], after: [typeof(SharedWieldableSystem)]);
|
||||
SubscribeLocalEvent<RepulseAttractComponent, RepulseAttractActionEvent>(OnRepulseAttractAction);
|
||||
}
|
||||
|
||||
private void OnMeleeAttempt(Entity<RepulseAttractComponent> ent, ref MeleeHitEvent args)
|
||||
{
|
||||
if (_delay.IsDelayed(ent.Owner))
|
||||
@@ -37,6 +40,15 @@ public sealed class RepulseAttractSystem : EntitySystem
|
||||
TryRepulseAttract(ent, args.User);
|
||||
}
|
||||
|
||||
private void OnRepulseAttractAction(Entity<RepulseAttractComponent> ent, ref RepulseAttractActionEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
var position = _xForm.GetMapCoordinates(args.Performer);
|
||||
args.Handled = TryRepulseAttract(position, args.Performer, ent.Comp.Speed, ent.Comp.Range, ent.Comp.Whitelist, ent.Comp.CollisionMask);
|
||||
}
|
||||
|
||||
public bool TryRepulseAttract(Entity<RepulseAttractComponent> ent, EntityUid user)
|
||||
{
|
||||
var position = _xForm.GetMapCoordinates(ent.Owner);
|
||||
|
||||
Reference in New Issue
Block a user