From 70b71c501332521b05173bc8e1d505720d0187c5 Mon Sep 17 00:00:00 2001 From: Gregor Parzefall <82708541+grorp@users.noreply.github.com> Date: Sun, 31 Jul 2022 15:18:29 +0200 Subject: [PATCH] Fix rotation of falling facedir nodes (#12587) in some cases --- builtin/game/falling.lua | 6 ++---- games/devtest/mods/testnodes/properties.lua | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index 023bd1fa3..d5727f2a7 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -158,12 +158,10 @@ core.register_entity(":__builtin:falling_node", { or def.drawtype == "normal" or def.drawtype == "nodebox" then if (def.paramtype2 == "facedir" or def.paramtype2 == "colorfacedir") then - local fdir = node.param2 % 32 + local fdir = node.param2 % 32 % 24 -- Get rotation from a precalculated lookup table local euler = facedir_to_euler[fdir + 1] - if euler then - self.object:set_rotation(euler) - end + self.object:set_rotation(euler) elseif (def.drawtype ~= "plantlike" and def.drawtype ~= "plantlike_rooted" and (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted" or def.drawtype == "signlike")) then local rot = node.param2 % 8 diff --git a/games/devtest/mods/testnodes/properties.lua b/games/devtest/mods/testnodes/properties.lua index 89facf71c..bacd555cd 100644 --- a/games/devtest/mods/testnodes/properties.lua +++ b/games/devtest/mods/testnodes/properties.lua @@ -13,6 +13,20 @@ minetest.register_node("testnodes:falling", { groups = { falling_node = 1, dig_immediate = 3 }, }) +minetest.register_node("testnodes:falling_facedir", { + description = S("Falling Facedir Node"), + tiles = { + "testnodes_1.png", + "testnodes_2.png", + "testnodes_3.png", + "testnodes_4.png", + "testnodes_5.png", + "testnodes_6.png", + }, + paramtype2 = "facedir", + groups = { falling_node = 1, dig_immediate = 3 }, +}) + -- Same as falling node, but will stop falling on top of liquids minetest.register_node("testnodes:falling_float", { description = S("Falling+Floating Node"),