From 4d24eb82be5183b827f3b827c54b93ac67a6081e Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 27 Jan 2025 08:51:17 +0100 Subject: [PATCH 01/13] Update CTLD.lua #CTLD - Add the group name of the extracted group to TroopsExtracted FSM event --- Moose Development/Moose/Ops/CTLD.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index 3ebcd67a2..bdf3a3b5e 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -975,7 +975,7 @@ do -- -- This function is called when a player has re-boarded already deployed troops from the field: -- --- function my_ctld:OnAfterTroopsExtracted(From, Event, To, Group, Unit, Troops) +-- function my_ctld:OnAfterTroopsExtracted(From, Event, To, Group, Unit, Troops, Troopname) -- ... your code here ... -- end -- @@ -1635,7 +1635,8 @@ function CTLD:New(Coalition, Prefixes, Alias) -- @param #string To State. -- @param Wrapper.Group#GROUP Group Group Object. -- @param Wrapper.Unit#UNIT Unit Unit Object. - -- @param #CTLD_CARGO Cargo Cargo troops. + -- @param Wrapper.Group#GROUP Troops extracted. + -- @param #string Troopname Name of the extracted group. -- @return #CTLD self --- FSM Function OnBeforeCratesPickedUp. @@ -1723,7 +1724,8 @@ function CTLD:New(Coalition, Prefixes, Alias) -- @param #string To State. -- @param Wrapper.Group#GROUP Group Group Object. -- @param Wrapper.Unit#UNIT Unit Unit Object. - -- @param #CTLD_CARGO Cargo Cargo troops. + -- @param Wrapper.Group#GROUP Troops extracted. + -- @param #string Troopname Name of the extracted group. -- @return #CTLD self --- FSM Function OnAfterCratesPickedUp. @@ -2533,7 +2535,8 @@ end self:ScheduleOnce(running,self._SendMessage,self,"Troops boarded!", 10, false, Group) self:_SendMessage("Troops boarding!", 10, false, Group) self:_UpdateUnitCargoMass(Unit) - self:__TroopsExtracted(running,Group, Unit, nearestGroup) + local groupname = nearestGroup:GetName() + self:__TroopsExtracted(running,Group, Unit, nearestGroup, groupname) local coord = Unit:GetCoordinate() or Group:GetCoordinate() -- Core.Point#COORDINATE local Point if coord then @@ -6032,8 +6035,9 @@ end -- @param Wrapper.Group#GROUP Group Group Object. -- @param Wrapper.Unit#UNIT Unit Unit Object. -- @param Wrapper.Group#GROUP Troops Troops #GROUP Object. + -- @param #string Groupname Name of the extracted #GROUP. -- @return #CTLD self - function CTLD:onbeforeTroopsExtracted(From, Event, To, Group, Unit, Troops) + function CTLD:onbeforeTroopsExtracted(From, Event, To, Group, Unit, Troops, Groupname) self:T({From, Event, To}) if Unit and Unit:IsPlayer() and self.PlayerTaskQueue then local playername = Unit:GetPlayerName() From a55959dfbb3d0b90132000c40445c73a77513473 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 27 Jan 2025 12:00:25 +0100 Subject: [PATCH 02/13] Update Base.lua Added property functions --- Moose Development/Moose/Core/Base.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index 5de2096a3..76671ffce 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -201,6 +201,7 @@ BASE = { States = {}, Debug = debug, Scheduler = nil, + Properties = {}, } -- @field #BASE.__ @@ -1109,6 +1110,31 @@ function BASE:ClearState( Object, StateName ) end end +--- Set one property of an object. +-- @param #BASE self +-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type! +-- @param Value The value that is stored. Note that the value can be a #string, but it can also be any other type! +function BASE:SetProperty(Key,Value) + self.Properties = self.Properties or {} + self.Properties[Key] = Value +end + +--- Get one property of an object by the key. +-- @param #BASE self +-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type! +-- @return Value The value that is stored. Note that the value can be a #string, but it can also be any other type! Nil if not found. +function BASE:GetProperty(Key) + self.Properties = self.Properties or {} + return self.Properties[Key] +end + +--- Get all of the properties of an object in a table. +-- @param #BASE self +-- @return #table of values, indexed by keys. +function BASE:GetProperties() + return self.Properties +end + -- Trace section -- Log a trace (only shown when trace is on) From bfb60b318eebab9f33a6bfc7f8c3b35a8e8f784e Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 27 Jan 2025 13:27:13 +0100 Subject: [PATCH 03/13] Update CTLD.lua update --- Moose Development/Moose/Ops/CTLD.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index bdf3a3b5e..c9440c657 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -6041,8 +6041,8 @@ end self:T({From, Event, To}) if Unit and Unit:IsPlayer() and self.PlayerTaskQueue then local playername = Unit:GetPlayerName() - local dropcoord = Troops:GetCoordinate() or COORDINATE:New(0,0,0) - local dropvec2 = dropcoord:GetVec2() + --local dropcoord = Troops:GetCoordinate() or COORDINATE:New(0,0,0) + --local dropvec2 = dropcoord:GetVec2() self.PlayerTaskQueue:ForEach( function (Task) local task = Task -- Ops.PlayerTask#PLAYERTASK @@ -6050,7 +6050,7 @@ end -- right subtype? if Event == subtype and not task:IsDone() then local targetzone = task.Target:GetObject() -- Core.Zone#ZONE should be a zone in this case .... - if targetzone and targetzone.ClassName and string.match(targetzone.ClassName,"ZONE") and targetzone:IsVec2InZone(dropvec2) then + if targetzone and targetzone.ClassName and string.match(targetzone.ClassName,"ZONE") and targetzone:GetProperty("Extractname") == Groupname then if task.Clients:HasUniqueID(playername) then -- success task:__Success(-1) From daffd7412acd68b8df2fbbff20530b05d2dc5fd2 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 27 Jan 2025 18:44:35 +0100 Subject: [PATCH 04/13] Update Base.lua --- Moose Development/Moose/Core/Base.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index 76671ffce..b1a12e740 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -1466,4 +1466,3 @@ function BASE:I( Arguments ) end end - From 6af836c118dffd49fdd1bf96efa82eeeef7dfaa7 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 27 Jan 2025 18:45:39 +0100 Subject: [PATCH 05/13] Update CTLD.lua --- Moose Development/Moose/Ops/CTLD.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index c9440c657..5c83896a5 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -5657,7 +5657,7 @@ end self.CargoCounter = self.CargoCounter + 1 cargo.ID = self.CargoCounter cargo.Stock = 1 - table.insert(self.Cargo_Crates,cargo) + table.insert(self.Cargo_Troops,cargo) end if match and CargoObject then @@ -6050,7 +6050,9 @@ end -- right subtype? if Event == subtype and not task:IsDone() then local targetzone = task.Target:GetObject() -- Core.Zone#ZONE should be a zone in this case .... - if targetzone and targetzone.ClassName and string.match(targetzone.ClassName,"ZONE") and targetzone:GetProperty("Extractname") == Groupname then + --self:T2({Name=Groupname,Property=task:GetProperty("ExtractName")}) + local okaygroup = string.find(Groupname,task:GetProperty("ExtractName"),1,true) + if targetzone and targetzone.ClassName and string.match(targetzone.ClassName,"ZONE") and okaygroup then if task.Clients:HasUniqueID(playername) then -- success task:__Success(-1) From 4fd55b1bd6413602adc5ac4d5d7deb9e7037a350 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Tue, 28 Jan 2025 08:31:17 +0100 Subject: [PATCH 06/13] Update Scenery.lua #SCENERY --- Moose Development/Moose/Wrapper/Scenery.lua | 1 + 1 file changed, 1 insertion(+) 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 From 5f7a4f2bbb36ad27d8e23a0520f466bae3e3dafc Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 28 Jan 2025 20:22:45 +0100 Subject: [PATCH 07/13] Update Group.lua - Added way to get the coordinate of the group --- Moose Development/Moose/Wrapper/Group.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index ef0561f84..8b4465f87 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 vec3 + end + + local Units = self:GetUnits() or {} for _,_unit in pairs(Units) do local FirstUnit = _unit -- Wrapper.Unit#UNIT From d9948d1a19dce8440e32adb1722aa3e539970474 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 28 Jan 2025 20:29:35 +0100 Subject: [PATCH 08/13] Update Group.lua --- Moose Development/Moose/Wrapper/Group.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 8b4465f87..aedf6412d 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -1225,7 +1225,7 @@ function GROUP:GetCoordinate() local vec3=self:GetVec3() if vec3 then local coord=COORDINATE:NewFromVec3(vec3) - return vec3 + return coord end local Units = self:GetUnits() or {} From 09d53f7d8c901a96e5566dd928626286dc44ab1c Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Wed, 29 Jan 2025 13:24:04 +0100 Subject: [PATCH 09/13] Update CTLD.lua #CTLD - Added HelicopterLost Event --- Moose Development/Moose/Ops/CTLD.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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 From 4aacdc156736e10a79e323ab07467cc2d119a63b Mon Sep 17 00:00:00 2001 From: Shafik Date: Wed, 29 Jan 2025 14:43:43 +0200 Subject: [PATCH 10/13] [FIXED] attempt to index local 'CleanUpUnit' (a nil value) --- Moose Development/Moose/Functional/CleanUp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Functional/CleanUp.lua b/Moose Development/Moose/Functional/CleanUp.lua index 14616331f..5d975c3ca 100644 --- a/Moose Development/Moose/Functional/CleanUp.lua +++ b/Moose Development/Moose/Functional/CleanUp.lua @@ -384,7 +384,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 From 5ef9bb2acda3e323817cf3909eb6b8f87fec59ac Mon Sep 17 00:00:00 2001 From: Shafik Date: Wed, 29 Jan 2025 14:44:31 +0200 Subject: [PATCH 11/13] [FIXED] attempt to get length of local 'parking' (a nil value) --- 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 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 From 99b93266ad466e417b0c0dbaff9ba791a042cbae Mon Sep 17 00:00:00 2001 From: Fedge <> Date: Wed, 29 Jan 2025 18:47:44 -0700 Subject: [PATCH 12/13] Fixes the AH-64D's FCR enum weapon definition. --- Moose Development/Moose/Utilities/Enums.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Utilities/Enums.lua b/Moose Development/Moose/Utilities/Enums.lua index 59df545e1..ffd2a7deb 100644 --- a/Moose Development/Moose/Utilities/Enums.lua +++ b/Moose Development/Moose/Utilities/Enums.lua @@ -1327,7 +1327,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} --- From 03c30f3ccef48b86e906f7224e7f8ffee24720c4 Mon Sep 17 00:00:00 2001 From: Fedge <> Date: Wed, 29 Jan 2025 18:48:34 -0700 Subject: [PATCH 13/13] Adds the 2 primary APKWS rockets as entries in the `ENUMS.Storage.weapons.missiles` table. I added them to `missiles`, rather than `nurs` because that's where they appear in the mission editor's storage window. --- Moose Development/Moose/Utilities/Enums.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Moose Development/Moose/Utilities/Enums.lua b/Moose Development/Moose/Utilities/Enums.lua index ffd2a7deb..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"