MCPcopy Create free account
hub / github.com/Norbyte/bg3se / SubmitTaskAndWait

Method SubmitTaskAndWait

BG3Extender/Extender/Shared/Console.cpp:10–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8char const* BuildDate = __DATE__ " " __TIME__;
9
10void DebugConsole::SubmitTaskAndWait(bool server, std::function<void()> task)
11{
12 if (server) {
13 auto state = GetStaticSymbols().GetServerState();
14 if (!state) {
15 ERR("Cannot queue server commands when the server state machine is not initialized");
16 } else if (*state == esv::GameState::Paused || *state == esv::GameState::Running) {
17 gExtender->GetServer().SubmitTaskAndWait(task);
18 } else {
19 ERR("Cannot queue server commands in game state %s", EnumInfo<esv::GameState>::Find(*state).GetString());
20 }
21 } else {
22 auto state = GetStaticSymbols().GetClientState();
23 if (!state) {
24 ERR("Cannot queue client commands when the client state machine is not initialized");
25 } else if (*state == ecl::GameState::Menu
26 || *state == ecl::GameState::Lobby
27 || *state == ecl::GameState::Paused
28 || *state == ecl::GameState::Running) {
29 gExtender->GetClient().SubmitTaskAndWait(task);
30 } else {
31 ERR("Cannot queue client commands in game state %s", EnumInfo<ecl::GameState>::Find(*state).GetString());
32 }
33 }
34}
35
36void DebugConsole::PrintHelp()
37{

Callers 1

OsiLuaResetFunction · 0.80

Calls 5

GetServerStateMethod · 0.80
GetServerMethod · 0.80
GetStringMethod · 0.80
GetClientStateMethod · 0.80
GetClientMethod · 0.80

Tested by

no test coverage detected