Cargo Group is working...

This commit is contained in:
FlightControl
2016-09-01 12:52:02 +02:00
parent 0edb083d5d
commit dac29f6356
138 changed files with 2478 additions and 58237 deletions

View File

@@ -0,0 +1,18 @@
local Mission = MISSION:New( "Transfer Cargo", "High", "Test for Cargo", coalition.side.RED )
local CargoSet = SET_BASE:New()
CargoSet:Add( "Engineer1", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer1" ), "Engineers", "Engineer", 81, 2000, 25 ) )
CargoSet:Add( "Engineer2", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer2" ), "Engineers", "Engineer", 64, 2000, 25 ) )
CargoSet:Add( "Engineer3", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer3" ), "Engineers", "Engineer", 72, 2000, 25 ) )
CargoSet:Add( "Engineer4", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer4" ), "Engineers", "Engineer", 69, 2000, 25 ) )
local InfantryCargo = CARGO_GROUPED:New( CargoSet, "Engineers", "Engineers", 2000, 25 )
local CargoCarrier = UNIT:FindByName( "Carrier" )
-- This call will make the Cargo run to the CargoCarrier.
-- Upon arrival at the CargoCarrier, the Cargo will be Loaded into the Carrier.
-- This process is now fully automated.
InfantryCargo:Board( CargoCarrier )

View File

@@ -0,0 +1,31 @@
local Mission = MISSION:New( "Transfer Cargo", "High", "Test for Cargo", coalition.side.RED )
local CargoSet = SET_BASE:New()
CargoSet:Add( "Engineer1", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer1" ), "Engineers", "Engineer", 81, 2000, 25 ) )
CargoSet:Add( "Engineer2", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer2" ), "Engineers", "Engineer", 64, 2000, 25 ) )
CargoSet:Add( "Engineer3", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer3" ), "Engineers", "Engineer", 72, 2000, 25 ) )
CargoSet:Add( "Engineer4", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer4" ), "Engineers", "Engineer", 69, 2000, 25 ) )
local InfantryCargo = CARGO_GROUPED:New( CargoSet, "Engineers", "Engineers", 2000, 25 )
local CargoCarrierFrom = UNIT:FindByName( "CarrierFrom" )
local CargoCarrierTo = UNIT:FindByName( "CarrierTo" )
-- This call will make the Cargo run to the CargoCarrier.
-- Upon arrival at the CargoCarrier, the Cargo will be Loaded into the Carrier.
-- This process is now fully automated.
InfantryCargo:Board( CargoCarrierFrom )
-- Once the Cargo has been loaded into the Carrier, drive to a point and unload the Cargo.
function InfantryCargo:OnAfterLoaded()
self:__UnBoard( 1 )
self.OnAfterLoaded = nil
end
-- Once the Cargo has been unloaded from the Carrier (the Cargo has arrived to the unload gathering point), OnBoard the Cargo in the other Carrier.
function InfantryCargo:OnAfterUnLoaded()
self:__Board( 1, CargoCarrierTo )
self.OnAfterUnLoaded = nil
end

View File

@@ -0,0 +1,18 @@
local Mission = MISSION:New( "Transfer Cargo", "High", "Test for Cargo", coalition.side.RED )
local CargoSet = SET_BASE:New()
CargoSet:Add( "Engineer1", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer1" ), "Engineers", "Engineer", 81, 2000, 25 ) )
CargoSet:Add( "Engineer2", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer2" ), "Engineers", "Engineer", 64, 2000, 25 ) )
CargoSet:Add( "Engineer3", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer3" ), "Engineers", "Engineer", 72, 2000, 25 ) )
CargoSet:Add( "Engineer4", CARGO_UNIT:New( Mission, UNIT:FindByName( "Engineer4" ), "Engineers", "Engineer", 69, 2000, 25 ) )
local InfantryCargo = CARGO_GROUPED:New( CargoSet, "Engineers", "Engineers", 2000, 25 )
local CargoCarrier = UNIT:FindByName( "Carrier" )
-- This will Load immediately the Cargo into the Carrier, regardless where the Cargo is.
InfantryCargo:Load( CargoCarrier )
-- This will Unboard the Cargo from the Carrier.
InfantryCargo:UnBoard()

View File

@@ -14,15 +14,13 @@ local CargoCarrierTo = UNIT:FindByName( "CarrierTo" )
InfantryCargo:Board( CargoCarrierFrom )
-- Once the Cargo has been loaded into the Carrier, drive to a point and unload the Cargo.
InfantryCargo:OnLoaded(
function( Cargo )
Cargo:UnLoad()
end
)
function InfantryCargo:OnAfterLoaded()
self:__UnBoard( 1 )
self.OnAfterLoaded = nil
end
-- Once the Cargo has been unloaded from the Carrier (the Cargo has arrived to the unload gathering point), OnBoard the Cargo in the other Carrier.
InfantryCargo:OnUnLoaded(
function( Cargo )
Cargo:Board( CargoCarrierTo )
end
)
function InfantryCargo:OnAfterUnLoaded()
self:__Board( 1, CargoCarrierTo )
self.OnAfterUnLoaded = nil
end

View File

@@ -6,8 +6,8 @@ local InfantryCargo = CARGO_UNIT:New( Mission, CargoEngineer, "Engineer", "Engin
local CargoCarrier = UNIT:FindByName( "Carrier" )
-- This will Load the Cargo into the Carrier, regardless where the Cargo is.
-- This will Load immediately the Cargo into the Carrier, regardless where the Cargo is.
InfantryCargo:Load( CargoCarrier )
-- This will Unboard the Cargo from the Carrier.
InfantryCargo:UnLoad()
InfantryCargo:UnBoard()

View File

@@ -1,6 +1,6 @@
-- This test mission models the behaviour of the AI_PATROLZONE class.
-- This test mission models the behaviour of the PROCESS_PATROLZONE class.
--
-- It creates a 2 AI_PATROLZONE objects with the name Patrol1 and Patrol2.
-- It creates a 2 PROCESS_PATROLZONE objects with the name Patrol1 and Patrol2.
-- Patrol1 will govern a GROUP object to patrol the zone defined by PatrolZone1, within 3000 meters and 6000 meters, within a speed of 400 and 600 km/h.
-- When the GROUP object that is assigned to Patrol has fuel below 20%, the GROUP object will orbit for 60 secondes, before returning to base.
--
@@ -23,24 +23,24 @@ local PatrolZone2 = ZONE_POLYGON:New( "Patrol Zone 2", PatrolZoneGroup2 )
local PatrolSpawn = SPAWN:New( "Patrol Group" )
local PatrolGroup = PatrolSpawn:Spawn()
local Patrol1 = AI_PATROLZONE:New( PatrolZone1, 3000, 6000, 400, 600 )
local Patrol1 = PROCESS_PATROLZONE:New( PatrolZone1, 3000, 6000, 400, 600 )
Patrol1:ManageFuel( 0.2, 60 )
Patrol1:SetControllable( PatrolGroup )
Patrol1:__Start( 5 )
local Patrol2 = AI_PATROLZONE:New( PatrolZone2, 600, 1000, 300, 400 )
local Patrol2 = PROCESS_PATROLZONE:New( PatrolZone2, 600, 1000, 300, 400 )
Patrol2:ManageFuel( 0.2, 0 )
--- State transition function for the AI\_PATROLZONE **Patrol1** object
-- @param #AI_PATROLZONE self
--- State transition function for the PROCESS\_PATROLZONE **Patrol1** object
-- @param #PROCESS_PATROLZONE self
-- @param Group#GROUP AIGroup
-- @return #boolean If false is returned, then the OnAfter state transition function will not be called.
function Patrol1:OnBeforeRTB( AIGroup )
AIGroup:MessageToRed( "Returning to base", 20 )
end
--- State transition function for the AI\_PATROLZONE **Patrol1** object
-- @param AI_PatrolZone#AI_PATROLZONE self
--- State transition function for the PROCESS\_PATROLZONE **Patrol1** object
-- @param Process_PatrolZone#PROCESS_PATROLZONE self
-- @param Group#GROUP AIGroup
function Patrol1:OnAfterRTB( AIGroup )
local NewGroup = PatrolSpawn:Spawn()
@@ -48,23 +48,23 @@ function Patrol1:OnAfterRTB( AIGroup )
Patrol2:__Start( 1 )
end
--- State transition function for the AI\_PATROLZONE **Patrol1** object
-- @param AI_PatrolZone#AI_PATROLZONE self
--- State transition function for the PROCESS\_PATROLZONE **Patrol1** object
-- @param Process_PatrolZone#PROCESS_PATROLZONE self
-- @param Group#GROUP AIGroup
function Patrol1:OnAfterPatrol( AIGroup )
AIGroup:MessageToRed( "Patrolling in zone " .. PatrolZone1:GetName() , 20 )
end
--- State transition function for the AI\_PATROLZONE **Patrol2** object
-- @param #AI_PATROLZONE self
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object
-- @param #PROCESS_PATROLZONE self
-- @param Group#GROUP AIGroup
-- @return #boolean If false is returned, then the OnAfter state transition function will not be called.
function Patrol2:OnBeforeRTB( AIGroup )
AIGroup:MessageToRed( "Returning to base", 20 )
end
--- State transition function for the AI\_PATROLZONE **Patrol2** object
-- @param AI_PatrolZone#AI_PATROLZONE self
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object
-- @param Process_PatrolZone#PROCESS_PATROLZONE self
-- @param Group#GROUP AIGroup
function Patrol2:OnAfterRTB( AIGroup )
local NewGroup = PatrolSpawn:Spawn()
@@ -72,8 +72,8 @@ function Patrol2:OnAfterRTB( AIGroup )
Patrol1:__Start( 1 )
end
--- State transition function for the AI\_PATROLZONE **Patrol2** object
-- @param AI_PatrolZone#AI_PATROLZONE self
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object
-- @param Process_PatrolZone#PROCESS_PATROLZONE self
-- @param Group#GROUP AIGroup
function Patrol2:OnAfterPatrol( AIGroup )
AIGroup:MessageToRed( "Patrolling in zone " .. PatrolZone2:GetName() , 20 )