cLuaState: Update Push
for entities. (#4128)
Fixes #4127 Some classes were exported but were only pushed as a cEntity meaning exported functions were inaccessible. This brings cLuaState::Push(cEntity *) up to date with all exported entities.
This commit is contained in:
parent
00da9006b7
commit
177273006e
@ -960,54 +960,42 @@ void cLuaState::Push(cEntity * a_Entity)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (a_Entity->GetEntityType())
|
const char * ClassName = [&]
|
||||||
{
|
|
||||||
case cEntity::etMonster:
|
|
||||||
{
|
{
|
||||||
// Don't push specific mob types, as those are not exported in the API:
|
switch (a_Entity->GetEntityType())
|
||||||
tolua_pushusertype(m_LuaState, a_Entity, "cMonster");
|
{
|
||||||
break;
|
case cEntity::etBoat: return "cBoat";
|
||||||
}
|
case cEntity::etExpOrb: return "cExpOrb";
|
||||||
case cEntity::etPlayer:
|
case cEntity::etFallingBlock: return "cFallingBlock";
|
||||||
{
|
case cEntity::etFloater: return "cFloater";
|
||||||
tolua_pushusertype(m_LuaState, a_Entity, "cPlayer");
|
case cEntity::etItemFrame: return "cItemFrame";
|
||||||
break;
|
case cEntity::etLeashKnot: return "cLeashKnot";
|
||||||
}
|
case cEntity::etPainting: return "cPainting";
|
||||||
case cEntity::etPickup:
|
case cEntity::etPickup: return "cPickup";
|
||||||
{
|
case cEntity::etPlayer: return "cPlayer";
|
||||||
tolua_pushusertype(m_LuaState, a_Entity, "cPickup");
|
case cEntity::etTNT: return "cTNTEntity";
|
||||||
break;
|
|
||||||
}
|
|
||||||
case cEntity::etTNT:
|
|
||||||
{
|
|
||||||
tolua_pushusertype(m_LuaState, a_Entity, "cTNTEntity");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case cEntity::etProjectile:
|
|
||||||
{
|
|
||||||
tolua_pushusertype(m_LuaState, a_Entity, a_Entity->GetClass());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case cEntity::etFloater:
|
|
||||||
{
|
|
||||||
tolua_pushusertype(m_LuaState, a_Entity, "cFloater");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case cEntity::etEntity:
|
case cEntity::etMonster:
|
||||||
case cEntity::etEnderCrystal:
|
{
|
||||||
case cEntity::etFallingBlock:
|
// Don't push specific mob types, as those are not exported in the API:
|
||||||
case cEntity::etMinecart:
|
return "cMonster";
|
||||||
case cEntity::etBoat:
|
}
|
||||||
case cEntity::etExpOrb:
|
case cEntity::etProjectile:
|
||||||
case cEntity::etItemFrame:
|
{
|
||||||
case cEntity::etPainting:
|
// Push the specific projectile type:
|
||||||
case cEntity::etLeashKnot:
|
return a_Entity->GetClass();
|
||||||
{
|
}
|
||||||
// Push the generic entity class type:
|
|
||||||
tolua_pushusertype(m_LuaState, a_Entity, "cEntity");
|
case cEntity::etEntity:
|
||||||
}
|
case cEntity::etEnderCrystal:
|
||||||
} // switch (EntityType)
|
case cEntity::etMinecart:
|
||||||
|
{
|
||||||
|
// Push the generic entity class type:
|
||||||
|
return "cEntity";
|
||||||
|
}
|
||||||
|
} // switch (EntityType)
|
||||||
|
}();
|
||||||
|
tolua_pushusertype(m_LuaState, a_Entity, ClassName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user