From 639584ec06da6d6c6ef6a47ae2f2232cb91f66a9 Mon Sep 17 00:00:00 2001 From: crabman77 Date: Tue, 3 Mar 2015 00:19:08 +0100 Subject: [PATCH] callback for torches in water --- minetestforfun_game/mods/default/functions.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/minetestforfun_game/mods/default/functions.lua b/minetestforfun_game/mods/default/functions.lua index a67593ae..d4bf13fb 100644 --- a/minetestforfun_game/mods/default/functions.lua +++ b/minetestforfun_game/mods/default/functions.lua @@ -426,3 +426,13 @@ minetest.register_abm({ }) end -- Ends: if minetest.setting_getbool("leaf_decay") ~= false + +minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing) + if newnode.name ~= "default:torch" or minetest.get_item_group(oldnode.name, "water") == 0 then + return + end + minetest.remove_node(pos, newnode) + minetest.set_node(pos, oldnode) + minetest.add_item(pos, "default:torch") +end) +