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

Method GetCurrentExtensionState

BG3Extender/Extender/ScriptExtender.cpp:365–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363}
364
365ExtensionStateBase* ScriptExtender::GetCurrentExtensionState()
366{
367 auto ctx = GetCurrentContextType();
368
369 if (ctx == ContextType::Server) {
370 if (server_.HasExtensionState()) {
371 return &server_.GetExtensionState();
372 } else {
373 return nullptr;
374 }
375 } else if (ctx == ContextType::Client) {
376 if (client_.HasExtensionState()) {
377 return &client_.GetExtensionState();
378 } else {
379 ERR("GetCurrentExtensionState() called from client thread %d, but no client state is available!", GetCurrentThreadId());
380 return nullptr;
381 }
382 } else {
383 ERR("GetCurrentExtensionState() called from thread %d that is not bound to any context!", GetCurrentThreadId());
384 if (client_.HasExtensionState()) {
385 return &client_.GetExtensionState();
386 } else {
387 return nullptr;
388 }
389 }
390}
391
392ecs::EntitySystemHelpersBase* ScriptExtender::GetECS(ecs::EntityWorld* world)
393{

Callers 3

OnParseDataFolderMethod · 0.80
GetCurrentExtensionStateFunction · 0.80
ExecLuaCommandMethod · 0.80

Calls 2

GetExtensionStateMethod · 0.80
HasExtensionStateMethod · 0.45

Tested by

no test coverage detected