mirror of
https://github.com/minetest-mods/magma_conduits.git
synced 2024-12-21 04:55:40 +01:00
665dbe2636
* Initial stab at volcano mapgen * Make caldera conical, randomized size a bit * remove grass from underwater soil * add snow, fix some errors in mountain shape calculations * improved soil and snow generation, more efficient mapgen * add some configuration for volcanos, and a find volcanoes command for debugging * enhance findvolcano, chunk sizes limited to multiples of mapblocks * more volcano options, also add soil cooking * update readme and screenshot * cosmetic tweaks, slight change to default slope range * fixed the mapgen v7 glitch via a horrible hack :( * fix the need-to-make-changes test * use biome-defined material to decorate slopes * apparently set_lighting and calc_lighting are only supposed to be called on mapgen voxelmanipulators * add magma chambers at the base of the volcano pipe * fixes to large-scale grid calculations * remove a line I added for debugging purposes * bringing back configurable limits now that the bug's been fixed for six months * generalizing the heating/cooling ABM * actually turn the cooling material into the targeted material. * Revert "actually turn the cooling material into the targeted material." This reverts commit 508e10acc7c3871cc56fb8347e7931e5595b5f54. * Fix cooling target node type for real * very strange, abms don't seem to be updating node groups somehow. * Workaround for Minetest issue #7864 * using minetest.after proved unreliable, trying different approach * remove the lava cutoff setting, no longer needed now that veins are fixed * improve findvolcano command * using the same solution for v7 mapgen bug as for the lava crash This is still not 100% reliable, but it's still better than the post-gen patching. * fix randomization of lava depth * remove debugging * extinct volcano lava depth wasn't working right either
115 lines
3.8 KiB
Lua
115 lines
3.8 KiB
Lua
if magma_conduits.config.glowing_rock then
|
|
|
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
|
local S, NS = dofile(modpath.."/intllib.lua")
|
|
|
|
minetest.register_node("magma_conduits:hot_cobble", {
|
|
description = S("Hot Cobble"),
|
|
_doc_items_longdesc = S("Hot stone riven with cracks and seeping traces of lava."),
|
|
_doc_items_usagehelp = S("When normal stone is heated by lava it is converted into this. Beware when digging here!"),
|
|
tiles = {"magma_conduits_hot_cobble.png"},
|
|
is_ground_content = false,
|
|
groups = {cracky = 3, stone = 2, lava_heated=1},
|
|
_magma_conduits_cools_to = "default:cobble",
|
|
sounds = default.node_sound_stone_defaults(),
|
|
light_source = 6,
|
|
drop = "default:cobble",
|
|
})
|
|
|
|
minetest.register_node("magma_conduits:glow_obsidian", {
|
|
description = S("Hot Obsidian"),
|
|
_doc_items_longdesc = S("Obsidian heated to a dull red glow."),
|
|
_doc_items_usagehelp = S("When normal obsidian is heated by lava it is converted into this. Beware when digging here!"),
|
|
tiles = {"magma_conduits_glow_obsidian.png"},
|
|
is_ground_content = true,
|
|
sounds = default.node_sound_stone_defaults(),
|
|
groups = {cracky=1, lava_heated=1, level=2},
|
|
_magma_conduits_cools_to = "default:obsidian",
|
|
light_source = 6,
|
|
drop = "default:obsidian",
|
|
})
|
|
|
|
local simple_copy
|
|
simple_copy = function(t)
|
|
local r = {}
|
|
for k, v in pairs(t) do
|
|
if type(v) == "table" then
|
|
r[k] = simple_copy(v)
|
|
else
|
|
r[k] = v
|
|
end
|
|
end
|
|
return r
|
|
end
|
|
|
|
-- can't use minetest.override_item to change group memberships here due to issue https://github.com/minetest/minetest/issues/5518
|
|
|
|
local make_heatable = function(nodename, heats_to)
|
|
local original_def = minetest.registered_nodes[nodename]
|
|
if original_def ~= nil then
|
|
local def = simple_copy(original_def)
|
|
def.groups.lava_heatable = 1
|
|
def._magma_conduits_heats_to = heats_to
|
|
minetest.register_node(":"..nodename, def)
|
|
end
|
|
end
|
|
|
|
make_heatable("default:obsidian", "magma_conduits:glow_obsidian")
|
|
|
|
make_heatable("default:stone", "magma_conduits:hot_cobble")
|
|
make_heatable("default:cobble", "magma_conduits:hot_cobble")
|
|
make_heatable("default:mossycobble", "magma_conduits:hot_cobble")
|
|
make_heatable("default:stone_with_coal", "magma_conduits:hot_cobble")
|
|
make_heatable("default:stone_with_diamond", "magma_conduits:hot_cobble")
|
|
|
|
make_heatable("default:permafrost", "default:dirt")
|
|
make_heatable("default:permafrost_with_stones", "default:dirt")
|
|
make_heatable("default:permafrost_with_moss", "default:dirt")
|
|
|
|
minetest.register_abm{
|
|
label = "magma_conduits lava heating neighbors",
|
|
nodenames = {"group:lava_heatable"},
|
|
neighbors = {"default:lava_source", "default:lava_flowing"},
|
|
interval = 10,
|
|
chance = 5,
|
|
action = function(pos)
|
|
local name = minetest.get_node(pos).name
|
|
local def = minetest.registered_nodes[name]
|
|
|
|
if def.groups.lava_heatable then
|
|
local target = def._magma_conduits_heats_to
|
|
if target then
|
|
minetest.set_node(pos, {name = target})
|
|
else
|
|
minetest.log("error", name .. " is in group lava_heatable but doesn't have a _magma_conduits_heats_to property defined in its definition")
|
|
end
|
|
end
|
|
end,
|
|
}
|
|
|
|
minetest.register_abm{
|
|
label = "magma_conduits cooling stuff heated by lava",
|
|
nodenames = {"group:lava_heated"},
|
|
interval = 100,
|
|
chance = 10,
|
|
action = function(pos)
|
|
if not minetest.find_node_near(pos, 2, {"default:lava_source", "default:lava_flowing"}, false) then
|
|
local name = minetest.get_node(pos).name
|
|
local def = minetest.registered_nodes[name]
|
|
local target = def._magma_conduits_cools_to
|
|
if target then
|
|
minetest.set_node(pos, {name = target})
|
|
else
|
|
minetest.log("error", name .. " is in group lava_heated but doesn't have a _magma_conduits_cools_to property defined in its definition")
|
|
end
|
|
end
|
|
end,
|
|
}
|
|
|
|
else
|
|
|
|
minetest.register_alias("magma_conduits:hot_cobble", "default:cobble")
|
|
minetest.register_alias("magma_conduits:glow_obsidian", "default:obsidian")
|
|
|
|
end
|