From e2c1097ec57a5ea7783a0a0a863ea46cf8f7e54f Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 3 Oct 2020 21:41:35 +0200 Subject: [PATCH 1/3] Update Airboss.lua - Fix for DCS bug that skill is not set in env.mission. Should not happen in current DCS version anyway. --- Moose Development/Moose/Ops/Airboss.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index b990c6c9c..51b053471 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -14048,10 +14048,10 @@ function AIRBOSS:_GetOnboardNumbers(group, playeronly) -- Onboard number and unit name. local n=tostring(unit.onboard_num) local name=unit.name - local skill=unit.skill + local skill=unit.skill or "Unknown" -- Debug text. - text=text..string.format("\n- unit %s: onboard #=%s skill=%s", name, n, skill) + text=text..string.format("\n- unit %s: onboard #=%s skill=%s", name, n, tostring(skill)) if playeronly and skill=="Client" or skill=="Player" then -- There can be only one player in the group, so we skip everything else. From aa4f8452fa6f73e450781bc032f1e2f94c4dbe19 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 3 Oct 2020 23:11:05 +0200 Subject: [PATCH 2/3] Update Airbase.lua - Fixed a bug inthe `AIRBASE:GetRunwayData()` function. --- Moose Development/Moose/Wrapper/Airbase.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index 4eb391ac8..01e4eeb17 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -1272,8 +1272,7 @@ function AIRBASE:GetRunwayData(magvar, mark) name==AIRBASE.PersianGulf.Abu_Dhabi_International_Airport or name==AIRBASE.PersianGulf.Dubai_Intl or name==AIRBASE.PersianGulf.Shiraz_International_Airport or - name==AIRBASE.PersianGulf.Kish_International_Airport - then + name==AIRBASE.PersianGulf.Kish_International_Airport then -- 1-->4, 2-->3, 3-->2, 4-->1 exception=1 @@ -1290,13 +1289,14 @@ function AIRBASE:GetRunwayData(magvar, mark) end + --- Function returning the index of the runway coordinate belonding to the given index i. local function f(i) local j if exception==1 then - j=N-(i+1) -- 1-->4, 2-->3 + j=N-(i-1) -- 1-->4, 2-->3 elseif exception==2 then @@ -1357,6 +1357,9 @@ function AIRBASE:GetRunwayData(magvar, mark) -- Get the other spawn point coordinate. local j=f(i) + + -- Debug info. + --env.info(string.format("Runway i=%s j=%s (N=%d #runwaycoord=%d)", tostring(i), tostring(j), N, #runwaycoords)) -- Coordinates of the two runway points. local c1=runwaycoords[i] --Core.Point#COORDINATE From 1312555690542861ab883dfe94502b56cca6373c Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 20 Oct 2020 23:26:32 +0200 Subject: [PATCH 3/3] Github Issues Addressed **GROUP** #1354 **ARTY v1.1.8** #1356 #1357 --- .../Moose/Functional/Artillery.lua | 7 ++- Moose Development/Moose/Wrapper/Group.lua | 57 +++++++++++++------ 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/Moose Development/Moose/Functional/Artillery.lua b/Moose Development/Moose/Functional/Artillery.lua index f5233e3b0..8a3d8ebce 100644 --- a/Moose Development/Moose/Functional/Artillery.lua +++ b/Moose Development/Moose/Functional/Artillery.lua @@ -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)) diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 34172a162..9c6c0a79c 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -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