From 86ad3e7c6a37699f7f8297a387bf08af74e36629 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 1 Apr 2016 22:10:20 -0400 Subject: Update all core mods --- caverealms/config.lua | 2 ++ caverealms/falling_ice.lua | 2 +- caverealms/functions.lua | 76 +++++++++++++++++++++++++++------------- caverealms/init.lua | 87 +++++++++++++++++++++++++++++++++++++++++----- caverealms/nodes.lua | 40 +++++++++++++++++---- 5 files changed, 166 insertions(+), 41 deletions(-) (limited to 'caverealms') diff --git a/caverealms/config.lua b/caverealms/config.lua index 15b23d0..c4deaf2 100644 --- a/caverealms/config.lua +++ b/caverealms/config.lua @@ -24,6 +24,8 @@ end setting("number", "ymin", -33000) --bottom realm limit setting("number", "ymax", -700) --top realm limit setting("number", "tcave", 0.5) --cave threshold +setting("number", "deepcaves_ymax", -10000) -- depth when deepcave biomes start +setting("number", "deepdeepcaves_ymax", -20000) --falling icicles setting("bool", "falling_icicles", true) --enable/disable falling icicles diff --git a/caverealms/falling_ice.lua b/caverealms/falling_ice.lua index 4e04b5f..46b704b 100644 --- a/caverealms/falling_ice.lua +++ b/caverealms/falling_ice.lua @@ -177,7 +177,7 @@ function caverealms:nodeupdate_single(p, delay) if delay then minetest.after(0.1, caverealms.nodeupdate_single, {x=p.x, y=p.y, z=p.z}, false) else - n.level = minetest.env:get_node_level(p) + n.level = minetest.get_node_level(p) minetest.remove_node(p) caverealms:spawn_falling_node(p, n) caverealms:nodeupdate(p) diff --git a/caverealms/functions.lua b/caverealms/functions.lua index 6c62a93..17beda7 100644 --- a/caverealms/functions.lua +++ b/caverealms/functions.lua @@ -119,6 +119,13 @@ function caverealms:crystal_stalagmite(x,y,z, area, data, biome) local c_meseore = minetest.get_content_id("default:stone_with_mese") local c_ice = minetest.get_content_id("default:ice") local c_thinice = minetest.get_content_id("caverealms:thin_ice") + local c_obsidian = { + minetest.get_content_id("caverealms:obsidian"), + minetest.get_content_id("caverealms:obsidian_2"), + minetest.get_content_id("caverealms:obsidian_3"), + minetest.get_content_id("caverealms:obsidian_4"), + } + local c_embers = minetest.get_content_id("fake_fire:embers"); --for randomness local mode = 1 @@ -132,7 +139,7 @@ function caverealms:crystal_stalagmite(x,y,z, area, data, biome) mode = 1 end end - if biome == 4 or biome == 5 then + if biome > 4 then if math.random(3) == 1 then mode = 2 end @@ -149,22 +156,33 @@ function caverealms:crystal_stalagmite(x,y,z, area, data, biome) local nid_b local nid_s = c_stone --stone base, will be rewritten to ice in certain biomes + local hell = false + if biome > 3 then - if mode == 1 then - nid_a = c_ice - nid_b = c_thinice - nid_s = c_ice + if biome == 6 then + nid_s = c_obsidian[math.random(1, #c_obsidian)] + biome = 1 + hell = true 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 + if mode == 1 then + nid_s = c_ice + end + biome = 4 + end + end + + if (hell) then + nid_a = c_embers + nid_b = c_embers + else + if 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 + end local top = math.random(5,H_CRY) --grab a random height for the stalagmite for j = 0, top do --y @@ -211,6 +229,13 @@ function caverealms:crystal_stalactite(x,y,z, area, data, biome) local c_meseore = minetest.get_content_id("default:stone_with_mese") local c_ice = minetest.get_content_id("default:ice") local c_thinice = minetest.get_content_id("caverealms:hanging_thin_ice") + local c_obsidian = { + minetest.get_content_id("caverealms:obsidian"), + minetest.get_content_id("caverealms:obsidian_2"), + minetest.get_content_id("caverealms:obsidian_3"), + minetest.get_content_id("caverealms:obsidian_4"), + minetest.get_content_id("caverealms:obsidian_5"), + } --for randomness local mode = 1 @@ -242,15 +267,18 @@ function caverealms:crystal_stalactite(x,y,z, area, data, biome) local nid_s = c_stone --stone base, will be rewritten to ice in certain biomes if biome > 3 then - if mode == 1 then - nid_a = c_ice - nid_b = c_thinice - nid_s = c_ice + if biome == 6 then + nid_s = c_obsidian[math.random(1, #c_obsidian)] + biome = 1 else - nid_a = c_crystore - nid_b = c_crystal - end - elseif mode == 1 then + if mode == 1 then + nid_s = c_ice + end + biome = 4 + end + end + + if mode == 1 then nid_a = stalids[biome][1][1] nid_b = stalids[biome][1][2] else @@ -375,4 +403,4 @@ function caverealms:legacy_giant_shroom(x, y, z, area, data) --leftovers :P end end end -end \ No newline at end of file +end diff --git a/caverealms/init.lua b/caverealms/init.lua index c13671b..f3b968a 100644 --- a/caverealms/init.lua +++ b/caverealms/init.lua @@ -25,6 +25,8 @@ end local YMIN = caverealms.config.ymin -- Approximate realm limits. local YMAX = caverealms.config.ymax +local DEEPCAVES_YMAX = caverealms.config.deepcaves_ymax +local DEEP_DEEP_CAVES_YMAZ = caverealms.config.deepdeepcaves_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 @@ -87,7 +89,7 @@ minetest.register_on_generated(function(minp, maxp, seed) end --easy reference to commonly used values - local t1 = os.clock() + --local t1 = os.clock() local x1 = maxp.x local y1 = maxp.y local z1 = maxp.z @@ -95,7 +97,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local y0 = minp.y local z0 = minp.z - print ("[caverealms] chunk minp ("..x0.." "..y0.." "..z0..")") --tell people you are generating a chunk + --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} @@ -106,6 +108,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local c_stone = minetest.get_content_id("default:stone") local c_water = minetest.get_content_id("default:water_source") local c_lava = minetest.get_content_id("default:lava_source") + local c_lava_flowing = minetest.get_content_id("default:lava_flowing") 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") @@ -122,6 +125,37 @@ minetest.register_on_generated(function(minp, maxp, seed) 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_coal_block = minetest.get_content_id("default:coalblock") + local c_diamond_block = minetest.get_content_id("default:diamondblock") + + + local c_obsidian = { + minetest.get_content_id("caverealms:obsidian"), + minetest.get_content_id("caverealms:obsidian_2"), + minetest.get_content_id("caverealms:obsidian_3"), + minetest.get_content_id("caverealms:obsidian_4"), + } + + local allow_deep_cave_biomes = false + if minp.y <= DEEPCAVES_YMAX then + allow_deep_cave_biomes = true + end + + local c_hard_rock + if minetest.get_modpath("morestones") then + if (minp.y <= DEEP_DEEP_CAVES_YMAZ) then + c_hard_rock = minetest.get_content_id("morestones:travertine") + else + c_hard_rock = minetest.get_content_id("morestones:comendite") + end + elseif minetest.get_modpath("gloopblocks") then + c_hard_rock = minetest.get_content_id("default:basalt") + else + c_hard_rock = minetest.get_content_id("default:stone_with_diamond") + end + + + local deep_cave_shell_type = math.random() --mandatory values local sidelen = x1 - x0 + 1 --length of a mapblock @@ -137,6 +171,7 @@ minetest.register_on_generated(function(minp, maxp, seed) 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 @@ -178,14 +213,18 @@ minetest.register_on_generated(function(minp, maxp, seed) 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 allow_deep_cave_biomes then --and n_biome >= 0.25 then + biome = 6 -- obsidian + else + biome = 1 --moss + end elseif n_biome <= -0.5 then biome = 2 --fungal elseif n_biome >= 0.5 then if n_biome >= 0.7 then - biome = 5 --deep glaciated + biome = 5 -- deep glaciated else - biome = 4 --glaciated + biome = 4 -- glaciated end else biome = 3 --algae @@ -195,6 +234,22 @@ minetest.register_on_generated(function(minp, maxp, seed) --ceiling local ai = area:index(x,y+1,z) --above index if data[ai] == c_stone and data[vi] == c_air then --ceiling + if biome == 6 then + if deep_cave_shell_type > 0.65 then + data[ai] = c_obsidian[math.random(1, #c_obsidian)] + data[vi] = c_obsidian[math.random(1, #c_obsidian)] + elseif deep_cave_shell_type > 0.35 then + data[ai] = c_coal_block + data[vi] = c_coal_block + elseif deep_cave_shell_type > 0.15 then + data[ai] = c_hard_rock + data[vi] = c_hard_rock + else + data[ai] = c_diamond_block + data[vi] = c_diamond_block + end + end + if math.random() < ICICHA and (biome == 4 or biome == 5) then data[vi] = c_icid end @@ -261,12 +316,26 @@ minetest.register_on_generated(function(minp, maxp, seed) if math.random() < ICICHA then --if glaciated, place icicles data[ai] = c_iciu end + elseif biome == 6 then + local bi = area:index(x,y-1,z) + if deep_cave_shell_type > 0.65 then + data[bi] = c_obsidian[math.random(1, #c_obsidian)] + data[vi] = c_obsidian[math.random(1, #c_obsidian)] + elseif deep_cave_shell_type > 0.35 then + data[bi] = c_coal_block + data[vi] = c_coal_block + else + data[bi] = c_hard_rock + data[vi] = c_hard_rock + end + else + print("[caverealms] Unknown cave biome") end if math.random() < STAGCHA then caverealms:stalagmite(x,y,z, area, data) end - if math.random() < CRYSTAL then + if math.random() < CRYSTAL or (biome == 6 and math.random() < CRYSTAL*1.5) then caverealms:crystal_stalagmite(x,y,z, area, data, biome) end end @@ -287,10 +356,10 @@ minetest.register_on_generated(function(minp, maxp, seed) vm:set_lighting({day=0, night=0}) vm:calc_lighting() --write it to world - vm:write_to_map(data) + vm:write_to_map() - local chugent = math.ceil((os.clock() - t1) * 1000) --grab how long it took - print ("[caverealms] "..chugent.." ms") --tell people how long + --local chugent = math.ceil((os.clock() - t1) * 1000) --grab how long it took + --print ("[caverealms] "..chugent.." ms") --tell people how long end) diff --git a/caverealms/nodes.lua b/caverealms/nodes.lua index 7588234..a1e819c 100644 --- a/caverealms/nodes.lua +++ b/caverealms/nodes.lua @@ -55,7 +55,7 @@ minetest.register_node("caverealms:glow_ore", { is_ground_content = true, groups = {cracky=2}, sounds = default.node_sound_glass_defaults(), - light_source = 10, + light_source = 12, paramtype = "light", }) @@ -66,7 +66,7 @@ minetest.register_node("caverealms:glow_emerald_ore", { is_ground_content = true, groups = {cracky=2}, sounds = default.node_sound_glass_defaults(), - light_source = 10, + light_source = 12, paramtype = "light", }) @@ -144,7 +144,7 @@ for i in ipairs(glow_gem_size) do is_ground_content = true, groups = {cracky=3, oddly_breakable_by_hand=1}, sounds = default.node_sound_glass_defaults(), - light_source = 11, + light_source = 12, paramtype = "light", drawtype = "plantlike", walkable = false, @@ -204,7 +204,7 @@ minetest.register_node("caverealms:stone_with_moss", { description = "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}, + groups = {crumbly=3, soil=1}, drop = 'default:cobble', sounds = default.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain=0.25}, @@ -216,8 +216,10 @@ minetest.register_node("caverealms:stone_with_lichen", { description = "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}, + groups = {crumbly=3, soil=1}, drop = 'default:cobble', + light_source = 2, + paramtype = "light", sounds = default.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain=0.25}, }), @@ -228,7 +230,9 @@ minetest.register_node("caverealms:stone_with_algae", { description = "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}, + groups = {crumbly=3, soil=1}, + light_source = 2, + paramtype = "light", drop = 'default:cobble', sounds = default.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain=0.25}, @@ -285,7 +289,7 @@ minetest.register_node("caverealms:mycena", { wield_image = "caverealms_mycena.png", is_ground_content = true, groups = {oddly_breakable_by_hand=3}, - light_source = 6, + light_source = 8, paramtype = "light", drawtype = "plantlike", walkable = false, @@ -323,3 +327,25 @@ minetest.register_node("caverealms:mushroom_gills", { drawtype = "plantlike", paramtype = "light", }) + +local obsidian_glow = {7, 5, 2, 0} + +for i in ipairs(obsidian_glow) do + if i == 1 then + nodename = "caverealms:obsidian" + else + nodename = "caverealms:obsidian_" .. i + end + minetest.register_node(nodename, { + description = "Obsidian", + tiles = {"default_obsidian.png"}, + is_ground_content = true, + sounds = default.node_sound_stone_defaults(), + groups = { + cracky=1, level=2, not_in_creative_inventory = 1 + }, + light_source = obsidian_glow[i], + drop = "default:obsidian", + paramtype = "light", + }) +end -- cgit v1.2.3