Difference between revisions of "RockHermitAI"
From Elite Wiki
m |
Eric Walch (talk | contribs) (script example from Oolite -> scripting page) |
||
Line 59: | Line 59: | ||
− | [[Category:Oolite]] |
+ | [[Category:Oolite scripting]] |
Latest revision as of 13:15, 2 January 2011
This state machine defines the behaviour (by alert levels) of hermitages. Launches miners, scavengers or defence ships, depending on situation.
Defined states:
- GLOBAL: →IDLE
- IDLE: →CHECK_FOR_DEBRIS, →DEFENSE_MODE
- CHECK_FOR_DEBRIS: →CHECK_FOR_ROCKS, →DEFENSE_MODE
- CHECK_FOR_ROCKS: →IDLE, →DEFENSE_MODE
- DEFENSE_MODE: →IDLE, →CHECK_FOR_DEBRIS
Refered to AI's: none.
{ "DEFENSE_MODE" = { ATTACKED = (setTargetToPrimaryAggressor, increaseAlertLevel); ENTER = (); EXIT = (); "RED_ALERT" = (launchDefenseShip); "YELLOW_ALERT" = ("setStateTo: IDLE"); "CONDITION_YELLOW" = ("setStateTo: IDLE"); "CONDITION_GREEN" = ("setStateTo: CHECK_FOR_DEBRIS"); "INCOMING_MISSILE" = (increaseAlertLevel); "ENERGY_FULL" = ("pauseAI: 20.0", "setStateTo: IDLE"); "TARGET_DESTROYED" = ("pauseAI: 20.0", "setStateTo: IDLE"); "TARGET_LOST" = ("pauseAI: 20.0", "setStateTo: IDLE"); "NO_TARGET" = ("pauseAI: 20.0", "setStateTo: IDLE"); UPDATE = (); };
"CHECK_FOR_DEBRIS" = { ENTER = (); UPDATE = (scanForLoot, "pauseAI: 20.0"); "TARGET_FOUND" = (launchScavenger, "setStateTo: IDLE"); "NOTHING_FOUND" = ("setStateTo: CHECK_FOR_ROCKS", "pauseAI: 20.0"); EXIT = (); ATTACKED = (setTargetToPrimaryAggressor, increaseAlertLevel, "setStateTo: DEFENSE_MODE"); "INCOMING_MISSILE" = (fireECM, increaseAlertLevel); };
"CHECK_FOR_ROCKS" = { ENTER = (); UPDATE = (scanForRocks, "pauseAI: 20.0"); "TARGET_FOUND" = (launchMiner, "setStateTo: IDLE"); "NOTHING_FOUND" = ("setStateTo: IDLE", "pauseAI: 20.0"); EXIT = (); ATTACKED = (setTargetToPrimaryAggressor, increaseAlertLevel, "setStateTo: DEFENSE_MODE"); "INCOMING_MISSILE" = (fireECM, increaseAlertLevel); };
GLOBAL = {ENTER = ("setStateTo: IDLE"); EXIT = (); UPDATE = (); };
IDLE = { ATTACKED = (setTargetToPrimaryAggressor, increaseAlertLevel, "setStateTo: DEFENSE_MODE"); ENTER = (); EXIT = (); "INCOMING_MISSILE" = (increaseAlertLevel); UPDATE = (decreaseAlertLevel, "setStateTo: CHECK_FOR_DEBRIS"); }; }