summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-10-23 08:40:39 +0200
committerMattes D <github@xoft.cz>2014-10-23 08:40:39 +0200
commitf8c54f4243049abbcafff1e96f994f742ea9f50d (patch)
tree67fe10bfea90cbb21952039bd795666682d43ad5 /src/Bindings/LuaState.cpp
parentCompile fix? (diff)
parentMerge pull request #1559 from mc-server/nullptr (diff)
downloadcuberite-f8c54f4243049abbcafff1e96f994f742ea9f50d.tar
cuberite-f8c54f4243049abbcafff1e96f994f742ea9f50d.tar.gz
cuberite-f8c54f4243049abbcafff1e96f994f742ea9f50d.tar.bz2
cuberite-f8c54f4243049abbcafff1e96f994f742ea9f50d.tar.lz
cuberite-f8c54f4243049abbcafff1e96f994f742ea9f50d.tar.xz
cuberite-f8c54f4243049abbcafff1e96f994f742ea9f50d.tar.zst
cuberite-f8c54f4243049abbcafff1e96f994f742ea9f50d.zip
Diffstat (limited to 'src/Bindings/LuaState.cpp')
-rw-r--r--src/Bindings/LuaState.cpp55
1 files changed, 48 insertions, 7 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 3b4ce3376..2f5d173fd 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -562,16 +562,57 @@ void cLuaState::Push(cEntity * a_Entity)
{
lua_pushnil(m_LuaState);
}
- else 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->GetClass());
+ switch (a_Entity->GetEntityType())
+ {
+ case cEntity::etMonster:
+ {
+ // Don't push specific mob types, as those are not exported in the API:
+ tolua_pushusertype(m_LuaState, a_Entity, "cMonster");
+ break;
+ }
+ case cEntity::etPlayer:
+ {
+ tolua_pushusertype(m_LuaState, a_Entity, "cPlayer");
+ break;
+ }
+ case cEntity::etPickup:
+ {
+ tolua_pushusertype(m_LuaState, a_Entity, "cPickup");
+ 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::etEnderCrystal:
+ case cEntity::etFallingBlock:
+ case cEntity::etMinecart:
+ case cEntity::etBoat:
+ case cEntity::etExpOrb:
+ case cEntity::etItemFrame:
+ case cEntity::etPainting:
+ {
+ // Push the generic entity class type:
+ tolua_pushusertype(m_LuaState, a_Entity, "cEntity");
+ }
+ } // switch (EntityType)
}
+
m_NumCurrentFunctionArgs += 1;
}