AI_BALANCER fixes and other stuff

This commit is contained in:
FlightControl
2017-01-07 16:44:41 +01:00
parent fc100716e0
commit 196f85f07b
71 changed files with 117 additions and 59464 deletions

View File

@@ -46,4 +46,4 @@ function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
Patrol:SetControllable( AIGroup )
Patrol:__Start( 5 )
end
end

View File

@@ -1,16 +1,16 @@
RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ):FilterStart()
RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
local US_PlanesClientSet = SET_CLIENT:New():FilterCountries( "USA" ):FilterCategories( "plane" ):FilterStart()
local US_PlanesSpawn = SPAWN:New( "AI US" ):InitCleanUp( 20 )
local US_AI_Balancer = AI_BALANCER:New( US_PlanesClientSet, US_PlanesSpawn )
local RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ):FilterStart()
local RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
local RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
local RU_AirbasesSet = SET_AIRBASE:New():FilterCoalitions("red"):FilterStart()
RU_AirbasesSet = SET_AIRBASE:New():FilterCoalitions("red"):FilterStart()
RU_AirbasesSet:Flush()
RU_AI_Balancer:ReturnToNearestAirbases( 10000, RU_AirbasesSet )
US_PlanesClientSet = SET_CLIENT:New():FilterCountries( "USA" ):FilterCategories( "plane" ):FilterStart()
US_PlanesSpawn = SPAWN:New( "AI US" ):InitCleanUp( 20 )
US_AI_Balancer = AI_BALANCER:New( US_PlanesClientSet, US_PlanesSpawn )
--RU_AI_Balancer:ReturnToHomeAirbase( 10000 )
--local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Blue" )

View File

@@ -12,13 +12,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.
function InfantryCargo:OnAfterLoaded()
function InfantryCargo:OnEnterLoaded()
self:__UnBoard( 1 )
self.OnAfterLoaded = nil
self.OnEnterLoaded = 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()
function InfantryCargo:OnEnterUnLoaded()
self:__Board( 1, CargoCarrierTo )
self.OnAfterUnLoaded = nil
self.OnEnterUnLoaded = nil
end

View File

@@ -17,13 +17,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.
function InfantryCargo:OnAfterLoaded()
function InfantryCargo:OnEnterLoaded()
self:__UnBoard( 1 )
self.OnAfterLoaded = nil
self.OnEnterLoaded = 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()
function InfantryCargo:OnEnterUnLoaded()
self:__Board( 1, CargoCarrierTo )
self.OnAfterUnLoaded = nil
self.OnEnterUnLoaded = nil
end

View File

@@ -35,7 +35,7 @@ Patrol2:ManageFuel( 0.2, 0 )
-- @param #AI_PATROLZONE self
-- @param Wrapper.Group#GROUP AIGroup
-- @return #boolean If false is returned, then the OnAfter state transition function will not be called.
function Patrol1:OnBeforeRTB( AIGroup )
function Patrol1:OnLeaveRTB( AIGroup )
AIGroup:MessageToRed( "Returning to base", 20 )
end
@@ -51,14 +51,14 @@ end
--- State transition function for the PROCESS\_PATROLZONE **Patrol1** object
-- @param Process_PatrolCore.Zone#AI_PATROLZONE self
-- @param Wrapper.Group#GROUP AIGroup
function Patrol1:OnAfterPatrol( AIGroup )
function Patrol1:OnEnterPatrol( AIGroup )
AIGroup:MessageToRed( "Patrolling in zone " .. PatrolZone1:GetName() , 20 )
end
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object
-- @param #AI_PATROLZONE self
-- @param Wrapper.Group#GROUP AIGroup
-- @return #boolean If false is returned, then the OnAfter state transition function will not be called.
-- @return #boolean If false is returned, then the OnEnter state transition function will not be called.
function Patrol2:OnBeforeRTB( AIGroup )
AIGroup:MessageToRed( "Returning to base", 20 )
end
@@ -66,7 +66,7 @@ end
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object
-- @param Process_PatrolCore.Zone#AI_PATROLZONE self
-- @param Wrapper.Group#GROUP AIGroup
function Patrol2:OnAfterRTB( AIGroup )
function Patrol2:OnEnterRTB( AIGroup )
local NewGroup = PatrolSpawn:Spawn()
Patrol1:SetControllable( NewGroup )
Patrol1:__Start( 1 )
@@ -75,6 +75,6 @@ end
--- State transition function for the PROCESS\_PATROLZONE **Patrol2** object
-- @param Process_PatrolCore.Zone#AI_PATROLZONE self
-- @param Wrapper.Group#GROUP AIGroup
function Patrol2:OnAfterPatrol( AIGroup )
function Patrol2:OnEnterPatrol( AIGroup )
AIGroup:MessageToRed( "Patrolling in zone " .. PatrolZone2:GetName() , 20 )
end

View File

@@ -506,7 +506,7 @@ SEADProcess:AddScoreProcess( "Updated", "Account", "Failed", "failed to destroy
SEADProcess:AddScore( "Success", "Destroyed all target radars", 250 )
SEADProcess:AddScore( "Failed", "Failed to destroy all target radars", -100 )
function SEADProcess:OnEnterUpdated(Controllable,From,Event,To)
function SEADProcess:OnEnterUpdated( Controllable, From, Event, To )
self:E( { self } )
self:Account()
self:Smoke()
@@ -517,7 +517,7 @@ end
-- we check if the SEADTask has still AlivePlayers assigned to the Task.
-- If not, the Task will Abort.
-- And it will be Replanned within 30 seconds.
function SEADTask:OnAfterPlayerCrashed( PlayerUnit, PlayerName )
function SEADTask:OnEnterPlayerCrashed( PlayerUnit, PlayerName )
if not SEADTask:HasAliveUnits() then
SEADTask:__Abort()
SEADTask:__Replan( 30 )