Subterrane split (#1)

Splitting the core giant-cave-making code out into its own separate mod
master
FaceDeer 2017-03-25 11:55:00 -06:00 committed by GitHub
parent 136473156d
commit ea1a20b32a
14 changed files with 918 additions and 1118 deletions

631
caverealms_biomes.lua Normal file
View File

@ -0,0 +1,631 @@
--grab a shorthand for the filepath of the mod
local modpath = minetest.get_modpath(minetest.get_current_modname())
if caverealms.config.falling_icicles == true then
dofile(modpath.."/falling_ice.lua") --complicated function for falling icicles
print("[caverealms] falling icicles enabled.")
end
local FORTRESSES = caverealms.config.fortresses --true | Should fortresses spawn?
local FOUNTAINS = caverealms.config.fountains --true | Should fountains spawn?
-- Parameters
local STAGCHA = caverealms.config.stagcha --0.002 --chance of stalagmites
local STALCHA = caverealms.config.stalcha --0.003 --chance of stalactites
local CRYSTAL = caverealms.config.crystal --0.007 --chance of glow crystal formations
local GEMCHA = caverealms.config.gemcha --0.03 --chance of small glow gems
local MUSHCHA = caverealms.config.mushcha --0.04 --chance of mushrooms
local MYCCHA = caverealms.config.myccha --0.03 --chance of mycena mushrooms
local WORMCHA = caverealms.config.wormcha --0.03 --chance of glow worms
local GIANTCHA = caverealms.config.giantcha --0.001 -- chance of giant mushrooms
local ICICHA = caverealms.config.icicha --0.035 -- chance of icicles
local FLACHA = caverealms.config.flacha --0.04 --chance of constant flames
local FOUNCHA = caverealms.config.founcha --0.001 --chance of statue + fountain
local FORTCHA = caverealms.config.fortcha --0.0003 --chance of DM Fortresses
local DM_TOP = caverealms.config.dm_top -- -4000 --level at which Dungeon Master Realms start to appear
local DM_BOT = caverealms.config.dm_bot -- -5000 --level at which "" ends
local DEEP_CAVE = caverealms.config.deep_cave -- -7000 --level at which deep cave biomes take over
local YMIN = caverealms.config.ymin
local YMAX = caverealms.config.ymax
local H_LAG = caverealms.config.h_lag --15 --max height for stalagmites
local H_LAC = caverealms.config.h_lac --20 --...stalactites
local H_CRY = caverealms.config.h_cry --9 --max height of glow crystals
local H_CLAC = caverealms.config.h_clac --13 --max height of glow crystal stalactites
minetest.register_alias("caverealms:constant_flame", "fire:permanent_flame")
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_ice = minetest.get_content_id("default:ice")
local c_stone = minetest.get_content_id("default:stone")
local c_desand = minetest.get_content_id("default:desert_sand")
local c_flame = minetest.get_content_id("fire:permanent_flame")
local c_ice = minetest.get_content_id("default:ice")
local c_lava = minetest.get_content_id("default:lava_source")
local c_algae = minetest.get_content_id("caverealms:stone_with_algae")
local c_ameth = minetest.get_content_id("caverealms:glow_amethyst")
local c_amethore = minetest.get_content_id("caverealms:glow_amethyst_ore")
local c_coalblock = minetest.get_content_id("default:coalblock")
local c_coaldust = minetest.get_content_id("caverealms:coal_dust")
local c_crystal = minetest.get_content_id("caverealms:glow_crystal")
local c_crystore = minetest.get_content_id("caverealms:glow_ore")
local c_emerald = minetest.get_content_id("caverealms:glow_emerald")
local c_emore = minetest.get_content_id("caverealms:glow_emerald_ore")
local c_fortress = minetest.get_content_id("caverealms:s_fortress")
local c_fountain = minetest.get_content_id("caverealms:s_fountain")
local c_fungus = minetest.get_content_id("caverealms:fungus")
local c_gem1 = minetest.get_content_id("caverealms:glow_gem")
local c_gem2 = minetest.get_content_id("caverealms:glow_gem_2")
local c_gem3 = minetest.get_content_id("caverealms:glow_gem_3")
local c_gem4 = minetest.get_content_id("caverealms:glow_gem_4")
local c_gem5 = minetest.get_content_id("caverealms:glow_gem_5")
local c_gobsidian = minetest.get_content_id("caverealms:glow_obsidian")
local c_gobsidian2 = minetest.get_content_id("caverealms:glow_obsidian_2")
local c_hcobble = minetest.get_content_id("caverealms:hot_cobble")
local c_icid = minetest.get_content_id("caverealms:icicle_down")
local c_iciu = minetest.get_content_id("caverealms:icicle_up")
local c_lichen = minetest.get_content_id("caverealms:stone_with_lichen")
local c_mesecry = minetest.get_content_id("caverealms:glow_mese")
local c_meseore = minetest.get_content_id("default:stone_with_mese")
local c_moss = minetest.get_content_id("caverealms:stone_with_moss")
local c_mycena = minetest.get_content_id("caverealms:mycena")
local c_rubore = minetest.get_content_id("caverealms:glow_ruby_ore")
local c_ruby = minetest.get_content_id("caverealms:glow_ruby")
local c_salt = minetest.get_content_id("caverealms:stone_with_salt")
local c_saltcrystal = minetest.get_content_id("caverealms:salt_crystal")
local c_saltgem1 = minetest.get_content_id("caverealms:salt_gem")
local c_saltgem2 = minetest.get_content_id("caverealms:salt_gem_2")
local c_saltgem3 = minetest.get_content_id("caverealms:salt_gem_3")
local c_saltgem4 = minetest.get_content_id("caverealms:salt_gem_4")
local c_saltgem5 = minetest.get_content_id("caverealms:salt_gem_5")
local c_spike1 = minetest.get_content_id("caverealms:spike")
local c_spike2 = minetest.get_content_id("caverealms:spike_2")
local c_spike3 = minetest.get_content_id("caverealms:spike_3")
local c_spike4 = minetest.get_content_id("caverealms:spike_4")
local c_spike5 = minetest.get_content_id("caverealms:spike_5")
local c_thinice = minetest.get_content_id("caverealms:thin_ice")
local c_worm = minetest.get_content_id("caverealms:glow_worm")
local c_stem = minetest.get_content_id("caverealms:mushroom_stem")
local c_cap = minetest.get_content_id("caverealms:mushroom_cap")
local c_gills = minetest.get_content_id("caverealms:mushroom_gills")
local glow_worm_ceiling = function(area, data, ai, vi, bi)
if math.random() < WORMCHA and data[vi] == c_air and data[bi] == c_air then
data[vi] = c_worm
data[bi] = c_worm
if math.random(2) == 1 then
local pos = area:position(vi)
pos.y = pos.y-2
local bbi = area:indexp(pos)
if data[bbi] == c_air then
data[bbi] = c_worm
if math.random(2) ==1 then
pos.y = pos.y-1
local bbbi = area:indexp(pos)
if data[bbbi] == c_air then
data[bbbi] = c_worm
end
end
end
end
end
end
local obsidian_plug = function(area, data, ai, vi, bi)
local pos = area:position(ai)
local x = pos.x
local y = pos.y
local z = pos.z
for i = x - 3, x + 3 do
for j = y - 1, y + 1 do
for k = z - 3, z + 3 do
data[area:index(i,j,k)] = c_water
end
end
end
end
-----------------------------------------------------------------------------------------------------------
-- Dungeon
local dungeon_floor = function(area, data, ai, vi, bi)
if data[bi] == c_stone then data[vi] = c_hcobble end
if math.random() < FLACHA then --neverending flames
data[ai] = c_flame
elseif math.random() < FOUNCHA and FOUNTAINS then --DM FOUNTAIN
data[ai] = c_fountain
elseif math.random() < FORTCHA and FORTRESSES then --DM FORTRESS
data[ai] = c_fortress
elseif subterrane:vertically_consistent_random(vi, area) < STAGCHA then
subterrane:giant_stalagmite(vi, area, data, 6, H_LAG, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_meseore, c_mesecry)
else
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_rubore, c_ruby)
end
end
end
local dungeon_ceiling = function(area, data, ai, vi, bi)
glow_worm_ceiling(area, data, ai, vi, bi)
if subterrane:vertically_consistent_random(vi, area) < STALCHA then
subterrane:giant_stalactite(vi, area, data, 6, H_LAC, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_meseore, c_mesecry)
else
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_rubore, c_ruby)
end
end
end
-----------------------------------------------------------------------------------------------------------
-- Moss
local moss_floor = function(area, data, ai, vi, bi)
if data[bi] == c_stone then data[vi] = c_moss end
if math.random() < GEMCHA then
-- gems of random size
local gems = { c_gem1, c_gem2, c_gem3, c_gem4, c_gem5 }
local gidx = math.random(1, 12)
if gidx > 5 then
gidx = 1
end
data[ai] = gems[gidx]
elseif subterrane:vertically_consistent_random(vi, area) < STAGCHA then
subterrane:giant_stalagmite(vi, area, data, 6, H_LAG, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_emore, c_emerald)
else
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_crystore, c_crystal)
end
end
end
local moss_ceiling = function(area, data, ai, vi, bi)
if data[ai] == c_lava then obsidian_plug(area, data, ai, vi, bi) end
glow_worm_ceiling(area, data, ai, vi, bi)
if subterrane:vertically_consistent_random(vi, area) < STALCHA then
subterrane:giant_stalactite(vi, area, data, 6, H_LAC, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_emore, c_emerald)
else
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_crystore, c_crystal)
end
end
end
-----------------------------------------------------------------------------------------------------------
-- Fungal
local fungal_floor = function(area, data, ai, vi, bi)
if data[bi] == c_stone then data[vi] = c_lichen end
if math.random() < MUSHCHA then --mushrooms
data[ai] = c_fungus
elseif math.random() < MYCCHA then --mycena mushrooms
data[ai] = c_mycena
elseif math.random() < GIANTCHA then --giant mushrooms
local cap_radius = math.random(2,5)
local stem_height = math.random(3,7)
subterrane:giant_shroom(vi, area, data, c_stem, c_cap, c_gills, stem_height, cap_radius)
elseif subterrane:vertically_consistent_random(vi, area) < STAGCHA then
subterrane:giant_stalagmite(vi, area, data, 6, H_LAG, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_crystore, c_crystal)
else
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_emore, c_emerald)
end
end
end
local fungal_ceiling = function(area, data, ai, vi, bi)
if data[ai] == c_lava then obsidian_plug(area, data, ai, vi, bi) end
glow_worm_ceiling(area, data, ai, vi, bi)
if subterrane:vertically_consistent_random(vi, area) < STALCHA then
subterrane:giant_stalactite(vi, area, data, 6, H_LAC, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_crystore, c_crystal)
else
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_emore, c_emerald)
end
end
end
-----------------------------------------------------------------------------------------------------------
-- Algae
local algae_floor = function(area, data, ai, vi, bi)
if data[bi] == c_stone then data[vi] = c_algae end
--if data[ai] == c_air then data[ai] = c_water end
if subterrane:vertically_consistent_random(vi, area) < STAGCHA then
subterrane:giant_stalagmite(vi, area, data, 6, H_LAG, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(25) == 1 then
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_meseore, c_mesecry)
else
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_emore, c_emerald)
end
end
end
local algae_ceiling = function(area, data, ai, vi, bi)
if data[ai] == c_lava then obsidian_plug(area, data, ai, vi, bi) end
glow_worm_ceiling(area, data, ai, vi, bi)
if subterrane:vertically_consistent_random(vi, area) < STALCHA then
subterrane:giant_stalactite(vi, area, data, 6, H_LAC, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(25) == 1 then
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_meseore, c_mesecry)
else
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_emore, c_emerald)
end
end
end
-----------------------------------------------------------------------------------------------------------
-- Glaciated
local glaciated_floor = function(area, data, ai, vi, bi)
data[vi] = c_thinice
data[bi] = c_thinice
if math.random() < ICICHA then --if glaciated, place icicles
data[ai] = c_iciu
elseif subterrane:vertically_consistent_random(vi, area) < STAGCHA then
subterrane:giant_stalagmite(vi, area, data, 6, H_LAG, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(3) == 1 then
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_crystore, c_crystal)
else
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_ice, c_ice, c_thinice)
end
end
end
local glaciated_ceiling = function(area, data, ai, vi, bi)
if data[ai] == c_lava then obsidian_plug(area, data, ai, vi, bi) end
if math.random() < ICICHA then
data[vi] = c_icid
end
glow_worm_ceiling(area, data, ai, vi, bi)
if subterrane:vertically_consistent_random(vi, area) < STALCHA then
subterrane:giant_stalactite(vi, area, data, 6, H_LAC, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(3) == 1 then
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_crystore, c_crystal)
else
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_ice, c_ice, c_thinice)
end
end
end
-----------------------------------------------------------------------------------------------------------
-- Deep Glaciated
local deep_glaciated_floor = function(area, data, ai, vi, bi)
data[vi] = c_ice
data[bi] = c_ice
if math.random() < ICICHA then --if glaciated, place icicles
data[ai] = c_iciu
elseif subterrane:vertically_consistent_random(vi, area) < STAGCHA then
subterrane:giant_stalagmite(vi, area, data, 6, H_LAG, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(3) == 1 then
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_crystore, c_crystal)
else
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_ice, c_ice, c_thinice)
end
end
end
local deep_glaciated_ceiling = function(area, data, ai, vi, bi)
if data[ai] == c_lava then obsidian_plug(area, data, ai, vi, bi) end
if math.random() < ICICHA then
data[vi] = c_icid
end
glow_worm_ceiling(area, data, ai, vi, bi)
if subterrane:vertically_consistent_random(vi, area) < STALCHA then
subterrane:giant_stalactite(vi, area, data, 6, H_LAC, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(3) == 1 then
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_crystore, c_crystal)
else
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_ice, c_ice, c_thinice)
end
end
end
-----------------------------------------------------------------------------------------------------------
-- Salt
--glowing crystal stalagmite spawner
local salt_stalagmite = function(vi, area, data)
local pos = area:position(vi)
local x = pos.x
local y = pos.y
local z = pos.z
local scale = math.random(2, 4)
if scale == 2 then
for j = -3, 3 do
for k = -3, 3 do
local vi = area:index(x+j, y, z+k)
data[vi] = c_stone
if math.abs(j) ~= 3 and math.abs(k) ~= 3 then
local vi = area:index(x+j, y+1, z+k)
data[vi] = c_stone
end
end
end
else
for j = -4, 4 do
for k = -4, 4 do
local vi = area:index(x+j, y, z+k)
data[vi] = c_stone
if math.abs(j) ~= 4 and math.abs(k) ~= 4 then
local vi = area:index(x+j, y+1, z+k)
data[vi] = c_stone
end
end
end
end
for j = 2, scale + 2 do --y
for k = -2, scale - 2 do
for l = -2, scale - 2 do
local vi = area:index(x+k, y+j, z+l)
data[vi] = c_saltcrystal -- make cube
end
end
end
end
local salt_floor = function(area, data, ai, vi, bi)
data[vi] = c_salt
data[bi] = c_salt
if math.random() < GEMCHA then
-- gems of random size
local gems = { c_saltgem1, c_saltgem2, c_saltgem3, c_saltgem4, c_saltgem5 }
local gidx = math.random(1, 12)
if gidx > 5 then
gidx = 1
end
data[ai] = gems[gidx]
elseif math.random() < STAGCHA then
salt_stalagmite(vi, area, data)
elseif subterrane:vertically_consistent_random(vi, area) < STAGCHA then
subterrane:giant_stalagmite(vi, area, data, 6, H_LAG, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_rubore, c_ruby)
else
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_crystore, c_crystal)
end
end
end
local salt_ceiling = function(area, data, ai, vi, bi)
glow_worm_ceiling(area, data, ai, vi, bi, 7)
if subterrane:vertically_consistent_random(vi, area) < STALCHA then
subterrane:giant_stalactite(vi, area, data, 6, H_LAC, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_rubore, c_ruby)
else
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_crystore, c_crystal)
end
end
end
-----------------------------------------------------------------------------------------------------------
-- Glowing Obsidian
local obsidian_floor = function(area, data, ai, vi, bi)
if math.random() < 0.5 then
data[vi] = c_gobsidian
data[bi] = c_gobsidian
else
data[vi] = c_gobsidian2
data[bi] = c_gobsidian2
end
if math.random() < FLACHA then --neverending flames
data[ai] = c_flame
elseif subterrane:vertically_consistent_random(vi, area) < STAGCHA then
subterrane:giant_stalagmite(vi, area, data, 6, H_LAG, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_emore, c_emerald)
else
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_rubore, c_ruby)
end
end
end
local obsidian_ceiling = function(area, data, ai, vi, bi)
glow_worm_ceiling(area, data, ai, vi, bi, 8)
if subterrane:vertically_consistent_random(vi, area) < STALCHA then
subterrane:giant_stalactite(vi, area, data, 6, H_LAC, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_emore, c_emerald)
else
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_rubore, c_ruby)
end
end
end
-----------------------------------------------------------------------------------------------------------
-- Coal Dust
local coal_floor = function(area, data, ai, vi, bi)
if math.random() < 0.05 then
data[vi] = c_coalblock
data[bi] = c_coalblock
elseif math.random() < 0.15 then
data[vi] = c_coaldust
data[bi] = c_coaldust
else
data[vi] = c_desand
data[bi] = c_desand
end
if math.random() < FLACHA * 0.75 then --neverending flames
data[ai] = c_flame
elseif math.random() < GEMCHA then
-- spikes of random size
local spikes = { c_spike1, c_spike2, c_spike3, c_spike4, c_spike5 }
local sidx = math.random(1, 12)
if sidx > 5 then
sidx = 1
end
data[ai] = spikes[sidx]
elseif subterrane:vertically_consistent_random(vi, area) < STAGCHA then
subterrane:giant_stalagmite(vi, area, data, 6, H_LAG, c_stone, c_stone, c_stone)
elseif math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_meseore, c_mesecry)
else
subterrane:giant_stalagmite(vi, area, data, 5, H_CRY, c_stone, c_amethore, c_ameth)
end
end
end
local coal_ceiling = function(area, data, ai, vi, bi)
if math.random() < WORMCHA then
glow_worm_ceiling(area, data, ai, vi, bi)
end
if subterrane:vertically_consistent_random(vi, area) < STALCHA then
subterrane:giant_stalactite(vi, area, data, 6, H_LAC, c_stone, c_stone, c_stone)
end
if math.random() < CRYSTAL then
if math.random(15) == 1 then
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_meseore, c_mesecry)
else
subterrane:giant_stalactite(vi, area, data, 6, H_CLAC, c_stone, c_amethore, c_ameth)
end
end
end
-------------------------------------------------------------------------------------------
-- default mapgen registers an "underground" biome that gets in the way of everything.
subterrane:override_biome({
name = "underground",
y_min = YMAX,
y_max = -113,
heat_point = 50,
humidity_point = 50,
})
minetest.register_biome({
name = "caverealms_dungeon",
y_min = DM_BOT,
y_max = DM_TOP,
heat_point = 50,
humidity_point = 50,
_subterrane_ceiling_decor = dungeon_ceiling,
_subterrane_floor_decor = dungeon_floor,
_subterrane_fill_node = c_air,
})
minetest.register_biome({
name = "caverealms_moss",
y_min = DEEP_CAVE,
y_max = YMAX,
heat_point = 80,
humidity_point = 10,
_subterrane_ceiling_decor = moss_ceiling,
_subterrane_floor_decor = moss_floor,
_subterrane_fill_node = c_air,
})
minetest.register_biome({
name = "caverealms_fungal",
y_min = DEEP_CAVE,
y_max = YMAX,
heat_point = 60,
humidity_point = 50,
_subterrane_ceiling_decor = fungal_ceiling,
_subterrane_floor_decor = fungal_floor,
_subterrane_fill_node = c_air,
})
minetest.register_biome({
name = "caverealms_algae",
y_min = DEEP_CAVE,
y_max = YMAX,
heat_point = 80,
humidity_point = 90,
_subterrane_ceiling_decor = algae_ceiling,
_subterrane_floor_decor = algae_floor,
_subterrane_fill_node = c_air,
})
minetest.register_biome({
name = "caverealms_glaciated",
y_min = DEEP_CAVE,
y_max = YMAX,
heat_point = 0,
humidity_point = 50,
_subterrane_ceiling_decor = glaciated_ceiling,
_subterrane_floor_decor = glaciated_floor,
_subterrane_fill_node = c_air,
})
minetest.register_biome({
name = "caverealms_deep_glaciated",
y_min = YMIN,
y_max = DEEP_CAVE,
heat_point = 0,
humidity_point = 50,
_subterrane_ceiling_decor = deep_glaciated_ceiling,
_subterrane_floor_decor = deep_glaciated_floor,
_subterrane_fill_node = c_air,
})
minetest.register_biome({
name = "caverealms_salt_crystal",
y_min = YMIN,
y_max = DEEP_CAVE,
heat_point = 80,
humidity_point = 90,
_subterrane_ceiling_decor = salt_ceiling,
_subterrane_floor_decor = salt_floor,
_subterrane_fill_node = c_air,
})
minetest.register_biome({
name = "caverealms_glow_obsidian",
y_min = YMIN,
y_max = DEEP_CAVE,
heat_point = 80,
humidity_point = 10,
_subterrane_ceiling_decor = obsidian_ceiling,
_subterrane_floor_decor = obsidian_floor,
_subterrane_fill_node = c_air,
})
minetest.register_biome({
name = "caverealms_coal_dust",
y_min = YMIN,
y_max = DEEP_CAVE,
heat_point = 60,
humidity_point = 50,
_subterrane_ceiling_decor = coal_ceiling,
_subterrane_floor_decor = coal_floor,
_subterrane_fill_node = c_air,
})

