1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

[CSM] Client side modding

* rename GameScripting to ServerScripting
* Make getBuiltinLuaPath static serverside
* Add on_shutdown callback
* Add on_receiving_chat_message & on_sending_chat_message callbacks
* ScriptApiBase: use IGameDef instead of Server
  This permits to share common attribute between client & server
* Enable mod security in client side modding without conditions
This commit is contained in:
Loic Blot 2017-01-21 15:02:08 +01:00 committed by Loïc Blot
parent c9492b4d37
commit 2efae3ffd7
37 changed files with 488 additions and 64 deletions

View file

@ -55,6 +55,10 @@ extern "C" {
setOriginFromTableRaw(index, __FUNCTION__)
class Server;
#ifndef SERVER
class Client;
#endif
class IGameDef;
class Environment;
class GUIEngine;
class ServerActiveObject;
@ -75,7 +79,11 @@ public:
void addObjectReference(ServerActiveObject *cobj);
void removeObjectReference(ServerActiveObject *cobj);
Server* getServer() { return m_server; }
IGameDef *getGameDef() { return m_gamedef; }
Server* getServer();
#ifndef SERVER
Client* getClient();
#endif
std::string getOrigin() { return m_last_run_mod; }
void setOriginDirect(const char *origin);
@ -98,7 +106,7 @@ protected:
void scriptError(int result, const char *fxn);
void stackDump(std::ostream &o);
void setServer(Server* server) { m_server = server; }
void setGameDef(IGameDef* gamedef) { m_gamedef = gamedef; }
Environment* getEnv() { return m_environment; }
void setEnv(Environment* env) { m_environment = env; }
@ -122,7 +130,7 @@ private:
lua_State* m_luastack;
Server* m_server;
IGameDef* m_gamedef;
Environment* m_environment;
GUIEngine* m_guiengine;
};