2019-08-23 22:45:08 -04:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
2019-11-28 11:29:21 -05:00
|
|
|
local math, minetest, nodecore
|
|
|
|
= math, minetest, nodecore
|
2019-08-23 22:45:08 -04:00
|
|
|
local math_random
|
|
|
|
= math.random
|
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
|
|
|
|
local ashdirs = {
|
|
|
|
{x = 1, y = -1, z = 0},
|
|
|
|
{x = -1, y = -1, z = 0},
|
|
|
|
{x = 0, y = -1, z = 1},
|
|
|
|
{x = 0, y = -1, z = -1}
|
|
|
|
}
|
|
|
|
|
|
|
|
nodecore.register_craft({
|
2019-08-27 19:14:51 -04:00
|
|
|
label = "mix concrete (fail)",
|
|
|
|
action = "pummel",
|
|
|
|
priority = 2,
|
|
|
|
toolgroups = {thumpy = 1},
|
|
|
|
normal = {y = 1},
|
|
|
|
nodes = {
|
|
|
|
{
|
2019-09-09 06:58:57 -04:00
|
|
|
match = {groups = {gravel = true}}
|
2019-08-27 19:14:51 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
x = 1,
|
|
|
|
y = -1,
|
|
|
|
match = {buildable_to = true}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
y = -1,
|
|
|
|
match = "nc_fire:ash",
|
|
|
|
replace = "air"
|
|
|
|
}
|
2019-08-23 22:45:08 -04:00
|
|
|
},
|
2019-08-27 19:14:51 -04:00
|
|
|
after = function(pos)
|
2019-11-28 11:29:21 -05:00
|
|
|
nodecore.item_disperse(pos, "nc_fire:lump_ash", 8, ashdirs)
|
2019-08-23 22:45:08 -04:00
|
|
|
end
|
2019-08-27 19:14:51 -04:00
|
|
|
})
|
2019-08-23 22:45:08 -04:00
|
|
|
|
|
|
|
nodecore.register_craft({
|
2019-08-27 19:14:51 -04:00
|
|
|
label = "mix concrete",
|
|
|
|
action = "pummel",
|
|
|
|
priority = 1,
|
|
|
|
toolgroups = {thumpy = 1},
|
|
|
|
normal = {y = 1},
|
|
|
|
nodes = {
|
|
|
|
{
|
2019-09-09 06:58:57 -04:00
|
|
|
match = {groups = {gravel = true}},
|
2019-08-27 19:14:51 -04:00
|
|
|
replace = "air"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
y = -1,
|
|
|
|
match = "nc_fire:ash",
|
|
|
|
replace = modname .. ":aggregate"
|
|
|
|
}
|
2019-08-23 22:45:08 -04:00
|
|
|
}
|
2019-08-27 19:14:51 -04:00
|
|
|
})
|
2019-08-23 23:16:59 -04:00
|
|
|
|
|
|
|
local flow = modname .. ":wet_flowing"
|
|
|
|
local src = modname .. ":wet_source"
|
|
|
|
|
|
|
|
nodecore.register_limited_abm({
|
2019-08-27 19:14:51 -04:00
|
|
|
label = "Aggregate Wettening",
|
|
|
|
interval = 1,
|
|
|
|
chance = 2,
|
|
|
|
limited_max = 100,
|
|
|
|
nodenames = {modname .. ":aggregate"},
|
|
|
|
neighbors = {"group:water"},
|
|
|
|
action = function(pos)
|
|
|
|
minetest.set_node(pos, {name = src})
|
|
|
|
nodecore.node_sound(pos, "place")
|
|
|
|
end
|
|
|
|
})
|
2019-08-23 23:16:59 -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 = "Aggregate Stack Wettening",
|
|
|
|
interval = 1,
|
|
|
|
chance = 2,
|
|
|
|
itemnames = {modname .. ":aggregate"},
|
|
|
|
action = function(stack, data)
|
|
|
|
local found = minetest.find_node_near(data.pos, 1, {"group:water"})
|
|
|
|
if not found then return end
|
2019-11-24 08:17:13 -05:00
|
|
|
if stack:get_count() == 1 and data.node then
|
|
|
|
local def = minetest.registered_nodes[data.node.name]
|
|
|
|
if def and def.groups and def.groups.is_stack_only then
|
|
|
|
found = data.pos
|
|
|
|
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
|
|
|
end
|
2019-11-24 08:17:13 -05:00
|
|
|
minetest.set_node(found, {name = src})
|
|
|
|
nodecore.node_sound(found, "place")
|
|
|
|
stack:take_item(1)
|
|
|
|
return stack
|
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
|
|
|
|
})
|
|
|
|
|
2019-08-23 23:16:59 -04:00
|
|
|
nodecore.register_limited_abm({
|
2019-08-27 19:14:51 -04:00
|
|
|
label = "Aggregate Wandering",
|
|
|
|
interval = 4,
|
|
|
|
chance = 2,
|
|
|
|
limited_max = 100,
|
|
|
|
nodenames = {src},
|
|
|
|
neighbors = {flow},
|
|
|
|
action = function(pos, node)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
local gen = meta:get_int("agggen")
|
|
|
|
if gen >= 8 and math_random(1, 2) == 1 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
|
|
|
nodecore.witness({x = pos.x, y = pos.y + 0.5, z = pos.z},
|
|
|
|
"aggregate to cobble")
|
2019-08-27 19:14:51 -04:00
|
|
|
minetest.set_node(pos, {name = "nc_terrain:cobble"})
|
|
|
|
return nodecore.node_sound(pos, "place")
|
|
|
|
end
|
|
|
|
local miny = pos.y
|
|
|
|
local found = {}
|
|
|
|
nodecore.scan_flood(pos, 2, function(p)
|
|
|
|
local nn = minetest.get_node(p).name
|
|
|
|
if nn == src then return end
|
|
|
|
if nn ~= flow then return false end
|
|
|
|
if p.y > miny then return end
|
|
|
|
if p.y == miny then
|
|
|
|
found[#found + 1] = p
|
|
|
|
return
|
|
|
|
end
|
|
|
|
miny = p.y
|
|
|
|
found = {p}
|
|
|
|
end)
|
2019-08-23 23:16:59 -04:00
|
|
|
if #found < 1 then return end
|
2019-08-27 19:14:51 -04:00
|
|
|
local np = nodecore.pickrand(found)
|
|
|
|
nodecore.node_sound(pos, "dig")
|
|
|
|
minetest.set_node(np, node)
|
|
|
|
minetest.get_meta(np):set_int("agggen", gen + 1)
|
|
|
|
minetest.set_node(pos, {name = flow, param2 = 7})
|
|
|
|
end
|
|
|
|
})
|
2019-08-23 23:16:59 -04:00
|
|
|
|
2019-11-28 09:28:51 -05:00
|
|
|
nodecore.register_limited_abm({
|
|
|
|
label = "Aggregate Sink/Disperse",
|
|
|
|
interval = 4,
|
|
|
|
chance = 2,
|
|
|
|
limited_max = 100,
|
|
|
|
nodenames = {src},
|
|
|
|
neighbors = {"group:water"},
|
|
|
|
action = function(pos, node)
|
|
|
|
local waters = #minetest.find_nodes_in_area(
|
|
|
|
{x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
|
|
|
|
{x = pos.x + 1, y = pos.y + 1, z = pos.z + 1},
|
|
|
|
{"group:water"}
|
|
|
|
)
|
|
|
|
local rnd = math_random() * 20
|
|
|
|
if rnd * rnd < waters then
|
|
|
|
minetest.set_node(pos, {name = "nc_terrain:gravel"})
|
|
|
|
return nodecore.fallcheck(pos)
|
|
|
|
end
|
|
|
|
|
|
|
|
local below = {x = pos.x, y = pos.y - 1, z = pos.z}
|
|
|
|
local bnode = minetest.get_node(below)
|
|
|
|
if bnode.name == "ignore" then return end
|
|
|
|
local bdef = minetest.registered_nodes[bnode.name] or {}
|
|
|
|
if bdef.groups and bdef.groups.water then
|
|
|
|
nodecore.node_sound(pos, "dig")
|
|
|
|
minetest.set_node(below, node)
|
|
|
|
minetest.set_node(pos, bnode)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
2019-08-23 23:16:59 -04:00
|
|
|
nodecore.register_craft({
|
2019-08-27 19:14:51 -04:00
|
|
|
label = "aggregate curing",
|
|
|
|
action = "cook",
|
|
|
|
duration = 300,
|
|
|
|
cookfx = {smoke = 0.05},
|
|
|
|
check = function(pos)
|
|
|
|
return not minetest.find_node_near(pos, 1, {flow, "group:water"})
|
|
|
|
end,
|
|
|
|
nodes = {
|
|
|
|
{
|
|
|
|
match = src,
|
|
|
|
replace = "nc_terrain:stone"
|
|
|
|
}
|
2019-08-23 23:16:59 -04:00
|
|
|
}
|
2019-08-27 19:14:51 -04:00
|
|
|
})
|
2019-08-23 23:16:59 -04:00
|
|
|
|
|
|
|
nodecore.register_cook_abm({nodenames = {src}})
|