multidwarf initial commit
parent
1968cffb13
commit
8c4de06999
@ -1,33 +1,33 @@
|
||||
[submodule "plugins/stonesense"]
|
||||
path = plugins/stonesense
|
||||
url = ../../DFHack/stonesense.git
|
||||
url = https://github.com/DFHack/stonesense.git
|
||||
[submodule "plugins/isoworld"]
|
||||
path = plugins/isoworld
|
||||
url = ../../DFHack/isoworld.git
|
||||
url = https://github.com/DFHack/isoworld.git
|
||||
[submodule "library/xml"]
|
||||
path = library/xml
|
||||
url = ../../DFHack/df-structures.git
|
||||
url = https://github.com/DFHack/df-structures.git
|
||||
[submodule "depends/clsocket"]
|
||||
path = depends/clsocket
|
||||
url = ../../DFHack/clsocket.git
|
||||
url = https://github.com/DFHack/clsocket.git
|
||||
[submodule "scripts2"]
|
||||
path = scripts
|
||||
url = ../../DFHack/scripts.git
|
||||
url = https://github.com/DFHack/scripts.git
|
||||
[submodule "depends/jsoncpp"]
|
||||
path = depends/jsoncpp-sub
|
||||
url = ../../DFHack/jsoncpp.git
|
||||
url = https://github.com/DFHack/jsoncpp.git
|
||||
[submodule "depends/xlsxio"]
|
||||
path = depends/xlsxio
|
||||
url = ../../DFHack/xlsxio.git
|
||||
url = https://github.com/DFHack/xlsxio.git
|
||||
[submodule "depends/libzip"]
|
||||
path = depends/libzip
|
||||
url = ../../DFHack/libzip.git
|
||||
url = https://github.com/DFHack/libzip.git
|
||||
[submodule "depends/libexpat"]
|
||||
path = depends/libexpat
|
||||
url = ../../DFHack/libexpat.git
|
||||
url = https://github.com/DFHack/libexpat.git
|
||||
[submodule "depends/luacov"]
|
||||
path = depends/luacov
|
||||
url = ../../DFHack/luacov.git
|
||||
url = https://github.com/DFHack/luacov.git
|
||||
[submodule "depends/googletest"]
|
||||
path = depends/googletest
|
||||
url = ../../google/googletest.git
|
||||
url = https://github.com/google/googletest.git
|
||||
|
@ -0,0 +1,119 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "df/world.h"
|
||||
|
||||
#include "Core.h"
|
||||
#include "Debug.h"
|
||||
#include "PluginManager.h"
|
||||
|
||||
#include "modules/Persistence.h"
|
||||
#include "modules/World.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
using namespace DFHack;
|
||||
|
||||
DFHACK_PLUGIN("multidwarf");
|
||||
DFHACK_PLUGIN_IS_ENABLED(is_enabled);
|
||||
|
||||
REQUIRE_GLOBAL(world);
|
||||
|
||||
namespace DFHack {
|
||||
DBG_DECLARE(multidwarf, status, DebugCategory::LDEBUG);
|
||||
DBG_DECLARE(multidwarf, onupdate, DebugCategory::LDEBUG);
|
||||
DBG_DECLARE(multidwarf, command, DebugCategory::LDEBUG);
|
||||
}
|
||||
|
||||
static command_result command_callback1(color_ostream &out, vector<string> ¶meters);
|
||||
|
||||
DFhackCExport command_result plugin_init(color_ostream &out, std::vector<PluginCommand> &commands) {
|
||||
DEBUG(status,out).print("initializing %s\n", plugin_name);
|
||||
|
||||
commands.push_back(PluginCommand(
|
||||
"multidwarf",
|
||||
"Short (~54 character) description of command.",
|
||||
command_callback1));
|
||||
return CR_OK;
|
||||
}
|
||||
|
||||
DFhackCExport command_result plugin_shutdown(color_ostream &out) {
|
||||
DEBUG(status,out).print("shutting down %s\n", plugin_name);
|
||||
|
||||
return CR_OK;
|
||||
|
||||
}
|
||||
|
||||
DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
|
||||
DEBUG(status,out).print("%s from the API\n", enable ? "enabled" : "disabled");
|
||||
|
||||
is_enabled = enable;
|
||||
return CR_OK;
|
||||
}
|
||||
|
||||
DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event) {
|
||||
switch (event) {
|
||||
case SC_UNKNOWN:
|
||||
DEBUG(status,out).print("game state changed: SC_UNKNOWN\n");
|
||||
break;
|
||||
case SC_WORLD_LOADED:
|
||||
DEBUG(status,out).print("game state changed: SC_WORLD_LOADED\n");
|
||||
break;
|
||||
case SC_WORLD_UNLOADED:
|
||||
DEBUG(status,out).print("game state changed: SC_WORLD_UNLOADED\n");
|
||||
break;
|
||||
case SC_MAP_LOADED:
|
||||
DEBUG(status,out).print("game state changed: SC_MAP_LOADED\n");
|
||||
break;
|
||||
case SC_MAP_UNLOADED:
|
||||
DEBUG(status,out).print("game state changed: SC_MAP_UNLOADED\n");
|
||||
break;
|
||||
case SC_VIEWSCREEN_CHANGED:
|
||||
DEBUG(status,out).print("game state changed: SC_VIEWSCREEN_CHANGED\n");
|
||||
break;
|
||||
case SC_CORE_INITIALIZED:
|
||||
DEBUG(status,out).print("game state changed: SC_CORE_INITIALIZED\n");
|
||||
break;
|
||||
case SC_BEGIN_UNLOAD:
|
||||
DEBUG(status,out).print("game state changed: SC_BEGIN_UNLOAD\n");
|
||||
break;
|
||||
case SC_PAUSED:
|
||||
DEBUG(status,out).print("game state changed: SC_PAUSED\n");
|
||||
break;
|
||||
case SC_UNPAUSED:
|
||||
DEBUG(status,out).print("game state changed: SC_UNPAUSED\n");
|
||||
break;
|
||||
}
|
||||
|
||||
return CR_OK;
|
||||
}
|
||||
|
||||
DFhackCExport command_result plugin_onupdate (color_ostream &out) {
|
||||
DEBUG(onupdate,out).print(
|
||||
"onupdate called (run 'debugfilter set info multidwarf onupdate' to stop"
|
||||
" seeing these messages)\n");
|
||||
|
||||
return CR_OK;
|
||||
}
|
||||
|
||||
DFhackCExport command_result plugin_save_data (color_ostream &out) {
|
||||
DEBUG(status,out).print("save or unload is imminent; time to persist state\n");
|
||||
|
||||
return CR_OK;
|
||||
}
|
||||
|
||||
DFhackCExport command_result plugin_load_data (color_ostream &out) {
|
||||
DEBUG(status,out).print("world is loading; time to load persisted state\n");
|
||||
|
||||
return CR_OK;
|
||||
}
|
||||
|
||||
static command_result command_callback1(color_ostream &out, vector<string> ¶meters) {
|
||||
DEBUG(command,out).print("%s command called with %zu parameters\n",
|
||||
plugin_name, parameters.size());
|
||||
|
||||
CoreSuspender suspend;
|
||||
|
||||
return CR_OK;
|
||||
}
|
Loading…
Reference in New Issue