Difference between revisions of "DockingAI"

From Elite Wiki
(Updating BB links)
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:
  
 
  {
 
  {
    "AWAIT_COORDS" = {
+
GLOBAL =
        "APPROACH_START" = ("setStateTo: GO_TO_START");
+
{
        "APPROACH_COORDINATES" = ("setStateTo: GO_TO_COORDS");
+
ENTER =
        "HOLD_POSITION" = (performIdle, "pauseAI: 10.0", "setStateTo: GLOBAL");
+
(
        "DOCKING_ABORTED" = ("setStateTo: ABORT");
+
"dropMessages: DOCKING_ABORTED,FACING_DESTINATION",
        "TRY_AGAIN_LATER" = ("pauseAI: 30.0", "setStateTo: ABORT");
+
"setSpeedTo: 0.0",
        "COLLISION" = ("setStateTo: ABORT");
+
requestDockingCoordinates,
        "RESTART_DOCKING" = ("setStateTo: GLOBAL");
+
"setStateTo: AWAIT_COORDS"
        DOCKED = ("setStateTo: EXIT_SYSTEM");
+
);
        ENTER = ();
+
};
        EXIT = ();  
 
        UPDATE = ();};
 
:
 
  
    ABORT = {
+
"AWAIT_COORDS" =  
        ENTER = (abortDocking, "setSpeedFactorTo: 0.0", setDestinationToDockingAbort, "setDesiredRangeTo: 500.0", performFaceDestination);  
+
{
        "FACING_DESTINATION" = ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 500.0", performFlyToRangeFromDestination);  
+
"APPROACH" = ("setStateTo: APPROACH");
        EXIT = ();  
+
"APPROACH_COORDINATES" = ("setStateTo: GO_TO_COORDS");
        "RESTART_DOCKING" = ("setStateTo: GLOBAL");  
+
"BACK_OFF" = ("setStateTo: RETREAT");
        "REACHED_SAFETY" = (performIdle, "setStateTo: GLOBAL");  
+
"HOLD_POSITION" = ("setStateTo: STATIONKEEPING");
        "DESIRED_RANGE_ACHIEVED" = (performIdle, "setStateTo: GLOBAL");  
+
"DOCKING_ABORTED" = ("setStateTo: ABORT");
        UPDATE = ();     };  
+
"TRY_AGAIN_LATER" = ("pauseAI: 30.0", "setStateTo: ABORT");
 +
"COLLISION" = ("setStateTo: ABORT");
 +
"RESTART_DOCKING" = ("setStateTo: GLOBAL");
 +
"TOO_BIG_TO_DOCK" = ("exitAIWithMessage: DOCKING_REFUSED");
 +
DOCKED = ("setStateTo: EXIT_SYSTEM");
 +
"NO_STATION_FOUND" = ("setStateTo: EXIT_SYSTEM");
 +
UPDATE = ("pauseAI: 2");
 +
};
  
    GLOBAL = {
+
STATIONKEEPING =
        ENTER = ("setSpeedTo: 0.0", "setDesiredRangeTo: 5.0", requestDockingCoordinates, "setStateTo: AWAIT_COORDS");  
+
{
        EXIT = ();  
+
ENTER = (performIdle, "setSpeedTo: 0.0", "pauseAI: 10.0");
        UPDATE = ();     };  
+
ATTACKED = ("setStateTo: ATTACK_SHIP");
 +
"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", "setStateTo: ATTACK_SHIP");
 +
"GROUP_ATTACK_TARGET" = ("setStateTo: ATTACK_SHIP");
 +
UPDATE = (requestDockingCoordinates, "setStateTo: AWAIT_COORDS");
 +
};
  
    "GO_TO_WAYPOINT" = {
+
APPROACH =
        ENTER = ("setDesiredRangeTo: 50.0", checkCourseToDestination);
+
{
        "COURSE_OK" = ("setSpeedFactorTo: 0.85", performFlyToRangeFromDestination);
+
ENTER = (recallDockingInstructions, "setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
        "WAYPOINT_SET" = ("setDesiredRangeTo: 50.0", checkCourseToDestination);
+
"DESIRED_RANGE_ACHIEVED" = (requestDockingCoordinates, "setStateTo: AWAIT_COORDS");
        "DESIRED_RANGE_ACHIEVED" = ("setStateTo: GO_TO_STATION");
+
"DOCKING_ABORTED" = ("setStateTo: ABORT");
        EXIT = ();
+
"COLLISION" = ("setStateTo: ABORT");
        UPDATE = ();   };  
+
ATTACKED = ("setStateTo: ATTACK_SHIP");
 +
"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", "setStateTo: ATTACK_SHIP");
 +
"GROUP_ATTACK_TARGET" = ("setStateTo: ATTACK_SHIP");
 +
"RESTART_DOCKING" = ("setStateTo: GLOBAL");
 +
};
  
    "GO_TO_START" = {
+
RETREAT =
        ENTER = ("setSpeedFactorTo: 0.05", setDestinationFromCoordinates,
+
{
                checkCourseToDestination);
+
ENTER = (recallDockingInstructions, "setSpeedTo: 0.0", setDestinationToDockingAbort, performFaceDestination);
        "WAYPOINT_SET" = ("setStateTo: GO_TO_WAYPOINT");
+
"FACING_DESTINATION" = ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 500.0", performFlyToRangeFromDestination);
        "COURSE_OK" = ("setSpeedFactorTo: 0.25", performFaceDestination);
+
"DESIRED_RANGE_ACHIEVED" = ("setSpeedTo: 0.0", requestDockingCoordinates, "setStateTo: AWAIT_COORDS");
        "FACING_DESTINATION" = ("setDesiredRangeTo: 50.0", "setSpeedFactorTo: 0.85",
+
ATTACKED = ("setStateTo: ATTACK_SHIP");
        performFlyToRangeFromDestination);  
+
"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", "setStateTo: ATTACK_SHIP");
        "DESIRED_RANGE_ACHIEVED" = (requestDockingCoordinates, "setStateTo: AWAIT_COORDS");  
+
"GROUP_ATTACK_TARGET" = ("setStateTo: ATTACK_SHIP");
        "DOCKING_ABORTED" = ("setStateTo: ABORT");  
+
"DOCKING_ABORTED" = ("setStateTo: ABORT");
        "COLLISION" = ("setStateTo: ABORT");  
+
"COLLISION" = ("setStateTo: ABORT");
        "RESTART_DOCKING" = ("setStateTo: GLOBAL");  
+
"RESTART_DOCKING" = ("setStateTo: GLOBAL");
        EXIT = ();
+
};
        UPDATE = (); };
 
  
    "GO_TO_COORDS" = {
+
"GO_TO_COORDS" =
        ENTER = (performFaceDestination);
+
{
        FRUSTRATED = (performIdle, "pauseAI: 5.0", performFaceDestination);  
+
ENTER = (performFaceDestination, dockEscorts);
        "FACING_DESTINATION" = (recallDockingInstructions, performFlyToRangeFromDestination);  
+
"FRUSTRATED" = (performFaceDestination);
        "DESIRED_RANGE_ACHIEVED" = (requestDockingCoordinates, "setStateTo: AWAIT_COORDS");  
+
"FACING_DESTINATION" = (recallDockingInstructions, performFlyToRangeFromDestination);
        "DOCKING_ABORTED" = ("setStateTo: ABORT");  
+
ATTACKED = ("setStateTo: ATTACK_SHIP");
        "COLLISION" = ("setStateTo: ABORT");  
+
"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", "setStateTo: ATTACK_SHIP");
        "RESTART_DOCKING" = ("setStateTo: GLOBAL");  
+
"GROUP_ATTACK_TARGET" = ("setStateTo: ATTACK_SHIP");
        EXIT = ();  
+
"DESIRED_RANGE_ACHIEVED" = (requestDockingCoordinates, "setStateTo: AWAIT_COORDS");
        UPDATE = (); }; }
