From 80629f40a85fccafaefea1a490d9ca384f73493f Mon Sep 17 00:00:00 2001 From: proller Date: Thu, 18 Nov 2021 00:03:16 +0300 Subject: [PATCH] Fix falling snow stacking --- games/default | 2 +- src/contrib/fallingsao.cpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/games/default b/games/default index f7d1844e5..821838ca3 160000 --- a/games/default +++ b/games/default @@ -1 +1 @@ -Subproject commit f7d1844e54ee924e6c6e65c876e83fe87a99dc41 +Subproject commit 821838ca3a22e2726ca56ad89865783aa4462ae8 diff --git a/src/contrib/fallingsao.cpp b/src/contrib/fallingsao.cpp index 37cf30b07..0359eacde 100644 --- a/src/contrib/fallingsao.cpp +++ b/src/contrib/fallingsao.cpp @@ -138,16 +138,17 @@ void FallingSAO::step(float dtime, bool send_recommended) if ((f_under.walkable || (itemgroup_get(f_under.groups, "float") && f_under.liquid_type == LIQUID_NONE))) { - if (f_under.leveled && f_under.name.compare(f.name) == 0) { - u8 addLevel = n.getLevel(ndef); - if (addLevel == 0) { - addLevel = n_under.getLevel(ndef); - } - - if (n_under.addLevel(ndef, addLevel)) { - m_removed = true; - return; + const std::string & n_name = ndef->get(m_node).name; + if (f_under.leveled && f_under.name.compare(n_name) == 0) { + u8 addLevel = m_node.getLevel(ndef); + addLevel = n_under.addLevel(ndef, addLevel); + if (addLevel) { + m_node.setLevel(ndef, addLevel); + m_env->setNode(p, m_node, fast); } + m_env->setNode(floatToInt(p_under, BS), n_under, fast); + m_removed = true; + return; } else if (f_under.buildable_to && (itemgroup_get(f.groups,"float") == 0 || @@ -161,7 +162,6 @@ void FallingSAO::step(float dtime, bool send_recommended) m_env->removeNode(p); if (!f.buildable_to) { ItemStack stack; - std::string n_name = ndef->get(m_node).name; stack.deSerialize(n_name); m_env->spawnItemActiveObject(n_name, m_base_position, stack); }