View File

@ -20,14 +20,6 @@ local function setting(stype, name, default)
caverealms.config[name] = value
end
--generation settings
setting("number", "ymin", -33000) --bottom realm limit
setting("number", "ymax", -700) --top realm limit
setting("number", "tcave", 0.5) --cave threshold
--should player spawn in caves?
setting("bool", "cavespawn", false)
--falling icicles
setting("bool", "falling_icicles", true) --enable/disable falling icicles
setting("number", "fallcha", 0.33) --chance of icicles falling when dug
@ -62,4 +54,11 @@ setting("number", "deep_cave", -7000) -- upper limit
--minimum number of items in chests found in fortresses
setting("number", "min_items", 2)
--maximum number of items in chests found in fortresses
setting("number", "max_items", 5)
setting("number", "max_items", 5)
--should player spawn in caves?
setting("bool", "cavespawn", false)
setting("number", "ymin", -31000) --bottom realm limit
setting("number", "ymax", -700) --top realm limit
setting("number", "tcave", 0.5) --cave threshold

View File

@ -1,10 +1,12 @@
--CaveRealms crafting.lua
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
--CRAFT ITEMS--
--mycena powder
minetest.register_craftitem("caverealms:mycena_powder", {
description = "Mycena Powder",
description = S("Mycena Powder"),
inventory_image = "caverealms_mycena_powder.png",
})