+
"DOCKING_ABORTED" = ("setStateTo: ABORT");
 +
"COLLISION" = ("setStateTo: ABORT");
 +
"RESTART_DOCKING" = ("setStateTo: GLOBAL");
 +
DOCKED = ("setStateTo: EXIT_SYSTEM");
 +
};
  
    "EXIT_SYSTEM" = {ENTER = (performDocking, exitAI); EXIT = (); UPDATE = (); };
+
ABORT =
 +
{
 +
ENTER = (abortDocking, "setSpeedTo: 0.0", setDestinationToDockingAbort, "setDesiredRangeTo: 500.0", performFaceDestination);
 +
"FACING_DESTINATION" = ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 500.0", performFlyToRangeFromDestination);
 +
"RESTART_DOCKING" = ("setStateTo: GLOBAL");
 +
"REACHED_SAFETY" = (performIdle, "setStateTo: GLOBAL");
 +
"DESIRED_RANGE_ACHIEVED" = (performIdle, "setStateTo: GLOBAL");
 +
ATTACKED = ("setStateTo: ATTACK_SHIP");
 +
"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", "setStateTo: ATTACK_SHIP");
 +
"GROUP_ATTACK_TARGET" = ("setStateTo: ATTACK_SHIP");
 +
};
  
 +
