Fix crash after 'LuaEntity name "particles:smoke" not defined' and similar errors
authorPerttu Ahola <celeron55@gmail.com>
Sun, 8 Apr 2012 20:13:27 +0000 (23:13 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 8 Apr 2012 20:16:15 +0000 (23:16 +0300)
src/content_sao.cpp

index 2b3f7c022854e7c3bf7e4380e7488ebad9b2867c..205621d791264ac8307a436b43267165a7bb36ef 100644 (file)
@@ -389,10 +389,9 @@ void LuaEntitySAO::addedToEnvironment()
                scriptapi_luaentity_get_properties(L, m_id, &m_prop);
                // Initialize HP from properties
                m_hp = m_prop.hp_max;
+               // Activate entity, supplying serialized state
+               scriptapi_luaentity_activate(L, m_id, m_init_state.c_str());
        }
-       
-       // Activate entity, supplying serialized state
-       scriptapi_luaentity_activate(L, m_id, m_init_state.c_str());
 }
 
 ServerActiveObject* LuaEntitySAO::create(ServerEnvironment *env, v3f pos,