diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-12-02 17:30:22 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-12-02 17:30:22 +0200 |
commit | 9344816bd6c40603729256b454e2f171902b02e5 (patch) | |
tree | fc2572f2f2184422a221a6959e70e81202c61280 /src | |
parent | 67c21fc42f79f5efe74e4c8194944ac834224069 (diff) | |
download | minetest-9344816bd6c40603729256b454e2f171902b02e5.tar.gz minetest-9344816bd6c40603729256b454e2f171902b02e5.tar.bz2 minetest-9344816bd6c40603729256b454e2f171902b02e5.zip |
Fix ActiveObject creation for fast player respawns
Diffstat (limited to 'src')
-rw-r--r-- | src/server.cpp | 21 | ||||
-rw-r--r-- | src/serverremoteplayer.h | 2 |
2 files changed, 13 insertions, 10 deletions
diff --git a/src/server.cpp b/src/server.cpp index cb515e0d0..b8bdd8830 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1348,6 +1348,15 @@ void Server::AsyncRunStep() if(player->m_hp_not_sent){ SendPlayerHP(player); } + + /* + Add to environment if is not in respawn screen + */ + if(!player->m_is_in_environment && !player->m_respawn_active){ + player->m_removed = false; + player->setId(0); + m_env->addActiveObject(player); + } } } @@ -2127,11 +2136,6 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) return; } - // Add PlayerSAO - player->m_removed = false; - player->setId(0); - m_env->addActiveObject(player); - /* Answer with a TOCLIENT_INIT */ @@ -2887,10 +2891,9 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) actionstream<<player->getName()<<" respawns at " <<PP(player->getPosition()/BS)<<std::endl; - - srp->m_removed = false; - srp->setId(0); - m_env->addActiveObject(srp); + + // ActiveObject is added to environment in AsyncRunStep after + // the previous addition has been succesfully removed } else if(command == TOSERVER_INTERACT) { diff --git a/src/serverremoteplayer.h b/src/serverremoteplayer.h index 1ef14ca93..15a9ebc38 100644 --- a/src/serverremoteplayer.h +++ b/src/serverremoteplayer.h @@ -92,9 +92,9 @@ public: bool m_inventory_not_sent; bool m_hp_not_sent; bool m_respawn_active; + bool m_is_in_environment; private: - bool m_is_in_environment; bool m_position_not_sent; }; |