Fix fallnode rotation of wallmounted nodebox/mesh (#10643)

This commit is contained in:
Wuzzy 2020-12-22 14:54:27 +01:00 committed by GitHub
parent 03540e7140
commit 535557cc2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -152,8 +152,8 @@ core.register_entity(":__builtin:falling_node", {
else else
self.object:set_yaw(-math.pi*0.25) self.object:set_yaw(-math.pi*0.25)
end end
elseif (node.param2 ~= 0 and (def.wield_image == "" elseif ((node.param2 ~= 0 or def.drawtype == "nodebox" or def.drawtype == "mesh")
or def.wield_image == nil)) and (def.wield_image == "" or def.wield_image == nil))
or def.drawtype == "signlike" or def.drawtype == "signlike"
or def.drawtype == "mesh" or def.drawtype == "mesh"
or def.drawtype == "normal" or def.drawtype == "normal"
@ -168,6 +168,19 @@ core.register_entity(":__builtin:falling_node", {
elseif (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted") then elseif (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted") then
local rot = node.param2 % 8 local rot = node.param2 % 8
local pitch, yaw, roll = 0, 0, 0 local pitch, yaw, roll = 0, 0, 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 if rot == 1 then
pitch, yaw = math.pi, math.pi pitch, yaw = math.pi, math.pi
elseif rot == 2 then elseif rot == 2 then
@ -179,6 +192,7 @@ core.register_entity(":__builtin:falling_node", {
elseif rot == 5 then elseif rot == 5 then
pitch, yaw = math.pi/2, 0 pitch, yaw = math.pi/2, 0
end end
end
if def.drawtype == "signlike" then if def.drawtype == "signlike" then
pitch = pitch - math.pi/2 pitch = pitch - math.pi/2
if rot == 0 then if rot == 0 then
@ -186,7 +200,7 @@ core.register_entity(":__builtin:falling_node", {
elseif rot == 1 then elseif rot == 1 then
yaw = yaw - math.pi/2 yaw = yaw - math.pi/2
end 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 if rot >= 0 and rot <= 1 then
roll = roll + math.pi roll = roll + math.pi
else else