2019-08-30 20:58:19 -04:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
2020-02-05 07:16:22 -05:00
|
|
|
local minetest, nodecore, pairs, vector
|
|
|
|
= minetest, nodecore, pairs, vector
|
2019-08-30 20:58:19 -04:00
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
|
|
|
nodecore.register_limited_abm({
|
2019-08-31 08:27:59 -04:00
|
|
|
label = "Lux Reaction",
|
|
|
|
interval = 1,
|
|
|
|
chance = 2,
|
|
|
|
limited_max = 100,
|
|
|
|
nodenames = {"group:lux_cobble"},
|
|
|
|
action = function(pos, node)
|
2020-02-05 07:16:22 -05:00
|
|
|
local qty = nodecore.lux_react_qty(pos)
|
2019-08-31 08:27:59 -04:00
|
|
|
local name = node.name:gsub("cobble%d", "cobble" .. qty)
|
|
|
|
if name == node.name then return end
|
|
|
|
minetest.set_node(pos, {name = name})
|
|
|
|
end
|
|
|
|
})
|
2019-08-30 21:35:43 -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({
|
2019-08-31 08:27:59 -04:00
|
|
|
label = "Lux Stack Reaction",
|
|
|
|
interval = 1,
|
|
|
|
chance = 2,
|
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
|
|
|
itemnames = {"group:lux_cobble"},
|
|
|
|
action = function(stack, data)
|
2020-02-05 07:16:22 -05:00
|
|
|
local name = stack:get_name()
|
|
|
|
if minetest.get_item_group(name, "lux_cobble") <= 0 then return end
|
|
|
|
local qty = nodecore.lux_react_qty(data.pos)
|
2019-08-31 08:27:59 -04:00
|
|
|
name = name:gsub("cobble%d", "cobble" .. qty)
|
|
|
|
if name == stack:get_name() then return end
|
|
|
|
stack:set_name(name)
|
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
|
|
|
return stack
|
2019-08-31 08:27:59 -04:00
|
|
|
end
|
|
|
|
})
|
2019-08-30 21:35:43 -04:00
|
|
|
|
|
|
|
local function playercheck(player)
|
|
|
|
local found
|
|
|
|
local stacks = {}
|
|
|
|
local inv = player:get_inventory()
|
|
|
|
for i = 1, inv:get_size("main") do
|
|
|
|
local stack = inv:get_stack("main", i)
|
2020-02-05 07:16:22 -05:00
|
|
|
if minetest.get_item_group(stack:get_name(), "lux_cobble") > 0 then
|
2019-08-30 21:35:43 -04:00
|
|
|
stacks[i] = stack
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if not found then return end
|
2020-02-05 07:16:22 -05:00
|
|
|
local qty = nodecore.lux_react_qty(vector.add(player:get_pos(), {x = 0, y = 1, z = 0}))
|
2019-08-30 21:35:43 -04:00
|
|
|
for k, v in pairs(stacks) do
|
|
|
|
local name = v:get_name()
|
|
|
|
local nn = name:gsub("cobble%d", "cobble" .. qty)
|
|
|
|
if name ~= nn then
|
|
|
|
v:set_name(nn)
|
|
|
|
inv:set_stack("main", k, v)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local function playercheckall()
|
|
|
|
minetest.after(1, playercheckall)
|
|
|
|
for _, p in pairs(minetest.get_connected_players()) do
|
|
|
|
playercheck(p)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
playercheckall()
|