15 pushtask( number pos, string name, int/pointer target )
16 @desc pushes a task onto the queue
17 @param pos puts it at the beginning if 0, or end if 1
18 @param name is the function name (should be defined in the lua file)
19 @param target is an int or pointer containing target info (can be for example
20 pilot ID or a Vector2d*)
24 @desc pops the current task from the list
28 @desc returns the currnt task's name
29 @return string name of the current task
35 @desc gets the current target
36 @return pointer to the current target
39 @desc gets the current targets ID
40 @return number the current target's ID
43 @desc gets a random target ID
44 @return number to a random target ID
47 @desc gets the distance from the position of the Vector2d vect
48 @param vect point to calculate the distance from
52 @desc gets the pilot's position or the current pilot's position if no pilot is specified
53 @param pilot ID of the pilot to get the position of, if no params are
54 called it uses the current pilot as target
58 @desc returns the minimum required braking distance assuming all goes well
59 @return number distance needed to brake
61 armour( [number pilot] )
62 @desc returns the total amount of armour left
63 @param pilot optional pilot id, if not the current pilot is used
64 @return pilots current amount of armour
66 shield( [number pilot] )
67 @desc returns the total amount of shield left
68 @param pilot optional pilot id, if not the current pilot is used
69 @return pilots current amount of shield
71 parmour( [number pilot] )
72 @desc returns the percent of armour left
73 @param pilot optional pilot id, if not the current pilot is used
74 @return percent of armour the pilot has left
76 pshield( [number pilot] )
77 @desc returns the percent of shield left
78 @param pilot optional pilot id, if not the current pilot is used
79 @return percent of shield the pilot has left
82 @desc returns how much free space the pilot has
83 @return free space of the current pilot (in tons)
89 @desc checks to see if pilot id is vald
90 @param id pilot to check
91 @return true if the pilot is valid
94 @desc checks if velocity is maximum
95 @return true if velocity is maximum, false otherwise
98 @desc checks if is stopped
99 @return true if stopped, false otherwise
102 @desc checks if p is an enemy of current pilot
103 @param p ID of a pilot to see if he is an enemy
104 @return true if p is an enemy
107 @desc checks if p is an ally of the current pilot
108 @param p ID of a pilot to check if he is an ally
109 @return true if p is an ally
111 incombat( [number id] )
112 @desc queries whether a pilot is in combat
113 @param id pilot to check whether is in combat or not, defaults to self
114 @return if pilot is in combat or not
120 accel( [number mod] )
121 @desc accelerates the pilot
122 @param mod float that represents speed to accel to (1. is full speed, 0. is stopped)
126 @desc turns the pilot
127 @param mod float that represents the turning ratio between -1 (max right) and 1 (max left)
130 face( number/Vector2d target, [number invert] )
131 @desc turns to face target
132 @param target pilot ID or Vector2d to face
133 @param invert faces away if 1
134 @return number offset from target in grad
137 @desc makes the pilot brake
141 @desc gets the nearest friendly planet's position
142 @return position to the nearest friendly planet
145 @desc gets the position of a random friendly planet
146 @return position to a random friendly planet
153 @desc makes the pilot be set as either in combat or out of combat (for comm and such)
154 @param b if 0 sets the pilot to be in combat, if 1 or ommitted sets it to be in combat
157 settarget( number target )
158 @desc sets the target for the pilot, should be called each frame
159 @param target pilot to be targetted
163 @desc attempts to set the best secondary weapon (defaults to launchers)
164 @return the type of the secondary weapon set ("None","Weapon","Launcher","Turret")
167 @desc checks to see if the pilot has turrets
168 @return true if the pilot has turrets
170 shoot( [number weapon] )
171 @desc makes the pilot shoot weapons
172 @param weapon weapons to shoot, 1 if primary, 2 if secondary, 3 if both. Defaults to 1.
176 @desc returns the id of the nearest enemy
177 @return Pilot id of the closest enemy or 0 if none is found
183 settimer( number t, number delay )
184 @desc sets timer t to wait for delay ms
185 @param t timer to set
186 @param delay time in ms to wait
190 @desc returns true if time is up for timer t
191 @param t timer to check
192 @return boolean true if timer t is up
198 comm( number id, string message )
199 @desc makes the pilot say something to the pilot of id id
200 @param id id of the pilot to talk to
201 @param message string to say to the player
204 broadcast( string message )
205 @desc makes the pilot broadcast a message to everyone in the system
206 @param message string to say to everyone in the system
213 setcredits( number creds )
214 @desc sets the pilot's credits to creds, only works during create
215 @param creds pilot's credits
218 setcargo( string cargo, number quantity )
219 @desc gives the pilot quantity of cargo, only works during create
220 @param cargo name of cargo to give the pilot
221 @param quantity amount to give the pilot
225 @desc gets the price of the pilot's ship
226 @return the price of the pilot's ship
232 rng( number low, number high )
233 @desc returns a random number between low and high
234 @param low minimum to return
235 @param high maximum to return
236 @return random number between low and high