Inheritance: EntityTargetActionEvent
Beispiel #1
0
    private void OnSmiteSpell(SmiteSpellEvent ev)
    {
        if (ev.Handled)
        {
            return;
        }

        if (!TryComp <BodyComponent>(ev.Target, out var body))
        {
            return;
        }

        var ents = body.Gib(true);

        if (!ev.DeleteNonBrainParts)
        {
            return;
        }

        foreach (var part in ents)
        {
            // just leaves a brain and clothes
            if ((HasComp <BodyPartComponent>(part) || HasComp <MechanismComponent>(part)) &&
                !HasComp <BrainComponent>(part))
            {
                QueueDel(part);
            }
        }
    }
    private void OnSmiteSpell(SmiteSpellEvent ev)
    {
        if (ev.Handled)
        {
            return;
        }

        var direction     = Transform(ev.Target).MapPosition.Position - Transform(ev.Performer).MapPosition.Position;
        var impulseVector = direction * 10000;

        Comp <PhysicsComponent>(ev.Target).ApplyLinearImpulse(impulseVector);

        if (!TryComp <BodyComponent>(ev.Target, out var body))
        {
            return;
        }

        var ents = body.Gib(true);

        if (!ev.DeleteNonBrainParts)
        {
            return;
        }

        foreach (var part in ents)
        {
            // just leaves a brain and clothes
            if ((HasComp <BodyPartComponent>(part) || HasComp <MechanismComponent>(part)) &&
                !HasComp <BrainComponent>(part))
            {
                QueueDel(part);
            }
        }
    }