Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ext/Server/Bot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions ext/Server/Bot/VehicleAttacking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down