"ATTACK_SHIP" =
 +
{
 +
ENTER = (abortDocking, setTargetToFoundTarget, "setAITo: interceptAI.plist");
 +
RESTARTED = (performIdle, "setStateTo: GLOBAL");
 +
};
 +
 +
"EXIT_SYSTEM" =
 +
{
 +
ENTER = (exitAI);
 +
};
 +
}
 
'''[[AI|BACK]]'''
 
'''[[AI|BACK]]'''
 +
 +
== Links ==
 +
*[https://bb.oolite.space/viewtopic.php?f=4&t=11607 Docking abort by script?] (2012)
 +
*[https://bb.oolite.space/viewtopic.php?f=4&t=21444 Docking Tunnel Length] (2023: is there a point where the dock tunnel is too long?)
 +
:This page was last edited by a developer in 2011!
  
  
[[Category:Oolite]]
+
[[Category:Oolite scripting]]

Latest revision as of 01:35, 29 February 2024

An extremely complex JobAI.

States: ABORT, AWAIT_COORDS, EXIT_SYSTEM, GLOBAL, GO_TO_WAYPOINT, GO_TO_START, GO_TO_COORDS.

{
	GLOBAL =
	{
		ENTER =
		(
			"dropMessages: DOCKING_ABORTED,FACING_DESTINATION",
			"setSpeedTo: 0.0",
			requestDockingCoordinates,
			"setStateTo: AWAIT_COORDS"
		);
	};
	"AWAIT_COORDS" = 
	{
		"APPROACH" = ("setStateTo: APPROACH");
		"APPROACH_COORDINATES" = ("setStateTo: GO_TO_COORDS");
		"BACK_OFF" = ("setStateTo: RETREAT");
		"HOLD_POSITION" = ("setStateTo: STATIONKEEPING");
		"DOCKING_ABORTED" = ("setStateTo: ABORT");
		"TRY_AGAIN_LATER" = ("pauseAI: 30.0", "setStateTo: ABORT");
		"COLLISION" = ("setStateTo: ABORT");
		"RESTART_DOCKING" = ("setStateTo: GLOBAL");
		"TOO_BIG_TO_DOCK" = ("exitAIWithMessage: DOCKING_REFUSED");
		DOCKED = ("setStateTo: EXIT_SYSTEM");
		"NO_STATION_FOUND" = ("setStateTo: EXIT_SYSTEM");
		UPDATE = ("pauseAI: 2");
	};
	STATIONKEEPING =
	{
		ENTER = (performIdle, "setSpeedTo: 0.0", "pauseAI: 10.0");
		ATTACKED = ("setStateTo: ATTACK_SHIP");
		"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", "setStateTo: ATTACK_SHIP");
		"GROUP_ATTACK_TARGET" = ("setStateTo: ATTACK_SHIP");
		UPDATE = (requestDockingCoordinates, "setStateTo: AWAIT_COORDS");
	};
	APPROACH =
	{
		ENTER = (recallDockingInstructions, "setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
		"DESIRED_RANGE_ACHIEVED" = (requestDockingCoordinates, "setStateTo: AWAIT_COORDS");
		"DOCKING_ABORTED" = ("setStateTo: ABORT");
		"COLLISION" = ("setStateTo: ABORT");
		ATTACKED = ("setStateTo: ATTACK_SHIP");
		"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", "setStateTo: ATTACK_SHIP");
		"GROUP_ATTACK_TARGET" = ("setStateTo: ATTACK_SHIP");
		"RESTART_DOCKING" = ("setStateTo: GLOBAL");
	};
	RETREAT =
	{
		ENTER = (recallDockingInstructions, "setSpeedTo: 0.0", setDestinationToDockingAbort, performFaceDestination);
		"FACING_DESTINATION" =  ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 500.0", performFlyToRangeFromDestination);
		"DESIRED_RANGE_ACHIEVED" = ("setSpeedTo: 0.0", requestDockingCoordinates, "setStateTo: AWAIT_COORDS");
		ATTACKED = ("setStateTo: ATTACK_SHIP");
		"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", "setStateTo: ATTACK_SHIP");
		"GROUP_ATTACK_TARGET" = ("setStateTo: ATTACK_SHIP");
		"DOCKING_ABORTED" = ("setStateTo: ABORT");
		"COLLISION" = ("setStateTo: ABORT");
		"RESTART_DOCKING" = ("setStateTo: GLOBAL");
	};
	"GO_TO_COORDS" =
	{
		ENTER = (performFaceDestination, dockEscorts);
		"FRUSTRATED" = (performFaceDestination);
		"FACING_DESTINATION" = (recallDockingInstructions, performFlyToRangeFromDestination);
		ATTACKED = ("setStateTo: ATTACK_SHIP");
		"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", "setStateTo: ATTACK_SHIP");
		"GROUP_ATTACK_TARGET" = ("setStateTo: ATTACK_SHIP");
		"DESIRED_RANGE_ACHIEVED" = (requestDockingCoordinates, "setStateTo: AWAIT_COORDS");
		"DOCKING_ABORTED" = ("setStateTo: ABORT");
		"COLLISION" = ("setStateTo: ABORT");
		"RESTART_DOCKING" = ("setStateTo: GLOBAL");
		DOCKED = ("setStateTo: EXIT_SYSTEM");
	};
	ABORT =
	{
		ENTER = (abortDocking, "setSpeedTo: 0.0", setDestinationToDockingAbort, "setDesiredRangeTo: 500.0", performFaceDestination);
		"FACING_DESTINATION" = ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 500.0", performFlyToRangeFromDestination);
		"RESTART_DOCKING" = ("setStateTo: GLOBAL");
		"REACHED_SAFETY" = (performIdle, "setStateTo: GLOBAL");
		"DESIRED_RANGE_ACHIEVED" = (performIdle, "setStateTo: GLOBAL");
		ATTACKED = ("setStateTo: ATTACK_SHIP");
		"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", "setStateTo: ATTACK_SHIP");
		"GROUP_ATTACK_TARGET" = ("setStateTo: ATTACK_SHIP");
	};
	"ATTACK_SHIP" =
	{
		ENTER = (abortDocking, setTargetToFoundTarget, "setAITo: interceptAI.plist");
		RESTARTED = (performIdle, "setStateTo: GLOBAL");
	};
	"EXIT_SYSTEM" =
	{
		ENTER = (exitAI);
	};
}

BACK

Links

This page was last edited by a developer in 2011!