diff options
Diffstat (limited to 'src/content_sao.cpp')
-rw-r--r-- | src/content_sao.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp index eeb17bd30..1096ac116 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -1568,12 +1568,13 @@ void LuaEntitySAO::addedToEnvironment(u16 id) ServerActiveObject::addedToEnvironment(id); // Create entity from name and state - m_registered = true; lua_State *L = m_env->getLua(); - scriptapi_luaentity_add(L, id, m_init_name.c_str(), m_init_state.c_str()); + m_registered = scriptapi_luaentity_add(L, id, m_init_name.c_str(), m_init_state.c_str()); - // Get properties - scriptapi_luaentity_get_properties(L, m_id, m_prop); + if(m_registered){ + // Get properties + scriptapi_luaentity_get_properties(L, m_id, m_prop); + } } ServerActiveObject* LuaEntitySAO::create(ServerEnvironment *env, v3f pos, |