aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Kok <sofar@foo-projects.org>2017-03-10 23:37:30 -0800
committerAuke Kok <sofar+github@foo-projects.org>2017-03-11 17:00:40 -0800
commit6738c7e9a310514fca7d4ddb685800391756626b (patch)
tree698c81c86ac3bf9b56726bb1ab4ce0743eeba583
parentf83d8687a7cd15dac61fd257d358eb42337d48e0 (diff)
downloadminetest-6738c7e9a310514fca7d4ddb685800391756626b.tar.gz
minetest-6738c7e9a310514fca7d4ddb685800391756626b.tar.bz2
minetest-6738c7e9a310514fca7d4ddb685800391756626b.zip
Do not increase breath if at full breath.
Prevents the server from sending TOCLIENT_BREATH packets every 0.5seconds, if there is no reason to.
-rw-r--r--src/content_sao.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index f87977f80..d4a218505 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -965,7 +965,7 @@ void PlayerSAO::step(float dtime, bool send_recommended)
MapNode n = m_env->getMap().getNodeNoEx(p);
const ContentFeatures &c = m_env->getGameDef()->ndef()->get(n);
// If player is alive & no drowning, breath
- if (m_hp > 0 && c.drowning == 0)
+ if (m_hp > 0 && m_breath < PLAYER_MAX_BREATH && c.drowning == 0)
setBreath(m_breath + 1);
}