Migrate features from +AI

Possibly wear gasmask if soldier sees tear or mustard gas
This commit is contained in:
Asdow
2026-01-23 16:47:34 +02:00
parent 9c0fb0b6da
commit 91a1059f87
3 changed files with 70 additions and 0 deletions
+14
View File
@@ -1,3 +1,4 @@
//#pragma optimize("", off)
#include "ai.h"
#include "AIInternals.h"
#include "Isometric Utils.h"
@@ -10730,6 +10731,19 @@ INT8 DecideActionWearGasmask(SOLDIERTYPE *pSoldier)
//Only put mask on in gas
if (bInGas && WearGasMaskIfAvailable(pSoldier)) { bInGas = InGasOrSmoke(pSoldier, pSoldier->sGridNo); }
// Chance to wear gas mask if soldier sees gas nearby
INT32 sSmokeSpot = NOWHERE;
INT8 bSmokeLevel = 0;
if ( SoldierAI(pSoldier) &&
pSoldier->CheckInitialAP() &&
!DoesSoldierWearGasMask(pSoldier) &&
FindClosestVisibleSmoke(pSoldier, sSmokeSpot, bSmokeLevel, TRUE) &&
Chance(30 + SoldierDifficultyLevel(pSoldier) * 10) )
{
WearGasMaskIfAvailable(pSoldier);
}
return bInGas;
}