mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-14 15:11:05 +01:00
Disallow torch placement on ceiling
This commit is contained in:
parent
1828a54374
commit
0f535df79a
2 changed files with 7 additions and 4 deletions
|
@ -226,9 +226,7 @@ minetest.register_node("signs:sign_wall", {
|
||||||
local sign_info
|
local sign_info
|
||||||
if wdir == 0 then
|
if wdir == 0 then
|
||||||
--how would you add sign to ceiling?
|
--how would you add sign to ceiling?
|
||||||
minetest.add_item(above, "signs:sign_wall")
|
return itemstack
|
||||||
itemstack:take_item()
|
|
||||||
return itemstack
|
|
||||||
elseif wdir == 1 then
|
elseif wdir == 1 then
|
||||||
minetest.add_node(above, {name = "signs:sign_yard", param2 = fdir})
|
minetest.add_node(above, {name = "signs:sign_yard", param2 = fdir})
|
||||||
sign_info = signs_yard[fdir + 1]
|
sign_info = signs_yard[fdir + 1]
|
||||||
|
|
|
@ -27,6 +27,7 @@ minetest.register_node(":default:torch", {
|
||||||
wall_bottom = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16},
|
wall_bottom = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16},
|
||||||
},
|
},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
node_placement_prediction = "",
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
-- no interaction possible with entities, for now.
|
-- 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 wdir = minetest.dir_to_wallmounted({x = under.x - above.x, y = under.y - above.y, z = under.z - above.z})
|
||||||
local fakestack = itemstack
|
local fakestack = itemstack
|
||||||
local retval
|
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")
|
retval = fakestack:set_name("default:torch")
|
||||||
else
|
else
|
||||||
retval = fakestack:set_name("default:torch_wall")
|
retval = fakestack:set_name("default:torch_wall")
|
||||||
|
|
Loading…
Reference in a new issue