mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
OPS (#1723)
**INTEL** - Added nil check for cluster position update **OPSGROUP** - Improved fire at point task to take only max avail shots and relative shot amount - Fixed tasks not executed after teleport
This commit is contained in:
@@ -4144,8 +4144,18 @@ function OPSGROUP:onafterTaskExecute(From, Event, To, Task)
|
||||
-- Debug info.
|
||||
self:T(self.lid..string.format("Fire at point with nshots=%d of %d", nShots, nAmmo))
|
||||
|
||||
-- Only fire number of avail shots.
|
||||
nShots=math.min(nShots, nAmmo)
|
||||
if nShots==-1 then
|
||||
-- The -1 is for using all available ammo.
|
||||
nShots=nAmmo
|
||||
self:T(self.lid..string.format("Fire at point taking max amount of ammo = %d", nShots))
|
||||
elseif nShots<1 then
|
||||
local p=nShots
|
||||
nShots=UTILS.Round(p*nAmmo, 0)
|
||||
self:T(self.lid..string.format("Fire at point taking %.1f percent amount of ammo = %d", p, nShots))
|
||||
else
|
||||
-- Fire nShots but at most nAmmo.
|
||||
nShots=math.min(nShots, nAmmo)
|
||||
end
|
||||
|
||||
-- Set quantity of task.
|
||||
DCSTask.params.expendQty=nShots
|
||||
|
||||
Reference in New Issue
Block a user