Github Issues Addressed

**GROUP**
#1354
**ARTY v1.1.8**
#1356
#1357
This commit is contained in:
Frank 2020-10-20 23:26:32 +02:00
parent aa4f8452fa
commit 1312555690
2 changed files with 45 additions and 19 deletions

View File

@ -693,7 +693,7 @@ ARTY.db={
--- Arty script version.
-- @field #string version
ARTY.version="1.1.7"
ARTY.version="1.1.8"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -2770,7 +2770,7 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
-- FSM state.
local fsmstate=self:GetState()
self:I(self.lid..string.format("Status %s, Ammo total=%d: shells=%d [smoke=%d, illu=%d, nukes=%d*%.3f kT], rockets=%d, missiles=%d", fsmstate, ntot, nshells, self.Nsmoke, self.Nillu, self.Nukes, self.nukewarhead/1000000, nrockets, nmissiles))
self:T(self.lid..string.format("Status %s, Ammo total=%d: shells=%d [smoke=%d, illu=%d, nukes=%d*%.3f kT], rockets=%d, missiles=%d", fsmstate, ntot, nshells, self.Nsmoke, self.Nillu, self.Nukes, self.nukewarhead/1000000, nrockets, nmissiles))
if self.Controllable and self.Controllable:IsAlive() then
@ -4814,7 +4814,8 @@ function ARTY:_CheckShootingStarted()
end
-- Check if we waited long enough and no shot was fired.
if dt > self.WaitForShotTime and self.Nshots==0 then
--if dt > self.WaitForShotTime and self.Nshots==0 then
if dt > self.WaitForShotTime and (self.Nshots==0 or self.currentTarget.nshells >= self.Nshots) then --https://github.com/FlightControl-Master/MOOSE/issues/1356
-- Debug info.
self:T(self.lid..string.format("%s, no shot event after %d seconds. Removing current target %s from list.", self.groupname, self.WaitForShotTime, name))

View File

@ -2202,27 +2202,52 @@ function GROUP:IsAirborne(AllUnits)
if units then
for _,_unit in pairs(units) do
local unit=_unit --Wrapper.Unit#UNIT
if unit then
-- Unit in air or not.
local inair=unit:InAir()
if AllUnits then
--- We want to know if ALL units are airborne.
for _,_unit in pairs(units) do
local unit=_unit --Wrapper.Unit#UNIT
-- Unit is not in air and we wanted to know whether ALL units are ==> return false
if inair==false and AllUnits==true then
return false
end
if unit then
-- At least one unit is in are and we did not care which one.
if inair==true and not AllUnits then
return true
-- Unit in air or not.
local inair=unit:InAir()
-- At least one unit is not in air.
if not inair then
return false
end
end
end
-- At least one unit is in the air.
return true
-- All units are in air.
return true
else
--- We want to know if ANY unit is airborne.
for _,_unit in pairs(units) do
local unit=_unit --Wrapper.Unit#UNIT
if unit then
-- Unit in air or not.
local inair=unit:InAir()
if inair then
-- At least one unit is in air.
return true
end
end
-- No unit is in air.
return false
end
end
end