mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Expose gamestate to Lua
This commit is contained in:
parent
713b965a85
commit
41d8210fd5
2 changed files with 21 additions and 0 deletions
|
@ -38,6 +38,7 @@
|
|||
#include "lua_script.h"
|
||||
#include "lua_hook.h"
|
||||
#include "d_clisrv.h"
|
||||
#include "g_state.h" // gamestate_t (for lua)
|
||||
|
||||
#include "m_cond.h"
|
||||
|
||||
|
@ -10106,6 +10107,22 @@ struct {
|
|||
{"MA_NOCUTSCENES",MA_NOCUTSCENES},
|
||||
{"MA_INGAME",MA_INGAME},
|
||||
|
||||
// gamestates
|
||||
{"GS_NULL",GS_NULL},
|
||||
{"GS_LEVEL",GS_LEVEL},
|
||||
{"GS_INTERMISSION",GS_INTERMISSION},
|
||||
{"GS_CONTINUING",GS_CONTINUING},
|
||||
{"GS_TITLESCREEN",GS_TITLESCREEN},
|
||||
{"GS_TIMEATTACK",GS_TIMEATTACK},
|
||||
{"GS_CREDITS",GS_CREDITS},
|
||||
{"GS_EVALUATION",GS_EVALUATION},
|
||||
{"GS_GAMEEND",GS_GAMEEND},
|
||||
{"GS_INTRO",GS_INTRO},
|
||||
{"GS_ENDING",GS_ENDING},
|
||||
{"GS_CUTSCENE",GS_CUTSCENE},
|
||||
{"GS_DEDICATEDSERVER",GS_DEDICATEDSERVER},
|
||||
{"GS_WAITINGPLAYERS",GS_WAITINGPLAYERS},
|
||||
|
||||
{NULL,0}
|
||||
};
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "lua_hook.h"
|
||||
|
||||
#include "doomstat.h"
|
||||
#include "g_state.h"
|
||||
|
||||
lua_State *gL = NULL;
|
||||
|
||||
|
@ -361,6 +362,9 @@ int LUA_PushGlobals(lua_State *L, const char *word)
|
|||
} else if (fastcmp(word, "token")) {
|
||||
lua_pushinteger(L, token);
|
||||
return 1;
|
||||
} else if (fastcmp(word, "gamestate")) {
|
||||
lua_pushinteger(L, gamestate);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue