Module airship_ai

Source

Structsยง

AirshipRouteContext ๐Ÿ”’
ZoneDistanceTracker ๐Ÿ”’
Tracks airship distance trend from a fixed position. Used for airship traffic control.

Enumsยง

AirshipAvoidanceMode ๐Ÿ”’
Airships can slow down or hold position to avoid collisions with other airships.
AirshipFlightPhase ๐Ÿ”’
The flight phases of an airship. When the airship is loaded from RTSim data there is no โ€œcurrent approach indexโ€, so the โ€˜Resetโ€™ phases are used to get the airship back on the route. The non-โ€˜Resetโ€™ phases are used for the normal flight loop.
DistanceTrend ๐Ÿ”’
DistanceZone ๐Ÿ”’

Functionsยง

approach_target_pos ๐Ÿ”’
Get the target position for airship movement given the target position, the default height above terrain, and the height above terrain for the airship route cruise phase. This samples terrain points aound the target pos to get the maximum terrain altitude in a 200 block radius of the target position (only checking 4 cardinal directions). and returns the input approach_pos with z equal to the maximum terrain alt + height or the default_alt whichever is greater.
fly_airship ๐Ÿ”’
Wrapper for the fly_airship action, so the route context fields can be reset.
fly_airship_inner ๐Ÿ”’
Called from pilot_airship to move the airship along phases of the route and for initial routing after server startup. The bulk of this action is collision-avoidance monitoring. The frequency of the collision-avoidance tests is controlled by the radar_interval parameter. The collision-avoidance logic has the ability to change the airshipโ€™s speed and to hold position.
pilot_airship
The NPC is the airship captain. This action defines the flight loop for the airship. The captain NPC is autonomous and will fly the airship along the assigned route. The routes are established and assigned to the captain NPCs when the world is generated.
resume_route ๐Ÿ”’
Calculates how to resume a route. Called when the server starts up. The airship will be at the approach final point, and this function just needs to figure out to which approach index that correlates. Returns the index of the approach to resume on.