| 926 | } |
| 927 | |
| 928 | static 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) |
| 954 | static void fInitthread(IODATA * iod) |
no test coverage detected