From 465c39529475f05de19c85299931e5c8ff43cf8a Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 18 Apr 2024 14:41:29 +0200 Subject: [PATCH 1/3] SPAWN - Allow setting of "hidden" options --- Moose Development/Moose/Core/Spawn.lua | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Moose Development/Moose/Core/Spawn.lua b/Moose Development/Moose/Core/Spawn.lua index 8be96a7e7..e9747fc9b 100644 --- a/Moose Development/Moose/Core/Spawn.lua +++ b/Moose Development/Moose/Core/Spawn.lua @@ -1467,6 +1467,30 @@ do -- Delay methods end -- Delay methods +--- Hide the group on the map view (visible to game master slots!). +-- @param #SPAWN self +-- @return #SPAWN The SPAWN object +function SPAWN:InitHiddenOnMap() + self.SpawnHiddenOnMap = true + return self +end + +--- Hide the group on MFDs (visible to game master slots!). +-- @param #SPAWN self +-- @return #SPAWN The SPAWN object +function SPAWN:InitHiddenOnMFD() + self.SpawnHiddenOnMFD = true + return self +end + +--- Hide the group on planner (visible to game master slots!). +-- @param #SPAWN self +-- @return #SPAWN The SPAWN object +function SPAWN:InitHiddenOnPlanner() + self.SpawnHiddenOnPlanner = true + return self +end + --- Will spawn a group based on the internal index. -- Note: This method uses the global _DATABASE object (an instance of @{Core.Database#DATABASE}), which contains ALL initial and new spawned objects in MOOSE. -- @param #SPAWN self @@ -1740,7 +1764,22 @@ function SPAWN:SpawnWithIndex( SpawnIndex, NoBirth ) if self.SpawnInitModu then SpawnTemplate.modulation = self.SpawnInitModu end + + -- hiding options + if self.SpawnHiddenOnPlanner then + SpawnTemplate.hiddenOnPlanner=true + end + if self.SpawnHiddenOnMFD then + SpawnTemplate.hiddenOnMFD=true + end + + if self.SpawnHiddenOnMap then + SpawnTemplate.hidden=true + end + + self:I(SpawnTemplate) + -- Set country, coalition and category. SpawnTemplate.CategoryID = self.SpawnInitCategory or SpawnTemplate.CategoryID SpawnTemplate.CountryID = self.SpawnInitCountry or SpawnTemplate.CountryID From 616690391c8dcb511b009455c4be05971255c0d2 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 18 Apr 2024 14:51:41 +0200 Subject: [PATCH 2/3] SADL/STN conversion fix --- Moose Development/Moose/Core/Database.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Core/Database.lua b/Moose Development/Moose/Core/Database.lua index cbfa62555..bdd3fcaae 100644 --- a/Moose Development/Moose/Core/Database.lua +++ b/Moose Development/Moose/Core/Database.lua @@ -1009,7 +1009,7 @@ function DATABASE:_RegisterGroupTemplate( GroupTemplate, CoalitionSide, Category self.Templates.Groups[GroupTemplateName].CategoryID = CategoryID self.Templates.Groups[GroupTemplateName].CoalitionID = CoalitionSide self.Templates.Groups[GroupTemplateName].CountryID = CountryID - + local UnitNames = {} for unit_num, UnitTemplate in pairs( GroupTemplate.units ) do @@ -1074,7 +1074,7 @@ end -- @param #string unitname Name of the associated unit. -- @return #number Octal function DATABASE:GetNextSTN(octal,unitname) - local first = UTILS.OctalToDecimal(octal) + local first = UTILS.OctalToDecimal(octal) or 0 if self.STNS[first] == unitname then return octal end local nextoctal = 77777 local found = false @@ -1111,7 +1111,7 @@ end -- @param #string unitname Name of the associated unit. -- @return #number Octal function DATABASE:GetNextSADL(octal,unitname) - local first = UTILS.OctalToDecimal(octal) + local first = UTILS.OctalToDecimal(octal) or 0 if self.SADL[first] == unitname then return octal end local nextoctal = 7777 local found = false @@ -2081,7 +2081,7 @@ function DATABASE:_RegisterTemplates() for group_num, Template in pairs(obj_type_data.group) do if obj_type_name ~= "static" and Template and Template.units and type(Template.units) == 'table' then --making sure again- this is a valid group - + self:_RegisterGroupTemplate(Template, CoalitionSide, _DATABASECategory[string.lower(CategoryName)], CountryID) else From b761078c188e1bfec4eee19947a2487ad9ffcd07 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 18 Apr 2024 18:40:59 +0200 Subject: [PATCH 3/3] XXX --- Moose Development/Moose/Core/Database.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Core/Database.lua b/Moose Development/Moose/Core/Database.lua index bdd3fcaae..8f031fdd0 100644 --- a/Moose Development/Moose/Core/Database.lua +++ b/Moose Development/Moose/Core/Database.lua @@ -1685,7 +1685,7 @@ function DATABASE:_EventOnPlayerLeaveUnit( Event ) if Event.IniObjectCategory == 1 then -- Try to get the player name. This can be buggy for multicrew aircraft! - local PlayerName = Event.IniUnit:GetPlayerName() or FindPlayerName(Event.IniUnitName) + local PlayerName = Event.IniPlayerName or Event.IniUnit:GetPlayerName() or FindPlayerName(Event.IniUnitName) if PlayerName then