Skip to content

Commit

Permalink
add GetRadLevel check for cells
Browse files Browse the repository at this point in the history
  • Loading branch information
Coronia committed Feb 26, 2025
1 parent af5f6b6 commit c01aa7b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Ext/RadSite/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ DEFINE_HOOK(0x5213B4, InfantryClass_AIDeployment_CheckRad, 0x7)
GET(InfantryClass*, pInf, ESI);
GET(int, weaponRadLevel, EBX);

if (!pInf->GetCell()->GetRadLevel())
return FireCheck;

auto const pWeapon = pInf->GetDeployWeapon()->WeaponType;
int radLevel = 0;

Expand All @@ -84,8 +87,7 @@ DEFINE_HOOK(0x5213B4, InfantryClass_AIDeployment_CheckRad, 0x7)

}

return (!radLevel || (radLevel < weaponRadLevel / 3)) ?
FireCheck : SetMissionRate;
return (radLevel < weaponRadLevel / 3) ? FireCheck : SetMissionRate;
}

// Fix for desolator unable to fire his deploy weapon when cloaked
Expand Down Expand Up @@ -137,6 +139,9 @@ DEFINE_HOOK(0x43FB23, BuildingClass_AI_Radiation, 0x5)
{
CellStruct nCurrentCoord = buildingCoords + *pFoundation;

if (!MapClass::Instance->GetCellAt(nCurrentCoord)->GetRadLevel())
continue;

for (auto const pRadSite : *RadSiteClass::Array)
{
auto const pRadExt = RadSiteExt::ExtMap.Find(pRadSite);
Expand Down Expand Up @@ -191,7 +196,7 @@ DEFINE_HOOK(0x4DA59F, FootClass_AI_Radiation, 0x5)

GET(FootClass* const, pFoot, ESI);

if (pFoot->IsInPlayfield && !pFoot->TemporalTargetingMe &&
if (pFoot->IsInPlayfield && !pFoot->TemporalTargetingMe && pFoot->GetCell()->GetRadLevel() &&
(!RulesExt::Global()->UseGlobalRadApplicationDelay || Unsorted::CurrentFrame % RulesClass::Instance->RadApplicationDelay == 0))
{
CellStruct CurrentCoord = pFoot->GetCell()->MapCoords;
Expand Down

0 comments on commit c01aa7b

Please sign in to comment.