1
0

Completely removed support for old style Lua plugins (can use both Plugin and NewPlugin in settings.ini for now)

Removed cPlugin_Lua, obviously
cPluginManager stores plugins by their (folder)name
cPluginManager now scans the Plugins folder for potential plugins and adds them as non-loaded plugins
Added a DisablePlugin and LoadPlugin to disable and load plugins on a per-plugin basis instead of all at once
cPluginManager::FindPlugins refreshes the plugin list by removing non-existing plugins and adding new plugins
Made it incredibly easy to use new plugins from the WebAdmin
Exposed some food/hunger related functions in cPlayer to Lua

git-svn-id: http://mc-server.googlecode.com/svn/trunk@959 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
faketruth
2012-10-13 23:34:47 +00:00
parent b4ca06b9d9
commit 41ba1a7642
19 changed files with 638 additions and 570 deletions

View File

@@ -521,17 +521,27 @@ static int tolua_cPluginManager_GetAllPlugins(lua_State* tolua_S)
{
cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0);
const cPluginManager::PluginList & AllPlugins = self->GetAllPlugins();
const cPluginManager::PluginMap & AllPlugins = self->GetAllPlugins();
lua_createtable(tolua_S, AllPlugins.size(), 0);
lua_newtable(tolua_S);
//lua_createtable(tolua_S, AllPlugins.size(), 0);
int newTable = lua_gettop(tolua_S);
int index = 1;
cPluginManager::PluginList::const_iterator iter = AllPlugins.begin();
cPluginManager::PluginMap::const_iterator iter = AllPlugins.begin();
while(iter != AllPlugins.end())
{
const cPlugin* Plugin = *iter;
tolua_pushusertype( tolua_S, (void*)Plugin, "const cPlugin" );
lua_rawseti(tolua_S, newTable, index);
const cPlugin* Plugin = iter->second;
tolua_pushstring( tolua_S, iter->first.c_str() );
if( Plugin != NULL )
{
tolua_pushusertype( tolua_S, (void*)Plugin, "const cPlugin" );
}
else
{
tolua_pushboolean(tolua_S, 0);
}
//lua_rawseti(tolua_S, newTable, index);
lua_rawset(tolua_S, -3);
++iter;
++index;
}