void CinematicTrigger::RemoveBadAI() { HOBJECT hObj = g_pLTServer->GetNextObject(LTNULL); HCLASS hClass = g_pLTServer->GetClass("CAI"); // Remove all the ai objects... LTBOOL bRemove = LTFALSE; HOBJECT hRemoveObj = LTNULL; while (hObj) { if (g_pLTServer->IsKindOf(g_pLTServer->GetObjectClass(hObj), hClass)) { hRemoveObj = hObj; } hObj = g_pLTServer->GetNextObject(hObj); if (hRemoveObj) { CCharacter* pChar = (CCharacter*) g_pLTServer->HandleToObject(hRemoveObj); if (pChar && pChar->GetCharacterClass() == BAD) { SendTriggerMsgToObject(this, pChar->m_hObject, LTFALSE, "REMOVE"); } hRemoveObj = LTNULL; } } hObj = g_pLTServer->GetNextInactiveObject(LTNULL); hRemoveObj = LTNULL; while (hObj) { if (g_pLTServer->IsKindOf(g_pLTServer->GetObjectClass(hObj), hClass)) { hRemoveObj = hObj; } hObj = g_pLTServer->GetNextInactiveObject(hObj); if (hRemoveObj) { CCharacter* pChar = (CCharacter*) g_pLTServer->HandleToObject(hRemoveObj); if (pChar && pChar->GetCharacterClass() == BAD) { SendTriggerMsgToObject(this, pChar->m_hObject, LTFALSE, "REMOVE"); } hRemoveObj = LTNULL; } } }
LTBOOL DoVectorFilterFn(HOBJECT hObj, void *pUserData) { // We're not attacking our self... if (SpecificObjectFilterFn(hObj, pUserData)) { // CharacterHitBox objects are used for vector impacts, don't // impact on the character/body prop object itself.... if (IsCharacter(hObj) || IsBody(hObj) || IsKindOf(hObj, "Intelligence")) { return LTFALSE; } // Check special character hit box cases... if (IsCharacterHitBox(hObj)) { CCharacterHitBox *pCharHitBox = (CCharacterHitBox*) g_pLTServer->HandleToObject(hObj); if (pCharHitBox) { // Make sure we don't hit ourself... HOBJECT hUs = (HOBJECT)pUserData; HOBJECT hTestObj = pCharHitBox->GetModelObject(); if (!hTestObj) return LTFALSE; if (hTestObj == hUs) { return LTFALSE; } // Do special AI hitting AI case... if (IsAI(hUs) && IsAI(hTestObj)) { CAI *pAI = (CAI*) g_pLTServer->HandleToObject(hUs); if (!pAI) return LTFALSE; // We can't hit guys we like, unless they're NEUTRAL CCharacter* pB = (CCharacter*)g_pLTServer->HandleToObject(hTestObj); if (!pB) return LTFALSE; CharacterClass cc = pB->GetCharacterClass(); if (cc != NEUTRAL) { return LIKE != GetAlignement(pAI->GetCharacterClass(), cc); } } // Check for friendly fire if (g_pGameServerShell->GetGameType() == COOPERATIVE_ASSAULT && g_vtNetFriendlyFire.GetFloat() < 1.0f) { // We can't hit guys on our team unless friendly fire is turned on if (IsPlayer(hUs) && IsPlayer(hTestObj)) { CPlayerObj* pUs = (CPlayerObj*) g_pLTServer->HandleToObject(hUs); if (!pUs) return LTFALSE; CPlayerObj* pThem = (CPlayerObj*) g_pLTServer->HandleToObject(hTestObj); if (!pThem) return LTFALSE; if (pUs->GetTeamID() == pThem->GetTeamID()) return LTFALSE; } } } } return LTTRUE; } return LTFALSE; }