function call fixes and resets for procs / call spell process
This commit is contained in:
parent
b7802d84db
commit
56e43288bf
@ -1721,6 +1721,7 @@ bool Entity::CastProc(Proc* proc, int8 type, Spawn* target) {
|
|||||||
else {
|
else {
|
||||||
lua_getglobal(state, "proc");
|
lua_getglobal(state, "proc");
|
||||||
}
|
}
|
||||||
|
if (lua_isfunction(state, -1)) {
|
||||||
if (item_proc) {
|
if (item_proc) {
|
||||||
num_args++;
|
num_args++;
|
||||||
lua_interface->SetItemValue(state, proc->item);
|
lua_interface->SetItemValue(state, proc->item);
|
||||||
@ -1769,6 +1770,9 @@ bool Entity::CastProc(Proc* proc, int8 type, Spawn* target) {
|
|||||||
lua_pop(state, 1);
|
lua_pop(state, 1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_interface->ResetFunctionStack(state);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -674,9 +674,11 @@ bool LuaInterface::CallSpellProcess(LuaSpell* spell, int8 num_parameters, std::s
|
|||||||
if(lua_pcall(spell->state, num_parameters, 0, 0) != 0){
|
if(lua_pcall(spell->state, num_parameters, 0, 0) != 0){
|
||||||
LogError("Error running function '%s' in %s: %s", customFunction.c_str(), spell->spell->GetName(), lua_tostring(spell->state, -1));
|
LogError("Error running function '%s' in %s: %s", customFunction.c_str(), spell->spell->GetName(), lua_tostring(spell->state, -1));
|
||||||
lua_pop(spell->state, 1);
|
lua_pop(spell->state, 1);
|
||||||
|
ResetFunctionStack(spell->state);
|
||||||
RemoveSpell(spell, false); // may be in a lock
|
RemoveSpell(spell, false); // may be in a lock
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
ResetFunctionStack(spell->state);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user