summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-08-22 04:25:43 -0400
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-08-22 04:25:43 -0400
commit4847b926d57b74067a61ce19dbcbd87a2914ea41 (patch)
treeeafaebe99f902f86f6f7de6cb3e7ac6efde08af8
parente3648f77e25db741141f9fd4f53239107945e6bf (diff)
downloadunifieddyes-4847b926d57b74067a61ce19dbcbd87a2914ea41.tar
unifieddyes-4847b926d57b74067a61ce19dbcbd87a2914ea41.tar.gz
unifieddyes-4847b926d57b74067a61ce19dbcbd87a2914ea41.tar.bz2
unifieddyes-4847b926d57b74067a61ce19dbcbd87a2914ea41.tar.xz
unifieddyes-4847b926d57b74067a61ce19dbcbd87a2914ea41.zip
preserve color bits in rotation fixup calls
-rw-r--r--init.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index 374bec7..c0acb92 100644
--- a/init.lua
+++ b/init.lua
@@ -251,6 +251,8 @@ end
function unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
+ local colorbits = node.param2 - (node.param2 % 8)
+
local yaw = placer:get_look_horizontal()
local dir = minetest.yaw_to_dir(yaw) -- -1.5)
local pitch = placer:get_look_vertical()
@@ -262,7 +264,7 @@ function unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
elseif pitch > math.pi/8 then
fdir = 1
end
- minetest.swap_node(pos, { name = node.name, param2 = fdir })
+ minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits })
end
-- use this when you have a "wallmounted" node that should never be oriented
@@ -270,10 +272,12 @@ end
function unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
+ local colorbits = node.param2 - (node.param2 % 8)
local yaw = placer:get_look_horizontal()
local dir = minetest.yaw_to_dir(yaw+1.5)
local fdir = minetest.dir_to_wallmounted(dir)
- minetest.swap_node(pos, { name = node.name, param2 = fdir })
+
+ minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits })
end
-- ... and use this one to force that kind of node off of floor/ceiling