Skip to content

Commit a5ad307

Browse files
red-001paramat
authored andcommittedMar 11, 2016
Add an on_burn callback.
1 parent 45bc0b2 commit a5ad307

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed
 

Diff for: ‎game_api.txt

+9-1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ The farming API allows you to easily register plants and hoes.
176176
maxlight = default.LIGHT_MAX -- Maximum light to grow
177177
}
178178

179+
Fire API
180+
--------
181+
182+
`on_burn(pos)`
183+
184+
* Called when fire attempts to remove a burning node.
185+
* `pos` Position of the burning node.
186+
179187
Screwdriver API
180188
---------------
181189

@@ -451,4 +459,4 @@ Trees
451459
* Grows a new design aspen tree at pos
452460

453461
* `default.grow_new_snowy_pine_tree(pos)`
454-
* Grows a new design snowy pine tree at pos
462+
* Grows a new design snowy pine tree at pos

Diff for: ‎mods/fire/init.lua

+8-2
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,14 @@ else
235235
-- remove flammable nodes around flame
236236
local p = minetest.find_node_near(p0, 1, {"group:flammable"})
237237
if p then
238-
minetest.remove_node(p)
239-
nodeupdate(p)
238+
local node = minetest.get_node(p)
239+
local def = minetest.registered_nodes[node.name]
240+
if def.on_burn then
241+
def.on_burn(p)
242+
else
243+
minetest.remove_node(p)
244+
nodeupdate(p)
245+
end
240246
end
241247
end
242248
end,

0 commit comments

Comments
 (0)