2019-02-19 19:02:21 -05:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
|
|
|
local minetest, nodecore, pairs
|
|
|
|
= minetest, nodecore, pairs
|
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
|
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 function findwater(pos)
|
2019-11-30 10:28:35 -05:00
|
|
|
return nodecore.find_nodes_around(pos, "group:water")
|
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
|
|
|
end
|
|
|
|
|
|
|
|
local function soakup(pos)
|
|
|
|
local any
|
|
|
|
for _, p in pairs(findwater(pos)) do
|
|
|
|
nodecore.node_sound(p, "dig")
|
|
|
|
minetest.remove_node(p)
|
|
|
|
any = true
|
|
|
|
end
|
|
|
|
return any
|
|
|
|
end
|
|
|
|
|
2019-02-19 19:02:21 -05:00
|
|
|
nodecore.register_limited_abm({
|
2020-06-17 07:09:20 -04:00
|
|
|
label = "sponge wet",
|
2019-02-19 19:02:21 -05:00
|
|
|
interval = 1,
|
|
|
|
chance = 10,
|
|
|
|
limited_max = 100,
|
|
|
|
nodenames = {modname .. ":sponge"},
|
|
|
|
neighbors = {"group:water"},
|
|
|
|
action = function(pos)
|
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 soakup(pos) then
|
2020-01-16 22:02:59 -05:00
|
|
|
nodecore.set_loud(pos, {name = modname .. ":sponge_wet"})
|
2020-05-29 09:20:40 -04:00
|
|
|
return nodecore.fallcheck(pos)
|
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
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
nodecore.register_aism({
|
2020-06-17 07:09:20 -04:00
|
|
|
label = "sponge stack wet",
|
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
|
|
|
interval = 1,
|
|
|
|
chance = 10,
|
|
|
|
itemnames = {modname .. ":sponge"},
|
|
|
|
action = function(stack, data)
|
|
|
|
if data.pos and soakup(data.pos) then
|
|
|
|
local taken = stack:take_item(1)
|
|
|
|
taken:set_name(modname .. ":sponge_wet")
|
|
|
|
if data.inv then taken = data.inv:add_item("main", taken) end
|
|
|
|
if not taken:is_empty() then nodecore.item_eject(data.pos, taken) end
|
|
|
|
return stack
|
2019-02-19 19:02:21 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
nodecore.register_limited_abm({
|
2020-06-17 07:09:20 -04:00
|
|
|
label = "sponge sun dry",
|
2019-02-19 19:02:21 -05:00
|
|
|
interval = 1,
|
|
|
|
chance = 100,
|
|
|
|
limited_max = 100,
|
2019-12-18 20:27:56 -05:00
|
|
|
nodenames = {modname .. ":sponge_wet"},
|
2019-02-19 19:02:21 -05:00
|
|
|
action = function(pos)
|
2020-02-22 09:17:36 -05:00
|
|
|
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
2020-02-22 16:55:42 -05:00
|
|
|
if nodecore.is_full_sun(above) and #findwater(pos) < 1 then
|
2020-04-05 21:22:51 -04:00
|
|
|
nodecore.sound_play("nc_api_craft_hiss", {gain = 0.02, pos = pos})
|
2019-02-19 19:02:21 -05:00
|
|
|
return minetest.set_node(pos, {name = modname .. ":sponge"})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
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({
|
2020-06-17 07:09:20 -04:00
|
|
|
label = "sponge stack sun dry",
|
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
|
|
|
interval = 1,
|
|
|
|
chance = 100,
|
2019-12-18 20:27:56 -05:00
|
|
|
itemnames = {modname .. ":sponge_wet"},
|
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
|
|
|
action = function(stack, data)
|
|
|
|
if data.player and (data.list ~= "main"
|
|
|
|
or data.slot ~= data.player:get_wield_index()) then return end
|
2020-02-22 16:55:42 -05:00
|
|
|
if data.pos and nodecore.is_full_sun(data.pos)
|
|
|
|
and #findwater(data.pos) < 1 then
|
2020-04-05 21:22:51 -04:00
|
|
|
nodecore.sound_play("nc_api_craft_hiss", {gain = 0.02, pos = data.pos})
|
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 taken = stack:take_item(1)
|
|
|
|
taken:set_name(modname .. ":sponge")
|
|
|
|
if data.inv then taken = data.inv:add_item("main", taken) end
|
|
|
|
if not taken:is_empty() then nodecore.item_eject(data.pos, taken) end
|
|
|
|
return stack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
2019-02-19 19:02:21 -05:00
|
|
|
nodecore.register_limited_abm({
|
2020-06-17 07:09:20 -04:00
|
|
|
label = "sponge fire dry",
|
2019-02-19 19:02:21 -05:00
|
|
|
interval = 1,
|
|
|
|
chance = 20,
|
|
|
|
limited_max = 100,
|
2019-12-18 20:27:56 -05:00
|
|
|
nodenames = {modname .. ":sponge_wet"},
|
2019-02-19 19:02:21 -05:00
|
|
|
neighbors = {"group:igniter"},
|
|
|
|
action = function(pos)
|
2020-04-05 21:22:51 -04:00
|
|
|
nodecore.sound_play("nc_api_craft_hiss", {gain = 0.02, pos = pos})
|
2019-02-19 19:02:21 -05:00
|
|
|
return minetest.set_node(pos, {name = modname .. ":sponge"})
|
|
|
|
end
|
|
|
|
})
|