nalc/misc/forbid_underwater_torch.lua

9 lines
363 B
Lua
Raw Normal View History

2018-11-03 15:12:44 +01:00
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
2018-11-07 20:02:38 +01:00
if newnode.name ~= "default:torch" and newnode.name ~= "default:torch_wall" or minetest.get_item_group(oldnode.name, "water") == 0 then
2018-11-03 15:12:44 +01:00
return
end
minetest.remove_node(pos, newnode)
minetest.set_node(pos, oldnode)
minetest.add_item(pos, "default:torch")
end)