diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-02-17 23:14:21 -0500 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-02-17 23:14:21 -0500 |
commit | df5879ef7204340b1b4a5d97e3dd211f36d76293 (patch) | |
tree | a190e865741a1f6047b499a5947d91b500b1f0ae /unifieddyes | |
parent | bc71eb952f8a699180bb7f4c22449a07bb29c91e (diff) | |
download | dreambuilder_modpack-df5879ef7204340b1b4a5d97e3dd211f36d76293.tar dreambuilder_modpack-df5879ef7204340b1b4a5d97e3dd211f36d76293.tar.gz dreambuilder_modpack-df5879ef7204340b1b4a5d97e3dd211f36d76293.tar.bz2 dreambuilder_modpack-df5879ef7204340b1b4a5d97e3dd211f36d76293.tar.xz dreambuilder_modpack-df5879ef7204340b1b4a5d97e3dd211f36d76293.zip |
update castle, homedecor, ilights, and unified dyes
Diffstat (limited to 'unifieddyes')
-rw-r--r-- | unifieddyes/init.lua | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/unifieddyes/init.lua b/unifieddyes/init.lua index 580218a..bc8234f 100644 --- a/unifieddyes/init.lua +++ b/unifieddyes/init.lua @@ -93,6 +93,35 @@ local default_dyes = { -- code borrowed from homedecor +-- call this function to reset the rotation of a "wallmounted" object on place + +function unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) + local node = minetest.get_node(pos) + local yaw = placer:get_look_yaw() + local dir = minetest.yaw_to_dir(yaw-1.5) + local pitch = placer:get_look_vertical() + + local fdir = minetest.dir_to_wallmounted(dir) + + if pitch < -(math.pi/8) then + fdir = 0 + elseif pitch > math.pi/8 then + fdir = 1 + end + minetest.swap_node(pos, { name = node.name, param2 = fdir }) +end + +-- use this when you have a "wallmounted" node that should never be oriented +-- to floor or ceiling + +function unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) + local node = minetest.get_node(pos) + local yaw = placer:get_look_yaw() + local dir = minetest.yaw_to_dir(yaw) + local fdir = minetest.dir_to_wallmounted(dir) + minetest.swap_node(pos, { name = node.name, param2 = fdir }) +end + function unifieddyes.select_node(pointed_thing) local pos = pointed_thing.under local node = minetest.get_node_or_nil(pos) |