Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add an on_burn callback.
  • Loading branch information
red-001 authored and paramat committed Mar 11, 2016
1 parent 45bc0b2 commit a5ad307
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion game_api.txt
Expand Up @@ -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
---------------

Expand Down Expand Up @@ -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
* Grows a new design snowy pine tree at pos
10 changes: 8 additions & 2 deletions mods/fire/init.lua
Expand Up @@ -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,
Expand Down

0 comments on commit a5ad307

Please sign in to comment.