Fixed error in SPAWN:RandomizeTemplate()

-- Units started in wrong x, y position (at the template, instead of at
the master template of the SPAWN).
-- Adjusted x, y and alt to the start position of the first unit of the
master template.
-- Added a test mission Moose_Test_SPAWN_RandomizeTemplate.
-- Regenerated MOOSE.lua
This commit is contained in:
Sven Van de Velde
2016-08-03 20:51:48 +02:00
parent 70f8234cd7
commit 88e280fee3
4 changed files with 27 additions and 9 deletions

View File

@@ -117,7 +117,7 @@ SPAWN = {
-- Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' )
-- @usage local Plane = SPAWN:New( "Plane" ) -- Creates a new local variable that can initiate new planes with the name "Plane#ddd" using the template "Plane" as defined within the ME.
function SPAWN:New( SpawnTemplatePrefix )
local self = BASE:Inherit( self, BASE:New() )
local self = BASE:Inherit( self, BASE:New() ) -- #SPAWN
self:F( { SpawnTemplatePrefix } )
local TemplateGroup = Group.getByName( SpawnTemplatePrefix )
@@ -1095,6 +1095,9 @@ function SPAWN:_RandomizeTemplate( SpawnIndex )
self.SpawnGroups[SpawnIndex].SpawnTemplate.start_time = self.SpawnTemplate.start_time
for UnitID = 1, #self.SpawnGroups[SpawnIndex].SpawnTemplate.units do
self.SpawnGroups[SpawnIndex].SpawnTemplate.units[UnitID].heading = self.SpawnTemplate.units[1].heading
self.SpawnGroups[SpawnIndex].SpawnTemplate.units[UnitID].x = self.SpawnTemplate.units[1].x
self.SpawnGroups[SpawnIndex].SpawnTemplate.units[UnitID].y = self.SpawnTemplate.units[1].y
self.SpawnGroups[SpawnIndex].SpawnTemplate.units[UnitID].alt = self.SpawnTemplate.units[1].alt
end
end