2019-09-14 20:35:58 -07:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
2019-10-01 18:30:15 -04:00
|
|
|
local minetest, nodecore, pairs, vector
|
|
|
|
= minetest, nodecore, pairs, vector
|
2019-09-14 20:35:58 -07:00
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
|
|
|
|
nodecore.register_limited_abm({
|
2019-10-01 19:01:06 -04:00
|
|
|
label = "Torch Igniting",
|
2019-10-01 18:30:15 -04:00
|
|
|
interval = 6,
|
|
|
|
chance = 1,
|
|
|
|
nodenames = {modname .. ":torch_lit"},
|
|
|
|
neighbors = {"group:flammable"},
|
|
|
|
action = function(pos)
|
|
|
|
local check = {
|
|
|
|
{x = 1, y = 0, z = 0},
|
|
|
|
{x = -1, y = 0, z = 0},
|
|
|
|
{x = 0, y = 0, z = 1},
|
|
|
|
{x = 0, y = 0, z = -1},
|
|
|
|
{x = 0, y = 1, z = 0}
|
|
|
|
}
|
|
|
|
for _, ofst in pairs(check) do
|
|
|
|
local npos = vector.add(pos, ofst)
|
|
|
|
local nbr = minetest.get_node(npos)
|
2019-10-05 17:49:16 -04:00
|
|
|
if minetest.get_item_group(nbr.name, "flammable") > 0 and not nodecore.quenched(npos) then
|
2019-10-01 18:30:15 -04:00
|
|
|
nodecore.fire_check_ignite(npos, nbr)
|
|
|
|
end
|
2019-09-14 20:35:58 -07:00
|
|
|
end
|
|
|
|
end
|
2019-10-01 18:30:15 -04:00
|
|
|
})
|
2019-09-14 20:35:58 -07:00
|
|
|
|
|
|
|
nodecore.register_limited_abm({
|
2019-10-01 19:01:06 -04:00
|
|
|
label = "Torch Extinguishing",
|
2019-10-01 18:30:15 -04:00
|
|
|
interval = 1,
|
|
|
|
chance = 1,
|
|
|
|
nodenames = {modname .. ":torch_lit"},
|
|
|
|
action = function(pos)
|
2019-10-01 19:01:06 -04:00
|
|
|
if nodecore.quenched(pos) or
|
|
|
|
minetest.get_gametime() > minetest.get_meta(pos):get_float("expire") then
|
|
|
|
minetest.remove_node(pos)
|
2019-10-01 18:30:15 -04:00
|
|
|
minetest.add_item(pos, {name = "nc_fire:lump_ash"})
|
|
|
|
minetest.sound_play("nc_fire_snuff", {gain = 1, pos = pos})
|
|
|
|
end
|
2019-09-14 21:40:35 -07:00
|
|
|
end
|
2019-10-01 18:30:15 -04:00
|
|
|
})
|
2019-10-01 19:23:34 -04:00
|
|
|
|
|
|
|
nodecore.register_ambiance({
|
|
|
|
label = "Flame Ambiance",
|
|
|
|
nodenames = {modname .. ":torch_lit"},
|
|
|
|
interval = 1,
|
|
|
|
chance = 1,
|
|
|
|
sound_name = "nc_fire_flamy",
|
|
|
|
sound_gain = 0.1
|
|
|
|
})
|