diff --git a/game_api.txt b/game_api.txt index 6f4af4a8..a204492f 100644 --- a/game_api.txt +++ b/game_api.txt @@ -178,6 +178,9 @@ farming.register_plant(name, Plant definition) Fire API ---------- Add group flammable when registering a node to make fire seek for it. +Add on_burn to nodedef to do sth different than simply removing the flammable node: +If on_burn is a string, then the node gets replaced with on_burn, +else on_burn is a function with the params pos and node, if it returns false, the node will be removed. Screwdriver API --------------- diff --git a/mods/fire/init.lua b/mods/fire/init.lua index cc49ae70..1ec2a94c 100644 --- a/mods/fire/init.lua +++ b/mods/fire/init.lua @@ -207,6 +207,19 @@ else if not p then return end + local node = minetest.get_node(p) + local on_burn = minetest.registered_nodes[node.name].on_burn + if on_burn then + if type(on_burn) == "string" then + node.name = on_burn + minetest.set_node(p, node) + nodeupdate(p) + return + end + if on_burn(p, node) ~= false then + return + end + end minetest.remove_node(p) nodeupdate(p) end,