Don't regain breath while in ignore node

* backported https://github.com/minetest/minetest/pull/8218
* Fixed the issue of Player regains a little breath when
  rejoining game into ignore
stable-4.X-namespace
mckaygerhard 2023-09-12 20:38:47 -04:00
parent 209f31601d
commit 23d8b837f4
1 changed files with 2 additions and 2 deletions

View File

@ -938,8 +938,8 @@ void PlayerSAO::step(float dtime, bool send_recommended)
v3s16 p = floatToInt(m_base_position + v3f(0, BS * 1.6, 0), BS);
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 && m_breath < PLAYER_MAX_BREATH && c.drowning == 0)
// If player is alive & no drowning & not in ignore, breathe
if (m_breath < m_prop.breath_max && c.drowning == 0 && n.getContent() != CONTENT_IGNORE && m_hp > 0)
setBreath(m_breath + 1);
}