[Add] ai.cargofree() to lua API.

This commit is contained in:
Allanis 2013-03-17 13:49:25 +00:00
parent ca84fe6a3a
commit 5d2f604703
2 changed files with 10 additions and 0 deletions

View File

@ -67,6 +67,9 @@ pshield()
-- Returns the percentage of shield remaining. -- Returns the percentage of shield remaining.
-- pilot - Optional pilot id, if not the current pilot is used. -- pilot - Optional pilot id, if not the current pilot is used.
cargofree()
-- Return amount of free space the pilot has.
// ================ // ================
// BOOLEAN! // BOOLEAN!
// ================ // ================

View File

@ -107,6 +107,7 @@ static int ai_pshield(lua_State* L); // pshield()
static int ai_getdistance(lua_State* L); // Number getdist(Vec2) static int ai_getdistance(lua_State* L); // Number getdist(Vec2)
static int ai_getpos(lua_State* L); // getpos(number) static int ai_getpos(lua_State* L); // getpos(number)
static int ai_minbrakedist(lua_State* L); // Number minbrakedist() static int ai_minbrakedist(lua_State* L); // Number minbrakedist()
static int ai_cargofree(lua_State* L); // Number cargofree().
// Boolean expressions. // Boolean expressions.
static int ai_exists(lua_State* L); // boolean exists static int ai_exists(lua_State* L); // boolean exists
static int ai_ismaxvel(lua_State* L); // Boolean ismaxvel() static int ai_ismaxvel(lua_State* L); // Boolean ismaxvel()
@ -166,6 +167,7 @@ static const luaL_Reg ai_methods[] = {
{ "dist", ai_getdistance }, { "dist", ai_getdistance },
{ "pos", ai_getpos }, { "pos", ai_getpos },
{ "minbrakedist", ai_minbrakedist }, { "minbrakedist", ai_minbrakedist },
{ "cargofree", ai_cargofree },
{ "nearestplanet", ai_getnearestplanet }, { "nearestplanet", ai_getnearestplanet },
{ "rndplanet", ai_getrndplanet }, { "rndplanet", ai_getrndplanet },
// Movement. // Movement.
@ -566,6 +568,11 @@ static int ai_minbrakedist(lua_State* L) {
return 1; return 1;
} }
static int ai_cargofree(lua_State* L) {
lua_pushnumber(L, cur_pilot->cargo_free);
return 1;
}
static int ai_exists(lua_State* L) { static int ai_exists(lua_State* L) {
MIN_ARGS(1); MIN_ARGS(1);