Difference between revisions of "PlanetPatrolAI"

From Elite Wiki
m
(script example from Oolite -> scripting page)
 
Line 56: Line 56:
  
  
[[Category:Oolite]]
+
[[Category:Oolite scripting]]

Latest revision as of 12:19, 2 January 2011

This 5-state AI navigates by waypoints around the planet, inflight it scans for criminals and will do police business.

Defined states:

  • GLOBAL: ->NEXT_COORDS
  • NEXT_COORDS: ->GO_TO_COORDS
  • GO_TO_WAYPOINT: ->GO_TO_COORDS
  • GO_TO_COORDS: ->NEXT_COORDS
  • EXIT_SYSTEM: - docks with station, exitsAI.

This AI refers to InterceptAI.plist and will exit when patroll is complete.


{
   GLOBAL = {
       ENTER = ("setStateTo: NEXT_COORDS"); 
       EXIT = (); 
       UPDATE = ();     }; 
   "NEXT_COORDS" = {
       "APPROACH_COORDINATES" = ("setStateTo: GO_TO_COORDS"); 
       ENTER = (setPlanetPatrolCoordinates); 
       EXIT = (); 
       UPDATE = ();     }; 
   "GO_TO_WAYPOINT" = {
       ENTER = ("setDesiredRangeTo: 50.0", checkCourseToDestination);
       "COURSE_OK" = ("setSpeedFactorTo: 0.4", performFlyToRangeFromDestination);
       "WAYPOINT_SET" = ("setDesiredRangeTo: 50.0", checkCourseToDestination);
       "DESIRED_RANGE_ACHIEVED" = ("setStateTo: GO_TO_COORDS");
       EXIT = ();
       UPDATE = ();
       ATTACKED = (setTargetToPrimaryAggressor, "setAITo: interceptAI.plist"); }; 
   "GO_TO_COORDS" = {
       ENTER = (
       patrolReportIn,
       "setSpeedFactorTo: 0.0",
       setDestinationFromCoordinates, 
       checkCourseToDestination        );
       "WAYPOINT_SET" = ("setStateTo: GO_TO_WAYPOINT");
       "COURSE_OK" = ("setSpeedFactorTo: 0.5", performFlyToRangeFromDestination);
       "DESIRED_RANGE_ACHIEVED" = ("setStateTo: NEXT_COORDS"); 
       EXIT = (); 
       UPDATE = (scanForOffenders, "pauseAI: 7.5");
       "TARGET_FOUND" = (setTargetToFoundTarget, checkTargetLegalStatus); 
       "TARGET_MINOR_OFFENDER" = (markTargetForFines); 
       "TARGET_MARKED" = ("sendTargetCommsMessage: [police-warning]"); 
       "TARGET_OFFENDER" = ("sendTargetCommsMessage: [police-attack-warning]", "setAITo: interceptAI.plist"); 
       "TARGET_FUGITIVE" = ("setAITo: interceptAI.plist"); 
       ATTACKED = (setTargetToPrimaryAggressor, "setAITo: interceptAI.plist"); 	};
   "EXIT_SYSTEM" = {ENTER = (performDocking, exitAI); EXIT = (); UPDATE = (); }; 
}

BACK