From 9b699ba37404204b0b3af743702d33385c393b1e Mon Sep 17 00:00:00 2001 From: Applevangelist <72444570+Applevangelist@users.noreply.github.com> Date: Tue, 10 May 2022 10:11:25 +0200 Subject: [PATCH 1/6] Update AI_Air.lua --- Moose Development/Moose/AI/AI_Air.lua | 40 +++++++++++++++++++-------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/Moose Development/Moose/AI/AI_Air.lua b/Moose Development/Moose/AI/AI_Air.lua index 42628e004..62c1f4a00 100644 --- a/Moose Development/Moose/AI/AI_Air.lua +++ b/Moose Development/Moose/AI/AI_Air.lua @@ -253,6 +253,9 @@ function AI_AIR:New( AIGroup ) self.IdleCount = 0 + self.RTBSpeedMaxFactor = 0.6 + self.RTBSpeedMinFactor = 0.5 + return self end @@ -370,11 +373,11 @@ end --- When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base. --- Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. --- When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_AIR. +-- Therefore, with a parameter and a calculation of the distance to the home base, the fuel threshold is calculated. +-- When the fuel threshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_AIR. -- Once the time is finished, the old AI will return to the base. -- @param #AI_AIR self --- @param #number FuelThresholdPercentage The treshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel. +-- @param #number FuelThresholdPercentage The threshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel. -- @param #number OutOfFuelOrbitTime The amount of seconds the out of fuel AIControllable will orbit before returning to the base. -- @return #AI_AIR self function AI_AIR:SetFuelThreshold( FuelThresholdPercentage, OutOfFuelOrbitTime ) @@ -387,14 +390,14 @@ function AI_AIR:SetFuelThreshold( FuelThresholdPercentage, OutOfFuelOrbitTime ) return self end ---- When the AI is damaged beyond a certain treshold, it is required that the AI returns to the home base. +--- When the AI is damaged beyond a certain threshold, it is required that the AI returns to the home base. -- However, damage cannot be foreseen early on. --- Therefore, when the damage treshold is reached, +-- Therefore, when the damage threshold is reached, -- the AI will return immediately to the home base (RTB). -- Note that for groups, the average damage of the complete group will be calculated. --- So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage treshold will be 0.25. +-- So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage threshold will be 0.25. -- @param #AI_AIR self --- @param #number PatrolDamageThreshold The treshold in percentage (between 0 and 1) when the AI is considered to be damaged. +-- @param #number PatrolDamageThreshold The threshold in percentage (between 0 and 1) when the AI is considered to be damaged. -- @return #AI_AIR self function AI_AIR:SetDamageThreshold( PatrolDamageThreshold ) @@ -476,7 +479,7 @@ function AI_AIR:onafterStatus() local Fuel = self.Controllable:GetFuelMin() - -- If the fuel in the controllable is below the treshold percentage, + -- If the fuel in the controllable is below the threshold percentage, -- then send for refuel in case of a tanker, otherwise RTB. if Fuel < self.FuelThresholdPercentage then @@ -576,6 +579,19 @@ function AI_AIR.RTBHold( AIGroup, Fsm ) end +--- Set the min and max factors on RTB speed. Use this, if your planes are heading back to base too fast. Default values are 0.5 and 0.6. +-- The RTB speed is calculated as the max speed of the unit multiplied by MinFactor (lower bracket) and multiplied by MaxFactor (upper bracket). +-- A random value in this bracket is then applied in the waypoint routing generation. +-- @param #AI_AIR self +-- @param #number MinFactor Lower bracket factor. Defaults to 0.5. +-- @param #number MaxFactor Upper bracket factor. Defaults to 0.6. +-- @return #AI_AIR self +function AI_AIR:SetRTBSpeedFactors(MinFactor,MaxFactor) + self.RTBSpeedMaxFactor = MaxFactor or 0.6 + self.RTBSpeedMinFactor = MinFactor or 0.5 + return self +end + --- @param #AI_AIR self -- @param Wrapper.Group#GROUP AIGroup @@ -591,7 +607,7 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To ) --AIGroup:ClearTasks() AIGroup:OptionProhibitAfterburner(true) - + local EngageRoute = {} --- Calculate the target route point. @@ -599,12 +615,14 @@ function AI_AIR:onafterRTB( AIGroup, From, Event, To ) local FromCoord = AIGroup:GetCoordinate() local ToTargetCoord = self.HomeAirbase:GetCoordinate() -- coordinate is on land height(!) local ToTargetVec3 = ToTargetCoord:GetVec3() - ToTargetVec3.y = ToTargetCoord:GetLandHeight()+1000 -- let's set this 1000m/3000 feet above ground + ToTargetVec3.y = ToTargetCoord:GetLandHeight()+3000 -- let's set this 1000m/3000 feet above ground local ToTargetCoord2 = COORDINATE:NewFromVec3( ToTargetVec3 ) if not self.RTBMinSpeed or not self.RTBMaxSpeed then local RTBSpeedMax = AIGroup:GetSpeedMax() - self:SetRTBSpeed( RTBSpeedMax * 0.5, RTBSpeedMax * 0.6 ) + local RTBSpeedMaxFactor = self.RTBSpeedMaxFactor or 0.6 + local RTBSpeedMinFactor = self.RTBSpeedMinFactor or 0.5 + self:SetRTBSpeed( RTBSpeedMax * RTBSpeedMinFactor, RTBSpeedMax * RTBSpeedMaxFactor) end local RTBSpeed = math.random( self.RTBMinSpeed, self.RTBMaxSpeed ) From b094c2d78f0cd6ce63540831571befc156970d35 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 10 May 2022 16:17:46 +0200 Subject: [PATCH 2/6] Correct link to demo missions --- Moose Development/Moose/AI/AI_Balancer.lua | 2 +- Moose Development/Moose/AI/AI_CAP.lua | 2 +- Moose Development/Moose/AI/AI_CAS.lua | 2 +- Moose Development/Moose/AI/AI_Patrol.lua | 2 +- Moose Development/Moose/Core/Scheduler.lua | 2 +- Moose Development/Moose/Core/Spawn.lua | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/AI/AI_Balancer.lua b/Moose Development/Moose/AI/AI_Balancer.lua index 9c3be56e7..b855acf9c 100644 --- a/Moose Development/Moose/AI/AI_Balancer.lua +++ b/Moose Development/Moose/AI/AI_Balancer.lua @@ -9,7 +9,7 @@ -- -- === -- --- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/AIB%20-%20AI%20Balancing) +-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/AIB%20-%20AI%20Balancing) -- -- === -- diff --git a/Moose Development/Moose/AI/AI_CAP.lua b/Moose Development/Moose/AI/AI_CAP.lua index 40f6caefa..a42516617 100644 --- a/Moose Development/Moose/AI/AI_CAP.lua +++ b/Moose Development/Moose/AI/AI_CAP.lua @@ -10,7 +10,7 @@ -- -- === -- --- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/CAP%20-%20Combat%20Air%20Patrol) +-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAP%20-%20Combat%20Air%20Patrol) -- -- === -- diff --git a/Moose Development/Moose/AI/AI_CAS.lua b/Moose Development/Moose/AI/AI_CAS.lua index ae85b0e04..f94fb0722 100644 --- a/Moose Development/Moose/AI/AI_CAS.lua +++ b/Moose Development/Moose/AI/AI_CAS.lua @@ -11,7 +11,7 @@ -- -- === -- --- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/CAS%20-%20Close%20Air%20Support) +-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/CAS%20-%20Close%20Air%20Support) -- -- === -- diff --git a/Moose Development/Moose/AI/AI_Patrol.lua b/Moose Development/Moose/AI/AI_Patrol.lua index 71ee7663f..726385f53 100644 --- a/Moose Development/Moose/AI/AI_Patrol.lua +++ b/Moose Development/Moose/AI/AI_Patrol.lua @@ -16,7 +16,7 @@ -- -- === -- --- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/PAT%20-%20Patrolling) +-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/PAT%20-%20Patrolling) -- -- === -- diff --git a/Moose Development/Moose/Core/Scheduler.lua b/Moose Development/Moose/Core/Scheduler.lua index ee0950f22..d9d18896c 100644 --- a/Moose Development/Moose/Core/Scheduler.lua +++ b/Moose Development/Moose/Core/Scheduler.lua @@ -14,7 +14,7 @@ -- -- # Demo Missions -- --- ### [SCHEDULER Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/SCH%20-%20Scheduler) +-- ### [SCHEDULER Demo Missions source code](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler) -- -- ### [SCHEDULER Demo Missions, only for beta testers](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler) -- diff --git a/Moose Development/Moose/Core/Spawn.lua b/Moose Development/Moose/Core/Spawn.lua index 9bea14623..175e972cb 100644 --- a/Moose Development/Moose/Core/Spawn.lua +++ b/Moose Development/Moose/Core/Spawn.lua @@ -30,7 +30,7 @@ -- -- === -- --- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/SPA%20-%20Spawning) +-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SPA%20-%20Spawning) -- -- === -- From 3d919cd937e71b5a536136f13abf118e6a0ca9c6 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 10 May 2022 19:40:44 +0200 Subject: [PATCH 3/6] AIRBASE - corrected ["Deir_ez_Zor"] = "Deir ez-Zor" (minus doesn't work in enum) --- Moose Development/Moose/Wrapper/Airbase.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index 84ee9cf83..04b474db9 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -399,6 +399,7 @@ AIRBASE.TheChannel = { -- * AIRBASE.Syria.Ruwayshid -- * AIRBASE.Syria.Sanliurfa -- * AIRBASE.Syria.Tal_Siman +-- * AIRBASE.Syria.Deir_ez_Zor -- --@field Syria AIRBASE.Syria={ @@ -464,7 +465,7 @@ AIRBASE.Syria={ ["Ruwayshid"]="Ruwayshid", ["Sanliurfa"]="Sanliurfa", ["Tal_Siman"]="Tal Siman", - ["Deir_ez-Zor"] = "Deir ez-Zor", + ["Deir_ez_Zor"] = "Deir ez-Zor", } --- Airbases of the Mariana Islands map: From d8e9997987cfd6fcad16bd471d772bce305cca47 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Wed, 11 May 2022 06:18:48 +0200 Subject: [PATCH 4/6] SRS - actually pass the volume to the command line --- Moose Development/Moose/Sound/SRS.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Sound/SRS.lua b/Moose Development/Moose/Sound/SRS.lua index e3d937a35..57beb40db 100644 --- a/Moose Development/Moose/Sound/SRS.lua +++ b/Moose Development/Moose/Sound/SRS.lua @@ -135,7 +135,7 @@ MSRS = { --- MSRS class version. -- @field #string version -MSRS.version="0.0.5" +MSRS.version="0.0.6" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -718,7 +718,7 @@ function MSRS:_GetCommand(freqs, modus, coal, gender, voice, culture, volume, sp --local command=string.format('start /b "" /d "%s" "%s" -f %s -m %s -c %s -p %s -n "%s" > bla.txt', path, exe, freqs, modus, coal, port, "ROBOT") -- Command. - local command=string.format('"%s\\%s" -f %s -m %s -c %s -p %s -n "%s"', path, exe, freqs, modus, coal, port, label) + local command=string.format('"%s\\%s" -f %s -m %s -c %s -p %s -n "%s" -v %.1f', path, exe, freqs, modus, coal, port, label,volume) -- Set voice or gender/culture. if voice then From dc2e5afe3e31829ce4b57580b38ff7eb80d7a642 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Wed, 11 May 2022 07:30:39 +0200 Subject: [PATCH 5/6] SRS - put volume in "" - just in case --- Moose Development/Moose/Sound/SRS.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Sound/SRS.lua b/Moose Development/Moose/Sound/SRS.lua index 57beb40db..eabaad197 100644 --- a/Moose Development/Moose/Sound/SRS.lua +++ b/Moose Development/Moose/Sound/SRS.lua @@ -718,7 +718,7 @@ function MSRS:_GetCommand(freqs, modus, coal, gender, voice, culture, volume, sp --local command=string.format('start /b "" /d "%s" "%s" -f %s -m %s -c %s -p %s -n "%s" > bla.txt', path, exe, freqs, modus, coal, port, "ROBOT") -- Command. - local command=string.format('"%s\\%s" -f %s -m %s -c %s -p %s -n "%s" -v %.1f', path, exe, freqs, modus, coal, port, label,volume) + local command=string.format('"%s\\%s" -f %s -m %s -c %s -p %s -n "%s" -v "%.1f"', path, exe, freqs, modus, coal, port, label,volume) -- Set voice or gender/culture. if voice then From 64e70d8e9220909f8237b658be3cd267755589eb Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 12 May 2022 10:49:18 +0200 Subject: [PATCH 6/6] OPSGROUP - #1677 - Fixed that damaged is triggered when group is despawned. - Fixed total ammo calculation when group is dead - Fixed assets do not carry out patrol zone after transport --- Moose Development/Moose/Ops/FlightGroup.lua | 6 +++--- Moose Development/Moose/Ops/OpsGroup.lua | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index c3914282f..50f9116fa 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -837,7 +837,7 @@ function FLIGHTGROUP:Status() -- ROE and Alarm State. local roe=self:GetROE() or -1 - local als=self:GetAlarmstate() or -1 + local rot=self:GetROT() or -1 -- Waypoint stuff. local wpidxCurr=self.currentwp @@ -882,8 +882,8 @@ function FLIGHTGROUP:Status() local curr=self.currbase and self.currbase:GetName() or "N/A" -- Info text. - local text=string.format("%s [%d/%d]: ROE/AS=%d/%d | T/M=%d/%d | Wp=%d[%d]-->%d[%d]/%d [%s] | Life=%.1f | v=%.1f (%d) | Hdg=%03d | Ammo=%d | Detect=%s | Cargo=%.1f | Base=%s [%s-->%s]", - fsmstate, nelem, Nelem, roe, als, nTaskTot, nMissions, wpidxCurr, wpuidCurr, wpidxNext, wpuidNext, wpN, wpF, life, speed, speedEx, hdg, ammo, ndetected, cargo, curr, home, dest) + local text=string.format("%s [%d/%d]: ROE/ROT=%d/%d | T/M=%d/%d | Wp=%d[%d]-->%d[%d]/%d [%s] | Life=%.1f | v=%.1f (%d) | Hdg=%03d | Ammo=%d | Detect=%s | Cargo=%.1f | Base=%s [%s-->%s]", + fsmstate, nelem, Nelem, roe, rot, nTaskTot, nMissions, wpidxCurr, wpuidCurr, wpidxNext, wpuidNext, wpN, wpF, life, speed, speedEx, hdg, ammo, ndetected, cargo, curr, home, dest) self:I(self.lid..text) end diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index c2bb3b5b1..e9c282d4c 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -4395,6 +4395,7 @@ function OPSGROUP:onafterTaskDone(From, Event, To, Task) if Task.description=="Task_Land_At" then self:T(self.lid.."Taske DONE Task_Land_At ==> Wait") + self:Cruise() self:Wait(20, 100) else self:T(self.lid.."Task Done but NO mission found ==> _CheckGroupDone in 1 sec") @@ -4790,6 +4791,11 @@ function OPSGROUP:onafterMissionExecute(From, Event, To, Mission) -- Set mission status to EXECUTING. Mission:Executing() + + -- Group is holding but has waypoints ==> Cruise. + if self:IsHolding() and not self:HasPassedFinalWaypoint() then + self:Cruise() + end -- Set auto engage detected targets. if Mission.engagedetectedOn then @@ -9698,6 +9704,8 @@ function OPSGROUP:_CheckDamage() for _,_element in pairs(self.elements) do local element=_element --Ops.OpsGroup#OPSGROUP.Element + if element.status~=OPSGROUP.ElementStatus.DEAD and element.status~=OPSGROUP.ElementStatus.INUTERO then + -- Current life points. local life=element.unit:GetLife() @@ -9708,6 +9716,8 @@ function OPSGROUP:_CheckDamage() self:ElementDamaged(element) damaged=true end + + end end @@ -11845,7 +11855,7 @@ function OPSGROUP:GetAmmoTot() Ammo.MissilesCR=0 Ammo.MissilesSA=0 - for _,_unit in pairs(units) do + for _,_unit in pairs(units or {}) do local unit=_unit --Wrapper.Unit#UNIT if unit and unit:IsAlive()~=nil then