Add an on_burn callback.
authorred-001 <red-001@users.noreply.github.com>
Wed, 20 Jan 2016 22:18:03 +0000 (22:18 +0000)
committerparamat <mat.gregory@virginmedia.com>
Fri, 11 Mar 2016 15:27:57 +0000 (15:27 +0000)
game_api.txt
mods/fire/init.lua

index 4ee23f09861f8dea8bfefd91690c80699d7c9e66..6944d580e35e56c888081464b4abd8337c859ced 100644 (file)
@@ -176,6 +176,14 @@ The farming API allows you to easily register plants and hoes.
                maxlight = default.LIGHT_MAX           -- Maximum light to grow
        }
 
+Fire API
+--------
+
+`on_burn(pos)`
+
+ * Called when fire attempts to remove a burning node.
+ * `pos` Position of the burning node.
+
 Screwdriver API
 ---------------
 
@@ -451,4 +459,4 @@ Trees
   * Grows a new design aspen tree at pos
 
  * `default.grow_new_snowy_pine_tree(pos)`
-  * Grows a new design snowy pine tree at pos
\ No newline at end of file
+  * Grows a new design snowy pine tree at pos
index a556662802a4e737b9e6005a240025a6cf9bcbe7..28f68e98671d0e0f6c47b34510c609eeb10900b5 100644 (file)
@@ -235,8 +235,14 @@ else
                                -- remove flammable nodes around flame
                                local p = minetest.find_node_near(p0, 1, {"group:flammable"})
                                if p then
-                                       minetest.remove_node(p)
-                                       nodeupdate(p)
+                                       local node = minetest.get_node(p)
+                                       local def = minetest.registered_nodes[node.name]
+                                       if def.on_burn then
+                                               def.on_burn(p)
+                                       else 
+                                               minetest.remove_node(p)
+                                               nodeupdate(p)
+                                       end
                                end
                        end
                end,