2019-09-14 20:35:58 -07:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
Active ItemStack Modifier overhaul.
AISM's now tick against stacks, including in piles, shelves,
and player inventories, (hopefully) efficiently compared to
the old way with separate ABMs. Item entity support is also
possible, but not necessary yet.
This started out as a bugfix for being able to put a torch inside a
shelf, which didn't make much sense gameplay-wise. It ended up
going quite a bit further.
- Aggregate now gets wet in stack form. Swimming with dry
concrete now has consequences.
- Lux reactions, radiation, and infusion should now behave more
consistently.
- Sponges can now wet or dry in stack form, including inside
containers.
- Torch ignition, quenching, and extinguishing is now more
consistent regardless of context, and torches are now more
dangerous, and can ignite things in more contexts.
2019-10-29 20:03:00 -04:00
|
|
|
local math, minetest, nodecore, pairs, vector
|
|
|
|
= math, minetest, nodecore, pairs, vector
|
|
|
|
local math_random
|
|
|
|
= math.random
|
2019-09-14 20:35:58 -07:00
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
|
2019-10-06 12:06:36 -04:00
|
|
|
local checkdirs = {
|
|
|
|
{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}
|
|
|
|
}
|
2019-09-14 20:35:58 -07:00
|
|
|
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)
|
2019-10-06 12:06:36 -04:00
|
|
|
for _, ofst in pairs(checkdirs) do
|
2019-10-01 18:30:15 -04:00
|
|
|
local npos = vector.add(pos, ofst)
|
|
|
|
local nbr = minetest.get_node(npos)
|
Active ItemStack Modifier overhaul.
AISM's now tick against stacks, including in piles, shelves,
and player inventories, (hopefully) efficiently compared to
the old way with separate ABMs. Item entity support is also
possible, but not necessary yet.
This started out as a bugfix for being able to put a torch inside a
shelf, which didn't make much sense gameplay-wise. It ended up
going quite a bit further.
- Aggregate now gets wet in stack form. Swimming with dry
concrete now has consequences.
- Lux reactions, radiation, and infusion should now behave more
consistently.
- Sponges can now wet or dry in stack form, including inside
containers.
- Torch ignition, quenching, and extinguishing is now more
consistent regardless of context, and torches are now more
dangerous, and can ignite things in more contexts.
2019-10-29 20:03:00 -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
|
2019-11-10 08:10:34 -05:00
|
|
|
nodecore.gametime > minetest.get_meta(pos):get_float("expire") then
|
2019-10-01 19:01:06 -04:00
|
|
|
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
|
|
|
|
Active ItemStack Modifier overhaul.
AISM's now tick against stacks, including in piles, shelves,
and player inventories, (hopefully) efficiently compared to
the old way with separate ABMs. Item entity support is also
possible, but not necessary yet.
This started out as a bugfix for being able to put a torch inside a
shelf, which didn't make much sense gameplay-wise. It ended up
going quite a bit further.
- Aggregate now gets wet in stack form. Swimming with dry
concrete now has consequences.
- Lux reactions, radiation, and infusion should now behave more
consistently.
- Sponges can now wet or dry in stack form, including inside
containers.
- Torch ignition, quenching, and extinguishing is now more
consistent regardless of context, and torches are now more
dangerous, and can ignite things in more contexts.
2019-10-29 20:03:00 -04:00
|
|
|
nodecore.register_aism({
|
|
|
|
label = "Torch Stack Interactions",
|
|
|
|
itemnames = {modname .. ":torch_lit"},
|
|
|
|
action = function(stack, data)
|
|
|
|
local expire = stack:get_meta():get_float("expire") or 0
|
2019-11-10 08:10:34 -05:00
|
|
|
if expire < nodecore.gametime then
|
Active ItemStack Modifier overhaul.
AISM's now tick against stacks, including in piles, shelves,
and player inventories, (hopefully) efficiently compared to
the old way with separate ABMs. Item entity support is also
possible, but not necessary yet.
This started out as a bugfix for being able to put a torch inside a
shelf, which didn't make much sense gameplay-wise. It ended up
going quite a bit further.
- Aggregate now gets wet in stack form. Swimming with dry
concrete now has consequences.
- Lux reactions, radiation, and infusion should now behave more
consistently.
- Sponges can now wet or dry in stack form, including inside
containers.
- Torch ignition, quenching, and extinguishing is now more
consistent regardless of context, and torches are now more
dangerous, and can ignite things in more contexts.
2019-10-29 20:03:00 -04:00
|
|
|
minetest.sound_play("nc_fire_snuff", {gain = 1, pos = data.pos})
|
|
|
|
return "nc_fire:lump_ash"
|
|
|
|
end
|
|
|
|
|
|
|
|
local pos = data.pos
|
|
|
|
local player = data.player
|
|
|
|
if player then
|
|
|
|
if data.list ~= "main" or player:get_wield_index()
|
|
|
|
~= data.slot then return end
|
|
|
|
pos = vector.add(pos, vector.multiply(player:get_look_dir(), 0.5))
|
|
|
|
end
|
|
|
|
|
2019-11-18 22:35:10 -05:00
|
|
|
if nodecore.quenched(pos, data.node and 1 or 0) then
|
Active ItemStack Modifier overhaul.
AISM's now tick against stacks, including in piles, shelves,
and player inventories, (hopefully) efficiently compared to
the old way with separate ABMs. Item entity support is also
possible, but not necessary yet.
This started out as a bugfix for being able to put a torch inside a
shelf, which didn't make much sense gameplay-wise. It ended up
going quite a bit further.
- Aggregate now gets wet in stack form. Swimming with dry
concrete now has consequences.
- Lux reactions, radiation, and infusion should now behave more
consistently.
- Sponges can now wet or dry in stack form, including inside
containers.
- Torch ignition, quenching, and extinguishing is now more
consistent regardless of context, and torches are now more
dangerous, and can ignite things in more contexts.
2019-10-29 20:03:00 -04:00
|
|
|
minetest.sound_play("nc_fire_snuff", {gain = 1, pos = pos})
|
|
|
|
return "nc_fire:lump_ash"
|
|
|
|
end
|
|
|
|
if math_random() < 0.1 then nodecore.fire_check_ignite(pos) end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
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
|
|
|
|
})
|