mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fixed respawn bug in AI_BALANCER + Scheduler bug
AI_BALANCER respawns back the AI. Bug was in the FSM. In a transition, when states are the same, the events SHOULD execute. Added spawn delay interval option API SetSpawnInterval(). Bug that prevented AI_BALANCER to start if multiple AI_BALANCERs is also fixed. Fixed bug in scheduler dispatcher. Multiple schedules for the same scheduler work now too!
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
-- Name: Respawn Test when Destroyed
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 January 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- For the red coalition, 2 client slots are foreseen.
|
||||
-- For those players that have not joined the mission, red AI is spawned.
|
||||
-- The red AI should start patrolling an area.
|
||||
--
|
||||
-- The blue side has SAMs nearby.
|
||||
-- Once the red AI takes off, the red AI is attacked by the blue SAMs.
|
||||
-- Red AI should be killed and once that happens, a Respawn of the group should happen!
|
||||
-- The Respawn happens through the InitCleanUp() API of SPAWN.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. If no player is logging into the red slots, 2 red AI planes should be alive.
|
||||
-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base.
|
||||
-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base.
|
||||
-- 4. Monitor that once a red AI is destroyed, that it ReSpawns...
|
||||
--
|
||||
|
||||
-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup.
|
||||
local RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ):FilterStart()
|
||||
|
||||
-- Define the SPAWN object for the red AI plane template.
|
||||
-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off.
|
||||
-- If a blocked plane exists, this red plane will be ReSpawned.
|
||||
local RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
|
||||
|
||||
-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter.
|
||||
local RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
|
||||
|
||||
function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
|
||||
local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" )
|
||||
local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup )
|
||||
|
||||
|
||||
local Patrol = AI_PATROLZONE:New( PatrolZone, 3000, 6000, 400, 600 )
|
||||
Patrol:ManageFuel( 0.2, 60 )
|
||||
Patrol:SetControllable( AIGroup )
|
||||
Patrol:__Start( 5 )
|
||||
|
||||
end
|
||||
Binary file not shown.
Reference in New Issue
Block a user