View File

@ -1 +1,3 @@
default
default
subterrane
intllib?

View File

@ -1,624 +0,0 @@
--CaveRealms functions.lua
--FUNCTIONS--
local H_LAG = caverealms.config.h_lag --15 --max height for stalagmites
local H_LAC = caverealms.config.h_lac --20 --...stalactites
local H_CRY = caverealms.config.h_cry --9 --max height of glow crystals
local H_CLAC = caverealms.config.h_clac --13 --max height of glow crystal stalactites
function caverealms:above_solid(x,y,z,area,data)
local c_air = minetest.get_content_id("air")
local c_vac
if (minetest.get_modpath("moontest")) then
c_vac = minetest.get_content_id("moontest:vacuum")
else
c_vac = minetest.get_content_id("air")
end
local ai = area:index(x,y+1,z-3)
if data[ai] == c_air or data[ai] == c_vac then
return false
else
return true
end
end
function caverealms:below_solid(x,y,z,area,data)
local c_air = minetest.get_content_id("air")
local c_vac
if (minetest.get_modpath("moontest")) then
c_vac = minetest.get_content_id("moontest:vacuum")
else
c_vac = minetest.get_content_id("air")
end
local ai = area:index(x,y-1,z-3)
if data[ai] == c_air or data[ai] == c_vac then
return false
else
return true
end
end
--stalagmite spawner
function caverealms:stalagmite(x,y,z, area, data)
if not caverealms:below_solid(x,y,z,area,data) then
return
end
--contest ids
local c_stone = minetest.get_content_id("default:stone")
local top = math.random(6,H_LAG) --grab a random height for the stalagmite
for j = 0, top do --y
for k = -3, 3 do
for l = -3, 3 do
if j == 0 then
if k*k + l*l <= 9 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = c_stone
end
elseif j <= top/5 then
if k*k + l*l <= 4 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = c_stone
end
elseif j <= top/5 * 3 then
if k*k + l*l <= 1 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = c_stone
end
else
local vi = area:index(x, y+j, z-3)
data[vi] = c_stone
end
end
end
end
end
--stalactite spawner
function caverealms:stalactite(x,y,z, area, data)
if not caverealms:above_solid(x,y,z,area,data) then
return
end
--contest ids
local c_stone = minetest.get_content_id("default:stone")--("caverealms:limestone")
local bot = math.random(-H_LAC, -6) --grab a random height for the stalagmite
for j = bot, 0 do --y
for k = -3, 3 do
for l = -3, 3 do
if j >= -1 then
if k*k + l*l <= 9 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = c_stone
end
elseif j >= bot/5 then
if k*k + l*l <= 4 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = c_stone
end
elseif j >= bot/5 * 3 then
if k*k + l*l <= 1 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = c_stone
end
else
local vi = area:index(x, y+j, z-3)
data[vi] = c_stone
end
end
end
end
end
--glowing crystal stalagmite spawner
function caverealms:crystal_stalagmite(x,y,z, area, data, biome)
if not caverealms:below_solid(x,y,z,area,data) then
return
end
--contest ids
local c_stone = minetest.get_content_id("default:stone")
local c_crystal = minetest.get_content_id("caverealms:glow_crystal")
local c_crystore = minetest.get_content_id("caverealms:glow_ore")
local c_emerald = minetest.get_content_id("caverealms:glow_emerald")
local c_emore = minetest.get_content_id("caverealms:glow_emerald_ore")
local c_mesecry = minetest.get_content_id("caverealms:glow_mese")
local c_meseore = minetest.get_content_id("default:stone_with_mese")
local c_ruby = minetest.get_content_id("caverealms:glow_ruby")
local c_rubore = minetest.get_content_id("caverealms:glow_ruby_ore")
local c_ameth = minetest.get_content_id("caverealms:glow_amethyst")
local c_amethore = minetest.get_content_id("caverealms:glow_amethyst_ore")
local c_ice = minetest.get_content_id("default:ice")
local c_thinice = minetest.get_content_id("caverealms:thin_ice")
--for randomness
local mode = 1
if math.random(15) == 1 then
mode = 2
end
if biome == 3 then
if math.random(25) == 1 then
mode = 2
else
mode = 1
end
end
if biome == 4 or biome == 5 then
if math.random(3) == 1 then
mode = 2
end
end
local stalids = {
{ {c_crystore, c_crystal}, {c_emore, c_emerald} },
{ {c_emore, c_emerald}, {c_crystore, c_crystal} },
{ {c_emore, c_emerald}, {c_meseore, c_mesecry} },
{ {c_ice, c_thinice}, {c_crystore, c_crystal}},
{ {c_ice, c_thinice}, {c_crystore, c_crystal}},
{ {c_rubore, c_ruby}, {c_meseore, c_mesecry}},
{ {c_crystore, c_crystal}, {c_rubore, c_ruby} },
{ {c_rubore, c_ruby}, {c_emore, c_emerald}},
{ {c_amethore, c_ameth}, {c_meseore, c_mesecry} },
}
local nid_a
local nid_b
local nid_s = c_stone --stone base, will be rewritten to ice in certain biomes
if biome > 3 and biome < 6 then
if mode == 1 then
nid_a = c_ice
nid_b = c_thinice
nid_s = c_ice
else
nid_a = c_crystore
nid_b = c_crystal
end
elseif mode == 1 then
nid_a = stalids[biome][1][1]
nid_b = stalids[biome][1][2]
else
nid_a = stalids[biome][2][1]
nid_b = stalids[biome][2][2]
end
local top = math.random(5,H_CRY) --grab a random height for the stalagmite
for j = 0, top do --y
for k = -3, 3 do
for l = -3, 3 do
if j == 0 then
if k*k + l*l <= 9 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = nid_s
end
elseif j <= top/5 then
if k*k + l*l <= 4 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = nid_a
end
elseif j <= top/5 * 3 then
if k*k + l*l <= 1 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = nid_b
end
else
local vi = area:index(x, y+j, z-3)
data[vi] = nid_b
end
end
end
end
end
--crystal stalactite spawner
function caverealms:crystal_stalactite(x,y,z, area, data, biome)
if not caverealms:above_solid(x,y,z,area,data) then
return
end
--contest ids
local c_stone = minetest.get_content_id("default:stone")
local c_crystore = minetest.get_content_id("caverealms:glow_ore")
local c_crystal = minetest.get_content_id("caverealms:glow_crystal")
local c_emerald = minetest.get_content_id("caverealms:glow_emerald")
local c_emore = minetest.get_content_id("caverealms:glow_emerald_ore")
local c_mesecry = minetest.get_content_id("caverealms:glow_mese")
local c_meseore = minetest.get_content_id("default:stone_with_mese")
local c_ruby = minetest.get_content_id("caverealms:glow_ruby")
local c_rubore = minetest.get_content_id("caverealms:glow_ruby_ore")
local c_ameth = minetest.get_content_id("caverealms:glow_amethyst")
local c_amethore = minetest.get_content_id("caverealms:glow_amethyst_ore")
local c_ice = minetest.get_content_id("default:ice")
local c_thinice = minetest.get_content_id("caverealms:hanging_thin_ice")
--for randomness
local mode = 1
if math.random(15) == 1 then
mode = 2
end
if biome == 3 then
if math.random(25) == 1 then
mode = 2
else
mode = 1
end
end
if biome == 4 or biome == 5 then
if math.random(3) == 1 then
mode = 2
end
end
local stalids = {
{ {c_crystore, c_crystal}, {c_emore, c_emerald} },
{ {c_emore, c_emerald}, {c_crystore, c_crystal} },
{ {c_emore, c_emerald}, {c_meseore, c_mesecry} },
{ {c_ice, c_thinice}, {c_crystore, c_crystal}},
{ {c_ice, c_thinice}, {c_crystore, c_crystal}},
{ {c_rubore, c_ruby}, {c_meseore, c_mesecry}},
{ {c_crystore, c_crystal}, {c_rubore, c_ruby} },
{ {c_rubore, c_ruby}, {c_emore, c_emerald}},
{ {c_amethore, c_ameth}, {c_meseore, c_mesecry} },
}
local nid_a
local nid_b
local nid_s = c_stone --stone base, will be rewritten to ice in certain biomes
if biome > 3 and biome < 6 then
if mode == 1 then
nid_a = c_ice
nid_b = c_thinice
nid_s = c_ice
else
nid_a = c_crystore
nid_b = c_crystal
end
elseif mode == 1 then
nid_a = stalids[biome][1][1]
nid_b = stalids[biome][1][2]
else
nid_a = stalids[biome][2][1]
nid_b = stalids[biome][2][2]
end
local bot = math.random(-H_CLAC, -6) --grab a random height for the stalagmite
for j = bot, 0 do --y
for k = -3, 3 do
for l = -3, 3 do
if j >= -1 then
if k*k + l*l <= 9 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = nid_s
end
elseif j >= bot/5 then
if k*k + l*l <= 4 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = nid_a
end
elseif j >= bot/5 * 3 then
if k*k + l*l <= 1 then
local vi = area:index(x+k, y+j, z+l-3)
data[vi] = nid_b
end
else
local vi = area:index(x, y+j, z-3)
data[vi] = nid_b
end
end
end
end
end
--glowing crystal stalagmite spawner
function caverealms:salt_stalagmite(x,y,z, area, data, biome)
if not caverealms:below_solid(x,y,z,area,data) then
return
end
--contest ids
local c_stone = minetest.get_content_id("default:stone")
local c_salt = minetest.get_content_id("caverealms:salt_crystal")
local scale = math.random(2, 4)
if scale == 2 then
for j = -3, 3 do
for k = -3, 3 do
local vi = area:index(x+j, y, z+k)
data[vi] = c_stone
if math.abs(j) ~= 3 and math.abs(k) ~= 3 then
local vi = area:index(x+j, y+1, z+k)
data[vi] = c_stone
end
end
end
else
for j = -4, 4 do
for k = -4, 4 do
local vi = area:index(x+j, y, z+k)
data[vi] = c_stone
if math.abs(j) ~= 4 and math.abs(k) ~= 4 then
local vi = area:index(x+j, y+1, z+k)
data[vi] = c_stone
end
end
end
end
for j = 2, scale + 2 do --y
for k = -2, scale - 2 do
for l = -2, scale - 2 do
local vi = area:index(x+k, y+j, z+l)
data[vi] = c_salt -- make cube
end
end
end
end
--function to create giant 'shrooms
function caverealms:giant_shroom(x, y, z, area, data)
if not caverealms:below_solid(x,y,z,area,data) then
return
end
--as usual, grab the content ID's
local c_stem = minetest.get_content_id("caverealms:mushroom_stem")
local c_cap = minetest.get_content_id("caverealms:mushroom_cap")
local c_gills = minetest.get_content_id("caverealms:mushroom_gills")
z = z - 5
--cap
for k = -5, 5 do
for l = -5, 5 do
if k*k + l*l <= 25 then
local vi = area:index(x+k, y+5, z+l)
data[vi] = c_cap
end
if k*k + l*l <= 16 then
local vi = area:index(x+k, y+6, z+l)
data[vi] = c_cap
vi = area:index(x+k, y+5, z+l)
data[vi] = c_gills
end
if k*k + l*l <= 9 then
local vi = area:index(x+k, y+7, z+l)
data[vi] = c_cap
end
if k*k + l*l <= 4 then
local vi = area:index(x+k, y+8, z+l)
data[vi] = c_cap
end
end
end
--stem
for j = 0, 5 do
for k = -1,1 do
local vi = area:index(x+k, y+j, z)
data[vi] = c_stem
if k == 0 then
local ai = area:index(x, y+j, z+1)
data[ai] = c_stem
ai = area:index(x, y+j, z-1)
data[ai] = c_stem
end
end
end
end
function caverealms:legacy_giant_shroom(x, y, z, area, data) --leftovers :P
--as usual, grab the content ID's
local c_stem = minetest.get_content_id("caverealms:mushroom_stem")
local c_cap = minetest.get_content_id("caverealms:mushroom_cap")
z = z - 4
--cap
for k = -4, 4 do
for l = -4, 4 do
if k*k + l*l <= 16 then
local vi = area:index(x+k, y+5, z+l)
data[vi] = c_cap
end
if k*k + l*l <= 9 then
local vi = area:index(x+k, y+4, z+l)
data[vi] = c_cap
vi = area:index(x+k, y+6, z+l)
data[vi] = c_cap
end
if k*k + l*l <= 4 then
local vi = area:index(x+k, y+7, z+l)
data[vi] = c_cap
end
end
end
--stem
for j = 0, 4 do
for k = -1,1 do
local vi = area:index(x+k, y+j, z)
data[vi] = c_stem
if k == 0 then
local ai = area:index(x, y+j, z+1)
data[ai] = c_stem
ai = area:index(x, y+j, z-1)
data[ai] = c_stem
end
end
end
end
-- Experimental and very geometric function to create giant octagonal crystals in a variety of random directions
-- Uses calculations for points on a sphere, lines in geometric space
-- CURRENTLY USELESS, NOT LIKELY TO BE IMPLEMENTED SOON
function caverealms:octagon(x, y, z, area, data)
--Grab content id's... diamond is a placeholder
local c_crys = minetest.get_content_id("default:diamondblock")
local MAX_LEN = 25 --placeholder for a config file constant
local MIN_LEN = 10 --ditto
local target = {x=0, y=MAX_LEN, z=0} -- 3D space coordinate of the crystal's endpoint
local length = math.random(MIN_LEN, MAX_LEN) --get a random length for the crystal
local dir1 = math.random(0, 359) -- Random direction in degrees around a circle
local dir2 = math.random(0, 180) -- Random direction in a semicircle, for 3D location
--OK, so now make a 3D point out of those spherical coordinates...
target.x = math.ceil(length * math.cos(dir1 * 3.14/180)) --Round it up to make sure it's a nice integer for the coordinate system
target.z = math.ceil(length * math.sin(dir1 * 3.14/180))
--Y is also simple, just use dir2. Note that, due to how these calculations are carried out, this is not a coordinate on a perfect sphere. This is OK for our purposes.
target.y = math.ceil(length * math.sin(dir2 * 3.14/180))
-- Now, determine if the crystal should go up or down, based on where it is
if (caverealms:above_solid(x,y,z,area,data)) then
target.y = target.y * -1
end
--Bring the coordinates near the area you're generating
target.x = target.x + x
target.y = target.y + y
target.z = target.z + z
end
local CAVESPAWN = caverealms.config.cavespawn --false by default. Change to true in order to spawn in the caves when joining as a new player or respawning after death
local spawned = false;
local ydepth = -960;
if (CAVESPAWN) then
minetest.register_on_newplayer(function(player)
while spawned ~= true do
player:setpos({x=0,y=ydepth,z=0})
--minetest.after(2, function(player, ydepth)
spawnplayer(player, ydepth)
--end, player, ydepth)
ydepth = ydepth - 80
end
end)
minetest.register_on_respawnplayer(function(player)
while spawned ~= true do
player:setpos({x=0,y=ydepth,z=0})
--minetest.after(2, function(player, ydepth)
spawnplayer(player, ydepth)
--end, player, ydepth)
ydepth = ydepth - 80
end
return true
end)
end
-- Spawn player underground
function spawnplayer(player, ydepth)
local xsp
local ysp
local zsp
-- 3D noise for caves
local np_cave = {
offset = 0,
scale = 1,
spread = {x=512, y=256, z=512}, -- squashed 2:1
seed = 59033,
octaves = 6,
persist = 0.63
}
-- 3D noise for wave
local np_wave = {
offset = 0,
scale = 1,
spread = {x=256, y=256, z=256},
seed = -400000000089,
octaves = 3,
persist = 0.67
}
local YMIN = caverealms.config.ymin -- Approximate realm limits.
local YMAX = caverealms.config.ymax
local TCAVE = caverealms.config.tcave --0.5 -- Cave threshold. 1 = small rare caves, 0.5 = 1/3rd ground volume, 0 = 1/2 ground volume
local BLEND = 128 -- Cave blend distance near YMIN, YMAX
local yblmin = YMIN + BLEND * 1.5
local yblmax = YMAX - BLEND * 1.5
for chunk = 1, 64 do
print ("[caverealms] searching for spawn "..chunk)
local x0 = 80 * math.random(-32, 32) - 32
local z0 = 80 * math.random(-32, 32) - 32
local y0 = ydepth-32
local x1 = x0 + 79
local z1 = z0 + 79
local y1 = ydepth+47
local sidelen = 80
local chulens = {x=sidelen, y=sidelen, z=sidelen}
local minposxyz = {x=x0, y=y0, z=z0}
local minposxz = {x=x0, y=z0}
local nvals_cave = minetest.get_perlin_map(np_cave, chulens):get3dMap_flat(minposxyz) --cave noise for structure
local nvals_wave = minetest.get_perlin_map(np_wave, chulens):get3dMap_flat(minposxyz) --wavy structure of cavern ceilings and floors
local nixz = 1
local nixyz = 1
for z = z0, z1 do
for y = y0, y1 do
for x = x0, x1 do
local n_abscave = math.abs(nvals_cave[nixyz])
local n_abswave = math.abs(nvals_wave[nixyz])
local tcave --declare variable
--determine the overal cave threshold
if y < yblmin then
tcave = TCAVE + ((yblmin - y) / BLEND) ^ 2
elseif y > yblmax then
tcave = TCAVE + ((y - yblmax) / BLEND) ^ 2
else
tcave = TCAVE
end
--if y >= 1 and density > -0.01 and density < 0 then
if (nvals_cave[nixyz] + nvals_wave[nixyz])/2 > tcave + 0.005 and (nvals_cave[nixyz] + nvals_wave[nixyz])/2 < tcave + 0.015 then --if node falls within cave threshold
ysp = y + 1
xsp = x
zsp = z
break
end
nixz = nixz + 1
nixyz = nixyz + 1
end
if ysp then
break
end
nixz = nixz - 80
end
if ysp then
break
end
nixz = nixz + 80
end
if ysp then
break
end
end
print ("[caverealms] spawn player ("..xsp.." "..ysp.." "..zsp..")")
player:setpos({x=xsp, y=ysp, z=zsp})
spawned = true
end
--minetest.register_on_newplayer(function(player)
--spawnplayer(player)
--end)

