Aaron Suen 2c47a151cc Started new mechanic for molten rock transport.
Quench lava to amalgam and it can be moved
around like loose cobble.  The tricky bit is that it
needs to STAY quenched at ALL TIMES, and is
not (currently) stackable, so water channels need
to be setup to transport it, and limited amounts
can be moved at a time.

It's also an igniter and thus will dry out sponges
left to keep it cool.
2020-01-16 23:09:55 -05:00

88 lines
2.1 KiB
Lua

-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore, vector
= minetest, nodecore, vector
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
local overlay = ""
for i = 0, 31 do
overlay = overlay .. ":0," .. (i * 16) .. "=nc_terrain_cobble.png"
.. ":0," .. (i * 16) .. "=nc_api_loose.png"
end
local amalgam = modname .. ":amalgam"
local lavasrc = modname .. ":lava_source"
minetest.register_node(amalgam, {
description = "Amalgam",
tiles = {{
name = "[combine:16x512:0,0=nc_terrain_lava.png" .. overlay,
animation = {
["type"] = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 8
}
}},
paramtype = "light",
light_source = 3,
groups = {
crumbly = 2,
falling_repose = 3,
igniter = 1,
stack_as_node = 1
},
crush_damage = 2,
stack_max = 1,
sounds = nodecore.sounds("nc_terrain_chompy")
})
nodecore.register_limited_abm({
label = "Quench Lava to Amalgam",
interval = 1,
chance = 2,
nodenames = {modname .. ":lava_source"},
neighbors = {"group:coolant"},
action = function(pos)
return nodecore.set_loud(pos, {name = amalgam})
end
})
nodecore.register_limited_abm({
label = "Melt Amalgam to Lava",
interval = 1,
chance = 2,
nodenames = {amalgam},
action = function(pos)
if nodecore.quenched(pos) then return end
return nodecore.set_loud(pos, {name = lavasrc})
end
})
nodecore.register_aism({
label = "Amalgam Stack Melting",
interval = 1,
chance = 2,
itemnames = {amalgam},
action = function(stack, data)
if nodecore.quenched(data.pos) then return end
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
nodecore.set_loud(data.pos, {name = lavasrc})
stack:take_item(1)
return stack
end
end
for rel in nodecore.settlescan() do
local p = vector.add(data.pos, rel)
if nodecore.buildable_to(p) then
nodecore.set_loud(p, {name = lavasrc})
stack:take_item(1)
return stack
end
end
end
})