From 2ccb449550227ab16834efbd1a98fc8b651cedd4 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Sun, 15 Sep 2019 01:22:49 -0400 Subject: [PATCH] move hanging wooden sign back to signs_lib (it's now handled by signs_lib's generic hanging-sign code) --- init.lua | 51 ++++++----------- models/basic_signs_hanging_sign.obj | 62 --------------------- models/basic_signs_hanging_sign_entity.obj | 15 ----- textures/basic_signs_ceiling_hangers.png | Bin 155 -> 0 bytes 4 files changed, 17 insertions(+), 111 deletions(-) delete mode 100644 models/basic_signs_hanging_sign.obj delete mode 100644 models/basic_signs_hanging_sign_entity.obj delete mode 100644 textures/basic_signs_ceiling_hangers.png diff --git a/init.lua b/init.lua index 083f75f..e9dd734 100644 --- a/init.lua +++ b/init.lua @@ -9,6 +9,14 @@ dofile(basic_signs.path .. "/crafting.lua") local S, NS = dofile(basic_signs.path .. "/intllib.lua") basic_signs.gettext = S +function basic_signs.check_for_floor(pointed_thing) + if pointed_thing.above.x == pointed_thing.under.x + and pointed_thing.above.z == pointed_thing.under.z + and pointed_thing.above.y > pointed_thing.under.y then + return true + end +end + function basic_signs.determine_sign_type(pos, placer, itemstack, pointed_thing) local playername = placer:get_player_name() local pt_name = minetest.get_node(pointed_thing.under).name @@ -19,24 +27,21 @@ function basic_signs.determine_sign_type(pos, placer, itemstack, pointed_thing) return itemstack end + local newparam2 = minetest.dir_to_facedir(placer:get_look_dir()) + if minetest.registered_nodes[pt_name] and minetest.registered_nodes[pt_name].on_rightclick and not placer:get_player_control().sneak then return minetest.registered_nodes[pt_name].on_rightclick(pos, node, placer, itemstack, pointed_thing) elseif signs_lib.check_for_pole(pos, pointed_thing) then - minetest.swap_node(pos, {name = "default:sign_wall_wood_onpole", param2 = node.param2}) - else - local lookdir = placer:get_look_dir() - print(dump(lookdir)) - local newparam2 = minetest.dir_to_facedir(lookdir) - - if node.param2 == 0 then - minetest.swap_node(pos, {name = "basic_signs:hanging_sign", param2 = newparam2}) - elseif node.param2 == 1 then - minetest.swap_node(pos, {name = "basic_signs:yard_sign", param2 = newparam2}) - end - signs_lib.update_sign(pos) + minetest.swap_node(pos, {name = "default:sign_wall_wood_onpole", param2 = node.param2}) + elseif signs_lib.check_for_ceiling(pointed_thing) then + minetest.swap_node(pos, {name = "default:sign_wall_wood_hanging", param2 = newparam2}) + elseif basic_signs.check_for_floor(pointed_thing) then + minetest.swap_node(pos, {name = "basic_signs:yard_sign", param2 = newparam2}) end + signs_lib.update_sign(pos) + if not creative.is_enabled_for(playername) then itemstack:take_item() end @@ -118,27 +123,5 @@ signs_lib.register_sign("basic_signs:yard_sign", { allow_onpole = false }) -signs_lib.register_sign("basic_signs:hanging_sign", { - description = "Wooden sign, hanging", - paramtype2 = "facedir", - selection_box = signs_lib.make_selection_boxes(35, 32, false, 0, 3, -18.5, true), - mesh = "basic_signs_hanging_sign.obj", - tiles = { - "signs_lib_sign_wall_wooden.png", - "signs_lib_sign_wall_wooden_edges.png", - "basic_signs_ceiling_hangers.png" - }, - inventory_image = "default_sign_wood.png", - entity_info = { - mesh = "basic_signs_hanging_sign_entity.obj", - yaw = signs_lib.standard_yaw - }, - drop = "default:sign_wall_wood", - allow_onpole = false -}) - table.insert(signs_lib.lbm_restore_nodes, "signs:sign_yard") -table.insert(signs_lib.lbm_restore_nodes, "signs:sign_hanging") minetest.register_alias("signs:sign_yard", "basic_signs:yard_sign") -minetest.register_alias("signs:sign_hanging", "basic_signs:hanging_sign") - diff --git a/models/basic_signs_hanging_sign.obj b/models/basic_signs_hanging_sign.obj deleted file mode 100644 index 263eb9c..0000000 --- a/models/basic_signs_hanging_sign.obj +++ /dev/null @@ -1,62 +0,0 @@ -# Blender v2.79 (sub 0) OBJ File: 'basic_signs wooden hanging sign.blend' -# www.blender.org -o Cube -v 0.437500 -0.312500 0.031250 -v 0.437500 -0.312500 -0.031250 -v 0.437500 0.312500 0.031250 -v 0.437500 0.312500 -0.031250 -v -0.437500 -0.312500 0.031250 -v -0.437500 -0.312500 -0.031250 -v -0.437500 0.312500 0.031250 -v -0.437500 0.312500 -0.031250 -v 0.437500 -0.312500 0.031250 -v 0.437500 -0.312500 -0.031250 -v 0.437500 0.312500 0.031250 -v 0.437500 0.312500 -0.031250 -v -0.437500 -0.312500 0.031250 -v -0.437500 -0.312500 -0.031250 -v -0.437500 0.312500 0.031250 -v -0.437500 0.312500 -0.031250 -v 0.500000 0.312500 0.000000 -v 0.500000 0.500000 0.000000 -v -0.500000 0.312500 0.000000 -v -0.500000 0.500000 0.000000 -vt 0.468750 0.812500 -vt 0.031250 0.812500 -vt 0.031250 0.187500 -vt 0.468750 0.187500 -vt 0.531250 0.812500 -vt 0.968750 0.812500 -vt 0.968750 0.187500 -vt 0.531250 0.187500 -vt 0.234375 0.000000 -vt 0.234375 1.000000 -vt 0.015625 1.000000 -vt 0.015625 -0.000000 -vt 0.609375 -0.000000 -vt 0.609375 1.000000 -vt 0.390625 1.000000 -vt 0.390625 -0.000000 -vt 0.765625 0.000000 -vt 0.765625 1.000000 -vt 1.000000 0.812500 -vt 1.000000 1.000000 -vt 0.000000 1.000000 -vt -0.000000 0.812500 -vn 0.0000 0.0000 -1.0000 -vn 0.0000 -0.0000 1.0000 -vn 0.0000 -1.0000 0.0000 -vn 0.0000 1.0000 0.0000 -vn 1.0000 0.0000 0.0000 -vn -1.0000 0.0000 0.0000 -g Cube_Cube_front-back -s off -f 8/1/1 4/2/1 2/3/1 6/4/1 -f 3/5/2 7/6/2 5/7/2 1/8/2 -g Cube_Cube_edges -f 13/9/3 14/10/3 10/11/3 9/12/3 -f 11/13/4 12/14/4 16/15/4 15/16/4 -f 11/13/5 9/17/5 10/18/5 12/14/5 -f 13/9/6 15/16/6 16/15/6 14/10/6 -g Cube_Cube_hangers -f 19/19/1 20/20/1 18/21/1 17/22/1 diff --git a/models/basic_signs_hanging_sign_entity.obj b/models/basic_signs_hanging_sign_entity.obj deleted file mode 100644 index 34fa86b..0000000 --- a/models/basic_signs_hanging_sign_entity.obj +++ /dev/null @@ -1,15 +0,0 @@ -# Blender v2.79 (sub 0) OBJ File: 'basic_signs wooden hanging sign.blend' -# www.blender.org -o Plane -v 0.406250 -0.281250 -0.042969 -v -0.406250 -0.281250 -0.042969 -v 0.406250 0.281250 -0.042969 -v -0.406250 0.281250 -0.042969 -vt 0.000000 0.000000 -vt 1.000000 0.000000 -vt 1.000000 1.000000 -vt 0.000000 1.000000 -vn 0.0000 -0.0000 -1.0000 -g Plane_Plane_None -s off -f 1/1/1 2/2/1 4/3/1 3/4/1 diff --git a/textures/basic_signs_ceiling_hangers.png b/textures/basic_signs_ceiling_hangers.png deleted file mode 100644 index 04d74a9359e059cf15e6bb7b47ac581dd5688e51..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 155 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJBu^K|kch)?FC64NpupqyaQday zn|C@KD`r&RvfOE+(#0UIr~l9WT4bnKbgs8CYPF!j<&7_%zW8wS+&y^@O~wE(Lx%Ev zosKdyyRzNa{%w7(pJw}NM|E`Ue`#4k5SaMiilJtk#*(ud7mR_nF?hQAxvX