Sven Van de Velde c000675471 Progress, changed and reworked protocols
2016-08-14

- Changed Spawn APIs to express Group position and Unit position
randomization.

- Changed the API protocol of SpawnInZone() method.
-- Removed OuterRadius and InnerRadius parameters !!!

- Changed the API protocol of SpawnFromUnit() method.
-- Removed OuterRadius and InnerRadius parameters !!!

- Added InitRandomizeUnits() method, taking 3 parameters:
-- RandomizeUnits given the value true, will randomize the units upon
spawning, false (default) will not randomize the untis.
-- OuterRadius is the outer radius of the band where the units will be
spawned, if RandomizeUnits is true.
-- InnerRadius is the inner radius of the band where the units will not
be spawned, if RandomizeUnits is true.

- Removed SpawnFunction() method.

- Added OnSpawnGroup() method as the new official CallBack function
method to catch when a new function will be called.
-- Documented OnSpawnGroup() method.

- Renamed Limit() method to InitLimit() method.

- Renamed Array() method to InitArray() method.

- Renamed RandomizeRoute() method to InitRandomizeRoute() method.

- Renamed RandomizeTemplate() method to InitRandomizeTemplate() method.

- Reviewed all test missions for the changes executed and made adaptions
where necessary + re-tests.
2016-08-14 21:37:11 +02:00

157 lines
4.9 KiB
Lua

