Created
December 3, 2014 14:47
-
-
Save BenDol/a3f3db323673642b1c15 to your computer and use it in GitHub Desktop.
NpcEvents::onThink()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void NpcEvents::onThink() { | |
if(m_onThink == -1) | |
return; | |
//onThink() | |
if(m_interface->reserveEnv()) { | |
ScriptEnviroment* env = m_interface->getEnv(); | |
#ifdef __DEBUG_LUASCRIPTS__ | |
std::stringstream desc; | |
desc << "npc " << m_npc->getName(); | |
env->setEvent(desc.str()); | |
#endif | |
env->setScriptId(m_onThink, m_interface); | |
env->setRealPos(m_npc->getPosition()); | |
env->setNpc(m_npc); | |
m_interface->pushFunction(m_onThink); | |
m_interface->callFunction(0); | |
m_interface->releaseEnv(); | |
} else | |
std::clog << "[Error - NpcEvents::onThink] NPC Name: " << m_npc->getName() << " - Call stack overflow" << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment