From 34b3c13404c466c8f64d198dce914a1e3fa094c2 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 15 Feb 2013 13:00:59 +0000 Subject: Plugins can now bind console commands FS #300 Most console commands are now implemented in the Core plugin. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1214 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Plugin_NewLua.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/Plugin_NewLua.h') diff --git a/source/Plugin_NewLua.h b/source/Plugin_NewLua.h index 529f0e0eb..ab1907a41 100644 --- a/source/Plugin_NewLua.h +++ b/source/Plugin_NewLua.h @@ -72,8 +72,12 @@ public: virtual bool HandleCommand(const AStringVector & a_Split, cPlayer * a_Player) override; + virtual bool HandleConsoleCommand(const AStringVector & a_Split) override; + virtual void ClearCommands(void) override; + virtual void ClearConsoleCommands(void) override; + virtual bool CanAddHook(cPluginManager::PluginHook a_Hook) override; // cWebPlugin override @@ -86,6 +90,9 @@ public: /// Binds the command to call the function specified by a Lua function reference. Simply adds to CommandMap. void BindCommand(const AString & a_Command, int a_FnRef); + /// Binds the console command to call the function specified by a Lua function reference. Simply adds to CommandMap. + void BindConsoleCommand(const AString & a_Command, int a_FnRef); + lua_State* GetLuaState() { return m_LuaState; } cCriticalSection & GetCriticalSection() { return m_CriticalSection; } @@ -98,6 +105,7 @@ protected: typedef std::map CommandMap; CommandMap m_Commands; + CommandMap m_ConsoleCommands; bool PushFunction(const char * a_FunctionName, bool a_bLogError = true); bool CallFunction(int a_NumArgs, int a_NumResults, const char * a_FunctionName ); // a_FunctionName is only used for error messages, nothing else -- cgit v1.2.3