void LuaAiState::onSeeEnemy(IActor *enemy) { LuaType::registerConstant<IBody>(this->script, "body", this->body); LuaFunction luaFunction; luaFunction.readyToRunFunction(this->script, "OnSeeEnemy"); this->script->sendToLua<void*>(enemy); luaFunction.runFunction(1, 0); luaFunction.clearAfterFunction(); this->script->removeSymbol("body"); }
void LuaAiState::onTakeDamage(IActor* instigator, float damageValue, Vector2D impulse) { LuaType::registerConstant<IBody>(this->script, "body", this->body); LuaFunction luaFunction; luaFunction.readyToRunFunction(this->script, "OnTakeDamage"); this->script->sendToLua<void*>(instigator); this->script->sendToLua<double>(damageValue); luaFunction.runFunction(2, 0); luaFunction.clearAfterFunction(); this->script->removeSymbol("body"); }