Skip to content

Get Aimed Actors

Pavle edited this page Mar 5, 2021 · 1 revision
static ZActorManager* actorManager = reinterpret_cast<ZActorManager*>(Globals::g_pActorManagerSingleton);
static ZLevelManager* levelManager = reinterpret_cast<ZLevelManager*>(Globals::g_pLevelManagerSingleton);

if (!actorManager)
{
    return;
}

ZHitman5* player = levelManager->m_rHitman.m_pInterfaceRef;
ZActor* actor = nullptr;
bool isActorAimed = false;

if (!player)
{
    return;
}

if (player->IsAiming())
{
    for (unsigned int i = 0; i < actorManager->m_aliveActors.Size(); i++)
    {
        actor = actorManager->m_aliveActors[i]->m_pInterfaceRef;
        ZKnowledge* knowledge = actor->Knowledge();
        SSharedEntityKnowledge* sharedEntityKnowledge = knowledge->m_pSelfKnown.m_pObject->m_pSharedKnowledge.m_pSharedEntityKnowledge;

        if (sharedEntityKnowledge && sharedEntityKnowledge->IsCurrent(AISET_BeingAimedAt))
        {
            isActorAimed = true;
            break;
        }
    }
}
Clone this wiki locally