From 0f535df79a5c1075124881dbc4eb933b13bfedb1 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 26 Jan 2017 18:06:31 +0100 Subject: [PATCH] Disallow torch placement on ceiling --- mods/signs/init.lua | 4 +--- mods/torches/init.lua | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mods/signs/init.lua b/mods/signs/init.lua index da33ecf500..8f65ed63ce 100644 --- a/mods/signs/init.lua +++ b/mods/signs/init.lua @@ -226,9 +226,7 @@ minetest.register_node("signs:sign_wall", { local sign_info if wdir == 0 then --how would you add sign to ceiling? - minetest.add_item(above, "signs:sign_wall") - itemstack:take_item() - return itemstack + return itemstack elseif wdir == 1 then minetest.add_node(above, {name = "signs:sign_yard", param2 = fdir}) sign_info = signs_yard[fdir + 1] diff --git a/mods/torches/init.lua b/mods/torches/init.lua index aec62bd6b3..5e7de69c13 100644 --- a/mods/torches/init.lua +++ b/mods/torches/init.lua @@ -27,6 +27,7 @@ minetest.register_node(":default:torch", { wall_bottom = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16}, }, sounds = default.node_sound_wood_defaults(), + node_placement_prediction = "", on_place = function(itemstack, placer, pointed_thing) if pointed_thing.type ~= "node" then -- no interaction possible with entities, for now. @@ -45,7 +46,11 @@ minetest.register_node(":default:torch", { local wdir = minetest.dir_to_wallmounted({x = under.x - above.x, y = under.y - above.y, z = under.z - above.z}) local fakestack = itemstack local retval - if wdir <= 1 then + + if wdir == 0 then + -- Prevent placement of ceiling torches + return itemstack + elseif wdir == 1 then retval = fakestack:set_name("default:torch") else retval = fakestack:set_name("default:torch_wall")