aboutsummaryrefslogtreecommitdiff
path: root/builtin/game
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2020-12-22 14:54:27 +0100
committerGitHub <noreply@github.com>2020-12-22 14:54:27 +0100
commit535557cc2e972c555bc5a294b95f2c2974b81eea (patch)
treee3cb1c2818fb2061515b992ded2bab3beafaabe5 /builtin/game
parent03540e7140fc5d54e7b8406415b53e708c7b0bea (diff)
downloadminetest-535557cc2e972c555bc5a294b95f2c2974b81eea.tar.gz
minetest-535557cc2e972c555bc5a294b95f2c2974b81eea.tar.bz2
minetest-535557cc2e972c555bc5a294b95f2c2974b81eea.zip
Fix fallnode rotation of wallmounted nodebox/mesh (#10643)
Diffstat (limited to 'builtin/game')
-rw-r--r--builtin/game/falling.lua40
1 files changed, 27 insertions, 13 deletions
diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua
index f489ea702..057d0d0ed 100644
--- a/builtin/game/falling.lua
+++ b/builtin/game/falling.lua
@@ -152,8 +152,8 @@ core.register_entity(":__builtin:falling_node", {
else
self.object:set_yaw(-math.pi*0.25)
end
- elseif (node.param2 ~= 0 and (def.wield_image == ""
- or def.wield_image == nil))
+ elseif ((node.param2 ~= 0 or def.drawtype == "nodebox" or def.drawtype == "mesh")
+ and (def.wield_image == "" or def.wield_image == nil))
or def.drawtype == "signlike"
or def.drawtype == "mesh"
or def.drawtype == "normal"
@@ -168,16 +168,30 @@ core.register_entity(":__builtin:falling_node", {
elseif (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted") then
local rot = node.param2 % 8
local pitch, yaw, roll = 0, 0, 0
- if rot == 1 then
- pitch, yaw = math.pi, math.pi
- elseif rot == 2 then
- pitch, yaw = math.pi/2, math.pi/2
- elseif rot == 3 then
- pitch, yaw = math.pi/2, -math.pi/2
- elseif rot == 4 then
- pitch, yaw = math.pi/2, math.pi
- elseif rot == 5 then
- pitch, yaw = math.pi/2, 0
+ if def.drawtype == "nodebox" or def.drawtype == "mesh" then
+ if rot == 0 then
+ pitch, yaw = math.pi/2, 0
+ elseif rot == 1 then
+ pitch, yaw = -math.pi/2, math.pi
+ elseif rot == 2 then
+ pitch, yaw = 0, math.pi/2
+ elseif rot == 3 then
+ pitch, yaw = 0, -math.pi/2
+ elseif rot == 4 then
+ pitch, yaw = 0, math.pi
+ end
+ else
+ if rot == 1 then
+ pitch, yaw = math.pi, math.pi
+ elseif rot == 2 then
+ pitch, yaw = math.pi/2, math.pi/2
+ elseif rot == 3 then
+ pitch, yaw = math.pi/2, -math.pi/2
+ elseif rot == 4 then
+ pitch, yaw = math.pi/2, math.pi
+ elseif rot == 5 then
+ pitch, yaw = math.pi/2, 0
+ end
end
if def.drawtype == "signlike" then
pitch = pitch - math.pi/2
@@ -186,7 +200,7 @@ core.register_entity(":__builtin:falling_node", {
elseif rot == 1 then
yaw = yaw - math.pi/2
end
- elseif def.drawtype == "mesh" or def.drawtype == "normal" then
+ elseif def.drawtype == "mesh" or def.drawtype == "normal" or def.drawtype == "nodebox" then
if rot >= 0 and rot <= 1 then
roll = roll + math.pi
else