Lephisto/scripts/ai/API
2013-02-03 14:44:03 +00:00

79 lines
2.0 KiB
Plaintext

// ================
// TASKS!
// ================
pushtask(number pos, string name, int/pointer targer)
-- Pushes a task onto the queue.
-- pos : Place task at the beginning if 0, or end if 1.
-- name : Function name, this is to be defined in the lua file.
-- target : int or pointer containing target info (for example, could be
pilot id or a Vec2).
-- return nil.
poptask()
-- Pops the current task from the list.
-- return nil
taskname()
-- Returns the current task name.
-- return string name of the current task.
// ================
// CONSULT!
// ================
gettarget()
-- Gets the current target.
-- return pointer to the target.
gettargerid()
-- Gets the current targets id.
-- return number of the current target id.
getdist(Vec2 vect)
-- Gets the distance from the position of the Vec2 vect.
-- Vect point to calculate the distance from.
-- return nil.
getpos(number/pilot)
-- Get the pilots position of the current pilots position if no pilot
is specified.
-- pilot ID or poiunter to the pilot to get the position of, if no params are called
it uses the current pilot as target.
-- return Vec2
minbrakedist()
-- Returns the minimum required braking distance assuming all goes well.
-- return number distance needed to brake.
// ================
// MOVEMENT!
// ================
accel(number mod)
-- Accelerates the pilot.
-- mod float that represents acceleration ratio between 0(stopped) and 1(max accel).
-- return nil.
turn(number mod)
-- Turns the pilot.
-- mod float that represents the turning ratio between -1(max right) and 1(max left).
-- return nil.
face(number/Vec2 target, number invert)
-- Turn to face the current target.
-- target pilot ID or Vec2 to face.
-- invert face away if 1
-- return nil
// ================
// MISC!
// ================
createvect(number x, number y)
-- Create a vector from cartesian coords.
-- x coord of the vector.
-- y coord of the vector.
-- return pointer to the Vec2