From 93cc48054af5792a0f9d572a354f86056e1e49c4 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Sat, 27 Jun 2020 15:30:23 +0200 Subject: [PATCH] Expose "server" and "dedicated" to Lua scripts Careful! Both are local variables and are always false for clients, and therefore should obviously not be used in anything gamelogic-related. --- src/lua_script.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lua_script.c b/src/lua_script.c index a295256da..5fb153c0e 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -326,6 +326,12 @@ int LUA_PushGlobals(lua_State *L, const char *word) return 0; LUA_PushUserdata(L, &players[secondarydisplayplayer], META_PLAYER); return 1; + } else if (fastcmp(word,"isserver")) { + lua_pushboolean(L, server); + return 1; + } else if (fastcmp(word,"isdedicatedserver")) { + lua_pushboolean(L, dedicated); + return 1; // end local player variables } else if (fastcmp(word,"server")) { if ((!multiplayer || !netgame) && !playeringame[serverplayer])