From 056b761ebce6ebe08f41b0c00f83996ab1a35fcd Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Wed, 17 Jan 2024 08:10:01 +0100 Subject: [PATCH 01/14] #PLAYERTASKCONTROLLER * Additions for lasing unit being an ARMYGROUP --- Moose Development/Moose/Ops/PlayerTask.lua | 44 ++++++++++++++-------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index 8ae53f1b1..406563273 100644 --- a/Moose Development/Moose/Ops/PlayerTask.lua +++ b/Moose Development/Moose/Ops/PlayerTask.lua @@ -98,7 +98,7 @@ PLAYERTASK = { --- PLAYERTASK class version. -- @field #string version -PLAYERTASK.version="0.1.23" +PLAYERTASK.version="0.1.24" --- Generic task condition. -- @type PLAYERTASK.Condition @@ -1966,6 +1966,8 @@ end -- Can optionally be handed as Ops.ArmyGroup#ARMYGROUP - **Note** might not find an LOS spot or get lost on the way. Cannot island-hop. -- @param #number LaserCode The lasercode to be used. Defaults to 1688. -- @param Core.Point#COORDINATE HoldingPoint (Optional) Point where the drone should initially circle. If not set, defaults to BullsEye of the coalition. +-- @param #number Alt (Optional) Altitude in feet. Only applies if using a FLIGHTGROUP object! Defaults to 10000. +-- @param #number Speed (Optional) Speed in knots. Only applies if using a FLIGHTGROUP object! Defaults to 120. -- @return #PLAYERTASKCONTROLLER self -- @usage -- -- Set up precision bombing, FlightGroup as lasing unit @@ -1980,7 +1982,7 @@ end -- ArmyGroup:Activate() -- taskmanager:EnablePrecisionBombing(ArmyGroup,1688) -- -function PLAYERTASKCONTROLLER:EnablePrecisionBombing(FlightGroup,LaserCode,HoldingPoint) +function PLAYERTASKCONTROLLER:EnablePrecisionBombing(FlightGroup,LaserCode,HoldingPoint, Alt, Speed) self:T(self.lid.."EnablePrecisionBombing") if FlightGroup then if FlightGroup.ClassName and (FlightGroup.ClassName == "FLIGHTGROUP" or FlightGroup.ClassName == "ARMYGROUP")then @@ -1993,11 +1995,20 @@ function PLAYERTASKCONTROLLER:EnablePrecisionBombing(FlightGroup,LaserCode,Holdi self.LasingDrone:SetLaser(LaserCode) self.LaserCode = LaserCode or 1688 self.LasingDroneTemplate = self.LasingDrone:_GetTemplate(true) + self.LasingDroneAlt = Alt or 10000 + self.LasingDroneSpeed = Speed or 120 -- let it orbit the BullsEye if FG if self.LasingDrone:IsFlightgroup() then + self.LasingDroneIsFlightgroup = true local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( self.Coalition )) if HoldingPoint then BullsCoordinate = HoldingPoint end - local Orbit = AUFTRAG:NewORBIT_CIRCLE(BullsCoordinate,10000,120) + local Orbit = AUFTRAG:NewORBIT_CIRCLE(BullsCoordinate,self.LasingDroneAlt,self.LasingDroneSpeed) + self.LasingDrone:AddMission(Orbit) + elseif self.LasingDrone:IsArmygroup() then + self.LasingDroneIsArmygroup = true + local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( self.Coalition )) + if HoldingPoint then BullsCoordinate = HoldingPoint end + local Orbit = AUFTRAG:NewONGUARD(BullsCoordinate) self.LasingDrone:AddMission(Orbit) end else @@ -2536,10 +2547,16 @@ function PLAYERTASKCONTROLLER:_CheckPrecisionTasks() if self.LasingDrone then self.LasingDrone:_Respawn(1,nil,true) else - -- TODO: Handle ArmyGroup - local FG = FLIGHTGROUP:New(self.LasingDroneTemplate) - FG:Activate() - self:EnablePrecisionBombing(FG,self.LaserCode or 1688) + -- DONE: Handle ArmyGroup + if self.LasingDroneIsFlightgroup then + local FG = FLIGHTGROUP:New(self.LasingDroneTemplate) + FG:Activate() + self:EnablePrecisionBombing(FG,self.LaserCode or 1688) + else + local FG = ARMYGROUP:New(self.LasingDroneTemplate) + FG:Activate() + self:EnablePrecisionBombing(FG,self.LaserCode or 1688) + end end return self end @@ -2554,13 +2571,11 @@ function PLAYERTASKCONTROLLER:_CheckPrecisionTasks() self.LasingDrone.playertask.inreach = false self.LasingDrone.playertask.reachmessage = false -- move the drone to target - if self.LasingDrone:IsFlightgroup() then + if self.LasingDroneIsFlightgroup then self.LasingDrone:CancelAllMissions() - local auftrag = AUFTRAG:NewORBIT_CIRCLE(task.Target:GetCoordinate(),10000,120) - --local currmission = self.LasingDrone:GetMissionCurrent() - self.LasingDrone:AddMission(auftrag) - --currmission:__Cancel(-2) - elseif self.LasingDrone:IsArmygroup() then + local auftrag = AUFTRAG:NewORBIT_CIRCLE(task.Target:GetCoordinate(),self.LasingDroneAlt,self.LasingDroneSpeed) + self.LasingDrone:AddMission(auftrag) + elseif self.LasingDroneIsArmygroup then local tgtcoord = task.Target:GetCoordinate() local tgtzone = ZONE_RADIUS:New("ArmyGroup-"..math.random(1,10000),tgtcoord:GetVec2(),3000) local finalpos=nil -- Core.Point#COORDINATE @@ -2573,11 +2588,10 @@ function PLAYERTASKCONTROLLER:_CheckPrecisionTasks() end end if finalpos then + self.LasingDrone:CancelAllMissions() -- yeah we got one local auftrag = AUFTRAG:NewARMOREDGUARD(finalpos,"Off road") - local currmission = self.LasingDrone:GetMissionCurrent() self.LasingDrone:AddMission(auftrag) - if currmission then currmission:__Cancel(-2) end else -- could not find LOS position! self:E("***Could not find LOS position to post ArmyGroup for lasing!") From dcd4d0ab624aa530cb6953d5c68bf94d2fb18ff2 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Wed, 17 Jan 2024 12:15:39 +0100 Subject: [PATCH 02/14] CONTROLLABLE * Added CommandSetFrequencyForUnit --- .../Moose/Wrapper/Controllable.lua | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 384281c32..4f291db8e 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -938,20 +938,22 @@ end -- @param #CONTROLLABLE self -- @param #number Frequency Radio frequency in MHz. -- @param #number Modulation Radio modulation. Default `radio.modulation.AM`. +-- @param #number Power (Optional) Power of the Radio in Watts. Defaults to 10. -- @param #number Delay (Optional) Delay in seconds before the frequency is set. Default is immediately. -- @return #CONTROLLABLE self -function CONTROLLABLE:CommandSetFrequency( Frequency, Modulation, Delay ) +function CONTROLLABLE:CommandSetFrequency( Frequency, Modulation, Power, Delay ) local CommandSetFrequency = { id = 'SetFrequency', params = { frequency = Frequency * 1000000, modulation = Modulation or radio.modulation.AM, + power=Power or 10, }, } if Delay and Delay > 0 then - SCHEDULER:New( nil, self.CommandSetFrequency, { self, Frequency, Modulation }, Delay ) + SCHEDULER:New( nil, self.CommandSetFrequency, { self, Frequency, Modulation, Power } ) else self:SetCommand( CommandSetFrequency ) end @@ -959,6 +961,32 @@ function CONTROLLABLE:CommandSetFrequency( Frequency, Modulation, Delay ) return self end +--- [AIR] Set radio frequency. See [DCS command EPLRS](https://wiki.hoggitworld.com/view/DCS_command_setFrequencyForUnit) +-- @param #CONTROLLABLE self +-- @param #number Frequency Radio frequency in MHz. +-- @param #number Modulation Radio modulation. Default `radio.modulation.AM`. +-- @param #number Power (Optional) Power of the Radio in Watts. Defaults to 10. +-- @param #UnitID UnitID (Optional, if your object is a UNIT) The UNIT ID this is for. +-- @param #number Delay (Optional) Delay in seconds before the frequency is set. Default is immediately. +-- @return #CONTROLLABLE self +function CONTROLLABLE:CommandSetFrequencyForUnit(Frequency,Modulation,Power,UnitID,Delay) + local CommandSetFrequencyForUnit={ + id='SetFrequencyForUnit', + params={ + frequency=Frequency*1000000, + modulation=Modulation or radio.modulation.AM, + unitId=UnitID or self:GetID(), + power=Power or 10, + }, + } + if Delay and Delay>0 then + SCHEDULER:New(nil,self.CommandSetFrequencyForUnit,{self,Frequency,Modulation,Power,UnitID}) + else + self:SetCommand(CommandSetFrequencyForUnit) + end + return self +end + --- Set EPLRS data link on/off. -- @param #CONTROLLABLE self -- @param #boolean SwitchOnOff If true (or nil) switch EPLRS on. If false switch off. From 4076ff5bb533c8dbacd77790ee2613c5864e7c76 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Wed, 17 Jan 2024 12:17:14 +0100 Subject: [PATCH 03/14] #AIRWING, #EASYGCICAP * Added SetCapStartTimeVariation() --- Moose Development/Moose/Ops/AirWing.lua | 25 +++++++++++++++++++++- Moose Development/Moose/Ops/EasyGCICAP.lua | 16 ++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/AirWing.lua b/Moose Development/Moose/Ops/AirWing.lua index 57daa15c6..1d2188ba4 100644 --- a/Moose Development/Moose/Ops/AirWing.lua +++ b/Moose Development/Moose/Ops/AirWing.lua @@ -56,6 +56,8 @@ -- @field #boolean despawnAfterHolding Aircraft are despawned after holding. -- @field #boolean capOptionPatrolRaceTrack Use closer patrol race track or standard orbit auftrag. -- @field #number capFormation If capOptionPatrolRaceTrack is true, set the formation, also. +-- @field #number capOptionVaryStartTime If set, vary mission start time for CAP missions generated random between capOptionVaryStartTime and capOptionVaryEndTime +-- @field #number capOptionVaryEndTime If set, vary mission start time for CAP missions generated random between capOptionVaryStartTime and capOptionVaryEndTime -- -- @extends Ops.Legion#LEGION @@ -132,6 +134,8 @@ AIRWING = { markpoints = false, capOptionPatrolRaceTrack = false, capFormation = nil, + capOptionVaryStartTime = nil, + capOptionVaryEndTime = nil, } --- Payload data. @@ -183,7 +187,7 @@ AIRWING = { --- AIRWING class version. -- @field #string version -AIRWING.version="0.9.4" +AIRWING.version="0.9.5" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- ToDo list @@ -721,6 +725,17 @@ function AIRWING:SetCapCloseRaceTrack(OnOff) return self end +--- Set CAP mission start to vary randomly between Start end End seconds. +-- @param #AIRWING self +-- @param #number Start +-- @param #number End +-- @return #AIRWING self +function AIRWING:SetCapStartTimeVariation(Start, End) + self.capOptionVaryStartTime = Start or 5 + self.capOptionVaryEndTime = End or 60 + return self +end + --- Set number of TANKER flights with Boom constantly in the air. -- @param #AIRWING self -- @param #number Nboom Number of flights. Default 1. @@ -1165,6 +1180,14 @@ function AIRWING:CheckCAP() end + if self.capOptionVaryStartTime then + + local ClockStart = math.random(self.capOptionVaryStartTime, self.capOptionVaryEndTime) + + missionCAP:SetTime(ClockStart) + + end + missionCAP.patroldata=patrol patrol.noccupied=patrol.noccupied+1 diff --git a/Moose Development/Moose/Ops/EasyGCICAP.lua b/Moose Development/Moose/Ops/EasyGCICAP.lua index 79d699a49..1cb3385ee 100644 --- a/Moose Development/Moose/Ops/EasyGCICAP.lua +++ b/Moose Development/Moose/Ops/EasyGCICAP.lua @@ -458,6 +458,17 @@ function EASYGCICAP:SetDefaultOverhead(Overhead) return self end +--- Set CAP mission start to vary randomly between Start end End seconds. +-- @param #EASYGCICAP self +-- @param #number Start +-- @param #number End +-- @return #EASYGCICAP self +function EASYGCICAP:SetCapStartTimeVariation(Start, End) + self.capOptionVaryStartTime = Start or 5 + self.capOptionVaryEndTime = End or 60 + return self +end + --- Add an AirWing to the manager -- @param #EASYGCICAP self -- @param #string Airbasename @@ -511,6 +522,11 @@ function EASYGCICAP:_AddAirwing(Airbasename, Alias) CAP_Wing:SetRespawnAfterDestroyed() CAP_Wing:SetNumberCAP(self.capgrouping) CAP_Wing:SetCapCloseRaceTrack(true) + + if self.capOptionVaryStartTime then + CAP_Wing:SetCapStartTimeVariation(self.capOptionVaryStartTime,self.capOptionVaryEndTime) + end + if CapFormation then CAP_Wing:SetCAPFormation(CapFormation) end From 08f2c2901447605cb43028fad10cacace6143e14 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 18 Jan 2024 14:32:17 +0100 Subject: [PATCH 04/14] #AIRBASE * Small workaround for Beirut runways * ATIS minor fix --- Moose Development/Moose/Ops/ATIS.lua | 2 +- Moose Development/Moose/Wrapper/Airbase.lua | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/ATIS.lua b/Moose Development/Moose/Ops/ATIS.lua index d07c751f1..a98245b0b 100644 --- a/Moose Development/Moose/Ops/ATIS.lua +++ b/Moose Development/Moose/Ops/ATIS.lua @@ -700,7 +700,7 @@ ATIS.Messages = { EN = { HOURS = "hours", - TIME = "hours", + TIME = "Hours", NOCLOUDINFO = "Cloud coverage information not available", OVERCAST = "Overcast", BROKEN = "Broken clouds", diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index 76da83c94..6f1ecd91a 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -1899,8 +1899,17 @@ function AIRBASE:_InitRunways(IncludeInverse) local heading=math.deg(bearing) -- Data table. - local runway={} --#AIRBASE.Runway - runway.name=string.format("%02d", tonumber(name)) + local runway={} --#AIRBASE.Runway + + local namefromheading = math.floor(heading/10) + + if self.AirbaseName == AIRBASE.Syria.Beirut_Rafic_Hariri and math.abs(namefromheading-name) > 1 then + runway.name=string.format("%02d", tonumber(namefromheading)) + else + runway.name=string.format("%02d", tonumber(name)) + end + + --runway.name=string.format("%02d", tonumber(name)) runway.magheading=tonumber(runway.name)*10 runway.heading=heading runway.width=width or 0 From 581138b5bc552e623588cf79a907602d62660bc9 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 19 Jan 2024 19:06:52 +0100 Subject: [PATCH 05/14] Avoid for pairs error --- Moose Development/Moose/Core/Set.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index 52c899bec..70fe7eaad 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -1204,7 +1204,7 @@ do if not DontSetCargoBayLimit then -- I set the default cargo bay weight limit each time a new group is added to the set. -- TODO Why is this here in the first place? - for UnitID, UnitData in pairs( group:GetUnits() ) do + for UnitID, UnitData in pairs( group:GetUnits() or {} ) do if UnitData and UnitData:IsAlive() then UnitData:SetCargoBayWeightLimit() end From 11f0b2899d26aef6031c94eab848e39c03ab6c97 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 19 Jan 2024 19:09:08 +0100 Subject: [PATCH 06/14] Minor fixes --- Moose Development/Moose/Functional/Stratego.lua | 3 ++- Moose Development/Moose/Ops/Awacs.lua | 2 ++ Moose Development/Moose/Ops/Intelligence.lua | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Functional/Stratego.lua b/Moose Development/Moose/Functional/Stratego.lua index 850f80b0f..2d9e9db04 100644 --- a/Moose Development/Moose/Functional/Stratego.lua +++ b/Moose Development/Moose/Functional/Stratego.lua @@ -435,7 +435,8 @@ function STRATEGO:AnalyseBases() if not abzone then abzone = ZONE_RADIUS:New(abname,ab:GetVec2(),500) end - local coa = ab:GetCoalition() + 1 + local coa = ab:GetCoalition() or 0 + coa = coa+1 local abtype = "AIRBASE" if ab:IsShip() then numrwys = 1 diff --git a/Moose Development/Moose/Ops/Awacs.lua b/Moose Development/Moose/Ops/Awacs.lua index d84541e17..28c710ccb 100644 --- a/Moose Development/Moose/Ops/Awacs.lua +++ b/Moose Development/Moose/Ops/Awacs.lua @@ -121,6 +121,7 @@ do -- @field #number TacticalIncrFreq -- @field #number TacticalModulation -- @field #number TacticalInterval +-- @field Core.Set#SET_GROUP DetectionSet -- @extends Core.Fsm#FSM @@ -603,6 +604,7 @@ AWACS = { TacticalIncrFreq = 0.5, TacticalModulation = radio.modulation.AM, TacticalInterval = 120, + DetectionSet = nil, } --- diff --git a/Moose Development/Moose/Ops/Intelligence.lua b/Moose Development/Moose/Ops/Intelligence.lua index 4e71d65b3..7751a140b 100644 --- a/Moose Development/Moose/Ops/Intelligence.lua +++ b/Moose Development/Moose/Ops/Intelligence.lua @@ -578,7 +578,7 @@ function INTEL:AddAgent(AgentGroup) end -- Add to detection set. - self.detectionset:AddGroup(AgentGroup) + self.detectionset:AddGroup(AgentGroup,true) return self end From e50d54f6bc5402e26a27cf3962da3d678d6c5d42 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 19 Jan 2024 19:31:49 +0100 Subject: [PATCH 07/14] Spawned FARP issue --- Moose Development/Moose/Functional/Stratego.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Functional/Stratego.lua b/Moose Development/Moose/Functional/Stratego.lua index 2d9e9db04..8b9438783 100644 --- a/Moose Development/Moose/Functional/Stratego.lua +++ b/Moose Development/Moose/Functional/Stratego.lua @@ -435,7 +435,8 @@ function STRATEGO:AnalyseBases() if not abzone then abzone = ZONE_RADIUS:New(abname,ab:GetVec2(),500) end - local coa = ab:GetCoalition() or 0 + local coa = ab:GetCoalition() + if coa == nil then return end -- Spawned FARPS issue - these have no tangible data coa = coa+1 local abtype = "AIRBASE" if ab:IsShip() then From 0b3fc515e067b2103b3d3d877b5d0188c8feb889 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 21 Jan 2024 16:44:14 +0100 Subject: [PATCH 08/14] SCENERY - small addons --- Moose Development/Moose/Core/Set.lua | 2 +- Moose Development/Moose/Wrapper/Scenery.lua | 28 ++++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index 70fe7eaad..0045ee7fa 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -8399,7 +8399,7 @@ do -- SET_SCENERY --- Calculate current relative lifepoints of the SET objects, i.e. Life divided by Life0 as percentage value, eg 75 meaning 75% alive. -- **CAVEAT**: Some objects change their life value or "hitpoints" **after** the first hit. Hence we will adjust the Life0 value to 120% -- of the last life value if life exceeds life0 ata any point. - -- Thus will will get a smooth percentage decrease, if you use this e.g. as success criteria for a bombing task. + -- Thus we will get a smooth percentage decrease, if you use this e.g. as success criteria for a bombing task. -- @param #SET_SCENERY self -- @return #number LifePoints function SET_SCENERY:GetRelativeLife() diff --git a/Moose Development/Moose/Wrapper/Scenery.lua b/Moose Development/Moose/Wrapper/Scenery.lua index 1ef31a039..2706aad71 100644 --- a/Moose Development/Moose/Wrapper/Scenery.lua +++ b/Moose Development/Moose/Wrapper/Scenery.lua @@ -123,18 +123,38 @@ end --- Check if SCENERY Object is alive. --@param #SCENERY self +--@param #number Threshold (Optional) If given, SCENERY counts as alive above this relative life in percent (1..100). --@return #number life -function SCENERY:IsAlive() - return self:GetLife() >= 1 and true or false +function SCENERY:IsAlive(Threshold) + if not Threshold then + return self:GetLife() >= 1 and true or false + else + return self:GetRelativeLife() > Threshold and true or false + end end --- Check if SCENERY Object is dead. --@param #SCENERY self +--@param #number Threshold (Optional) If given, SCENERY counts as dead below this relative life in percent (1..100). --@return #number life -function SCENERY:IsDead() - return self:GetLife() < 1 and true or false +function SCENERY:IsDead(Threshold) + if not Threshold then + return self:GetLife() < 1 and true or false + else + return self:GetRelativeLife() <= Threshold and true or false + end end +--- Get SCENERY relative life in percent, e.g. 75. +--@param #SCENERY self +--@return #number rlife +function SCENERY:GetRelativeLife() + local life = self:GetLife() + local life0 = self:GetLife0() + local rlife = math.floor((life/life0)*100) + return rlife +end + --- Get the threat level of a SCENERY object. Always 0 as scenery does not pose a threat to anyone. --@param #SCENERY self --@return #number Threat level 0. From f2fc321dedcb7d5d3cb2aa5bbffb3a506caed044 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 21 Jan 2024 16:46:24 +0100 Subject: [PATCH 09/14] TARGET - declare Scenery target dead if <= 25% of life0 --- Moose Development/Moose/Ops/PlayerTask.lua | 2 +- Moose Development/Moose/Ops/Target.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index 406563273..1e1fd5c9a 100644 --- a/Moose Development/Moose/Ops/PlayerTask.lua +++ b/Moose Development/Moose/Ops/PlayerTask.lua @@ -3207,7 +3207,7 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Task, Group, Client) local islasing = self.LasingDrone:IsLasing() == true and yes or no local prectext = self.gettext:GetEntry("POINTERTARGETREPORT",self.locale) prectext = string.format(prectext,inreach,islasing) - text = text .. prectext.."("..self.LaserCode..")" + text = text .. prectext.." ("..self.LaserCode..")" end end -- Buddylasing diff --git a/Moose Development/Moose/Ops/Target.lua b/Moose Development/Moose/Ops/Target.lua index c5b9ca558..abba2f886 100644 --- a/Moose Development/Moose/Ops/Target.lua +++ b/Moose Development/Moose/Ops/Target.lua @@ -1107,7 +1107,7 @@ function TARGET:GetTargetLife(Target) elseif Target.Type==TARGET.ObjectType.SCENERY then - if Target.Object and Target.Object:IsAlive() then + if Target.Object and Target.Object:IsAlive(25) then local life = Target.Object:GetLife() return life else From 33bd9280763d959f7a4f9dc5de14a7c87789e3f1 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 22 Jan 2024 06:30:53 +0100 Subject: [PATCH 10/14] Update Pathline.lua (#2097) Small fixes --- Moose Development/Moose/Core/Pathline.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Core/Pathline.lua b/Moose Development/Moose/Core/Pathline.lua index 7cbb48552..8fdda2bc6 100644 --- a/Moose Development/Moose/Core/Pathline.lua +++ b/Moose Development/Moose/Core/Pathline.lua @@ -73,7 +73,7 @@ PATHLINE = { --- PATHLINE class version. -- @field #string version -PATHLINE.version="0.1.0" +PATHLINE.version="0.1.1" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -237,13 +237,14 @@ end --- Get COORDINATES of pathline. Note that COORDINATE objects are created when calling this function. That does involve deep copy calls and can have an impact on performance if done too often. -- @param #PATHLINE self -- @return List of COORDINATES points. -function PATHLINE:GetCoordinats() +function PATHLINE:GetCoordinates() local vecs={} for _,_point in pairs(self.points) do local point=_point --#PATHLINE.Point local coord=COORDINATE:NewFromVec3(point.vec3) + table.insert(vecs,coord) end return vecs @@ -262,7 +263,7 @@ function PATHLINE:GetPointFromIndex(n) local point=nil --#PATHLINE.Point if n>=1 and n<=N then - point=self.point[n] + point=self.points[n] else self:E(self.lid..string.format("ERROR: No point in pathline for N=%s", tostring(n))) end @@ -367,4 +368,4 @@ end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \ No newline at end of file +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- From a3d56b6d1bbdb7c2435f38608d4d458f46c9264a Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 22 Jan 2024 06:32:42 +0100 Subject: [PATCH 11/14] Update Pathline.lua (#2097) (#2098) Small fixes --- Moose Development/Moose/Core/Pathline.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Core/Pathline.lua b/Moose Development/Moose/Core/Pathline.lua index 7cbb48552..8fdda2bc6 100644 --- a/Moose Development/Moose/Core/Pathline.lua +++ b/Moose Development/Moose/Core/Pathline.lua @@ -73,7 +73,7 @@ PATHLINE = { --- PATHLINE class version. -- @field #string version -PATHLINE.version="0.1.0" +PATHLINE.version="0.1.1" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -237,13 +237,14 @@ end --- Get COORDINATES of pathline. Note that COORDINATE objects are created when calling this function. That does involve deep copy calls and can have an impact on performance if done too often. -- @param #PATHLINE self -- @return List of COORDINATES points. -function PATHLINE:GetCoordinats() +function PATHLINE:GetCoordinates() local vecs={} for _,_point in pairs(self.points) do local point=_point --#PATHLINE.Point local coord=COORDINATE:NewFromVec3(point.vec3) + table.insert(vecs,coord) end return vecs @@ -262,7 +263,7 @@ function PATHLINE:GetPointFromIndex(n) local point=nil --#PATHLINE.Point if n>=1 and n<=N then - point=self.point[n] + point=self.points[n] else self:E(self.lid..string.format("ERROR: No point in pathline for N=%s", tostring(n))) end @@ -367,4 +368,4 @@ end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \ No newline at end of file +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- From 1b4e170271b6b2dcf304a8eaa0ad0e1d7e2ba17a Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 22 Jan 2024 21:49:31 +0100 Subject: [PATCH 12/14] Update FlightGroup.lua - Added menu update after cruise. (Fixes launches from aircraft carriers.) --- Moose Development/Moose/Ops/FlightGroup.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/FlightGroup.lua b/Moose Development/Moose/Ops/FlightGroup.lua index 1be7c0dbe..05145caac 100644 --- a/Moose Development/Moose/Ops/FlightGroup.lua +++ b/Moose Development/Moose/Ops/FlightGroup.lua @@ -2333,7 +2333,8 @@ function FLIGHTGROUP:onafterCruise(From, Event, To) -- CLIENT --- - --self:_UpdateMenu(0.1) + -- Had this commented out (forgot why, probably because it was not necessary) but re-enabling it because of carrier launch. + self:_UpdateMenu(0.1) end From 748aa131e4e9ba35bbe728fa6a2acb4d0efa4cf8 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 23 Jan 2024 10:03:52 +0100 Subject: [PATCH 13/14] WAREHOUSE - trying to ensure WH for AirWing starts again when runway is repaired --- Moose Development/Moose/Functional/Warehouse.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Functional/Warehouse.lua b/Moose Development/Moose/Functional/Warehouse.lua index 86c1255c7..686bede21 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -3414,7 +3414,7 @@ end -- FSM states ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---- On after Start event. Starts the warehouse. Addes event handlers and schedules status updates of reqests and queue. +--- On after Start event. Starts the warehouse. Adds event handlers and schedules status updates of reqests and queue. -- @param #WAREHOUSE self -- @param #string From From state. -- @param #string Event Event. @@ -3595,6 +3595,7 @@ function WAREHOUSE:onafterStatus(From, Event, To) local Trepair=self:GetRunwayRepairtime() self:I(self.lid..string.format("Runway destroyed! Will be repaired in %d sec", Trepair)) if Trepair==0 then + self.runwaydestroyed = nil self:RunwayRepaired() end end @@ -5392,7 +5393,8 @@ function WAREHOUSE:onafterRunwayDestroyed(From, Event, To) self:_InfoMessage(text) self.runwaydestroyed=timer.getAbsTime() - + + return self end --- On after "RunwayRepaired" event. @@ -5407,7 +5409,8 @@ function WAREHOUSE:onafterRunwayRepaired(From, Event, To) self:_InfoMessage(text) self.runwaydestroyed=nil - + + return self end From d0d52246f4fb52984137034fb74e142836370139 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 23 Jan 2024 10:04:50 +0100 Subject: [PATCH 14/14] #STRATEGO * Change strategy for finding strategic targets from base to consolidated weight --- .../Moose/Functional/Stratego.lua | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Moose Development/Moose/Functional/Stratego.lua b/Moose Development/Moose/Functional/Stratego.lua index 8b9438783..3c48cb7a0 100644 --- a/Moose Development/Moose/Functional/Stratego.lua +++ b/Moose Development/Moose/Functional/Stratego.lua @@ -176,7 +176,7 @@ STRATEGO = { debug = false, drawzone = false, markzone = false, - version = "0.2.3", + version = "0.2.4", portweight = 3, POIweight = 1, maxrunways = 3, @@ -948,22 +948,22 @@ function STRATEGO:FindClosestConsolidationTarget(Startpoint,BaseWeight) return shortest,target, weight, coa end ---- [USER] Get the next best strategic target node with same or higher BaseWeight. +--- [USER] Get the next best strategic target node with same or higher Consolidated Weight. -- @param #STRATEGO self -- @param #string Startpoint Name of start point. --- @param #number BaseWeight Base weight of the node, e.g. the number of runways of an airbase or the weight of ports or POIs. +-- @param #number Weight Consolidated Weight of the node, i.e. the calculated weight of the node based on number of runways, connections and a weight factor. -- @return #number ShortestDist Shortest distance found. -- @return #string Name Name of the target node. -- @return #number Weight Consolidated weight of the target node, zero if none found. -- @return #number Coalition Coaltion of the target. -function STRATEGO:FindClosestStrategicTarget(Startpoint,BaseWeight) - self:T(self.lid.."FindClosestStrategicTarget") +function STRATEGO:FindClosestStrategicTarget(Startpoint,Weight) + self:T(self.lid.."FindClosestStrategicTarget for "..Startpoint.." Weight "..Weight or 0) -- find existing routes local shortest = 1000*1000 local target = nil local weight = 0 local coa = nil - if not BaseWeight then BaseWeight = self.maxrunways end + if not Weight then Weight = self.maxrunways end local startpoint = string.gsub(Startpoint,"[%p%s]",".") for _,_route in pairs(self.routexists) do if string.find(_route,startpoint,1,true) then @@ -971,7 +971,11 @@ function STRATEGO:FindClosestStrategicTarget(Startpoint,BaseWeight) local tname = string.gsub(_route,startpoint,"") local tname = string.gsub(tname,";","") local cname = self.easynames[tname] - if dist < shortest and self.airbasetable[cname].coalition ~= self.coalition and self.airbasetable[cname].baseweight >= BaseWeight then + local coa = self.airbasetable[cname].coalition + local tweight = self.airbasetable[cname].baseweight + local ttweight = self.airbasetable[cname].weight + self:T("Start -> End: "..startpoint.." -> "..cname) + if (dist < shortest) and (coa ~= self.coalition) and (tweight >= Weight) then shortest = dist target = cname weight = self.airbasetable[cname].weight @@ -991,7 +995,7 @@ function STRATEGO:FindStrategicTargets() for _,_data in pairs(self.airbasetable) do local data = _data -- #STRATEGO.Data if data.coalition == self.coalition then - local dist, name, points, coa = self:FindClosestStrategicTarget(data.name,self.maxrunways) + local dist, name, points, coa = self:FindClosestStrategicTarget(data.name,data.weight) if coa == coalition.side.NEUTRAL and points ~= 0 then local fpoints = points + self.NeutralBenefit local tries = 1