From 4d70a0e9df22fb4b06339d86b519ba7564ed76bc Mon Sep 17 00:00:00 2001 From: Tagener Noisu Date: Thu, 27 Jul 2023 17:47:40 +0600 Subject: [PATCH] Use TOW in IFVs --- ext/Server/Bot.lua | 2 ++ ext/Server/Bot/VehicleAttacking.lua | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/ext/Server/Bot.lua b/ext/Server/Bot.lua index 0dabd52e..c5e4f0cd 100644 --- a/ext/Server/Bot.lua +++ b/ext/Server/Bot.lua @@ -76,6 +76,7 @@ function Bot:__init(p_Player) self._ObstacleSequenceTimer = 0.0 self._StuckTimer = 0.0 self._ShotTimer = 0.0 + self._VehicleSecondaryWeaponTimer = 0.0 self._ShootModeTimer = 0.0 self._ReloadTimer = 0.0 self._DeployTimer = 0.0 @@ -1050,6 +1051,7 @@ function Bot:ResetSpawnVars() end self._ShotTimer = 0.0 + self._VehicleSecondaryWeaponTimer = 0.0 self._UpdateTimer = 0.0 self._StuckTimer = 0.0 self._SpawnProtectionTimer = 2.0 diff --git a/ext/Server/Bot/VehicleAttacking.lua b/ext/Server/Bot/VehicleAttacking.lua index b47fab7b..430d866b 100644 --- a/ext/Server/Bot/VehicleAttacking.lua +++ b/ext/Server/Bot/VehicleAttacking.lua @@ -65,6 +65,25 @@ function VehicleAttacking:UpdateAttackingVehicle(p_Bot) else p_Bot._VehicleWeaponSlotToUse = 2 end + elseif m_Vehicles:IsVehicleType(p_Bot.m_ActiveVehicle, VehicleTypes.IFV) then + if p_Bot.m_Player.controlledEntryId == 0 and + (p_Bot._ShootPlayerVehicleType == VehicleTypes.Tank + or p_Bot._ShootPlayerVehicleType == VehicleTypes.MobileArtillery + or p_Bot._ShootPlayerVehicleType == VehicleTypes.AntiAir + or p_Bot._ShootPlayerVehicleType == VehicleTypes.IFV) + then + if p_Bot._VehicleSecondaryWeaponTimer == 0 then + p_Bot._VehicleSecondaryWeaponTimer = 12.0 + end + + if p_Bot._VehicleSecondaryWeaponTimer >= 8.0 then + p_Bot._VehicleWeaponSlotToUse = 2 + else + p_Bot._VehicleWeaponSlotToUse = 1 + end + else + p_Bot._VehicleWeaponSlotToUse = 1 + end else p_Bot._VehicleWeaponSlotToUse = 1 end @@ -128,6 +147,8 @@ function VehicleAttacking:UpdateAttackingVehicle(p_Bot) elseif p_Bot._ShootPlayer.soldier == nil then -- Reset if enemy is dead. p_Bot:AbortAttack() end + + p_Bot._VehicleSecondaryWeaponTimer = math.max(p_Bot._VehicleSecondaryWeaponTimer - Registry.BOT.BOT_UPDATE_CYCLE, 0) end function VehicleAttacking:UpdateAttackStationaryAAVehicle(p_Bot)