add namegen and named_waypoint support (#7)

* initial pass at naming volcanoes

* pull in some chat commands from settlements too

* pulled hud code out into a separate library mod

* add color to active volcanoes

* settings

* add option to disable HUD waypoints

* add some more name components
This commit is contained in:
FaceDeer 2020-01-25 21:28:13 -06:00 committed by GitHub
parent 6db6f183c6
commit 0197eaf1de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 76 additions and 7 deletions

@ -1,6 +1,4 @@
name = magma_conduits
description = Removes default mapgen lava and adds widely-spaced volcanoes and lava "veins".
depends = default
optional_depends = intllib, doc
description = '''
Removes default mapgen lava and adds widely-spaced volcanoes and lava "veins".
'''
optional_depends = namegen, intllib, doc, map, named_waypoints

@ -40,4 +40,10 @@ magma_conduits_volcano_magma_chamber_radius_multiplier (Magma chamber radius mul
magma_conduits_volcano_probability_active (Probability of active volcano in region) float 0.3
magma_conduits_volcano_probability_dormant (Probability of dormant volcano in region) float 0.15
magma_conduits_volcano_probability_extinct (Probability of extinct volcano in region) float 0.15
magma_conduits_volcano_probability_extinct (Probability of extinct volcano in region) float 0.15
[Volcano HUD waypoints]
magma_conduits_show_volcanoes_in_hud (Show volcanoes in HUD) bool true
magma_conduits_hud_requires_mapping_kit (Require mapping kit to show in HUD) bool true
magma_conduits_volcano_discovery_range (Volcano discovery range) int 60
magma_conduits_volcano_visibility_range (Volcano HUD visibility range) int 1000

1
sounds/license.txt Normal file

@ -0,0 +1 @@
magma_conduits_chime01.ogg is from https://freesound.org/people/Andromadax24/sounds/186719/ by Andromadax24 under the CC-BY-3.0 license

Binary file not shown.

19
volcano_names.cfg Normal file

@ -0,0 +1,19 @@
name "active_volcano" {
syllablesStart = "Fire, Smolder, Grey, Ash, Pyre, Ember, Forge, Crack, Earth, Stone, Boulder, Sulphur, Mist, Cloud, Tomb, Inferno, Gout, Gyre, Storm, Sulphur, Sour, Vapor, Miasma, Steam, Trickle, Scorch, Dragon, Drake, Smog, Salamander, Phoenix, Wyrm, Hydra, Wyvern, Diamond, Ruby, Obsidian, Black, White"
syllablesEnd = "forge, mouth, heap, cone, pit, vent, horn, well, crack, split, mass, horn, scar, wall, well, rock, tumble, shard, scar, nest, gate, portal, plume, burn, scorch, drake"
syllablesPost = "Peak, Crag, Spire, Mountain, Tor, Ridge, Dome, Mound, Palisade, Volcano, Apex"
rules = "Mount_$s$e, $s$e_$90p, 10%$s_$p"
}
name "inactive_volcano" {
syllablesStart = "Bird, Baker, Ball, Aurora, Aerie, Bishop, Block, Blue, Grey, Cave, Caribou, Cole, Cirrus, Copper, Cougar, Crow, Eagle, Fable, Fiddle, Finger, Fox, Gloria, Gold, Gordon, Heart, Goat, Kent, Red, Ring, Rose, Rundle, Shark, Scarab, Smut, Snow, South, North, East, West, Stone, Storm, Sulphur, Cloud, Temple, Tomb, Terra, Tower, Tunnel, Twin, Turtle, Trap, War, Wedge, Wind, Wonder, Cirrus, Loft, Shard, Splinter, Block, Wedge, Rubble, Sheep, Heaven, Upper, Low, Flat, Tall, Ever, Never, Force, Cold, Ice, Spike, Anvil, Hammer, Black, White, Obsidian"
syllablesEnd = "wood, ston, ton, land, lets, wall, well, foot, nest, en, view, hood, arch, met, meet, horn, holm, scraper, swept, shard, scar, loft, rock, stone, slab, spike, spine, wedge, fold, crack, spit, anvil, hammer,"
syllablesPost = "Peak, Crag, Spire, Mountain, Tor, Ridge, Dome, Mound, Palisade, Apex"
rules = "Mount_$s$80e, $s$e_$90p, 20%$s_$p"
}

@ -7,6 +7,28 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath .. "/volcano_lava.lua") -- https://github.com/minetest/minetest/issues/7864, https://github.com/minetest/minetest/issues/7878
local S, NS = dofile(modpath.."/intllib.lua")
local named_waypoints_modpath = minetest.get_modpath("named_waypoints")
if named_waypoints_modpath then
local volcano_waypoint_def = {
default_name = S("a volcano"),
default_color = 0xFFFFFF,
discovery_volume_radius = tonumber(minetest.settings:get("magma_conduits_volcano_discovery_range")) or 60,
}
if minetest.settings:get_bool("magma_conduits_hud_requires_mapping_kit", true)
and minetest.registered_items["map:mapping_kit"] then
volcano_waypoint_def.visibility_requires_item = "map:mapping_kit"
end
if minetest.settings:get_bool("magma_conduits_show_volcanoes_in_hud", true) then
volcano_waypoint_def.visibility_volume_radius = tonumber(minetest.settings:get("magma_conduits_volcano_visibility_range")) or 1000
volcano_waypoint_def.on_discovery = named_waypoints.default_discovery_popup
end
named_waypoints.register_named_waypoints("volcanoes", volcano_waypoint_def)
end
local depth_root = magma_conduits.config.volcano_min_depth
local depth_base = -50 -- point where the mountain root starts expanding
local depth_maxwidth = -30 -- point of maximum width
@ -94,6 +116,12 @@ local get_corner = function(pos)
return {x = math.floor((pos.x+32) / volcano_region_size) * volcano_region_size - 32, z = math.floor((pos.z+32) / volcano_region_size) * volcano_region_size - 32}
end
local namegen_path = minetest.get_modpath("namegen")
if namegen_path then
namegen.parse_lines(io.lines(modpath.."/volcano_names.cfg"))
end
local get_volcano = function(pos)
local corner_xz = get_corner(pos)
local next_seed = math.random(1, 1000000000)
@ -104,20 +132,36 @@ local get_volcano = function(pos)
math.randomseed(next_seed)
return nil
end
local name
local color
local location = scatter_2d(corner_xz, volcano_region_size, radius_cone_max)
local depth_peak = math.random(depth_minpeak, depth_maxpeak)
local depth_lava
if state < state_extinct then
depth_lava = - math.random(1, math.abs(depth_root)) -- extinct, put the lava somewhere deep.
if namegen_path then
name = namegen.generate("inactive_volcano")
end
elseif state < state_dormant then
depth_lava = depth_peak - math.random(5, 50) -- dormant
if namegen_path then
name = namegen.generate("inactive_volcano")
end
else
depth_lava = depth_peak - math.random(1, 25) -- active, put the lava near the top
if namegen_path then
name = namegen.generate("active_volcano")
end
color = 0xFF7F00 -- orange
end
local slope = math.random() * (slope_max - slope_min) + slope_min
local caldera = math.random() * (caldera_max - caldera_min) + caldera_min
if named_waypoints_modpath then
named_waypoints.add_waypoint("volcanoes", {x=location.x, y=depth_peak, z=location.z}, {name=name, color=color})
end
math.randomseed(next_seed)
return {location = location, depth_peak = depth_peak, depth_lava = depth_lava, slope = slope, state = state, caldera = caldera}
end
@ -411,3 +455,4 @@ minetest.register_chatcommand("findvolcano", {
end
end,
})