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

Method onNPCInitialized

src/logic/ScriptEngine.cpp:246–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246void ScriptEngine::onNPCInitialized(Daedalus::GameState::NpcHandle npc)
247{
248 // Initialize daily routine
249 Daedalus::GEngineClasses::C_Npc& npcData = getGameState().getNpc(npc);
250
251 //LogInfo() << "Initializing daily routine for: " << npcData.name[0] << ", hdl: " << npc.index;
252 //LogInfo() << "Self: " << getSymbolIndexByName("self");
253
254 if (npcData.daily_routine != 0)
255 {
256 prepareRunFunction();
257
258 m_pVM->setInstance("self", ZMemory::toBigHandle(npc), Daedalus::IC_Npc);
259 m_pVM->setCurrentInstance(getSymbolIndexByName("self"));
260
261 runFunctionBySymIndex(npcData.daily_routine);
262 }
263}
264
265std::set<Handle::EntityHandle> ScriptEngine::getNPCsInRadius(const Math::float3& center, float radius)
266{

Callers

nothing calls this directly

Calls 1

setInstanceMethod · 0.80

Tested by

no test coverage detected