BIGFIX: InitRandomizeTemplate is now correctly positioning the Spawned Units.

-- Fixed in spawn.lua
-- InitRandomizeTemplate is now correctly positioning the spawned units
according the initial position as modeled in the mission editor.
-- When combining InitRandomizeTemplate with InitRandomizeZone, the
spawned units are still positioned at their initial position according
the position modeled in the mission editor.

-- Added test missions SPA-019 and SPA-020.
This commit is contained in:
Sven Van de Velde
2017-02-24 13:13:24 +01:00
parent f4b4a40d75
commit 152a3a789f
28 changed files with 72 additions and 9 deletions

View File

@@ -1304,10 +1304,12 @@ function SPAWN:_RandomizeTemplate( SpawnIndex )
self.SpawnGroups[SpawnIndex].SpawnTemplate.x = self.SpawnTemplate.x
self.SpawnGroups[SpawnIndex].SpawnTemplate.y = self.SpawnTemplate.y
self.SpawnGroups[SpawnIndex].SpawnTemplate.start_time = self.SpawnTemplate.start_time
local OldX = self.SpawnGroups[SpawnIndex].SpawnTemplate.units[1].x
local OldY = self.SpawnGroups[SpawnIndex].SpawnTemplate.units[1].y
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].x = self.SpawnTemplate.units[1].x + ( self.SpawnGroups[SpawnIndex].SpawnTemplate.units[UnitID].x - OldX )
self.SpawnGroups[SpawnIndex].SpawnTemplate.units[UnitID].y = self.SpawnTemplate.units[1].y + ( self.SpawnGroups[SpawnIndex].SpawnTemplate.units[UnitID].y - OldY )
self.SpawnGroups[SpawnIndex].SpawnTemplate.units[UnitID].alt = self.SpawnTemplate.units[1].alt
end
end