add doc support, remove height settings on account of issue #7364

This commit is contained in:
FaceDeer 2018-05-22 00:27:28 -06:00
parent dd9779cc9d
commit ec66452d08
6 changed files with 143 additions and 109 deletions

@ -28,5 +28,10 @@ setting("bool", "remove_default_lava", true, "Removes default mapgen lava")
setting("bool", "ameliorate_floods", true, "Ameliorate lava floods on the surface")
setting("bool", "obsidian_lining", true, "Add an obsidian lining to magma conduits")
setting("bool", "glowing_rock", true, "Cause rock adjacent to lava to convert into glowing form")
setting("int", "upper_limit", 512, "Upper extent of magma conduits")
setting("int", "lower_limit", -31000, "Lower extent of magma conduits")
setting("int", "remove_lava_above", 512, "Remove lava above this y level")
-- Removing this setting on account of issue https://github.com/minetest/minetest/issues/7364
--setting("int", "upper_limit", 512, "Upper extent of magma conduits")
--setting("int", "lower_limit", -31000, "Lower extent of magma conduits")
--from settingtypes.txt:
--magma_conduits_upper_limit (Upper extent of magma conduits) int 512
--magma_conduits_lower_limit (Lower extent of magma conduits) int -31000

@ -1,2 +1,3 @@
default
intllib?
intllib?
doc?

81
hot_rock.lua Normal file

@ -0,0 +1,81 @@
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, hot=1},
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, hot=1, level=2},
light_source = 6,
drop = "default:obsidian",
})
minetest.register_abm{
label = "stone heating",
nodenames = {"default:stone", "default:cobble", "default:mossycobble"},
neighbors = {"default:lava_source", "default:lava_flowing"},
interval = 10,
chance = 5,
action = function(pos)
minetest.set_node(pos, {name = "magma_conduits:hot_cobble"})
end,
}
minetest.register_abm{
label = "obsidian heating",
nodenames = {"default:obsidian"},
neighbors = {"default:lava_source", "default:lava_flowing"},
interval = 10,
chance = 5,
action = function(pos)
minetest.set_node(pos, {name = "magma_conduits:glow_obsidian"})
end,
}
minetest.register_abm{
label = "stone cooling",
nodenames = {"magma_conduits:hot_cobble"},
interval = 100,
chance = 10,
action = function(pos)
if not minetest.find_node_near(pos, 2, {"default:lava_source", "default:lava_flowing"}, false) then
minetest.set_node(pos, {name = "default:cobble"})
end
end,
}
minetest.register_abm{
label = "obsidian cooling",
nodenames = {"magma_conduits:glow_obsidian"},
interval = 100,
chance = 10,
action = function(pos)
if not minetest.find_node_near(pos, 2, {"default:lava_source", "default:lava_flowing"}, false) then
minetest.set_node(pos, {name = "default:obsidian"})
end
end,
}
else
minetest.register_alias("magma_conduits:hot_cobble", "default:cobble")
minetest.register_alias("magma_conduits:glow_obsidian", "default:obsidian")
end

128
init.lua

