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
This commit is contained in:
mckaygerhard 2023-07-21 22:42:38 -04:00
parent d07cc1e760
commit 63556217b3

View File

@ -940,8 +940,9 @@ 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 < m_prop.breath_max && 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);
}