From 8126b198bac2b175b9f786537a692cb46e8cc276 Mon Sep 17 00:00:00 2001 From: Wingthor Date: Sun, 7 Apr 2019 02:56:41 +0200 Subject: [PATCH 01/13] Fixed bug with SPAWN:GetLastAliveGroup() issue 1141 Changed line 2208 --- Moose Development/Moose/Core/Spawn.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Core/Spawn.lua b/Moose Development/Moose/Core/Spawn.lua index 6594633c9..206f1e4cb 100644 --- a/Moose Development/Moose/Core/Spawn.lua +++ b/Moose Development/Moose/Core/Spawn.lua @@ -2204,9 +2204,8 @@ end -- end function SPAWN:GetLastAliveGroup() self:F( { self.SpawnTemplatePrefix, self.SpawnAliasPrefix } ) - - self.SpawnIndex = self:_GetLastIndex() - for SpawnIndex = self.SpawnIndex, 1, -1 do + + for SpawnIndex = self.SpawnCount, 1, -1 do -- Added local SpawnGroup = self:GetGroupFromIndex( SpawnIndex ) if SpawnGroup and SpawnGroup:IsAlive() then self.SpawnIndex = SpawnIndex From 49217291add22064b8629f20be2ade1bc6fe0f50 Mon Sep 17 00:00:00 2001 From: TommyC81 Date: Wed, 24 Apr 2019 17:22:41 +0400 Subject: [PATCH 02/13] Corrected AIRBASE name comment. Corrected array name for Bandar-e-Jask Airfield. --- Moose Development/Moose/Wrapper/Airbase.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index 565bc22ad..8b1efea83 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -226,7 +226,7 @@ AIRBASE.Normandy = { -- * AIRBASE.PersianGulf.Al_Dhafra_AB -- * AIRBASE.PersianGulf.Al_Maktoum_Intl -- * AIRBASE.PersianGulf.Al_Minhad_AB --- * AIRBASE.PersianGulf.Bandar-e-Jask_airfield +-- * AIRBASE.PersianGulf.Bandar_e_Jask_airfield -- * AIRBASE.PersianGulf.Bandar_Abbas_Intl -- * AIRBASE.PersianGulf.Bandar_Lengeh -- * AIRBASE.PersianGulf.Dubai_Intl @@ -931,4 +931,4 @@ function AIRBASE._CheckTerminalType(Term_Type, termtype) end return match -end \ No newline at end of file +end From 604ff07933430e976c62cf0d81f06a083df45378 Mon Sep 17 00:00:00 2001 From: Wingthor Date: Sun, 26 May 2019 16:49:56 +0200 Subject: [PATCH 03/13] fix issue #948 in Scoring.lua Changed ScoreGoals to PenaltyGoals in function CORING:ReportScoreAllSummary( PlayerGroup ) --- Moose Development/Moose/Functional/Scoring.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Functional/Scoring.lua b/Moose Development/Moose/Functional/Scoring.lua index af50957e6..b5c8da81b 100644 --- a/Moose Development/Moose/Functional/Scoring.lua +++ b/Moose Development/Moose/Functional/Scoring.lua @@ -1635,7 +1635,7 @@ function SCORING:ReportScoreGroupSummary( PlayerGroup ) self:F( { ReportMissions, ScoreMissions, PenaltyMissions } ) local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions - local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions + local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyGoals + PenaltyMissions PlayerMessage = string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )", From 256ef2c7b48d3b14ba1f38675f848165b81e03e0 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 26 May 2019 21:25:11 +0200 Subject: [PATCH 04/13] Update Warehouse.lua --- .../Moose/Functional/Warehouse.lua | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Moose Development/Moose/Functional/Warehouse.lua b/Moose Development/Moose/Functional/Warehouse.lua index e2c8c7b6d..49558c58d 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -3096,7 +3096,7 @@ function WAREHOUSE:FindAssetInDB(group) if aid~=nil then local asset=_WAREHOUSEDB.Assets[aid] - self:E({asset=asset}) + self:T2({asset=asset}) if asset==nil then self:_ErrorMessage(string.format("ERROR: Asset for group %s not found in the data base!", group:GetName()), 0) end @@ -7753,14 +7753,21 @@ function WAREHOUSE:_CheckFuel() local group=_group --Wrapper.Group#GROUP if group and group:IsAlive() then - + + -- Get min fuel of group. local fuel=group:GetFuelMin() - self:T2(self.wid..string.format("Transport group %s min fuel state = %.2f %%", group:GetName(), fuel)) + -- Debug info. + self:T2(self.wid..string.format("Transport group %s min fuel state = %.2f", group:GetName(), fuel)) + -- Check if fuel is below threshold for first time. if fuel Date: Mon, 27 May 2019 14:15:17 +0200 Subject: [PATCH 05/13] RANGE 2.1.2 fixes --- Moose Development/Moose/Core/Radio.lua | 2 +- Moose Development/Moose/Functional/Fox.lua | 35 ++++++++---- Moose Development/Moose/Functional/Range.lua | 58 ++++++++++---------- 3 files changed, 53 insertions(+), 42 deletions(-) diff --git a/Moose Development/Moose/Core/Radio.lua b/Moose Development/Moose/Core/Radio.lua index ffd33255d..412e18430 100644 --- a/Moose Development/Moose/Core/Radio.lua +++ b/Moose Development/Moose/Core/Radio.lua @@ -1175,7 +1175,7 @@ function RADIOQUEUE:_CheckRadioQueue() else - if time-Tlast>=transmission.interval then + if Tlast==nil or time-Tlast>=transmission.interval then next=transmission else diff --git a/Moose Development/Moose/Functional/Fox.lua b/Moose Development/Moose/Functional/Fox.lua index e6fb352f4..69afa5761 100644 --- a/Moose Development/Moose/Functional/Fox.lua +++ b/Moose Development/Moose/Functional/Fox.lua @@ -76,8 +76,8 @@ -- fox=FOX:New() -- -- -- Add training zones. --- fox:AddSafeZone(ZONE:New("Training Zone Alpha") --- fox:AddSafeZone(ZONE:New("Training Zone Bravo") +-- fox:AddSafeZone(ZONE:New("Training Zone Alpha")) +-- fox:AddSafeZone(ZONE:New("Training Zone Bravo")) -- -- -- Start missile trainer. -- fox:Start() @@ -90,8 +90,8 @@ -- fox=FOX:New() -- -- -- Add training zones. --- fox:AddLaunchZone(ZONE:New("Launch Zone SA-10 Krim") --- fox:AddLaunchZone(ZONE:New("Training Zone Bravo") +-- fox:AddLaunchZone(ZONE:New("Launch Zone SA-10 Krim")) +-- fox:AddLaunchZone(ZONE:New("Training Zone Bravo")) -- -- -- Start missile trainer. -- fox:Start() @@ -189,7 +189,7 @@ FOX.MenuF10Root=nil --- FOX class version. -- @field #string version -FOX.version="0.5.0" +FOX.version="0.5.1" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- ToDo list @@ -444,6 +444,17 @@ function FOX:SetExplosionPower(power) return self end +--- Set missile-player distance when missile is destroyed. +-- @param #FOX self +-- @param #number distance Distance in meters. Default 100 m. +-- @return #FOX self +function FOX:SetExplosionDistance(distance) + + self.explosiondist=distance or 100 + + return self +end + --- Disable F10 menu for all players. -- @param #FOX self @@ -1065,13 +1076,13 @@ function FOX:OnEventShot(EventData) end -- Debug info. - self:E(FOX.lid.."EVENT SHOT: FOX") - self:E(FOX.lid..string.format("EVENT SHOT: Ini unit = %s", tostring(EventData.IniUnitName))) - self:E(FOX.lid..string.format("EVENT SHOT: Ini group = %s", tostring(EventData.IniGroupName))) - self:E(FOX.lid..string.format("EVENT SHOT: Weapon type = %s", tostring(_weapon))) - self:E(FOX.lid..string.format("EVENT SHOT: Weapon categ = %s", tostring(weaponcategory))) - self:E(FOX.lid..string.format("EVENT SHOT: Missil categ = %s", tostring(missilecategory))) - self:E(FOX.lid..string.format("EVENT SHOT: Missil range = %s", tostring(missilerange))) + self:T2(FOX.lid.."EVENT SHOT: FOX") + self:T2(FOX.lid..string.format("EVENT SHOT: Ini unit = %s", tostring(EventData.IniUnitName))) + self:T2(FOX.lid..string.format("EVENT SHOT: Ini group = %s", tostring(EventData.IniGroupName))) + self:T2(FOX.lid..string.format("EVENT SHOT: Weapon type = %s", tostring(_weapon))) + self:T2(FOX.lid..string.format("EVENT SHOT: Weapon categ = %s", tostring(weaponcategory))) + self:T2(FOX.lid..string.format("EVENT SHOT: Missil categ = %s", tostring(missilecategory))) + self:T2(FOX.lid..string.format("EVENT SHOT: Missil range = %s", tostring(missilerange))) -- Check if fired in launch zone. diff --git a/Moose Development/Moose/Functional/Range.lua b/Moose Development/Moose/Functional/Range.lua index eb3009ee4..a1d716058 100644 --- a/Moose Development/Moose/Functional/Range.lua +++ b/Moose Development/Moose/Functional/Range.lua @@ -78,7 +78,7 @@ -- @field #boolean trackrockets If true (default), all rocket types are tracked and impact point to closest bombing target is evaluated. -- @field #boolean trackmissiles If true (default), all missile types are tracked and impact point to closest bombing target is evaluated. -- @field #boolean defaultsmokebomb If true, initialize player settings to smoke bomb. --- @field #boolean autosafe If true, automatically save results every X seconds. +-- @field #boolean autosave If true, automatically save results every X seconds. -- @extends Core.Base#BASE --- Enables a mission designer to easily set up practice ranges in DCS. A new RANGE object can be created with the @{#RANGE.New}(rangename) contructor. @@ -340,7 +340,7 @@ RANGE.MenuF10Root=nil --- Range script version. -- @field #string version -RANGE.version="2.1.1" +RANGE.version="2.1.2" --TODO list: --TODO: Verbosity level for messages. @@ -617,19 +617,19 @@ function RANGE:SetMessageTimeDuration(time) return self end ---- Automatically safe player results to disc. +--- Automatically save player results to disc. -- @param #RANGE self -- @return #RANGE self -function RANGE:SetAutosafeOn() - self.autosafe=true +function RANGE:SetAutosaveOn() + self.autosave=true return self end ---- Switch off auto safe player results. +--- Switch off auto save player results. -- @param #RANGE self -- @return #RANGE self -function RANGE:SetAutosafeOff() - self.autosafe=false +function RANGE:SetAutosaveOff() + self.autosave=false return self end @@ -662,7 +662,7 @@ function RANGE:SetRangeRadius(radius) return self end ---- Set player setting whether bomb impact points are smoked or not +--- Set player setting whether bomb impact points are smoked or not. -- @param #RANGE self -- @param #boolean switch If true nor nil default is to smoke impact points of bombs. -- @return #RANGE self @@ -1650,7 +1650,7 @@ function RANGE:onafterStatus(From, Event, To) self:_CheckPlayers() -- Save results. - if self.autosafe then + if self.autosave then self:Save() end @@ -1725,10 +1725,10 @@ function RANGE:onafterSave(From, Event, To) end -- Path. - local path=lfs.writedir() + local path=lfs.writedir()..[[Logs\]] -- Set file name. - local filename=path..string.format("\\RANGE-%s_BombingResults.csv", self.rangename) + local filename=path..string.format("RANGE-%s_BombingResults.csv", self.rangename) -- Header line. local scores="Name,Pass,Target,Distance,Radial,Quality,Weapon,Airframe,Mission Time" @@ -1788,11 +1788,11 @@ function RANGE:onafterLoad(From, Event, To) end end - -- Path. - local path=lfs.writedir() + -- Path in DCS log file. + local path=lfs.writedir()..[[Logs\]] -- Set file name. - local filename=path..string.format("\\RANGE-%s_BombingResults.csv", self.rangename) + local filename=path..string.format("RANGE-%s_BombingResults.csv", self.rangename) -- Info message. local text=string.format("Loading player bomb results from file %s", filename) @@ -2185,15 +2185,16 @@ function RANGE:_DisplayBombTargets(_unitname) local _text="Bomb Target Locations:" for _,_bombtarget in pairs(self.bombingTargets) do - local _target=_bombtarget.target --Wrapper.Positionable#POSITIONABLE + local bombtarget=_bombtarget --#RANGE.BombTarget -- Coordinate of bombtarget. - local coord=self:_GetBombTargetCoordinate(_bombtarget) + local coord=self:_GetBombTargetCoordinate(bombtarget) if coord then - local mycoord=coord:ToStringA2G(_unit, _settings) - _text=_text..string.format("\n- %s: %s",_bombtarget.name or "unknown", mycoord) + local ca2g=coord:ToStringA2G(_unit, _settings) + local lldms=coord:ToStringLLDMS() + _text=_text..string.format("\n- %s: %s %s", bombtarget.name or "unknown", ca2g, lldms) end end @@ -2708,21 +2709,19 @@ function RANGE:_MarkTargetsOnMap(_unitName) self:F(_unitName) -- Get group. - local group=nil + local group=nil --Wrapper.Group#GROUP if _unitName then group=UNIT:FindByName(_unitName):GetGroup() end -- Mark bomb targets. for _,_bombtarget in pairs(self.bombingTargets) do - local _target=_bombtarget.target --Wrapper.Positionable#POSITIONABLE - if _target and _target:IsAlive() then - local coord=_target:GetCoordinate() --Core.Point#COORDINATE - if group then - coord:MarkToGroup("Bomb target ".._bombtarget.name, group) - else - coord:MarkToAll("Bomb target ".._bombtarget.name) - end + local bombtarget=_bombtarget --#RANGE.BombTarget + local coord=self:_GetBombTargetCoordinate(_bombtarget) + if group then + coord:MarkToGroup(string.format("Bomb target %s:\n%s\n%s", bombtarget.name, coord:ToStringLLDMS(), coord:ToStringBULLS(group:GetCoalition())), group) + else + coord:MarkToAll(string.format("Bomb target %s", bombtarget.name)) end end @@ -2733,7 +2732,8 @@ function RANGE:_MarkTargetsOnMap(_unitName) if _target and _target:IsAlive() then local coord=_target:GetCoordinate() --Core.Point#COORDINATE if group then - coord:MarkToGroup("Strafe target ".._target:GetName(), group) + --coord:MarkToGroup("Strafe target ".._target:GetName(), group) + coord:MarkToGroup(string.format("Strafe target %s:\n%s\n%s", _target:GetName(), coord:ToStringLLDMS(), coord:ToStringBULLS(group:GetCoalition())), group) else coord:MarkToAll("Strafe target ".._target:GetName()) end From a53bb1aac6a216cdd85c93ac46a0e27b15c6edfd Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 28 May 2019 00:24:47 +0200 Subject: [PATCH 06/13] WH v0.9.1 - Added request as parameter in AssetSpawned event. --- 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 49558c58d..16ad67f5e 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -1743,7 +1743,7 @@ _WAREHOUSEDB = { --- Warehouse class version. -- @field #string version -WAREHOUSE.version="0.9.0" +WAREHOUSE.version="0.9.1" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO: Warehouse todo list. @@ -2318,6 +2318,7 @@ function WAREHOUSE:New(warehouse, alias) -- @param #WAREHOUSE self -- @param Wrapper.Group#GROUP group the group that was spawned. -- @param #WAREHOUSE.Assetitem asset The asset that was spawned. + -- @param #WAREHOUSE.Pendingitem request The request of the spawned asset. --- Triggers the FSM event "AssetSpawned" with a delay when the warehouse has spawned an asset. -- @function [parent=#WAREHOUSE] __AssetSpawned @@ -2325,6 +2326,7 @@ function WAREHOUSE:New(warehouse, alias) -- @param #number delay Delay in seconds. -- @param Wrapper.Group#GROUP group the group that was spawned. -- @param #WAREHOUSE.Assetitem asset The asset that was spawned. + -- @param #WAREHOUSE.Pendingitem request The request of the spawned asset. --- On after "AssetSpawned" event user function. Called when the warehouse has spawned an asset. -- @function [parent=#WAREHOUSE] OnAfterAssetSpawned @@ -2334,6 +2336,7 @@ function WAREHOUSE:New(warehouse, alias) -- @param #string To To state. -- @param Wrapper.Group#GROUP group the group that was spawned. -- @param #WAREHOUSE.Assetitem asset The asset that was spawned. + -- @param #WAREHOUSE.Pendingitem request The request of the spawned asset. --- Triggers the FSM event "AssetLowFuel" when an asset runs low on fuel @@ -4330,7 +4333,7 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request) table.insert(_transportassets,_assetitem) -- Asset spawned FSM function. - self:__AssetSpawned(1, spawngroup, _assetitem) + self:__AssetSpawned(1, spawngroup, _assetitem, Request) end end @@ -5269,7 +5272,7 @@ function WAREHOUSE:_SpawnAssetRequest(Request) table.insert(_assets, _assetitem) -- Call FSM function. - self:__AssetSpawned(1,_group,_assetitem) + self:__AssetSpawned(1,_group,_assetitem, Request) else self:E(self.wid.."ERROR: Cargo asset could not be spawned!") end From 271217cf04fcdcdf67c1f3bbb7dfcbbe43eb6815 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 28 May 2019 23:58:14 +0200 Subject: [PATCH 07/13] Update Warehouse.lua --- Moose Development/Moose/Functional/Warehouse.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Functional/Warehouse.lua b/Moose Development/Moose/Functional/Warehouse.lua index 16ad67f5e..1f6b3d441 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -3152,7 +3152,7 @@ function WAREHOUSE:onafterStart(From, Event, To) end -- Mark point at road connection. if self.road then - self.road:MarkToAll(string.format("%s road connection.", self.alias), true) + self.markroad=self.road:MarkToCoalition(string.format("%s road connection.",self.alias), self:GetCoalition(), true) end -- Get the closest point on railroad wrt spawnzone of ground assets. @@ -3166,7 +3166,7 @@ function WAREHOUSE:onafterStart(From, Event, To) end -- Mark point at rail connection. if self.rail then - self.rail:MarkToAll(string.format("%s rail connection.", self.alias), true) + self.markrail=self.rail:MarkToCoalition(string.format("%s rail connection.", self.alias), self:GetCoalition(), true) end -- Handle events: From 1627c92460fa0f8a7cfa377326dc57721e6db8ea Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 1 Jun 2019 23:25:44 +0200 Subject: [PATCH 08/13] Airboss v1.0.1 --- Moose Development/Moose/Ops/Airboss.lua | 40 +++++++++++++++++++++---- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 24a36a7c8..e0337906c 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -207,6 +207,7 @@ -- @field Core.Set#SET_GROUP excludesetAI AI groups in this set will be explicitly excluded from handling by the airboss and not forced into the Marshal pattern. -- @field #boolean menusingle If true, menu is optimized for a single carrier. -- @field #number collisiondist Distance up to which collision checks are done. +-- @field #nubmer holdtimestamp Timestamp when the carrier first came to an unexpected hold. -- @field #number Tmessage Default duration in seconds messages are displayed to players. -- @field #string soundfolder Folder within the mission (miz) file where airboss sound files are located. -- @field #string soundfolderLSO Folder withing the mission (miz) file where LSO sound files are stored. @@ -271,7 +272,7 @@ -- The flight that transitions form the holding pattern to the landing approach, it should leave the Marshal stack at the 3 position and make a left hand turn to the *Initial* -- position, which is 3 NM astern of the boat. Note that you need to be below 1300 feet to be registered in the initial zone. -- The altitude can be set via the function @{AIRBOSS.SetInitialMaxAlt}(*altitude*) function. --- As described belwo, the initial zone can be smoked or flared via the AIRBOSS F10 Help radio menu. +-- As described below, the initial zone can be smoked or flared via the AIRBOSS F10 Help radio menu. -- -- ### Landing Pattern -- @@ -1208,6 +1209,7 @@ AIRBOSS = { excludesetAI = nil, menusingle = nil, collisiondist = nil, + holdtimestamp = nil, Tmessage = nil, soundfolder = nil, soundfolderLSO = nil, @@ -1673,7 +1675,7 @@ AIRBOSS.MenuF10Root=nil --- Airboss class version. -- @field #string version -AIRBOSS.version="1.0.0" +AIRBOSS.version="1.0.1" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -3227,13 +3229,36 @@ function AIRBOSS:onafterStatus(From, Event, To) -- Current heading and position of the carrier. local hdg=self:GetHeading() local pos=self:GetCoordinate() + local speed=self.carrier:GetVelocityKNOTS() -- Check water is ahead. local collision=self:_CheckCollisionCoord(pos:Translate(self.collisiondist, hdg)) + + local holdtime=0 + if self.holdtimestamp then + holdtime=timer.getTime()-self.holdtimestamp + end + + -- Check if carrier is stationary. + local NextWP=self:_GetNextWaypoint() + local ExpectedSpeed=UTILS.MpsToKnots(NextWP:GetVelocity()) + if speed<0.5 and ExpectedSpeed>0 and not (self.detour or self.turnintowind) then + if not self.holdtimestamp then + self:E(self.lid.."Carrier came to an unexpected standstill. Trying to re-route in 3 min.") + self.holdtimestamp=timer.getTime() + else + if holdtime>3*60 then + local coord=self:GetCoordinate():Translate(500, hdg+10) + --coord:MarkToAll("Re-route after standstill.") + self:CarrierResumeRoute(coord) + self.holdtimestamp=nil + end + end + end -- Debug info. - local text=string.format("Time %s - Status %s (case=%d) - Speed=%.1f kts - Heading=%d - WP=%d - ETA=%s - Turning=%s - Collision Warning=%s", - clock, self:GetState(), self.case, self.carrier:GetVelocityKNOTS(), hdg, self.currentwp, eta, tostring(self.turning), tostring(collision)) + local text=string.format("Time %s - Status %s (case=%d) - Speed=%.1f kts - Heading=%d - WP=%d - ETA=%s - Turning=%s - Collision Warning=%s - Detour=%s - Turn Into Wind=%s - Holdtime=%d sec", + clock, self:GetState(), self.case, speed, hdg, self.currentwp, eta, tostring(self.turning), tostring(collision), tostring(self.detour), tostring(self.turnintowind), holdtime) self:T(self.lid..text) -- Players online: @@ -13130,7 +13155,7 @@ end --- Get next waypoint of the carrier. -- @param #AIRBOSS self -- @return Core.Point#COORDINATE Coordinate of the next waypoint. --- @return #number Number of waypoint +-- @return #number Number of waypoint. function AIRBOSS:_GetNextWaypoint() -- Next waypoint. @@ -13459,6 +13484,7 @@ function AIRBOSS._ResumeRoute(group, airboss, gotocoord) -- First goto this coordinate. if gotocoord then + --gotocoord:MarkToAll(string.format("Goto waypoint speed=%.1f km/h", speedkmh)) local wp1=gotocoord:WaypointGround(speedkmh) table.insert(waypoints, wp1) end @@ -13468,7 +13494,7 @@ function AIRBOSS._ResumeRoute(group, airboss, gotocoord) -- Debug message. MESSAGE:New(text,10):ToAllIf(airboss.Debug) - airboss:I(airboss.lid..text) + airboss:I(airboss.lid..text) -- Loop over all remaining waypoints. for i=Nextwp, #airboss.waypoints do @@ -13484,6 +13510,8 @@ function AIRBOSS._ResumeRoute(group, airboss, gotocoord) speed=UTILS.KnotsToKmph(10) end + --coord:MarkToAll(string.format("Resume route WP %d, speed=%.1f km/h", i, speed)) + -- Create waypoint. local wp=coord:WaypointGround(speed) From 9fed91b16f2a1ee87fac6f8a961e3096bef7fd13 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 2 Jun 2019 23:12:08 +0200 Subject: [PATCH 09/13] AIRBOSS v1.0.2 - Added skipper menu. - Added turn help waypoints. --- Moose Development/Moose/Ops/Airboss.lua | 232 +++++++++++++++++++++++- 1 file changed, 229 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index e0337906c..654f9d22e 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -229,6 +229,11 @@ -- @field #string trapprefix File prefix for trap sheet files. -- @field #number initialmaxalt Max altitude in meters to register in the inital zone. -- @field #boolean welcome If true, display welcome message to player. +-- @field #boolean skipperMenu If true, add skipper menu. +-- @field #number skipperSpeed Speed in knots for manual recovery start. +-- @field #number skipperCase Manual recovery case. +-- @field #boolean skipperUturn U-turn on/off via menu. +-- @field #number skipperTime Recovery time in min for manual recovery. -- @extends Core.Fsm#FSM --- Be the boss! @@ -1229,6 +1234,10 @@ AIRBOSS = { trapprefix = nil, initialmaxalt = nil, welcome = nil, + skipperMenu = nil, + skipperSpeed = nil, + skipperTime = nil, + skipperUturn = nil, } --- Aircraft types capable of landing on carrier (human+AI). @@ -1675,7 +1684,7 @@ AIRBOSS.MenuF10Root=nil --- Airboss class version. -- @field #string version -AIRBOSS.version="1.0.1" +AIRBOSS.version="1.0.2" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -2312,6 +2321,26 @@ function AIRBOSS:SetHoldingOffsetAngle(offset) return self end +--- Enable F10 menu to manually start recoveries. +-- @param #AIRBOSS self +-- @param #number duration Default duration of the recovery in minutes. Default 30 min. +-- @param #number windondeck Default wind on deck in knots. Default 25 knots. +-- @param #boolean uturn U-turn after recovery window closes on=true or off=false/nil. Default off. +-- @return #AIRBOSS self +function AIRBOSS:SetMenuRecovery(duration, windondeck, uturn) + + self.skipperMenu=true + self.skipperTime=duration or 30 + self.skipperSpeed=windondeck or 25 + if uturn then + self.skipperUturn=true + else + self.skipperUturn=false + end + + return self +end + --- Add aircraft recovery time window and recovery case. -- @param #AIRBOSS self -- @param #string starttime Start time, e.g. "8:00" for eight o'clock. Default now. @@ -13478,15 +13507,46 @@ function AIRBOSS._ResumeRoute(group, airboss, gotocoord) -- Waypoints array. local waypoints={} + -- Current position. + local c0=group:GetCoordinate() + -- Current positon as first waypoint. - local wp0=group:GetCoordinate():WaypointGround(speedkmh) + local wp0=c0:WaypointGround(speedkmh) table.insert(waypoints, wp0) -- First goto this coordinate. if gotocoord then + --gotocoord:MarkToAll(string.format("Goto waypoint speed=%.1f km/h", speedkmh)) + + local headingto=c0:HeadingTo(gotocoord) + + local hdg1=airboss:GetHeading() + local hdg2=c0:HeadingTo(gotocoord) + local delta=airboss:_GetDeltaHeading(hdg1, hdg2) + + --env.info(string.format("FF hdg1=%d, hdg2=%d, delta=%d", hdg1, hdg2, delta)) + + + if delta>90 then + + local gotocoordh=c0:Translate(2500, hdg1+45) + --gotocoordh:MarkToAll(string.format("Goto help waypoint 1 speed=%.1f km/h", speedkmh)) + + local wp=gotocoordh:WaypointGround(speedkmh) + table.insert(waypoints, wp) + + gotocoordh=c0:Translate(5000, hdg1+90) + --gotocoordh:MarkToAll(string.format("Goto help waypoint 2 speed=%.1f km/h", speedkmh)) + + wp=gotocoordh:WaypointGround(speedkmh) + table.insert(waypoints, wp) + + end + local wp1=gotocoord:WaypointGround(speedkmh) - table.insert(waypoints, wp1) + table.insert(waypoints, wp1) + end -- Debug message. @@ -15280,6 +15340,29 @@ function AIRBOSS:_AddF10Commands(_unitName) missionCommands.addCommandForGroup(gid, "Greenie Board", _resultsPath, self._DisplayScoreBoard, self, _unitName) -- F1 missionCommands.addCommandForGroup(gid, "My LSO Grades", _resultsPath, self._DisplayPlayerGrades, self, _unitName) -- F2 missionCommands.addCommandForGroup(gid, "Last Debrief", _resultsPath, self._DisplayDebriefing, self, _unitName) -- F3 + + -- F10/Airboss//F2 Kneeboard/F2 Skipper/ + if self.skipperMenu then + local _skipperPath =missionCommands.addSubMenuForGroup(gid, "Skipper", _kneeboardPath) + local _menusetspeed=missionCommands.addSubMenuForGroup(gid, "Set Speed", _skipperPath) + missionCommands.addCommandForGroup(gid, "10 knots", _menusetspeed, self._SkipperRecoverySpeed, self, _unitName, 10) + missionCommands.addCommandForGroup(gid, "15 knots", _menusetspeed, self._SkipperRecoverySpeed, self, _unitName, 15) + missionCommands.addCommandForGroup(gid, "20 knots", _menusetspeed, self._SkipperRecoverySpeed, self, _unitName, 20) + missionCommands.addCommandForGroup(gid, "25 knots", _menusetspeed, self._SkipperRecoverySpeed, self, _unitName, 25) + missionCommands.addCommandForGroup(gid, "30 knots", _menusetspeed, self._SkipperRecoverySpeed, self, _unitName, 30) + local _menusetrtime=missionCommands.addSubMenuForGroup(gid, "Set Time", _skipperPath) + missionCommands.addCommandForGroup(gid, "15 min", _menusetrtime, self._SkipperRecoveryTime, self, _unitName, 15) + missionCommands.addCommandForGroup(gid, "30 min", _menusetrtime, self._SkipperRecoveryTime, self, _unitName, 30) + missionCommands.addCommandForGroup(gid, "45 min", _menusetrtime, self._SkipperRecoveryTime, self, _unitName, 45) + missionCommands.addCommandForGroup(gid, "60 min", _menusetrtime, self._SkipperRecoveryTime, self, _unitName, 60) + missionCommands.addCommandForGroup(gid, "90 min", _menusetrtime, self._SkipperRecoveryTime, self, _unitName, 90) + missionCommands.addCommandForGroup(gid, "U-turn On/Off", _skipperPath, self._SkipperRecoveryUturn, self, _unitName) + missionCommands.addCommandForGroup(gid, "Start CASE I", _skipperPath, self._SkipperStartRecovery, self, _unitName, 1) + missionCommands.addCommandForGroup(gid, "Start CASE II", _skipperPath, self._SkipperStartRecovery, self, _unitName, 2) + missionCommands.addCommandForGroup(gid, "Start CASE III",_skipperPath, self._SkipperStartRecovery, self, _unitName, 3) + missionCommands.addCommandForGroup(gid, "Stop Recovery", _skipperPath, self._SkipperStopRecovery, self, _unitName) + end + -- F10/Airboss/ Date: Mon, 3 Jun 2019 22:58:53 +0200 Subject: [PATCH 10/13] minor --- Moose Development/Moose/Ops/Airboss.lua | 10 +++++++--- Moose Development/Moose/Ops/RecoveryTanker.lua | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 654f9d22e..6d0d68c09 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -3273,7 +3273,7 @@ function AIRBOSS:onafterStatus(From, Event, To) local ExpectedSpeed=UTILS.MpsToKnots(NextWP:GetVelocity()) if speed<0.5 and ExpectedSpeed>0 and not (self.detour or self.turnintowind) then if not self.holdtimestamp then - self:E(self.lid.."Carrier came to an unexpected standstill. Trying to re-route in 3 min.") + self:E(self.lid..string.format("Carrier came to an unexpected standstill. Trying to re-route in 3 min. Speed=%.1f knots, expected=%.1f knots", speed, ExpectedSpeed)) self.holdtimestamp=timer.getTime() else if holdtime>3*60 then @@ -13528,15 +13528,19 @@ function AIRBOSS._ResumeRoute(group, airboss, gotocoord) --env.info(string.format("FF hdg1=%d, hdg2=%d, delta=%d", hdg1, hdg2, delta)) + -- Add additional turn points if delta>90 then + + -- Turn radius 3 NM. + local turnradius=UTILS.NMToMeters(3) - local gotocoordh=c0:Translate(2500, hdg1+45) + local gotocoordh=c0:Translate(turnradius, hdg1+45) --gotocoordh:MarkToAll(string.format("Goto help waypoint 1 speed=%.1f km/h", speedkmh)) local wp=gotocoordh:WaypointGround(speedkmh) table.insert(waypoints, wp) - gotocoordh=c0:Translate(5000, hdg1+90) + gotocoordh=c0:Translate(turnradius, hdg1+90) --gotocoordh:MarkToAll(string.format("Goto help waypoint 2 speed=%.1f km/h", speedkmh)) wp=gotocoordh:WaypointGround(speedkmh) diff --git a/Moose Development/Moose/Ops/RecoveryTanker.lua b/Moose Development/Moose/Ops/RecoveryTanker.lua index 1ad33047f..3c4d781dc 100644 --- a/Moose Development/Moose/Ops/RecoveryTanker.lua +++ b/Moose Development/Moose/Ops/RecoveryTanker.lua @@ -1491,7 +1491,7 @@ function RECOVERYTANKER:_ActivateTACAN(delay) local unit=self.tanker:GetUnit(1) -- Check if unit is alive. - if unit:IsAlive() then + if unit and unit:IsAlive() then -- Debug message. local text=string.format("Activating recovery tanker TACAN beacon: channel=%d mode=%s, morse=%s.", self.TACANchannel, self.TACANmode, self.TACANmorse) From 94f9cb4a79a3bff5678ff7518f126e9a119baebe Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 3 Jun 2019 23:18:54 +0200 Subject: [PATCH 11/13] Update Airboss.lua --- Moose Development/Moose/Ops/Airboss.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 6d0d68c09..e6b13ad69 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -76,6 +76,7 @@ -- * [[MOOSE] Airboss - CASE I Walkthrough in the F/A-18C by TG](https://www.youtube.com/watch?v=o1UrP4Q6PMM) -- * [[MOOSE] Airboss - New LSO/Marshal Voice Overs by Raynor](https://www.youtube.com/watch?v=_Suo68bRu8k) -- * [[MOOSE] Airboss - CASE I, "Until We Go Down" featuring the F-14B by Pikes](https://www.youtube.com/watch?v=ojgHDSw3Doc) +-- * [[MOOSE] Airboss - Skipper Menu](https://youtu.be/awnecCxRoNQ) -- -- ### Lex explaining Boat Ops: -- From bc229f1a8668d03e813e31e8aac208f2ec0bf4d1 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 4 Jun 2019 17:36:23 +0200 Subject: [PATCH 12/13] Update Warehouse.lua --- Moose Development/Moose/Functional/Warehouse.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Functional/Warehouse.lua b/Moose Development/Moose/Functional/Warehouse.lua index 1f6b3d441..802e22275 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -1743,7 +1743,7 @@ _WAREHOUSEDB = { --- Warehouse class version. -- @field #string version -WAREHOUSE.version="0.9.1" +WAREHOUSE.version="0.9.2" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO: Warehouse todo list. From 10bfefdd06872e8c715dc4fc5e384e453f241697 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 8 Jun 2019 23:06:45 +0200 Subject: [PATCH 13/13] pseudoATC - Fixed bug for ReportBR. --- Moose Development/Moose/Functional/PseudoATC.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Functional/PseudoATC.lua b/Moose Development/Moose/Functional/PseudoATC.lua index 17f30ac98..1143b00e8 100644 --- a/Moose Development/Moose/Functional/PseudoATC.lua +++ b/Moose Development/Moose/Functional/PseudoATC.lua @@ -98,7 +98,7 @@ PSEUDOATC.id="PseudoATC | " --- PSEUDOATC version. -- @field #number version -PSEUDOATC.version="0.9.1" +PSEUDOATC.version="0.9.2" ----------------------------------------------------------------------------------------------------------------------------------------- @@ -807,8 +807,9 @@ function PSEUDOATC:ReportBR(GID, UID, position, location) -- Message text. local text=string.format("%s: Bearing %s, Range %s.", location, Bs, Rs) - -- Send message to player group. - MESSAGE:New(text, self.mdur):ToGroup(self.player[id].group) + -- Send message + self:_DisplayMessageToGroup(self.group[GID].player[UID].unit, text, self.mdur, true) + end --- Report altitude above ground level of player unit.