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
This commit is contained in:
madmaxoft@gmail.com
2013-02-15 13:00:59 +00:00
parent 48d30dfca2
commit 34b3c13404
16 changed files with 825 additions and 235 deletions
+8
View File
@@ -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<AString, int> 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