Skip to content

Commit

Permalink
Fix rotation of falling facedir nodes (minetest#12587)
Browse files Browse the repository at this point in the history
in some cases
  • Loading branch information
grorp committed Jul 31, 2022
1 parent 95d7fcb commit 70b71c5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 2 additions & 4 deletions builtin/game/falling.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions games/devtest/mods/testnodes/properties.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit 70b71c5

Please sign in to comment.