Module pilotai
Pilot AI helper utilities.
Meant for controlling the AI without using explicit pilot#control.
Functions
apply (plts, func) | Applies a function to one or more pilots. |
hyperspace (plts, target) | Makes a pilot try to hyperspace to target while not disabling most functionality. |
patrol (plts, waypoints) | Makes a pilot patrol a set of waypoints indefinately |
guard (plts, pos) | Makes the pilot go to a certain position and guard it. |
clear ([allpilots=false]) | Tries to clear the system by making all the AI pilots go away. |
Functions
- apply (plts, func)
-
Applies a function to one or more pilots.
Parameters:
- plts Pilot or table Pilots to apply command to.
- func function Function to apply to each pilot. Should take a single parameter.
- hyperspace (plts, target)
-
Makes a pilot try to hyperspace to target while not disabling most functionality.
Clears current task.
Parameters:
- plts Pilot or table Pilot or pilots to command.
- target Jump or nil Target jump point. If nil, tries to find a random hyperspace.
- patrol (plts, waypoints)
-
Makes a pilot patrol a set of waypoints indefinately
Parameters:
- plts Pilot or table Pilot or pilots to make patrol.
- waypoints Table Ordered table with the waypoints as Vec2.
- guard (plts, pos)
-
Makes the pilot go to a certain position and guard it. Note that this changes the AI of the pilot.
Parameters:
- plts Pilot or table Pilot or pilots to make guard.
- pos Vec2 Position to guard.
- clear ([allpilots=false])
-
Tries to clear the system by making all the AI pilots go away. Soft alternative to pilot.clear()
Parameters:
- allpilots boolean Wether or not to affect all non-player pilots, or just natural pilots. (default false)