bool PoweredUnitClass::PowerDown() { auto const pTechno = this->Techno; if(EMPulse::IsDeactivationAdvisable(pTechno)) { // destroy if EMP.Threshold would crash this unit when in air auto const pType = pTechno->GetTechnoType(); auto const pExt = TechnoTypeExt::ExtMap.Find(pType); if(EMPulse::EnableEMPEffect2(pTechno) || (pExt->EMP_Threshold && pTechno->IsInAir())) { return false; } } return true; }
#include "Body.h" #include "../Rules/Body.h" #include "../TechnoType/Body.h" #include <FlyLocomotionClass.h> #include <InfantryClass.h> #include <UnitClass.h> #include <YRMath.h> DEFINE_HOOK(4CCB84, FlyLocomotionClass_ILocomotion_Process_HunterSeeker, 6) { GET(ILocomotion*, pThis, ESI); auto pLoco = static_cast<FlyLocomotionClass*>(pThis); auto pObject = pLoco->LinkedTo; auto pType = pObject->GetTechnoType(); if(pType->HunterSeeker) { if(!pObject->Target) { pLoco->Acquire_Hunter_Seeker_Target(); if(pObject->Target) { pLoco->IsLanding = false; pLoco->FlightLevel = pType->GetFlightLevel(); pObject->SendToFirstLink(rc_Exit); pObject->QueueMission(mission_Attack, false); pObject->NextMission(); } } }