diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index fe37e9cd7..b1a12e740 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -1465,4 +1465,4 @@ function BASE:I( Arguments ) env.info( string.format( "%1s:%30s%05d(%s)", "I", self.ClassName, self.ClassID, UTILS.BasicSerialize(Arguments)) ) end -end \ No newline at end of file +end diff --git a/Moose Development/Moose/Functional/CleanUp.lua b/Moose Development/Moose/Functional/CleanUp.lua index f4a391eef..82990f839 100644 --- a/Moose Development/Moose/Functional/CleanUp.lua +++ b/Moose Development/Moose/Functional/CleanUp.lua @@ -387,7 +387,7 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule() local CleanUpUnit = CleanUpListData.CleanUpUnit -- Wrapper.Unit#UNIT local CleanUpGroupName = CleanUpListData.CleanUpGroupName - if CleanUpUnit:IsAlive() ~= nil then + if CleanUpUnit and CleanUpUnit:IsAlive() ~= nil then if self:IsInAirbase( CleanUpUnit:GetVec2() ) then diff --git a/Moose Development/Moose/Functional/Warehouse.lua b/Moose Development/Moose/Functional/Warehouse.lua index 3c812686d..29682074f 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -6047,7 +6047,7 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol else - if #parking<#template.units and not airstart then + if parking and #parking<#template.units and not airstart then local text=string.format("ERROR: Not enough parking! Free parking = %d < %d aircraft to be spawned.", #parking, #template.units) self:_DebugMessage(text) return nil diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index 5c83896a5..b5c7d9e19 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -1422,6 +1422,7 @@ function CTLD:New(Coalition, Prefixes, Alias) self:AddTransition("*", "CratesRepaired", "*") -- CTLD repair event. self:AddTransition("*", "CratesBuildStarted", "*") -- CTLD build event. self:AddTransition("*", "CratesRepairStarted", "*") -- CTLD repair event. + self:AddTransition("*", "HelicopterLost", "*") -- CTLD lost event. self:AddTransition("*", "Load", "*") -- CTLD load event. self:AddTransition("*", "Loaded", "*") -- CTLD load event. self:AddTransition("*", "Save", "*") -- CTLD save event. @@ -1831,6 +1832,24 @@ function CTLD:New(Coalition, Prefixes, Alias) -- @param #string To State. -- @param Wrapper.Group#GROUP Group Group Object. -- @param Wrapper.Unit#UNIT Unit Unit Object. + + --- FSM Function OnBeforeHelicopterLost. + -- @function [parent=#CTLD] OnBeforeHelicopterLost + -- @param #CTLD self + -- @param #string From State. + -- @param #string Event Trigger. + -- @param #string To State. + -- @param #string Unitname The name of the unit lost. + -- @param #table LostCargo Table of #CTLD_CARGO object which were aboard the helicopter/transportplane lost. Can be an empty table! + + --- FSM Function OnAfterHelicopterLost. + -- @function [parent=#CTLD] OnAfterHelicopterLost + -- @param #CTLD self + -- @param #string From State. + -- @param #string Event Trigger. + -- @param #string To State. + -- @param #string Unitname The name of the unit lost. + -- @param #table LostCargo Table of #CTLD_CARGO object which were aboard the helicopter/transportplane lost. Can be an empty table! --- FSM Function OnAfterLoad. -- @function [parent=#CTLD] OnAfterLoad @@ -1972,6 +1991,10 @@ function CTLD:_EventHandler(EventData) elseif event.id == EVENTS.PlayerLeaveUnit or event.id == EVENTS.UnitLost then -- remove from pilot table local unitname = event.IniUnitName or "none" + if self.CtldUnits[unitname] then + local lostcargo = UTILS.DeepCopy(self.Loaded_Cargo[unitname] or {}) + self:__HelicopterLost(1,unitname,lostcargo) + end self.CtldUnits[unitname] = nil self.Loaded_Cargo[unitname] = nil self.MenusDone[unitname] = nil diff --git a/Moose Development/Moose/Utilities/Enums.lua b/Moose Development/Moose/Utilities/Enums.lua index 59df545e1..a269fb972 100644 --- a/Moose Development/Moose/Utilities/Enums.lua +++ b/Moose Development/Moose/Utilities/Enums.lua @@ -1279,6 +1279,8 @@ ENUMS.Storage.weapons.nurs.S_5M = "weapons.nurs.S_5M" ENUMS.Storage.weapons.missiles.AGM_12A = "weapons.missiles.AGM_12A" ENUMS.Storage.weapons.droptanks.JAYHAWK_120_Fuel_Tank = "weapons.droptanks.JAYHAWK_120_Fuel_Tank" ENUMS.Storage.weapons.bombs.GBU_15_V_1_B = "weapons.bombs.GBU_15_V_1_B" +ENUMS.Storage.weapons.missiles.HYDRA_70_M151_APKWS = {4,4,8,292} +ENUMS.Storage.weapons.missiles.HYDRA_70_M282_APKWS = {4,4,8,293} -- dupes with typos ENUMS.Storage.weapons.bombs.BAP100 = "weapons.bombs.BAP_100" ENUMS.Storage.weapons.bombs.BLU3B_GROUP = "weapons.bombs.BLU-3B_GROUP" @@ -1327,7 +1329,7 @@ ENUMS.Storage.weapons.OH58.Smk_Grenade_Violet = {4,5,9,490} ENUMS.Storage.weapons.OH58.Smk_Grenade_White = {4,5,9,492} ENUMS.Storage.weapons.OH58.Smk_Grenade_Yellow = {4,5,9,491} -- Apache -ENUMS.Storage.weapons.AH64D.AN_APG78 = {4,15,44,2138} +ENUMS.Storage.weapons.AH64D.AN_APG78 = {4,15,44,2114} ENUMS.Storage.weapons.AH64D.Internal_Aux_FuelTank = {1,3,43,1700} --- diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index ef0561f84..aedf6412d 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -1221,7 +1221,14 @@ end -- @return Core.Point#COORDINATE The COORDINATE of the GROUP. function GROUP:GetCoordinate() - local Units = self:GetUnits() or {} + -- First try to get the 3D vector of the group. This uses + local vec3=self:GetVec3() + if vec3 then + local coord=COORDINATE:NewFromVec3(vec3) + return coord + end + + local Units = self:GetUnits() or {} for _,_unit in pairs(Units) do local FirstUnit = _unit -- Wrapper.Unit#UNIT diff --git a/Moose Development/Moose/Wrapper/Scenery.lua b/Moose Development/Moose/Wrapper/Scenery.lua index eb69e7ab4..9c6b02516 100644 --- a/Moose Development/Moose/Wrapper/Scenery.lua +++ b/Moose Development/Moose/Wrapper/Scenery.lua @@ -91,6 +91,7 @@ function SCENERY:SetProperty(PropertyName, PropertyValue) self.Properties[PropertyName] = PropertyValue return self end + --- Obtain object name. --@param #SCENERY self --@return #string Name