434
init.lua
View File

@ -4,415 +4,43 @@
-- Depends default
-- License: code WTFPL
caverealms = {} --create a container for functions and constants
--grab a shorthand for the filepath of the mod
local modpath = minetest.get_modpath(minetest.get_current_modname())
caverealms = {}
--load companion lua files
dofile(modpath.."/config.lua") --configuration file; holds various constants
dofile(modpath.."/crafting.lua") --crafting recipes
dofile(modpath.."/nodes.lua") --node definitions
dofile(modpath.."/functions.lua") --function definitions
dofile(modpath.."/abms.lua") --abm definitions
dofile(modpath.."/crafting.lua")
dofile(modpath.."/falling_ice.lua")
dofile(modpath.."/nodes.lua")
dofile(modpath.."/caverealms_biomes.lua")
if caverealms.config.falling_icicles == true then
dofile(modpath.."/falling_ice.lua") --complicated function for falling icicles
print("[caverealms] falling icicles enabled.")
end
local FORTRESSES = caverealms.config.fortresses --true | Should fortresses spawn?
local FOUNTAINS = caverealms.config.fountains --true | Should fountains spawn?
-- Parameters
local YMIN = caverealms.config.ymin -- Approximate realm limits.
local YMAX = caverealms.config.ymax
local TCAVE = caverealms.config.tcave --0.5 -- Cave threshold. 1 = small rare caves, 0.5 = 1/3rd ground volume, 0 = 1/2 ground volume
local BLEND = 128 -- Cave blend distance near YMIN, YMAX
local STAGCHA = caverealms.config.stagcha --0.002 --chance of stalagmites
local STALCHA = caverealms.config.stalcha --0.003 --chance of stalactites
local CRYSTAL = caverealms.config.crystal --0.007 --chance of glow crystal formations
local GEMCHA = caverealms.config.gemcha --0.03 --chance of small glow gems
local MUSHCHA = caverealms.config.mushcha --0.04 --chance of mushrooms
local MYCCHA = caverealms.config.myccha --0.03 --chance of mycena mushrooms
local WORMCHA = caverealms.config.wormcha --0.03 --chance of glow worms
local GIANTCHA = caverealms.config.giantcha --0.001 -- chance of giant mushrooms
local ICICHA = caverealms.config.icicha --0.035 -- chance of icicles
local FLACHA = caverealms.config.flacha --0.04 --chance of constant flames
local FOUNCHA = caverealms.config.founcha --0.001 --chance of statue + fountain
local FORTCHA = caverealms.config.fortcha --0.0003 --chance of DM Fortresses
local DM_TOP = caverealms.config.dm_top -- -4000 --level at which Dungeon Master Realms start to appear
local DM_BOT = caverealms.config.dm_bot -- -5000 --level at which "" ends
local DEEP_CAVE = caverealms.config.deep_cave -- -7000 --level at which deep cave biomes take over
-- 3D noise for caves
local np_cave = {
offset = 0,
scale = 1,
spread = {x=512, y=256, z=512}, -- squashed 2:1
seed = 59033,
octaves = 6,
persist = 0.63
local caverealms_def = {
minimum_depth = caverealms.config.ymax,
maximum_depth = caverealms.config.ymin,
cave_threshold = caverealms.config.tcave,
boundary_blend_range = 128,
perlin_cave = {
offset = 0,
scale = 1,
spread = {x=256, y=256, z=256},
seed = -400000000089,
octaves = 3,
persist = 0.67
},
perlin_wave = {
offset = 0,
scale = 1,
spread = {x=512, y=256, z=512}, -- squashed 2:1
seed = 59033,
octaves = 6,
persist = 0.63
},
}
-- 3D noise for wave
subterrane:register_cave_layer(caverealms_def)
local np_wave = {
offset = 0,
scale = 1,
spread = {x=256, y=256, z=256},
seed = -400000000089,
octaves = 3,
persist = 0.67
}
-- 2D noise for biome
local np_biome = {
offset = 0,
scale = 1,
spread = {x=250, y=250, z=250},
seed = 9130,
octaves = 3,
persist = 0.5
}
-- Stuff
subterrain = {}
local yblmin = YMIN + BLEND * 1.5
local yblmax = YMAX - BLEND * 1.5
-- On generated function
minetest.register_on_generated(function(minp, maxp, seed)
--if out of range of caverealms limits
if minp.y > YMAX or maxp.y < YMIN then
return --quit; otherwise, you'd have stalagmites all over the place
end
--easy reference to commonly used values
local t1 = os.clock()
local x1 = maxp.x
local y1 = maxp.y
local z1 = maxp.z
local x0 = minp.x
local y0 = minp.y
local z0 = minp.z
print ("[caverealms] chunk minp ("..x0.." "..y0.." "..z0..")") --tell people you are generating a chunk
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
local data = vm:get_data()
--grab content IDs
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")
if (minetest.get_modpath("moontest")) then
c_air = minetest.get_content_id("moontest:vacuum")
c_stone = minetest.get_content_id("moontest:stone")
end
local c_water = minetest.get_content_id("default:water_source")
local c_lava = minetest.get_content_id("default:lava_source")
local c_ice = minetest.get_content_id("default:ice")
local c_thinice = minetest.get_content_id("caverealms:thin_ice")
local c_crystal = minetest.get_content_id("caverealms:glow_crystal")
local c_gem1 = minetest.get_content_id("caverealms:glow_gem")
local c_gem2 = minetest.get_content_id("caverealms:glow_gem_2")
local c_gem3 = minetest.get_content_id("caverealms:glow_gem_3")
local c_gem4 = minetest.get_content_id("caverealms:glow_gem_4")
local c_gem5 = minetest.get_content_id("caverealms:glow_gem_5")
local c_saltgem1 = minetest.get_content_id("caverealms:salt_gem")
local c_saltgem2 = minetest.get_content_id("caverealms:salt_gem_2")
local c_saltgem3 = minetest.get_content_id("caverealms:salt_gem_3")
local c_saltgem4 = minetest.get_content_id("caverealms:salt_gem_4")
local c_saltgem5 = minetest.get_content_id("caverealms:salt_gem_5")
local c_spike1 = minetest.get_content_id("caverealms:spike")
local c_spike2 = minetest.get_content_id("caverealms:spike_2")
local c_spike3 = minetest.get_content_id("caverealms:spike_3")
local c_spike4 = minetest.get_content_id("caverealms:spike_4")
local c_spike5 = minetest.get_content_id("caverealms:spike_5")
local c_moss = minetest.get_content_id("caverealms:stone_with_moss")
local c_lichen = minetest.get_content_id("caverealms:stone_with_lichen")
local c_algae = minetest.get_content_id("caverealms:stone_with_algae")
local c_salt = minetest.get_content_id("caverealms:stone_with_salt")
local c_hcobble = minetest.get_content_id("caverealms:hot_cobble")
local c_gobsidian = minetest.get_content_id("caverealms:glow_obsidian")
local c_gobsidian2 = minetest.get_content_id("caverealms:glow_obsidian_2")
local c_coalblock = minetest.get_content_id("default:coalblock")
local c_desand = minetest.get_content_id("default:desert_sand")
local c_coaldust = minetest.get_content_id("caverealms:coal_dust")
local c_fungus = minetest.get_content_id("caverealms:fungus")
local c_mycena = minetest.get_content_id("caverealms:mycena")
local c_worm = minetest.get_content_id("caverealms:glow_worm")
local c_iciu = minetest.get_content_id("caverealms:icicle_up")
local c_icid = minetest.get_content_id("caverealms:icicle_down")
local c_flame = minetest.get_content_id("caverealms:constant_flame")
local c_fountain = minetest.get_content_id("caverealms:s_fountain")
local c_fortress = minetest.get_content_id("caverealms:s_fortress")
--mandatory values
local sidelen = x1 - x0 + 1 --length of a mapblock
local chulens = {x=sidelen, y=sidelen, z=sidelen} --table of chunk edges
local chulens2D = {x=sidelen, y=sidelen, z=1}
local minposxyz = {x=x0, y=y0, z=z0} --bottom corner
local minposxz = {x=x0, y=z0} --2D bottom corner
local nvals_cave = minetest.get_perlin_map(np_cave, chulens):get3dMap_flat(minposxyz) --cave noise for structure
local nvals_wave = minetest.get_perlin_map(np_wave, chulens):get3dMap_flat(minposxyz) --wavy structure of cavern ceilings and floors
local nvals_biome = minetest.get_perlin_map(np_biome, chulens2D):get2dMap_flat({x=x0+150, y=z0+50}) --2D noise for biomes (will be 3D humidity/temp later)
local nixyz = 1 --3D node index
local nixz = 1 --2D node index
local nixyz2 = 1 --second 3D index for second loop
for z = z0, z1 do -- for each xy plane progressing northwards
--structure loop
for y = y0, y1 do -- for each x row progressing upwards
local tcave --declare variable
--determine the overal cave threshold
if y < yblmin then
tcave = TCAVE + ((yblmin - y) / BLEND) ^ 2
elseif y > yblmax then
tcave = TCAVE + ((y - yblmax) / BLEND) ^ 2
else
tcave = TCAVE
end
local vi = area:index(x0, y, z) --current node index
for x = x0, x1 do -- for each node do
if (nvals_cave[nixyz] + nvals_wave[nixyz])/2 > tcave then --if node falls within cave threshold
data[vi] = c_air --hollow it out to make the cave
end
--increment indices
nixyz = nixyz + 1
vi = vi + 1
end
end
--decoration loop
for y = y0, y1 do -- for each x row progressing upwards
local is_deep = false
if y < DEEP_CAVE then
is_deep = true
end
local tcave --same as above
if y < yblmin then
tcave = TCAVE + ((yblmin - y) / BLEND) ^ 2
elseif y > yblmax then
tcave = TCAVE + ((y - yblmax) / BLEND) ^ 2
else
tcave = TCAVE
end
local vi = area:index(x0, y, z)
for x = x0, x1 do -- for each node do
--determine biome
local biome = false --preliminary declaration
local n_biome = nvals_biome[nixz] --make an easier reference to the noise
--compare noise values to determine a biome
if n_biome >= 0 and n_biome < 0.5 then
biome = 1 --moss
if is_deep then
biome = 7 --salt crystal
end
elseif n_biome <= -0.5 then
biome = 2 --fungal
if is_deep then
biome = 8 --glow obsidian
end
elseif n_biome >= 0.5 then
if n_biome >= 0.7 then
biome = 5 --deep glaciated
else
biome = 4 --glaciated
end
else
biome = 3 --algae
if is_deep then
biome = 9 --coal dust
end
end
if y <= DM_TOP and y >= DM_BOT then
biome = 6 --DUNGEON MASTER'S LAIR
end
--if y <= -1000 then
--biome = 6 --DUNGEON MASTER'S LAIR
--end
if math.floor(((nvals_cave[nixyz2] + nvals_wave[nixyz2])/2)*100) == math.floor(tcave*100) then
--ceiling
local ai = area:index(x,y+1,z) --above index
if data[ai] == c_stone and data[vi] == c_air then --ceiling
if math.random() < ICICHA and (biome == 4 or biome == 5) then
data[vi] = c_icid
end
if math.random() < WORMCHA then
data[vi] = c_worm
local bi = area:index(x,y-1,z)
data[bi] = c_worm
if math.random(2) == 1 then
local bbi = area:index(x,y-2,z)
data[bbi] = c_worm
if math.random(2) ==1 then
local bbbi = area:index(x,y-3,z)
data[bbbi] = c_worm
end
end
end
if math.random() < STALCHA then
caverealms:stalactite(x,y,z, area, data)
end
if math.random() < CRYSTAL then
caverealms:crystal_stalactite(x,y,z, area, data, biome)
end
end
--ground
local bi = area:index(x,y-1,z) --below index
if data[bi] == c_stone and data[vi] == c_air then --ground
local ai = area:index(x,y+1,z)
--place floor material, add plants/decorations
if biome == 1 then
data[vi] = c_moss
if math.random() < GEMCHA then
-- gems of random size
local gems = { c_gem1, c_gem2, c_gem3, c_gem4, c_gem5 }
local gidx = math.random(1, 12)
if gidx > 5 then
gidx = 1
end
data[ai] = gems[gidx]
end
elseif biome == 2 then
data[vi] = c_lichen
if math.random() < MUSHCHA then --mushrooms
data[ai] = c_fungus
end
if math.random() < MYCCHA then --mycena mushrooms
data[ai] = c_mycena
end
if math.random() < GIANTCHA then --giant mushrooms
caverealms:giant_shroom(x, y, z, area, data)
end
elseif biome == 3 then
data[vi] = c_algae
elseif biome == 4 then
data[vi] = c_thinice
local bi = area:index(x,y-1,z)
data[bi] = c_thinice
if math.random() < ICICHA then --if glaciated, place icicles
data[ai] = c_iciu
end
elseif biome == 5 then
data[vi] = c_ice
local bi = area:index(x,y-1,z)
data[bi] = c_ice
if math.random() < ICICHA then --if glaciated, place icicles
data[ai] = c_iciu
end
elseif biome == 6 then
data[vi] = c_hcobble
if math.random() < FLACHA then --neverending flames
data[ai] = c_flame
end
if math.random() < FOUNCHA and FOUNTAINS then --DM FOUNTAIN
data[ai] = c_fountain
end
if math.random() < FORTCHA and FORTRESSES then --DM FORTRESS
data[ai] = c_fortress
end
elseif biome == 7 then
local bi = area:index(x,y-1,z)
data[vi] = c_salt
data[bi] = c_salt
if math.random() < GEMCHA then
-- gems of random size
local gems = { c_saltgem1, c_saltgem2, c_saltgem3, c_saltgem4, c_saltgem5 }
local gidx = math.random(1, 12)
if gidx > 5 then
gidx = 1
end
data[ai] = gems[gidx]
end
if math.random() < STAGCHA then
caverealms:salt_stalagmite(x,y,z, area, data)
end
elseif biome == 8 then
local bi = area:index(x,y-1,z)
if math.random() < 0.5 then
data[vi] = c_gobsidian
data[bi] = c_gobsidian
else
data[vi] = c_gobsidian2
data[bi] = c_gobsidian2
end
if math.random() < FLACHA then --neverending flames
data[ai] = c_flame
end
elseif biome == 9 then
local bi = area:index(x,y-1,z)
if math.random() < 0.05 then
data[vi] = c_coalblock
data[bi] = c_coalblock
elseif math.random() < 0.15 then
data[vi] = c_coaldust
data[bi] = c_coaldust
else
data[vi] = c_desand
data[bi] = c_desand
end
if math.random() < FLACHA * 0.75 then --neverending flames
data[ai] = c_flame
end
if math.random() < GEMCHA then
-- spikes of random size
local spikes = { c_spike1, c_spike2, c_spike3, c_spike4, c_spike5 }
local sidx = math.random(1, 12)
if sidx > 5 then
sidx = 1
end
data[ai] = spikes[sidx]
end
end
if math.random() < STAGCHA then
caverealms:stalagmite(x,y,z, area, data)
end
if math.random() < CRYSTAL then
caverealms:crystal_stalagmite(x,y,z, area, data, biome)
end
end
end
nixyz2 = nixyz2 + 1
nixz = nixz + 1
vi = vi + 1
end
nixz = nixz - sidelen --shift the 2D index back
end
nixz = nixz + sidelen --shift the 2D index up a layer
end
--send data back to voxelmanip
vm:set_data(data)
--calc lighting
vm:set_lighting({day=0, night=0})
vm:calc_lighting()
--write it to world
vm:write_to_map(data)
local chugent = math.ceil((os.clock() - t1) * 1000) --grab how long it took
print ("[caverealms] "..chugent.." ms") --tell people how long
end)
print("[caverealms] loaded!")
if caverealms.config.cavespawn then
subterrane:register_cave_spawn(caverealms_def, -960)
end

45
intllib.lua Normal file
View File

@ -0,0 +1,45 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

140
locale/template.pot Normal file
View File

@ -0,0 +1,140 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-21 23:46-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"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\crafting.lua:9
msgid "Mycena Powder"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:14
msgid "Glow Crystal"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:28
msgid "Glow Emerald"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:42
msgid "Mese Crystal Block"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:56
msgid "Glow Ruby"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:70
msgid "Glow Amethyst"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:84
msgid "Glow Crystal Ore"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:95
msgid "Glow Emerald Ore"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:106
msgid "Glow Ruby Ore"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:117
msgid "Glow Amethyst Ore"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:128
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:156
msgid "Thin Ice"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:142
msgid "Salt Crystal"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:207
msgid "Glow Gem"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:240
msgid "Salt Gem"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:273
msgid "Stone Spike"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:295
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:316
msgid "Icicle"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:337
msgid "Cave Stone with Moss"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:349
msgid "Cave Stone with Lichen"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:361
msgid "Cave Stone with Algae"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:373
msgid "Cave Stone with Salt"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:387
msgid "Hot Cobble"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:400
msgid "Glowing Obsidian"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:412
msgid "Hot Glow Obsidian"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:425
msgid "Coal Dust"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:434
msgid "Glow Worms"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:456
msgid "Glowing Fungus"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:476
msgid "Mycena Mushroom"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:497
msgid "Giant Mushroom Stem"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:506
msgid "Giant Mushroom Cap"
msgstr ""
#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\minetest-caverealms\nodes.lua:515
msgid "Giant Mushroom Gills"
msgstr ""

6
locale/update.bat Normal file
View File

@ -0,0 +1,6 @@
@echo off
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
cd ..
set LIST=
for /r %%X in (*.lua) do set LIST=!LIST! %%X
..\intllib\tools\xgettext.bat %LIST%

115
nodes.lua
View File

@ -1,4 +1,6 @@
-- CaveRealms nodes.lua
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
--NODES--
@ -9,7 +11,7 @@ local DM_TOP = caverealms.config.dm_top -- -4000 --level at which Dungeon Master
--glowing crystal
minetest.register_node("caverealms:glow_crystal", {
description = "Glow Crystal",
description = S("Glow Crystal"),
tiles = {"caverealms_glow_crystal.png"},
is_ground_content = true,
groups = {cracky=3},
@ -23,7 +25,7 @@ minetest.register_node("caverealms:glow_crystal", {
--glowing emerald
minetest.register_node("caverealms:glow_emerald", {
description = "Glow Emerald",
description = S("Glow Emerald"),
tiles = {"caverealms_glow_emerald.png"},
is_ground_content = true,
groups = {cracky=3},
@ -37,7 +39,7 @@ minetest.register_node("caverealms:glow_emerald", {
--glowing mese crystal blocks
minetest.register_node("caverealms:glow_mese", {
description = "Mese Crystal Block",
description = S("Mese Crystal Block"),
tiles = {"caverealms_glow_mese.png"},
is_ground_content = true,
groups = {cracky=3},
@ -51,7 +53,7 @@ minetest.register_node("caverealms:glow_mese", {
--glowing ruby
minetest.register_node("caverealms:glow_ruby", {
description = "Glow Ruby",
description = S("Glow Ruby"),
tiles = {"caverealms_glow_ruby.png"},
is_ground_content = true,
groups = {cracky=3},
@ -65,7 +67,7 @@ minetest.register_node("caverealms:glow_ruby", {
--glowing amethyst
minetest.register_node("caverealms:glow_amethyst", {
description = "Glow Amethyst",
description = S("Glow Amethyst"),
tiles = {"caverealms_glow_amethyst.png"},
is_ground_content = true,
groups = {cracky=3},
@ -79,7 +81,7 @@ minetest.register_node("caverealms:glow_amethyst", {
--embedded crystal
minetest.register_node("caverealms:glow_ore", {
description = "Glow Crystal Ore",
description = S("Glow Crystal Ore"),
tiles = {"caverealms_glow_ore.png"},
is_ground_content = true,
groups = {cracky=2},
@ -90,7 +92,7 @@ minetest.register_node("caverealms:glow_ore", {
--embedded emerald
minetest.register_node("caverealms:glow_emerald_ore", {
description = "Glow Emerald Ore",
description = S("Glow Emerald Ore"),
tiles = {"caverealms_glow_emerald_ore.png"},
is_ground_content = true,
groups = {cracky=2},
@ -101,7 +103,7 @@ minetest.register_node("caverealms:glow_emerald_ore", {
--embedded ruby
minetest.register_node("caverealms:glow_ruby_ore", {
description = "Glow Ruby Ore",
description = S("Glow Ruby Ore"),
tiles = {"caverealms_glow_ruby_ore.png"},
is_ground_content = true,
groups = {cracky=2},
@ -112,7 +114,7 @@ minetest.register_node("caverealms:glow_ruby_ore", {
--embedded amethyst
minetest.register_node("caverealms:glow_amethyst_ore", {
description = "Glow Amethyst Ore",
description = S("Glow Amethyst Ore"),
tiles = {"caverealms_glow_amethyst_ore.png"},
is_ground_content = true,
groups = {cracky=2},
@ -123,10 +125,10 @@ minetest.register_node("caverealms:glow_amethyst_ore", {
--thin (transparent) ice
minetest.register_node("caverealms:thin_ice", {
description = "Thin Ice",
description = S("Thin Ice"),
tiles = {"caverealms_thin_ice.png"},
is_ground_content = true,
groups = {cracky=3},
groups = {cracky=3, puts_out_fire = 1, cools_lava = 1},
sounds = default.node_sound_glass_defaults(),
use_texture_alpha = true,
drawtype = "glasslike",
@ -137,7 +139,7 @@ minetest.register_node("caverealms:thin_ice", {
--salt crystal
minetest.register_node("caverealms:salt_crystal", {
description = "Salt Crystal",
description = S("Salt Crystal"),
tiles = {"caverealms_salt_crystal.png"},
is_ground_content = true,
groups = {cracky=3},
@ -151,10 +153,10 @@ minetest.register_node("caverealms:salt_crystal", {
--alternate version for stalactites
minetest.register_node("caverealms:hanging_thin_ice", {
description = "Thin Ice",
description = S("Thin Ice"),
tiles = {"caverealms_thin_ice.png"},
is_ground_content = true,
groups = {cracky=3},
groups = {cracky=3, puts_out_fire = 1, cools_lava = 1},
sounds = default.node_sound_glass_defaults(),
use_texture_alpha = true,
drawtype = "glasslike",
@ -202,7 +204,7 @@ for i in ipairs(glow_gem_size) do
vs = glow_gem_size[i]
minetest.register_node(nodename, {
description = "Glow Gem",
description = S("Glow Gem"),
tiles = {"caverealms_glow_gem.png"},
inventory_image = "caverealms_glow_gem.png",
wield_image = "caverealms_glow_gem.png",
@ -235,7 +237,7 @@ for i in ipairs(salt_gem_size) do
vs = salt_gem_size[i]
minetest.register_node(nodename, {
description = "Salt Gem",
description = S("Salt Gem"),
tiles = {"caverealms_salt_gem.png"},
inventory_image = "caverealms_salt_gem.png",
wield_image = "caverealms_salt_gem.png",
@ -268,7 +270,7 @@ for i in ipairs(spike_size) do
vs = spike_size[i]
minetest.register_node(nodename, {
description = "Stone Spike",
description = S("Stone Spike"),
tiles = {"caverealms_spike.png"},
inventory_image = "caverealms_spike.png",
wield_image = "caverealms_spike.png",
@ -290,7 +292,7 @@ end
--upward pointing icicle
minetest.register_node("caverealms:icicle_up", {
description = "Icicle",
description = S("Icicle"),
tiles = {"caverealms_icicle_up.png"},
inventory_image = "caverealms_icicle_up.png",
wield_image = "caverealms_icicle_up.png",
@ -311,7 +313,7 @@ minetest.register_node("caverealms:icicle_up", {
--downward pointing icicle
minetest.register_node("caverealms:icicle_down", {
description = "Icicle",
description = S("Icicle"),
tiles = {"caverealms_icicle_down.png"},
inventory_image = "caverealms_icicle_down.png",
wield_image = "caverealms_icicle_down.png",
@ -332,7 +334,7 @@ minetest.register_node("caverealms:icicle_down", {
--cave mossy cobble - bluish?
minetest.register_node("caverealms:stone_with_moss", {
description = "Cave Stone with Moss",
description = S("Cave Stone with Moss"),
tiles = {"default_cobble.png^caverealms_moss.png", "default_cobble.png", "default_cobble.png^caverealms_moss_side.png"},
is_ground_content = true,
groups = {crumbly=3},
@ -344,7 +346,7 @@ minetest.register_node("caverealms:stone_with_moss", {
--cave lichen-covered cobble - purple-ish
minetest.register_node("caverealms:stone_with_lichen", {
description = "Cave Stone with Lichen",
description = S("Cave Stone with Lichen"),
tiles = {"default_cobble.png^caverealms_lichen.png", "default_cobble.png", "default_cobble.png^caverealms_lichen_side.png"},
is_ground_content = true,
groups = {crumbly=3},
@ -356,7 +358,7 @@ minetest.register_node("caverealms:stone_with_lichen", {
--cave algae-covered cobble - yellow-ish
minetest.register_node("caverealms:stone_with_algae", {
description = "Cave Stone with Algae",
description = S("Cave Stone with Algae"),
tiles = {"default_cobble.png^caverealms_algae.png", "default_cobble.png", "default_cobble.png^caverealms_algae_side.png"},
is_ground_content = true,
groups = {crumbly=3},
@ -368,7 +370,7 @@ minetest.register_node("caverealms:stone_with_algae", {
--tiny-salt-crystal-covered cobble - pink-ish
minetest.register_node("caverealms:stone_with_salt", {
description = "Cave Stone with Salt",
description = S("Cave Stone with Salt"),
tiles = {"caverealms_salty2.png"},--{"caverealms_salty2.png^caverealms_salty.png", "caverealms_salty2.png", "caverealms_salty2.png^caverealms_salty_side.png"},
light_source = 9,
paramtype = "light",
@ -382,7 +384,7 @@ minetest.register_node("caverealms:stone_with_salt", {
--Hot Cobble - cobble with lava instead of mortar XD
minetest.register_node("caverealms:hot_cobble", {
description = "Hot Cobble",
description = S("Hot Cobble"),
tiles = {"caverealms_hot_cobble.png"},
is_ground_content = true,
groups = {crumbly=2, hot=1},
@ -395,7 +397,7 @@ minetest.register_node("caverealms:hot_cobble", {
--Glow Obsidian
minetest.register_node("caverealms:glow_obsidian", {
description = "Glowing Obsidian",
description = S("Glowing Obsidian"),
tiles = {"caverealms_glow_obsidian.png"},
is_ground_content = true,
groups = {crumbly=1},
@ -407,7 +409,7 @@ minetest.register_node("caverealms:glow_obsidian", {
--Glow Obsidian 2 - has traces of lava
minetest.register_node("caverealms:glow_obsidian_2", {
description = "Hot Glow Obsidian",
description = S("Hot Glow Obsidian"),
tiles = {"caverealms_glow_obsidian2.png"},
is_ground_content = true,
groups = {crumbly=1, hot=1},
@ -420,7 +422,7 @@ minetest.register_node("caverealms:glow_obsidian_2", {
--Coal Dust
minetest.register_node("caverealms:coal_dust", {
description = "Coal Dust",
description = S("Coal Dust"),
tiles = {"caverealms_coal_dust.png"},
is_ground_content = true,
groups = {crumbly=3, falling_node=1, sand=1},
@ -429,7 +431,7 @@ minetest.register_node("caverealms:coal_dust", {
--glow worms
minetest.register_node("caverealms:glow_worm", {
description = "Glow Worms",
description = S("Glow Worms"),
tiles = {"caverealms_glow_worm.png"},
inventory_image = "caverealms_glow_worm.png",
wield_image = "caverealms_glow_worm.png",
@ -451,12 +453,12 @@ minetest.register_node("caverealms:glow_worm", {
--glowing fungi
minetest.register_node("caverealms:fungus", {
description = "Glowing Fungus",
description = S("Glowing Fungus"),
tiles = {"caverealms_fungi.png"},
inventory_image = "caverealms_fungi.png",
wield_image = "caverealms_fungi.png",
is_ground_content = true,
groups = {oddly_breakable_by_hand=3},
groups = {oddly_breakable_by_hand=3, flammable = 1},
light_source = 5,
paramtype = "light",
drawtype = "plantlike",
@ -471,12 +473,12 @@ minetest.register_node("caverealms:fungus", {
--mycena mushroom
minetest.register_node("caverealms:mycena", {
description = "Mycena Mushroom",
description = S("Mycena Mushroom"),
tiles = {"caverealms_mycena.png"},
inventory_image = "caverealms_mycena.png",
wield_image = "caverealms_mycena.png",
is_ground_content = true,
groups = {oddly_breakable_by_hand=3},
groups = {oddly_breakable_by_hand=3, flammable = 1},
light_source = 6,
paramtype = "light",
drawtype = "plantlike",
@ -492,62 +494,33 @@ minetest.register_node("caverealms:mycena", {
--giant mushroom
--stem
minetest.register_node("caverealms:mushroom_stem", {
description = "Giant Mushroom Stem",
description = S("Giant Mushroom Stem"),
tiles = {"caverealms_mushroom_stem.png"},
is_ground_content = true,
groups = {oddly_breakable_by_hand=1},
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
--cap
minetest.register_node("caverealms:mushroom_cap", {
description = "Giant Mushroom Cap",
description = S("Giant Mushroom Cap"),
tiles = {"caverealms_mushroom_cap.png"},
is_ground_content = true,
groups = {oddly_breakable_by_hand=1},
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
--gills
minetest.register_node("caverealms:mushroom_gills", {
description = "Giant Mushroom Gills",
description = S("Giant Mushroom Gills"),
tiles = {"caverealms_mushroom_gills.png"},
is_ground_content = true,
groups = {oddly_breakable_by_hand=1},
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
sounds = default.node_sound_leaves_defaults(),
drawtype = "plantlike",
paramtype = "light",
})
--define special flame so that it does not expire
minetest.register_node("caverealms:constant_flame", {
description = "Fire",
drawtype = "plantlike",
tiles = {{
name="fire_basic_flame_animated.png",
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1},
}},
inventory_image = "fire_basic_flame.png",
light_source = 14,
groups = {igniter=2,dig_immediate=3,hot=3, not_in_creative_inventory=1},
drop = '',
walkable = false,
buildable_to = true,
damage_per_second = 4,
after_place_node = function(pos, placer)
if pos.y > DM_TOP then
minetest.remove_node(pos)
end
if not (minetest.get_modpath("moontest")) then
fire.on_flame_add_at(pos)
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if not (minetest.get_modpath("moontest")) then
fire.on_flame_remove_at(pos)
end
end,
})
--node to create a treasure chest in DM Forts.
minetest.register_node("caverealms:s_chest", {
description = "Trying to rob the bank before it's opened, eh?",

View File

@ -1,12 +1,10 @@
[Generation settings]
caverealms.ymin (bottom realm limit) int -33000 -33000 33000
caverealms.ymax (top realm limit) int -700 -33000 33000
#Cave threshold. 1 = small rare caves, 0.5 = 1/3rd ground volume, 0 = 1/2 ground volume
caverealms.tcave (cave threshold) float 0.5 0 1.0
caverealms.deep_cave (deep cave upper limit) int -7000 -33000 33000
caverealms_ymax (upper limit of caves) int -700 -31000 31000
caverealms_ymin (lower limit of caves) int -31000 -31000 31000
#1 = small rare caves, 0.5 = 1/3rd ground volume, 0 = 1/2 ground volume
caverealms_tcave (cave threshold) float 0.5 0 1.5
[Player spawning]
caverealms.cavespawn (Player spawns in caves) bool false
caverealms_deep_cave (deep cave upper limit) int -7000 -31000 31000
caverealms_cavespawn (spawn player in cave) bool false
[Decorations]
caverealms.stagcha (chance of stalagmites) float 0.002 0 1

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB