1
0
Fork 0

Disallow torch placement on ceiling

This commit is contained in:
Wuzzy 2017-01-26 18:06:31 +01:00
parent 1828a54374
commit 0f535df79a
2 changed files with 7 additions and 4 deletions

View File

@ -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]

View File

@ -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")