MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / initVMWithLoadedDAT

Method initVMWithLoadedDAT

src/logic/ScriptEngine.cpp:53–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52
53bool ScriptEngine::initVMWithLoadedDAT()
54{
55 // Register externals
56 const bool verbose = false;
57 Logic::ScriptExternals::registerStubs(*m_pVM, verbose);
58 Daedalus::registerGothicEngineClasses(*m_pVM);
59 Logic::ScriptExternals::registerEngineExternals(m_World, m_pVM, verbose);
60
61 // Register our externals
62 Daedalus::GameState::DaedalusGameState::GameExternals ext;
63 ext.wld_insertnpc = [this](Daedalus::GameState::NpcHandle npc, std::string spawnpoint) { onNPCInserted(npc, spawnpoint); };
64 ext.post_wld_insertnpc = [this](Daedalus::GameState::NpcHandle npc) { onNPCInitialized(npc); };
65 ext.wld_removenpc = [this](Daedalus::GameState::NpcHandle npc) { onNPCRemoved(npc); };
66 ext.createinvitem = [this](Daedalus::GameState::ItemHandle item, Daedalus::GameState::NpcHandle npc) { onInventoryItemInserted(item, npc); };
67
68 m_pVM->getGameState().setGameExternals(ext);
69
70 return true;
71}
72
73void ScriptEngine::prepareRunFunction()
74{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected