diff options
author | sfan5 <sfan5@live.de> | 2017-09-15 12:19:01 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-09-15 12:19:01 +0200 |
commit | 04839f233f37faa9af406ea66fc6c199127781eb (patch) | |
tree | d243fcae7f57fe4cf22046f42cda5424a1561e4c /src/content_sao.cpp | |
parent | edbc533414b0ba991a82f8003d90924e1dc60d95 (diff) | |
download | hax-minetest-server-04839f233f37faa9af406ea66fc6c199127781eb.tar.gz hax-minetest-server-04839f233f37faa9af406ea66fc6c199127781eb.zip |
ServerEnv: Clean up object lifecycle handling (#6414)
* ServerEnv: Clean up object lifecycle handling
Diffstat (limited to '')
-rw-r--r-- | src/content_sao.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp index 2a2384b3d..f0004da01 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -59,7 +59,7 @@ public: m_age += dtime; if(m_age > 10) { - m_removed = true; + m_pending_removal = true; return; } @@ -397,12 +397,11 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) { ServerMap *map = dynamic_cast<ServerMap *>(&m_env->getMap()); assert(map); - if (!m_pending_deactivation && + if (!m_pending_removal && map->saoPositionOverLimit(m_base_position)) { - infostream << "Remove SAO " << m_id << "(" << m_init_name + infostream << "Removing SAO " << m_id << "(" << m_init_name << "), outside of limits" << std::endl; - m_pending_deactivation = true; - m_removed = true; + m_pending_removal = true; return; } } @@ -550,9 +549,9 @@ int LuaEntitySAO::punch(v3f dir, ServerActiveObject *puncher, float time_from_last_punch) { - if (!m_registered){ + if (!m_registered) { // Delete unknown LuaEntities when punched - m_removed = true; + m_pending_removal = true; return 0; } @@ -596,12 +595,10 @@ int LuaEntitySAO::punch(v3f dir, } if (getHP() == 0) { - m_removed = true; + m_pending_removal = true; m_env->getScriptIface()->luaentity_on_death(m_id, puncher); } - - return result.wear; } @@ -1353,11 +1350,10 @@ void PlayerSAO::setWieldIndex(int i) } } -// Erase the peer id and make the object for removal void PlayerSAO::disconnected() { m_peer_id = 0; - m_removed = true; + m_pending_removal = true; } void PlayerSAO::unlinkPlayerSessionAndSave() |