@ -1,16 +1,17 @@
magma_conduits = {}
--grab a shorthand for the filepath of the mod
local modpath = minetest.get_modpath(minetest.get_current_modname())
--load companion lua files
dofile(modpath.."/config.lua")
dofile(modpath.."/voxelarea_iterator.lua")
dofile(modpath.."/hot_rock.lua")
if magma_conduits.config.remove_default_lava then
minetest.register_alias_force("mapgen_lava_source", "air") -- veins of lava are far more realistic
end
-- Hard-coding on account of issue https://github.com/minetest/minetest/issues/7364
local height_min = -31000 -- magma_conduits.config.lower_limit
local height_max = 31000 --magma_conduits.config.upper_limit
minetest.register_ore({
ore_type = "vein",
@ -19,10 +20,6 @@ minetest.register_ore({
"default:stone",
"default:desert_stone",
"default:sandstone",
"default:sand",
"default:desert_sand",
"default:silver_sand",
"default:gravel",
"default:stone_with_coal",
"default:stone_with_iron",
"default:stone_with_copper",
@ -33,11 +30,17 @@ minetest.register_ore({
"default:dirt_with_grass",
"default:dirt_with_dry_grass",
"default:dirt_with_snow",
},
"default:dirt_with_rainforest_litter",
"default:dirt_with_coniferous_litter",
"default:sand",
"default:desert_sand",
"default:silver_sand",
"default:gravel",
},
column_height_min = 2,
column_height_max = 6,
height_min = magma_conduits.config.lower_limit,
height_max = magma_conduits.config.upper_limit,
y_min = height_min,
y_max = height_max,
noise_threshold = 0.9,
noise_params = {
offset = 0,
@ -51,90 +54,13 @@ minetest.register_ore({
random_factor = 0,
})
if magma_conduits.config.glowing_rock then
local S, NS = dofile(modpath.."/intllib.lua")
minetest.register_node("magma_conduits:hot_cobble", {
description = S("Hot Cobble"),
tiles = {"magma_conduits_hot_cobble.png"},
is_ground_content = false,
groups = {cracky = 3, stone = 2, hot=1},
sounds = default.node_sound_stone_defaults(),
light_source = 6,
drop = "default:cobble",
})
minetest.register_node("magma_conduits:glow_obsidian", {
description = S("Hot Obsidian"),
tiles = {"magma_conduits_glow_obsidian.png"},
is_ground_content = true,
sounds = default.node_sound_stone_defaults(),
groups = {cracky=1, hot=1, level=2},
light_source = 6,
drop = "default:obsidian",
})
minetest.register_abm{
label = "stone heating",
nodenames = {"default:stone", "default:cobble", "default:mossycobble"},
neighbors = {"default:lava_source", "default:lava_flowing"},
interval = 10,
chance = 5,
action = function(pos)
minetest.set_node(pos, {name = "magma_conduits:hot_cobble"})
end,
}
minetest.register_abm{
label = "obsidian heating",
nodenames = {"default:obsidian"},
neighbors = {"default:lava_source", "default:lava_flowing"},
interval = 10,
chance = 5,
action = function(pos)
minetest.set_node(pos, {name = "magma_conduits:glow_obsidian"})
end,
}
minetest.register_abm{
label = "stone cooling",
nodenames = {"magma_conduits:hot_cobble"},
interval = 100,
chance = 10,
action = function(pos)
if not minetest.find_node_near(pos, 2, {"default:lava_source", "default:lava_flowing"}, false) then
minetest.set_node(pos, {name = "default:cobble"})
end
end,
}
minetest.register_abm{
label = "obsidian cooling",
nodenames = {"magma_conduits:glow_obsidian"},
interval = 100,
chance = 10,
action = function(pos)
if not minetest.find_node_near(pos, 2, {"default:lava_source", "default:lava_flowing"}, false) then
minetest.set_node(pos, {name = "default:obsidian"})
end
end,
}
else
minetest.register_alias("magma_conduits:hot_cobble", "default:cobble")
minetest.register_alias("magma_conduits:glow_obsidian", "default:obsidian")
end
-------------------------------------------------------------------------------------------------
-- Ameliorate lava floods on the surface world by removing lava that's poised to spill
if not (magma_conduits.config.ameliorate_floods or magma_conduits.config.obsidian_lining) then return end
local water_level = tonumber(minetest.get_mapgen_setting("water_level"))
local ameliorate_floods = magma_conduits.config.ameliorate_floods
local lava_y_cutoff = magma_conduits.config.remove_lava_above
-- if the y cutoff is at or below water level, ameliorate_floods is pointless.
local ameliorate_floods = magma_conduits.config.ameliorate_floods and lava_y_cutoff > water_level
local obsidian_lining = magma_conduits.config.obsidian_lining
local c_air = minetest.get_content_id("air")
@ -142,8 +68,6 @@ local c_lava = minetest.get_content_id("default:lava_source")
local c_stone = minetest.get_content_id("default:stone")
local c_obsidian = minetest.get_content_id("default:obsidian")
local water_level = tonumber(minetest.get_mapgen_setting("water_level"))
local is_adjacent_to_air = function(area, data, x, y, z)
return (data[area:index(x+1, y, z)] == c_air
or data[area:index(x-1, y, z)] == c_air
@ -154,8 +78,8 @@ end
local remove_unsupported_lava
remove_unsupported_lava = function(area, data, vi, x, y, z)
--if too far from water level, abort. Caverns are on their own.
if y < water_level or y > 512 or not area:contains(x, y, z) then return end
--if below water level, abort. Caverns are on their own.
if y < water_level or y > lava_y_cutoff or not area:contains(x, y, z) then return end
if data[vi] == c_lava then
if is_adjacent_to_air(area, data, x, y, z) then
@ -196,11 +120,15 @@ minetest.register_on_generated(function(minp, maxp, seed)
vm:get_data(data)
for vi, x, y, z in area:iterp_xyz(minp, maxp) do
if ameliorate_floods then
remove_unsupported_lava(area, data, vi, x, y, z)
end
if obsidian_lining then
obsidianize(area, data, vi, x, y, z, minp, maxp)
if y > lava_y_cutoff and data[vi] == c_lava then
data[vi] = c_air
else
if obsidian_lining then
obsidianize(area, data, vi, x, y, z, minp, maxp)
end
if ameliorate_floods then
remove_unsupported_lava(area, data, vi, x, y, z)
end
end
end

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-18 00:10-0600\n"
"POT-Creation-Date: 2018-05-22 00:26-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,10 +17,30 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: init.lua:57
#: hot_rock.lua:7
msgid "Hot Cobble"
msgstr ""
#: init.lua:69
#: hot_rock.lua:8
msgid "Hot stone riven with cracks and seeping traces of lava."
msgstr ""
#: hot_rock.lua:9
msgid ""
"When normal stone is heated by lava it is converted into this. Beware when "
"digging here!"
msgstr ""
#: hot_rock.lua:19
msgid "Hot Obsidian"
msgstr ""
#: hot_rock.lua:20
msgid "Obsidian heated to a dull red glow."
msgstr ""
#: hot_rock.lua:21
msgid ""
"When normal obsidian is heated by lava it is converted into this. Beware "
"when digging here!"
msgstr ""

@ -1,7 +1,6 @@
magma_conduits_spread (Approximate spacing between magma conduits) int 400
magma_conduits_upper_limit (Upper extent of magma conduits) int 512
magma_conduits_lower_limit (Lower extent of magma conduits) int -31000
magma_conduits_ameliorate_floods (Ameliorate lava floods on the surface) bool true
magma_conduits_obsidian_lining (Adds an obsidian lining to magma conduits) bool true
magma_conduits_remove_default_lava (Remove default mapgen lava) bool true
magma_conduits_glowing_rock (Cause rock adjacent to lava to convert into "glowing" form) bool true
magma_conduits_glowing_rock (Cause rock adjacent to lava to convert into "glowing" form) bool true
magma_conduits_remove_lava_above (Removes any lava above this y level) int 512