return itemstack
end
- local wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
+ local buildable = minetest.get_nodedef(minetest.get_node(pointed_thing.under).name, "buildable_to")
+
+ local wdir
+
+ if buildable then
+ wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.under))
+ else
+ wdir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under,pointed_thing.above))
+ end
local fakestack = itemstack
local retval = false
- if wdir < 1 then
+
+ if buildable and wdir == 4 then
+ retval = fakestack:set_name("torch:floor")
+ elseif wdir < 1 then
return itemstack
elseif wdir == 1 then
retval = fakestack:set_name("torch:floor")
else
retval = fakestack:set_name("torch:wall")
end
+
if not retval then
return itemstack
end
})
minetest.register_node("torch:floor", {
- inventory_image = "default_torch.png",
+ inventory_image = "torches_torch.png",
wield_image = "torches_torch.png",
wield_scale = {x = 1, y = 1, z = 1 + 2/16},
drawtype = "mesh",
sunlight_propagates = true,
drop = "torch:torch",
walkable = false,
+ floodable = true,
+ on_flood = function(pos, oldnode, newnode)
+ minetest.throw_item(pos, "torch:torch")
+ end,
light_source = 13,
groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1},
legacy_wallmounted = true,
})
minetest.register_node("torch:wall", {
- inventory_image = "default_torch.png",
+ inventory_image = "torches_torch.png",
wield_image = "torches_torch.png",
wield_scale = {x = 1, y = 1, z = 1 + 1/16},
drawtype = "mesh",
tiles = {"torches_torch.png"},
paramtype = "light",
paramtype2 = "wallmounted",
+ floodable = true,
+ on_flood = function(pos, oldnode, newnode)
+ minetest.throw_item(pos, "torch:torch")
+ end,
sunlight_propagates = true,
walkable = false,
light_source = 13,
minetest.register_craft({
output = "torch:torch 4",
recipe = {
- {"main:coal"},
- {"main:stick"}
- }
-})
-minetest.register_craft({
- output = "torch:torch 4",
- recipe = {
- {"main:charcoal"},
- {"main:stick"}
+ {"group:coal"},
+ {"group:stick"}
}
})