From 1c97eb6f3c75d7e380d279c654bcd1b2d7cce3c3 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 24 Sep 2021 11:04:54 +0200 Subject: [PATCH] SPAWNSTATIC - bugfix on canCargo, mass could be set but not transported into the template spawn --- Moose Development/Moose/Core/SpawnStatic.lua | 34 +++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/Moose Development/Moose/Core/SpawnStatic.lua b/Moose Development/Moose/Core/SpawnStatic.lua index 95b41655d..5fde1c12c 100644 --- a/Moose Development/Moose/Core/SpawnStatic.lua +++ b/Moose Development/Moose/Core/SpawnStatic.lua @@ -138,24 +138,24 @@ SPAWNSTATIC = { -- @return #SPAWNSTATIC self function SPAWNSTATIC:NewFromStatic(SpawnTemplateName, SpawnCountryID) - local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC + local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC - local TemplateStatic, CoalitionID, CategoryID, CountryID = _DATABASE:GetStaticGroupTemplate(SpawnTemplateName) - - if TemplateStatic then - self.SpawnTemplatePrefix = SpawnTemplateName - self.TemplateStaticUnit = UTILS.DeepCopy(TemplateStatic.units[1]) - self.CountryID = SpawnCountryID or CountryID - self.CategoryID = CategoryID - self.CoalitionID = CoalitionID - self.SpawnIndex = 0 - else - error( "SPAWNSTATIC:New: There is no static declared in the mission editor with SpawnTemplatePrefix = '" .. tostring(SpawnTemplateName) .. "'" ) - end + local TemplateStatic, CoalitionID, CategoryID, CountryID = _DATABASE:GetStaticGroupTemplate(SpawnTemplateName) + + if TemplateStatic then + self.SpawnTemplatePrefix = SpawnTemplateName + self.TemplateStaticUnit = UTILS.DeepCopy(TemplateStatic.units[1]) + self.CountryID = SpawnCountryID or CountryID + self.CategoryID = CategoryID + self.CoalitionID = CoalitionID + self.SpawnIndex = 0 + else + error( "SPAWNSTATIC:New: There is no static declared in the mission editor with SpawnTemplatePrefix = '" .. tostring(SpawnTemplateName) .. "'" ) + end self:SetEventPriority( 5 ) - return self + return self end --- Creates the main object to spawn a @{Static} given a template table. @@ -422,7 +422,11 @@ function SPAWNSTATIC:_SpawnStatic(Template, CountryID) end if self.InitCargo~=nil then - Template.isCargo=self.InitCargo + Template.canCargo=self.InitCargo + end + + if self.InitCargoMass~=nil then + Template.mass=self.InitCargoMass end if self.InitLinkUnit then