2019-03-07 21:50:29 -05:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
2019-03-22 21:55:02 -04:00
|
|
|
local minetest, nodecore
|
|
|
|
= minetest, nodecore
|
2019-03-07 21:50:29 -05:00
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
|
2019-03-22 21:55:02 -04:00
|
|
|
nodecore.register_craft({
|
|
|
|
label = "melt sand to glass",
|
|
|
|
action = "cook",
|
|
|
|
touchgroups = {
|
|
|
|
coolant = 0,
|
|
|
|
flame = 3
|
|
|
|
},
|
|
|
|
duration = 20,
|
|
|
|
nodes = {
|
|
|
|
{
|
|
|
|
match = "nc_terrain:sand_loose",
|
|
|
|
replace = modname .. ":glass_hot_source"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2019-03-07 21:50:29 -05:00
|
|
|
|
2019-03-22 21:55:02 -04:00
|
|
|
nodecore.register_cook_abm({
|
2019-03-07 21:50:29 -05:00
|
|
|
nodenames = {"nc_terrain:sand_loose"},
|
2019-03-22 21:55:02 -04:00
|
|
|
neighbors = {"group:flame"}
|
|
|
|
})
|
2019-03-07 22:05:37 -05:00
|
|
|
|
2019-03-07 22:21:04 -05:00
|
|
|
local src = modname .. ":glass_hot_source"
|
|
|
|
local flow = modname .. ":glass_hot_flowing"
|
|
|
|
|
2019-03-22 21:55:02 -04:00
|
|
|
nodecore.register_craft({
|
|
|
|
label = "cool clear glass",
|
|
|
|
action = "cook",
|
|
|
|
duration = 120,
|
|
|
|
nosizzle = true,
|
|
|
|
check = function(pos)
|
|
|
|
return #minetest.find_nodes_in_area(
|
2019-03-07 22:21:04 -05:00
|
|
|
{x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
|
|
|
|
{x = pos.x + 1, y = pos.y + 1, z = pos.z + 1},
|
2019-03-22 21:55:02 -04:00
|
|
|
{flow}) < 1
|
|
|
|
end,
|
|
|
|
nodes = {
|
|
|
|
{
|
|
|
|
match = src,
|
|
|
|
replace = modname .. ":glass"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
nodecore.register_craft({
|
|
|
|
label = "quench opaque glass",
|
|
|
|
action = "cook",
|
|
|
|
nosizzle = true,
|
|
|
|
check = function(pos)
|
|
|
|
return #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},
|
|
|
|
{flow}) < 1
|
|
|
|
and #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:coolant"}) > 0
|
|
|
|
end,
|
|
|
|
nodes = {
|
|
|
|
{
|
|
|
|
match = src,
|
|
|
|
replace = modname .. ":glass_opaque"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2019-03-07 22:21:04 -05:00
|
|
|
|
2019-03-22 21:55:02 -04:00
|
|
|
nodecore.register_cook_abm({nodenames = {src}})
|
2019-03-07 22:21:04 -05:00
|
|
|
|
2019-03-22 21:55:02 -04:00
|
|
|
nodecore.register_limited_abm({
|
|
|
|
label = "Molten Glass Flowing",
|
|
|
|
interval = 1,
|
|
|
|
chance = 4,
|
|
|
|
nodenames = {src},
|
|
|
|
action = function(pos, node)
|
|
|
|
local miny = pos.y
|
|
|
|
local found = {}
|
|
|
|
nodecore.scan_flood(pos, 5, 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)
|
|
|
|
if #found < 1 then return end
|
|
|
|
local np = nodecore.pickrand(found)
|
|
|
|
minetest.set_node(np, node)
|
|
|
|
return minetest.set_node(pos, {name = flow, param2 = 7})
|
2019-03-07 22:05:37 -05:00
|
|
|
end})
|