aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2015-03-03 16:23:47 +0100
committerLoic Blot <loic.blot@unix-experience.fr>2015-03-03 16:33:20 +0100
commit7e56637ed07d9f32b4bd9049009cf7e1e4cff884 (patch)
treef683ef8fbbd078bee6c8465850e20d580225952a /src/server.cpp
parent64ff966bae99813229dff6629fd9131a91ba7484 (diff)
downloadminetest-7e56637ed07d9f32b4bd9049009cf7e1e4cff884.tar.gz
minetest-7e56637ed07d9f32b4bd9049009cf7e1e4cff884.tar.bz2
minetest-7e56637ed07d9f32b4bd9049009cf7e1e4cff884.zip
Send Breath packet on event, don't check it at each AsyncRunStep
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 3536471bf..84a8df4b8 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -604,20 +604,15 @@ void Server::AsyncRunStep(bool initial_step)
if(playersao == NULL)
continue;
- /*
- Send player breath if changed
- */
- if(playersao->m_breath_not_sent) {
- SendPlayerBreath(*i);
- }
- /*
- Send player inventories if necessary
- */
if(playersao->m_moved) {
SendMovePlayer(*i);
playersao->m_moved = false;
}
+
+ /*
+ Send player inventories if necessary
+ */
if(playersao->m_inventory_not_sent) {
UpdateCrafting(*i);
SendInventory(*i);
@@ -1892,8 +1887,8 @@ void Server::SendPlayerBreath(u16 peer_id)
DSTACK(__FUNCTION_NAME);
PlayerSAO *playersao = getPlayerSAO(peer_id);
assert(playersao);
- playersao->m_breath_not_sent = false;
- m_script->player_event(playersao,"breath_changed");
+
+ m_script->player_event(playersao, "breath_changed");
SendBreath(peer_id, playersao->getBreath());
}
@@ -2604,6 +2599,7 @@ void Server::RespawnPlayer(u16 peer_id)
playersao->setBreath(PLAYER_MAX_BREATH);
SendPlayerHP(peer_id);
+ SendPlayerBreath(peer_id);
bool repositioned = m_script->on_respawnplayer(playersao);
if(!repositioned){