MCPcopy Create free account
hub / github.com/DFHack/dfhack / run_dfhack_init

Function run_dfhack_init

library/Core.cpp:928–951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

926}
927
928static void run_dfhack_init(color_ostream &out, Core *core)
929{
930 CoreSuspender lock;
931 if (!df::global::world || !df::global::plotinfo || !df::global::gview)
932 {
933 out.printerr("Key globals are missing, skipping loading dfhack.init.\n");
934 return;
935 }
936
937 // load baseline defaults
938 core->loadScriptFile(out, getConfigPath() / "init" / "default.dfhack.init", false);
939
940 // load user overrides
941 std::vector<std::string> prefixes(1, "dfhack");
942 loadScriptFiles(core, out, prefixes, getConfigPath() / "init");
943
944 // show the terminal if requested
945 auto L = DFHack::Core::getInstance().getLuaState();
946 Lua::CallLuaModuleFunction(out, L, "dfhack", "getHideConsoleOnStartup", 0, 1,
947 Lua::DEFAULT_LUA_LAMBDA, [&](lua_State* L) {
948 if (!lua_toboolean(L, -1))
949 core->getConsole().show();
950 }, false);
951}
952
953// Load dfhack.init in a dedicated thread (non-interactive console mode)
954static void fInitthread(IODATA * iod)

Callers 2

fInitthreadFunction · 0.85
fIOthreadFunction · 0.85

Calls 6

getConfigPathFunction · 0.85
loadScriptFilesFunction · 0.85
CallLuaModuleFunctionFunction · 0.85
lua_tobooleanFunction · 0.85
loadScriptFileMethod · 0.80
showMethod · 0.45

Tested by

no test coverage detected