Naev

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 indefinitely
guard (plts, pos) Makes the pilot go to a certain position and guard it.
setTaunt (plts, tauntmsg) Sets the taunt message of the pilot.
setNoComm (plts, state, msg) Sets the no communication message of a pilot.
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 indefinitely

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.
setTaunt (plts, tauntmsg)
Sets the taunt message of the pilot. Which will only be seen if the player is hostile to them and they are targeted and attacked.

Parameters:

  • plts Pilot or table Pilot or pilots to set taunt of.
  • tauntmsg string or function Message to set as taunt or function that returns message to set as taunt.
setNoComm (plts, state, msg)
Sets the no communication message of a pilot.

Parameters:

  • plts Pilot or table Pilot or pilots to set taunt of.
  • state boolean Whether or not to enable or disable the no communication.
  • msg string Message to use if comm is set to disabled.
clear ([allpilots=false])
Tries to clear the system by making all the AI pilots go away. Soft alternative to pilot.clear()

Parameters:

  • allpilots boolean Whether or not to affect all non-player pilots, or just natural pilots. (default false)
generated by LDoc 1.5.0 Last updated 2025-04-25 01:49:55