[Change] ai.exists() should return false if pilot is dead.
This commit is contained in:
parent
4e7f7c73e5
commit
562ba56aab
10
src/ai.c
10
src/ai.c
@ -613,13 +613,19 @@ static int ai_cargofree(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ai_exists(lua_State* L) {
|
static int ai_exists(lua_State* L) {
|
||||||
|
Pilot* p;
|
||||||
|
int i;
|
||||||
LLUA_MIN_ARGS(1);
|
LLUA_MIN_ARGS(1);
|
||||||
|
|
||||||
if(lua_isnumber(L,1)) {
|
if(lua_isnumber(L,1)) {
|
||||||
lua_pushboolean(L, (pilot_get((unsigned int)lua_tonumber(L,1)) != NULL)?1:0);
|
i = 1;
|
||||||
|
p = pilot_get((unsigned int)lua_tonumber(L,1));
|
||||||
|
if(p == NULL) i = 0;
|
||||||
|
else if(pilot_isFlag(p, PILOT_DEAD)) i = 0;
|
||||||
|
lua_pushboolean(L, i);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
LLUA_INVALID_PARAMETER();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Are we at max velocity? */
|
/* Are we at max velocity? */
|
||||||
|
Loading…
Reference in New Issue
Block a user