mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-09 17:23:51 +01:00
Make functions of fire mod global and move register_on_* functions to node definition
This commit is contained in:
parent
bed848f68a
commit
8a6b2df6b1
@ -13,9 +13,17 @@ minetest.register_node("fire:basic_flame", {
|
||||
drop = '',
|
||||
walkable = false,
|
||||
damage_per_second = 4,
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
fire.on_flame_add_at(pos)
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
fire.on_flame_remove_at(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
local fire = {}
|
||||
fire = {}
|
||||
fire.D = 6
|
||||
-- key: position hash of low corner of area
|
||||
-- value: {handle=sound handle, name=sound name}
|
||||
@ -93,18 +101,6 @@ function fire.flame_should_extinguish(pos)
|
||||
return (#ps ~= 0)
|
||||
end
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer)
|
||||
if newnode.name == "fire:basic_flame" then
|
||||
fire.on_flame_add_at(pos)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_dignode(function(pos, oldnode, digger)
|
||||
if oldnode.name == "fire:basic_flame" then
|
||||
fire.on_flame_remove_at(pos)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Ignite neighboring nodes
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:flammable"},
|
||||
|
Loading…
Reference in New Issue
Block a user