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

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170224_1222' )
env.info( 'Moose Generation Timestamp: 20170224_1309' )
local base = _G
Include = {}
@ -20115,10 +20115,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

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170224_1222' )
env.info( 'Moose Generation Timestamp: 20170224_1309' )
local base = _G
Include = {}
@ -20115,10 +20115,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

View File

@ -1,6 +1,7 @@
---
-- Name: SPA-018 - Ground Ops - Randomize Templates
-- Author: FlightControl
-- Date Created: 10 January 2017
-- Date Created: 10 Jan 2017
--
-- # Situation:
--

View File

@ -0,0 +1,27 @@
---
-- Name: SPA-019 - Ground Ops - Randomize Templates with Waypoints
-- Author: FlightControl
-- Date Created: 24 Feb 2017
--
-- # Situation:
--
-- At Gudauta spawn multiple ground vehicles, in a scheduled fashion.
--
-- # Test cases:
--
-- 1. Observe that the ground vehicles are spawned with randomized templates.
-- 2. Observe that the ground vehicles are spread around the spawning area and are not stacked upon each other.
-- Tests Gudauta
-- -------------
-- Create a zone table of the 2 zones.
ZoneTable = { ZONE:New( "Zone1" ), ZONE:New( "Zone2" ) }
TemplateTable = { "A", "B", "C" }
Spawn_Vehicle_1 = SPAWN:New( "Spawn Vehicle 1" )
:InitLimit( 10, 10 )
:InitRandomizeTemplate( TemplateTable )
:SpawnScheduled( 5, .5 )

View File

@ -0,0 +1,29 @@
---
-- Name: SPA-020 - Ground Ops - Randomize Templates in Random Zones without Waypoints
-- Author: FlightControl
-- Date Created: 24 Feb 2017
--
-- # Situation:
--
-- At Gudauta spawn multiple ground vehicles, in a scheduled fashion.
--
-- # Test cases:
--
-- 1. Observe that the ground vehicles are spawned with randomized templates.
-- 2. Observe that the ground vehicles are spread around the spawning area and are not stacked upon each other.
-- 3. Observe that the ground vehicles are spread over the random zones, and that the initial templates formations are kept.
-- Tests Gudauta
-- -------------
-- Create a zone table of the 2 zones.
ZoneTable = { ZONE:New( "Zone1" ), ZONE:New( "Zone2" ) }
TemplateTable = { "A", "B", "C" }
Spawn_Vehicle_1 = SPAWN:New( "Spawn Vehicle 1" )
:InitLimit( 100, 10 )
:InitRandomizeTemplate( TemplateTable )
:InitRandomizeZones( ZoneTable )
:SpawnScheduled( 5, .5 )