1
0

cLuaState: cMonster descendants don't push their specific type.

The individual mob types aren't exported to Lua, so pushing them would crash the server.
This commit is contained in:
Mattes D 2014-10-19 12:49:54 +02:00
parent b0a59927fb
commit d50bbf3899

View File

@ -558,7 +558,16 @@ void cLuaState::Push(cEntity * a_Entity)
{
ASSERT(IsValid());
tolua_pushusertype(m_LuaState, a_Entity, (a_Entity == nullptr) ? "cEntity" : a_Entity->GetClass());
if (a_Entity->IsMob())
{
// Don't push specific mob types, as those are not exported in the API:
tolua_pushusertype(m_LuaState, a_Entity, "cMonster");
}
else
{
// Push the specific class type:
tolua_pushusertype(m_LuaState, a_Entity, (a_Entity == nullptr) ? "cEntity" : a_Entity->GetClass());
}
m_NumCurrentFunctionArgs += 1;
}