diff --git a/Moose Development/Moose/Core/Settings.lua b/Moose Development/Moose/Core/Settings.lua index 59f171321..b68eaaeaa 100644 --- a/Moose Development/Moose/Core/Settings.lua +++ b/Moose Development/Moose/Core/Settings.lua @@ -201,6 +201,7 @@ SETTINGS = { ClassName = "SETTINGS", ShowPlayerMenu = true, MenuShort = false, + staticmenu = true, } @@ -457,7 +458,7 @@ do -- SETTINGS -- A2G Coordinate System ------- - local text="A2G Coordinate System" + local text="A2G Coordinate System XXX" if self.MenuShort then text="A2G Coordinates" end @@ -698,29 +699,29 @@ do -- SETTINGS local A2GCoordinateMenu = MENU_GROUP:New( PlayerGroup, "A2G Coordinate System", PlayerMenu ) - if not self:IsA2G_LL_DMS() then + if not self:IsA2G_LL_DMS() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "Lat/Lon Degree Min Sec (LL DMS)", A2GCoordinateMenu, self.MenuGroupA2GSystem, self, PlayerUnit, PlayerGroup, PlayerName, "LL DMS" ) end - if not self:IsA2G_LL_DDM() then + if not self:IsA2G_LL_DDM() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "Lat/Lon Degree Dec Min (LL DDM)", A2GCoordinateMenu, self.MenuGroupA2GSystem, self, PlayerUnit, PlayerGroup, PlayerName, "LL DDM" ) end - if self:IsA2G_LL_DDM() then + if self:IsA2G_LL_DDM() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "LL DDM Accuracy 1", A2GCoordinateMenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 1 ) MENU_GROUP_COMMAND:New( PlayerGroup, "LL DDM Accuracy 2", A2GCoordinateMenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 2 ) MENU_GROUP_COMMAND:New( PlayerGroup, "LL DDM Accuracy 3", A2GCoordinateMenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 3 ) end - if not self:IsA2G_BR() then + if not self:IsA2G_BR() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "Bearing, Range (BR)", A2GCoordinateMenu, self.MenuGroupA2GSystem, self, PlayerUnit, PlayerGroup, PlayerName, "BR" ) end - if not self:IsA2G_MGRS() then + if not self:IsA2G_MGRS() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "Military Grid (MGRS)", A2GCoordinateMenu, self.MenuGroupA2GSystem, self, PlayerUnit, PlayerGroup, PlayerName, "MGRS" ) end - if self:IsA2G_MGRS() then + if self:IsA2G_MGRS() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "MGRS Accuracy 1", A2GCoordinateMenu, self.MenuGroupMGRS_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 1 ) MENU_GROUP_COMMAND:New( PlayerGroup, "MGRS Accuracy 2", A2GCoordinateMenu, self.MenuGroupMGRS_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 2 ) MENU_GROUP_COMMAND:New( PlayerGroup, "MGRS Accuracy 3", A2GCoordinateMenu, self.MenuGroupMGRS_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 3 ) @@ -731,33 +732,33 @@ do -- SETTINGS local A2ACoordinateMenu = MENU_GROUP:New( PlayerGroup, "A2A Coordinate System", PlayerMenu ) - if not self:IsA2A_LL_DMS() then + if not self:IsA2A_LL_DMS() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "Lat/Lon Degree Min Sec (LL DMS)", A2GCoordinateMenu, self.MenuGroupA2GSystem, self, PlayerUnit, PlayerGroup, PlayerName, "LL DMS" ) end - if not self:IsA2A_LL_DDM() then + if not self:IsA2A_LL_DDM() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "Lat/Lon Degree Dec Min (LL DDM)", A2GCoordinateMenu, self.MenuGroupA2GSystem, self, PlayerUnit, PlayerGroup, PlayerName, "LL DDM" ) end - if self:IsA2A_LL_DDM() then + if self:IsA2A_LL_DDM() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "LL DDM Accuracy 1", A2GCoordinateMenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 1 ) MENU_GROUP_COMMAND:New( PlayerGroup, "LL DDM Accuracy 2", A2GCoordinateMenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 2 ) MENU_GROUP_COMMAND:New( PlayerGroup, "LL DDM Accuracy 3", A2GCoordinateMenu, self.MenuGroupLL_DDM_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 3 ) end - if not self:IsA2A_BULLS() then + if not self:IsA2A_BULLS() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "Bullseye (BULLS)", A2ACoordinateMenu, self.MenuGroupA2ASystem, self, PlayerUnit, PlayerGroup, PlayerName, "BULLS" ) end - if not self:IsA2A_BRAA() then + if not self:IsA2A_BRAA() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "Bearing Range Altitude Aspect (BRAA)", A2ACoordinateMenu, self.MenuGroupA2ASystem, self, PlayerUnit, PlayerGroup, PlayerName, "BRAA" ) end - if not self:IsA2A_MGRS() then + if not self:IsA2A_MGRS() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "Military Grid (MGRS)", A2ACoordinateMenu, self.MenuGroupA2ASystem, self, PlayerUnit, PlayerGroup, PlayerName, "MGRS" ) end - if self:IsA2A_MGRS() then + if self:IsA2A_MGRS() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "MGRS Accuracy 1", A2ACoordinateMenu, self.MenuGroupMGRS_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 1 ) MENU_GROUP_COMMAND:New( PlayerGroup, "MGRS Accuracy 2", A2ACoordinateMenu, self.MenuGroupMGRS_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 2 ) MENU_GROUP_COMMAND:New( PlayerGroup, "MGRS Accuracy 3", A2ACoordinateMenu, self.MenuGroupMGRS_AccuracySystem, self, PlayerUnit, PlayerGroup, PlayerName, 3 ) @@ -767,11 +768,11 @@ do -- SETTINGS local MetricsMenu = MENU_GROUP:New( PlayerGroup, "Measures and Weights System", PlayerMenu ) - if self:IsMetric() then + if self:IsMetric() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "Imperial (Miles,Feet)", MetricsMenu, self.MenuGroupMWSystem, self, PlayerUnit, PlayerGroup, PlayerName, false ) end - if self:IsImperial() then + if self:IsImperial() or self.staticmenu then MENU_GROUP_COMMAND:New( PlayerGroup, "Metric (Kilometers,Meters)", MetricsMenu, self.MenuGroupMWSystem, self, PlayerUnit, PlayerGroup, PlayerName, true ) end diff --git a/Moose Development/Moose/Functional/Warehouse.lua b/Moose Development/Moose/Functional/Warehouse.lua index 49f5b509a..f10e7a1fc 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -2082,6 +2082,22 @@ function WAREHOUSE:New(warehouse, alias) -- @param #number Delay Delay in seconds. -- @param #WAREHOUSE.Queueitem Request Information table of the request. + --- On before "Request" user function. The necessary cargo and transport assets will be spawned. Time to set some additional asset parameters. + -- @function [parent=#WAREHOUSE] OnBeforeRequest + -- @param #WAREHOUSE self + -- @param #string From From state. + -- @param #string Event Event. + -- @param #string To To state. + -- @param #WAREHOUSE.Queueitem Request Information table of the request. + + --- On after "Request" user function. The necessary cargo and transport assets were spawned. + -- @function [parent=#WAREHOUSE] OnAfterRequest + -- @param #WAREHOUSE self + -- @param #string From From state. + -- @param #string Event Event. + -- @param #string To To state. + -- @param #WAREHOUSE.Queueitem Request Information table of the request. + --- Triggers the FSM event "Arrived" when a group has arrived at the destination warehouse. -- This function should always be called from the sending and not the receiving warehouse. @@ -3711,7 +3727,11 @@ function WAREHOUSE:onafterAddAsset(From, Event, To, group, ngroups, forceattribu -- Set livery. if liveries then - asset.livery=liveries[math.random(#liveries)] + if type(liveries)=="table" then + asset.livery=liveries[math.random(#liveries)] + else + asset.livery=liveries + end end -- Set skill. @@ -4167,9 +4187,6 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request) -- Set time stamp. Request.timestamp=timer.getAbsTime() - -- Init problem table. - --Pending.assetproblem={} - -- Spawn assets of this request. self:_SpawnAssetRequest(Request) @@ -4255,6 +4272,9 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request) Request.assets[_assetitem.uid]=_assetitem end + + -- Init problem table. + Request.assetproblem={} -- Add request to pending queue. table.insert(self.pending, Request) @@ -5545,9 +5565,14 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol if asset.livery then unit.livery_id = asset.livery end + if asset.skill then unit.skill= asset.skill end + + if asset.payload then + unit.payload=asset.payload + end end diff --git a/Moose Development/Moose/Ops/Squadron.lua b/Moose Development/Moose/Ops/Squadron.lua index 68ea07349..f011a0922 100644 --- a/Moose Development/Moose/Ops/Squadron.lua +++ b/Moose Development/Moose/Ops/Squadron.lua @@ -94,6 +94,12 @@ function SQUADRON:New(squadronname, airbase, tasks) self:AddTransition("Stopped", "Start", "Running") -- Start FSM. self:AddTransition("*", "SquadronStatus", "*") -- SQUADRON status update + + self:AddTransition("*", "DetectedUnit", "*") -- + + self:AddTransition("*", "FlightSpawned", "*") -- + self:AddTransition("*", "FlightAirborne", "*") -- + self:AddTransition("*", "FlightDead", "*") -- ------------------------ --- Pseudo Functions --- diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index ecdc99956..c99154a1b 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -959,3 +959,11 @@ function UTILS.FileExists(file) return nil end end + +--- Checks the current memory usage collectgarbage("count"). Info is printed to the DCS log file. Time stamp is the current mission runtime. +function UTILS.CheckMemory() + local time=timer.getTime() + local clock=UTILS.SecondsToClock(time) + local mem=collectgarbage("count") + env.info(string.format("T=%s Memory usage %d kByte = %.2f MByte", clock, mem, mem/1024)) +end