Files
crystall-punk-14/Content.Shared/_CP14/MagicSpell/Spells/CP14SpellThrowFromUser.cs
Ed b5eb3a3dc1 Kick stamina spell (#844)
* kick spell

* kick fix
2025-02-06 12:38:20 +03:00

32 lines
995 B
C#

using Content.Shared.Throwing;
namespace Content.Shared._CP14.MagicSpell.Spells;
public sealed partial class CP14SpellThrowFromUser : CP14SpellEffect
{
[DataField]
public float ThrowPower = 10f;
public override void Effect(EntityManager entManager, CP14SpellEffectBaseArgs args)
{
if (args.Target is null)
return;
var targetEntity = args.Target.Value;
var throwing = entManager.System<ThrowingSystem>();
var xfom = entManager.System<SharedTransformSystem>();
if (!entManager.TryGetComponent<TransformComponent>(args.User, out var userTransform))
return;
if (!entManager.TryGetComponent<TransformComponent>(targetEntity, out var targetTransform))
return;
var worldPos = xfom.GetWorldPosition(args.User.Value);
var foo = xfom.GetWorldPosition(args.Target.Value) - worldPos;
throwing.TryThrow(targetEntity, foo * 2.5f, ThrowPower, args.User, doSpin: true);
}
}