From 7482f84929f777ee87535f2244c982edb9e5ff1b Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Sat, 13 Aug 2022 00:13:12 +0800 Subject: [PATCH] [heads] heads may now be placed on ceilings, upside down --- mods/ITEMS/mcl_heads/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_heads/init.lua b/mods/ITEMS/mcl_heads/init.lua index a971d7b918..69c26b97d5 100644 --- a/mods/ITEMS/mcl_heads/init.lua +++ b/mods/ITEMS/mcl_heads/init.lua @@ -122,18 +122,20 @@ function mcl_heads.deftemplate_floor.on_place(itemstack, placer, pointed_thing) if wdir ~= 0 and wdir ~= 1 then placestack:set_name(itemstring .."_wall") itemstack = minetest.item_place(placestack, placer, pointed_thing, wdir) + -- place floor head node (floor and ceiling) else local fdir = minetest.dir_to_facedir(dir) -- determine the head node rotation based on player's yaw (in cw direction from North/Z+) - local yaw = math.pi*2 - placer:get_look_horizontal() + local yaw = placer:get_look_horizontal() + yaw = wdir == 1 and math.pi*2 - yaw or yaw local rotation_level = math.min(math.max(math.round((yaw / (math.pi*2)) * 16), 0), 15) placestack:set_name(itemstring ..mcl_heads.FLOOR_DEGREES[rotation_level % 4]) -- determine the head node face direction based on rotation level - fdir = math.floor(rotation_level / 4) + fdir = math.floor(rotation_level / 4) + (wdir == 1 and 0 or 20) itemstack = minetest.item_place(placestack, placer, pointed_thing, fdir) end