mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-06 13:54:25 -04:00
Add on_burn code that happens upon burning.
This commit is contained in:
parent
31c88df258
commit
6be732e432
2 changed files with 16 additions and 0 deletions
|
@ -178,6 +178,9 @@ farming.register_plant(name, Plant definition)
|
||||||
Fire API
|
Fire API
|
||||||
----------
|
----------
|
||||||
Add group flammable when registering a node to make fire seek for it.
|
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
|
Screwdriver API
|
||||||
---------------
|
---------------
|
||||||
|
|
|
@ -207,6 +207,19 @@ else
|
||||||
if not p then
|
if not p then
|
||||||
return
|
return
|
||||||
end
|
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)
|
minetest.remove_node(p)
|
||||||
nodeupdate(p)
|
nodeupdate(p)
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Add table
Reference in a new issue