move script-manager into core
parent
0d4d10de08
commit
e88b1fdfe5
@ -1,14 +0,0 @@
|
|||||||
script-manager
|
|
||||||
==============
|
|
||||||
|
|
||||||
.. dfhack-tool::
|
|
||||||
:summary: Triggers startup tasks for scripts.
|
|
||||||
:tags: dev
|
|
||||||
:no-command:
|
|
||||||
|
|
||||||
This plugin loads all scripts that are declared as modules so that they can
|
|
||||||
put state change hooks in place for loading persistent data. It also scans for
|
|
||||||
global ``isEnabled()`` functions and gathers them for script enabled state
|
|
||||||
tracking and reporting for the `enable` command.
|
|
||||||
|
|
||||||
Please see `script-enable-api` for more details.
|
|
@ -1,4 +1,4 @@
|
|||||||
local _ENV = mkmodule('plugins.script-manager')
|
local _ENV = mkmodule('script-manager')
|
||||||
|
|
||||||
local utils = require('utils')
|
local utils = require('utils')
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
#include "Debug.h"
|
|
||||||
#include "LuaTools.h"
|
|
||||||
#include "PluginManager.h"
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
using namespace DFHack;
|
|
||||||
|
|
||||||
DFHACK_PLUGIN("script-manager");
|
|
||||||
|
|
||||||
namespace DFHack {
|
|
||||||
DBG_DECLARE(script_manager, log, DebugCategory::LINFO);
|
|
||||||
}
|
|
||||||
|
|
||||||
DFhackCExport command_result plugin_init(color_ostream &, std::vector<PluginCommand> &) {
|
|
||||||
return CR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event) {
|
|
||||||
if (event != SC_CORE_INITIALIZED)
|
|
||||||
return CR_OK;
|
|
||||||
|
|
||||||
DEBUG(log,out).print("scanning scripts for onStateChange() functions\n");
|
|
||||||
|
|
||||||
auto L = Lua::Core::State;
|
|
||||||
Lua::StackUnwinder top(L);
|
|
||||||
Lua::CallLuaModuleFunction(out, L, "plugins.script-manager", "reload");
|
|
||||||
|
|
||||||
return CR_OK;
|
|
||||||
}
|
|
Loading…
Reference in New Issue