| 51 | |
| 52 | |
| 53 | bool 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 | |
| 73 | void ScriptEngine::prepareRunFunction() |
| 74 | { |
nothing calls this directly
no outgoing calls
no test coverage detected