Implemented optional support for the ConfigList plugin. It will execute the "zr_post_exec" list right before post map configs if it exists. Example usage in randommode.cfg and swarm.cfg.
This commit is contained in:
@ -174,6 +174,24 @@ public OnAllPluginsLoaded()
|
||||
{
|
||||
// Forward event to modules.
|
||||
WeaponsOnAllPluginsLoaded();
|
||||
ConfigOnAllPluginsLoaded();
|
||||
}
|
||||
|
||||
/**
|
||||
* A library was added.
|
||||
*/
|
||||
public OnLibraryAdded(const String:name[])
|
||||
{
|
||||
// Forward event to modules.
|
||||
ConfigOnLibraryAdded(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* A library was removed.
|
||||
*/
|
||||
public OnLibraryRemoved(const String:name[])
|
||||
{
|
||||
ConfigOnLibraryRemoved(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,6 +170,11 @@ enum ConfigData
|
||||
*/
|
||||
new g_ConfigData[ConfigFile][ConfigData];
|
||||
|
||||
/**
|
||||
* Stores status of the optional ConfigList plugin.
|
||||
*/
|
||||
new bool:g_ConfigListAvailable = false;
|
||||
|
||||
/**
|
||||
* Actions to use when working on key/values.
|
||||
*/
|
||||
@ -250,6 +255,14 @@ ConfigOnModulesLoaded()
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if ConfigList is available.
|
||||
if (g_ConfigListAvailable)
|
||||
{
|
||||
// Execute the zr_post_exec list before the map config file. This list
|
||||
// may not exist, but that's ok.
|
||||
ServerCommand("cfglist_exec_list zr_post_exec");
|
||||
}
|
||||
|
||||
// Execute config file.
|
||||
ServerCommand("exec %s", mapconfig);
|
||||
|
||||
@ -257,6 +270,38 @@ ConfigOnModulesLoaded()
|
||||
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Config, "Post Map Configs", "Executed post map config file: %s", path);
|
||||
}
|
||||
|
||||
/**
|
||||
* All plugins have finished loading.
|
||||
*/
|
||||
ConfigOnAllPluginsLoaded()
|
||||
{
|
||||
g_ConfigListAvailable = LibraryExists("configlist");
|
||||
}
|
||||
|
||||
/**
|
||||
* A library was added.
|
||||
*/
|
||||
ConfigOnLibraryAdded(const String:name[])
|
||||
{
|
||||
if (StrEqual(name, "configlist"))
|
||||
{
|
||||
// ConfigList loaded.
|
||||
g_ConfigListAvailable = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A library was removed.
|
||||
*/
|
||||
ConfigOnLibraryRemoved(const String:name[])
|
||||
{
|
||||
if (StrEqual(name, "configlist"))
|
||||
{
|
||||
// ConfigList was unloaded.
|
||||
g_ConfigListAvailable = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by modules that rely on configs to register their config file info.
|
||||
* (Don't forget to set 'loaded' to 'true' (ConfigSetConfigLoaded) in config load function)
|
||||
|
Reference in New Issue
Block a user