[Add] Function to get the player, for usage in mission stuff.
This commit is contained in:
parent
76bea0092c
commit
67cd35faa5
11
src/ai.c
11
src/ai.c
@ -108,6 +108,7 @@ static int ai_pushtask(lua_State* L); /* pushtask(string, number/point
|
|||||||
static int ai_poptask(lua_State* L); /* poptask() */
|
static int ai_poptask(lua_State* L); /* poptask() */
|
||||||
static int ai_taskname(lua_State* L); /* Number taskname. */
|
static int ai_taskname(lua_State* L); /* Number taskname. */
|
||||||
/* Consult values. */
|
/* Consult values. */
|
||||||
|
static int ai_getplayer(lua_State* L); /* number getPlayer() */
|
||||||
static int ai_gettarget(lua_State* L); /* Pointer gettarget() */
|
static int ai_gettarget(lua_State* L); /* Pointer gettarget() */
|
||||||
static int ai_gettargetid(lua_State* L); /* Number gettargetis() */
|
static int ai_gettargetid(lua_State* L); /* Number gettargetis() */
|
||||||
static int ai_getrndpilot(lua_State* L); /* Number getrndpilot() */
|
static int ai_getrndpilot(lua_State* L); /* Number getrndpilot() */
|
||||||
@ -164,15 +165,16 @@ static const luaL_Reg ai_methods[] = {
|
|||||||
{ "pushtask", ai_pushtask },
|
{ "pushtask", ai_pushtask },
|
||||||
{ "poptask", ai_poptask },
|
{ "poptask", ai_poptask },
|
||||||
{ "taskname", ai_taskname },
|
{ "taskname", ai_taskname },
|
||||||
/* Sanity checks. */
|
/* Is. */
|
||||||
{ "exists", ai_exists },
|
{ "exists", ai_exists },
|
||||||
{ "ismaxvel", ai_ismaxvel },
|
{ "ismaxvel", ai_ismaxvel },
|
||||||
{ "isstopped", ai_isstopped },
|
{ "isstopped", ai_isstopped },
|
||||||
{ "isenemy", ai_isenemy },
|
{ "isenemy", ai_isenemy },
|
||||||
{ "isally", ai_isally },
|
{ "isally", ai_isally },
|
||||||
/* Get's. */
|
|
||||||
{ "incombat", ai_incombat },
|
{ "incombat", ai_incombat },
|
||||||
{ "haslockon", ai_haslockon },
|
{ "haslockon", ai_haslockon },
|
||||||
|
/* Get. */
|
||||||
|
{ "getPlayer", ai_getplayer },
|
||||||
{ "target", ai_gettarget },
|
{ "target", ai_gettarget },
|
||||||
{ "targetid", ai_gettargetid },
|
{ "targetid", ai_gettargetid },
|
||||||
{ "rndpilot", ai_getrndpilot },
|
{ "rndpilot", ai_getrndpilot },
|
||||||
@ -547,6 +549,11 @@ static int ai_taskname(lua_State* L) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ai_getplayer(lua_State* L) {
|
||||||
|
lua_pushnumber(L, PLAYER_ID);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Grab the target pointer. */
|
/* Grab the target pointer. */
|
||||||
static int ai_gettarget(lua_State* L) {
|
static int ai_gettarget(lua_State* L) {
|
||||||
if(cur_pilot->task->dtype == TYPE_PTR) {
|
if(cur_pilot->task->dtype == TYPE_PTR) {
|
||||||
|
Loading…
Reference in New Issue
Block a user