[Add] ai.cargofree() to lua API.
This commit is contained in:
parent
ca84fe6a3a
commit
5d2f604703
@ -67,6 +67,9 @@ pshield()
|
||||
-- Returns the percentage of shield remaining.
|
||||
-- pilot - Optional pilot id, if not the current pilot is used.
|
||||
|
||||
cargofree()
|
||||
-- Return amount of free space the pilot has.
|
||||
|
||||
// ================
|
||||
// BOOLEAN!
|
||||
// ================
|
||||
|
7
src/ai.c
7
src/ai.c
@ -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_getpos(lua_State* L); // getpos(number)
|
||||
static int ai_minbrakedist(lua_State* L); // Number minbrakedist()
|
||||
static int ai_cargofree(lua_State* L); // Number cargofree().
|
||||
// Boolean expressions.
|
||||
static int ai_exists(lua_State* L); // boolean exists
|
||||
static int ai_ismaxvel(lua_State* L); // Boolean ismaxvel()
|
||||
@ -166,6 +167,7 @@ static const luaL_Reg ai_methods[] = {
|
||||
{ "dist", ai_getdistance },
|
||||
{ "pos", ai_getpos },
|
||||
{ "minbrakedist", ai_minbrakedist },
|
||||
{ "cargofree", ai_cargofree },
|
||||
{ "nearestplanet", ai_getnearestplanet },
|
||||
{ "rndplanet", ai_getrndplanet },
|
||||
// Movement.
|
||||
@ -566,6 +568,11 @@ static int ai_minbrakedist(lua_State* L) {
|
||||
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) {
|
||||
MIN_ARGS(1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user