SetVehicles = SET_GROUP:New()
SetVehicles:AddGroupsByName( { "Vehicle A", "Vehicle B", "Vehicle C" } )
SetVehicles:ForEachGroup(
--- @param Group#GROUP MooseGroup
function( MooseGroup )
for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do
local UnitAction = UnitData -- Unit#UNIT
UnitAction:SmokeGreen()
end
end
)
SetBluePlanesGroup = SET_GROUP:New()
:FilterCoalitions( "blue" )
:FilterCategories( "plane" )
:FilterStart()
SetNorthKoreaGroup = SET_GROUP:New()
:FilterCountries( "RUSSIA" )
:FilterStart()
SetSAMGroup = SET_GROUP:New()
:FilterPrefixes( "SAM" )
:FilterStart()
:SetIteratorIntervals( 5, 10 )
SpawnUS_Plane = SPAWN:New( 'Spawn Test USA Plane')
GroupUS_Plane = SpawnUS_Plane:Spawn()
SpawnUS_Vehicle = SPAWN:New( 'Spawn Test USA Vehicle')
GroupUS_Vehicle = SpawnUS_Vehicle:Spawn()
SpawnUS_Ship = SPAWN:New( 'Spawn Test USA Ship')
GroupUS_Ship = SpawnUS_Ship:Spawn()
SpawnRU_Vehicle = SPAWN:New( 'Spawn Test RUSSIA Vehicle')
GroupRU_Vehicle = SpawnRU_Vehicle:Spawn()
SpawnRU_Ship = SPAWN:New( 'Spawn Test RUSSIA Ship')
GroupRU_Ship = SpawnRU_Ship:Spawn()
SpawnM2A2_AttackVehicle = SPAWN:New( 'Spawn Test M2A2 Attack Vehicle' ):InitRandomizeUnits( true, 10, 4 )
SpawnSAM_AttackVehicle = SPAWN:New( 'Spawn Test SAM Attack Vehicle' ):InitRandomizeUnits( true, 10, 4 )
for i = 1, 30 do
GroupM2A2_AttackVehicle = SpawnM2A2_AttackVehicle:SpawnInZone( ZONE:New("Spawn Zone") )
GroupSAM_AttackVehicle = SpawnSAM_AttackVehicle:SpawnInZone( ZONE:New("Spawn Zone") )
end
SetVehicleCompletely = SET_GROUP:New()
:FilterPrefixes( "Spawn Vehicle Zone Completely" )
:FilterStart()
SetVehiclePartly = SET_GROUP:New()
:FilterPrefixes( "Spawn Vehicle Zone Partly" )
:FilterStart()
SetVehicleNot = SET_GROUP:New()
:FilterPrefixes( "Spawn Vehicle Zone Not" )
:FilterStart()
Spawn_Vehicle_Zone_Completely = SPAWN:New( 'Spawn Vehicle Zone Completely' ):InitRandomizeUnits( true, 10, 4)
Spawn_Vehicle_Zone_Partly = SPAWN:New( 'Spawn Vehicle Zone Partly' ):InitRandomizeUnits( true, 10, 4 )
Spawn_Vehicle_Zone_Not = SPAWN:New( 'Spawn Vehicle Zone Not' ):InitRandomizeUnits( true, 10, 4 )
for i = 1, 30 do
Spawn_Vehicle_Zone_Completely:SpawnInZone( ZONE:New("Spawn Zone Completely") )
Spawn_Vehicle_Zone_Partly:SpawnInZone( ZONE:New("Spawn Zone Partly") )
Spawn_Vehicle_Zone_Not:SpawnInZone( ZONE:New("Spawn Zone Not") )
end
--DBBlue:TraceDatabase()
--SCHEDULER:New( DBBluePlanes, DBBluePlanes.Flush, { }, 1 )
--SCHEDULER:New( DBRedVehicles, DBRedVehicles.Flush, { }, 1 )
--SCHEDULER:New( DBShips, DBShips.Flush, { }, 1 )
--SCHEDULER:New( DBBelgium, DBBelgium.Flush, { }, 1 )
--SCHEDULER:New( DBNorthKorea, DBNorthKorea.Flush, { }, 1 )
--SCHEDULER:New( DBKA50Vinson, DBKA50Vinson.Flush, { }, 1 )
--
--SCHEDULER:New( DBBluePlanesGroup, DBBluePlanesGroup.Flush, { }, 1 )
--SCHEDULER:New( DBNorthKoreaGroup, DBNorthKoreaGroup.Flush, { }, 1 )
SetBluePlanesGroup:ForEachGroup(
--- @param Group#GROUP MooseGroup
function( MooseGroup )
for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do
local UnitAction = UnitData -- Unit#UNIT
UnitAction:SmokeBlue()
end
end
)
SetNorthKoreaGroup:ForEachGroup(
--- @param Group#GROUP MooseGroup
function( MooseGroup )
for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do
local UnitAction = UnitData -- Unit#UNIT
UnitAction:SmokeRed()
end
end
)
SetSAMGroup:ForEachGroup(
--- @param Group#GROUP MooseGroup
function( MooseGroup )
for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do
local UnitAction = UnitData -- Unit#UNIT
UnitAction:SmokeOrange()
end
end
)
GroupZoneCompletely = GROUP:FindByName( "Zone Completely" )
GroupZonePartly = GROUP:FindByName( "Zone Partly" )
GroupZoneNot = GROUP:FindByName( "Zone Not" )
ZoneCompletely = ZONE_POLYGON:New( "Zone Completely", GroupZoneCompletely ):SmokeZone( POINT_VEC3.SmokeColor.White )
ZonePartly = ZONE_POLYGON:New( "Zone Partly", GroupZonePartly ):SmokeZone( POINT_VEC3.SmokeColor.White )
ZoneNot = ZONE_POLYGON:New( "Zone Not", GroupZoneNot ):SmokeZone( POINT_VEC3.SmokeColor.White )
SetVehicleCompletely:ForEachGroupCompletelyInZone( ZoneCompletely,
--- @param Group#GROUP MooseGroup
function( MooseGroup )
for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do
local UnitAction = UnitData -- Unit#UNIT
UnitAction:SmokeBlue()
end
end
)
SetVehiclePartly:ForEachGroupPartlyInZone( ZonePartly,
--- @param Group#GROUP MooseGroup
function( MooseGroup )
for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do
local UnitAction = UnitData -- Unit#UNIT
UnitAction:SmokeBlue()
end
end
)
SetVehicleNot:ForEachGroupNotInZone( ZoneNot,
--- @param Group#GROUP MooseGroup
function( MooseGroup )
for UnitId, UnitData in pairs( MooseGroup:GetUnits() ) do
local UnitAction = UnitData -- Unit#UNIT
UnitAction:SmokeBlue()
end
end
)