Ejemplo n.º 1
0
    bool HasTarget() {
        mc::core::PlayerPtr targetPlayer = m_Client->GetPlayerManager()->GetPlayerByName(TargetPlayer);
        if (!targetPlayer) return false;

        mc::entity::EntityPtr entity = targetPlayer->GetEntity();
        return entity != nullptr;
    }
Ejemplo n.º 2
0
    void Act() override {
        mc::core::PlayerPtr targetPlayer = m_Client->GetPlayerManager()->GetPlayerByName(TargetPlayer);
        auto entity = targetPlayer->GetEntity();

        auto targeting = GetActorComponent(m_Client, TargetingComponent);
        if (!targeting) return;

        targeting->SetTargetEntity(entity->GetEntityId());
        targeting->SetTarget(mc::ToVector3i(entity->GetPosition()));
    }
Ejemplo n.º 3
0
    void Act() override {
        mc::core::PlayerPtr targetPlayer = m_Client->GetPlayerManager()->GetPlayerByName(TargetPlayer);
        auto entity = targetPlayer->GetEntity();
        auto physics = GetActorComponent(m_Client, PhysicsComponent);
        auto targeting = GetActorComponent(m_Client, TargetingComponent);

        ai::FaceSteering align(m_Client, entity->GetPosition(), 0.1, 1, 1);

        physics->ApplyRotation(align.GetSteering().rotation);
        //physics->ClearHorizontalVelocity();
        Vector3d entityHeading = util::OrientationToVector(entity->GetYaw());

        Vector3d target = entity->GetPosition() - entityHeading * 2;
        targeting->SetTarget(ToVector3i(target));

        s64 time = util::GetTime();

        if (time >= m_LastAttack + m_AttackCooldown) {
            Attack(entity);

            m_LastAttack = time;
        }
    }