diff --git a/decogen.lua b/decogen.lua index f9637bf..e95e472 100644 --- a/decogen.lua +++ b/decogen.lua @@ -153,27 +153,21 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi break end - local biome_val = biome_n[index3d] - local stone_type = "default:stone" - local stone_depth = 1 - - -- Compress biomes at the surface to avoid fluids. - if y > fluid_compression then - biome_val = biome_val / max(1, log(y - fluid_compression)) - end - ------------------- - --biome_val = -0.75 - ------------------- - local biome = nil - if underzone and y < (underzone.ceiling + underzone.floor) / 2 then + local biome + --if underzone and y < (underzone.ceiling + underzone.floor) / 2 then + if underzone then biome = underzone - stone_type = underzone.floor_node - stone_depth = 2 - elseif underzone then - biome = underzone - stone_type = underzone.ceiling_node - stone_depth = 2 else + local biome_val = biome_n[index3d] + + -- Compress biomes at the surface to avoid fluids. + if y > fluid_compression then + biome_val = biome_val / max(1, log(y - fluid_compression)) + end + ------------------- + --biome_val = -0.75 + ------------------- + for _, bi in pairs(fun_caves.cave_biomes) do if biome_val >= bi.biome_val_low and biome_val < bi.biome_val_high then biome = bi @@ -187,9 +181,6 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi if not biome or (y < undersea and not biome.underwater) then biome = fun_caves.cave_biomes['algae'] end - - stone_type = biome.stone_type - stone_depth = biome.stone_depth end @@ -213,7 +204,7 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi end local air_above = false - for i = 1, stone_depth do + for i = 1, biome.stone_depth do if data[ivm + area.ystride * i] == node["air"] or (y < undersea and data[ivm + area.ystride * i] == node["default:water_source"]) then air_above = true end @@ -225,20 +216,20 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi write = true break else - data[ivm] = node[stone_type] + data[ivm] = node[biome.floor_node] write = true break end end local air_below = false - for i = 1, stone_depth do + for i = 1, biome.stone_depth do if data[ivm - area.ystride * i] == node["air"] then air_below = true end end - if not air_above and stone_type == "default:sand" then + if not air_above and biome.floor_node == "default:sand" then data[ivm] = node["default:sandstone"] write = true break @@ -250,7 +241,7 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi write = true break else - data[ivm] = node[stone_type] + data[ivm] = node[biome.ceiling_node] write = true break end @@ -285,13 +276,13 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi end -- fluids - if y > minp.y and biome and biome.fluid and node_below == node[stone_type] and rand(biome.fluid_chance) == 1 then + if y > minp.y and biome and biome.fluid and node_below == node[biome.floor_node] and rand(biome.fluid_chance) == 1 then data[ivm] = node[biome.fluid] write = true break -- standing up - elseif node_below == node[stone_type] and biome and biome.stalagmite and rand(biome.stalagmite_chance) == 1 then + elseif node_below == node[biome.floor_node] and biome and biome.stalagmite and rand(biome.stalagmite_chance) == 1 then if type(biome.stalagmite) == 'table' then data[ivm] = node[biome.stalagmite[rand(#biome.stalagmite)]] else diff --git a/mapgen.lua b/mapgen.lua index 0fcd11a..13fffe1 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -87,6 +87,7 @@ fun_caves.underzones = { regular_columns = false, stalactite = 'fun_caves:icicle_down', stalactite_chance = 12, + stone_depth = 2, upper_bound = -4832, vary = true, }, @@ -104,6 +105,7 @@ fun_caves.underzones = { lake_level = 5, lower_bound = -10032, regular_columns = false, + stone_depth = 1, upper_bound = -9872, vary = true, }, @@ -112,11 +114,11 @@ fun_caves.underzones = { ceiling = -14914, ceiling_node = 'fun_caves:hot_brass', column_node = 'default:steelblock', - column_node_rare = nil, floor = -14982, floor_node = 'fun_caves:hot_brass', lower_bound = -14992, regular_columns = true, + stone_depth = 1, upper_bound = -14912, vary = false, }, @@ -134,6 +136,7 @@ fun_caves.underzones = { lake_level = 10, lower_bound = -19952, regular_columns = false, + stone_depth = 2, upper_bound = -19792, vary = true, }, @@ -141,12 +144,11 @@ fun_caves.underzones = { name = 'Styx', ceiling = -29812, ceiling_node = 'default:dirt', - column_node = nil, - column_node_rare = nil, floor = -30012, floor_node = 'default:dirt', lower_bound = -30032, regular_columns = false, + stone_depth = 2, sealevel = -29842, upper_bound = -29792, vary = true, @@ -157,111 +159,120 @@ fun_caves.cave_biomes = { algae = { biome_val_low = 0, biome_val_high = 0.2, + ceiling_node = 'fun_caves:stone_with_algae', dirt = 'default:dirt', dirt_chance = 10, + floor_node = 'fun_caves:stone_with_algae', fungi = true, stalactite = 'fun_caves:stalactite_slimy', stalactite_chance = 12, stalagmite = 'fun_caves:stalagmite_slimy', stalagmite_chance = 12, - stone_type = 'fun_caves:stone_with_algae', stone_depth = 1, underwater = true, }, coal = { biome_val_low = 0.5, biome_val_high = 0.6, + ceiling_node = 'fun_caves:black_sand', deco = 'default:coalblock', deco_chance = 100, - fungi = nil, + floor_node = 'fun_caves:black_sand', stalagmite = 'fun_caves:constant_flame', stalagmite_chance = 50, - stone_type = 'fun_caves:black_sand', stone_depth = 2, underwater = false, }, hot = { biome_val_low = 0.6, biome_val_high = 99, + ceiling_node = 'fun_caves:hot_cobble', + floor_node = 'fun_caves:hot_cobble', fluid = 'default:lava_source', fluid_chance = 300, stalagmite = fun_caves.hot_spikes, stalagmite_chance = 50, - stone_type = 'fun_caves:hot_cobble', stone_depth = 1, underwater = false, }, ice = { biome_val_low = -99, biome_val_high = -0.6, + ceiling_node = 'default:ice', + floor_node = 'default:ice', stalactite = 'fun_caves:icicle_down', stalactite_chance = 12, stalagmite = 'fun_caves:icicle_up', stalagmite_chance = 12, - stone_type = 'default:ice', stone_depth = 2, underwater = true, }, ice_thin = { biome_val_low = -0.6, biome_val_high = -0.5, - stone_type = 'fun_caves:thin_ice', + ceiling_node = 'fun_caves:thin_ice', + floor_node = 'fun_caves:thin_ice', stone_depth = 2, underwater = true, }, lichen = { biome_val_low = -0.3, biome_val_high = 0, + ceiling_node = 'fun_caves:stone_with_lichen', dirt = 'default:dirt', dirt_chance = 10, + floor_node = 'fun_caves:stone_with_lichen', fungi = true, stalactite = 'fun_caves:stalactite', stalactite_chance = 12, stalagmite = 'fun_caves:stalagmite', stalagmite_chance = 12, - stone_type = 'fun_caves:stone_with_lichen', stone_depth = 1, underwater = true, }, lichen_dead = { biome_val_low = -0.6, biome_val_high = -0.5, + ceiling_node = 'fun_caves:stone_with_lichen', + floor_node = 'fun_caves:stone_with_lichen', stalactite = 'fun_caves:stalactite', stalactite_chance = 12, stalagmite = 'fun_caves:stalagmite', stalagmite_chance = 12, - stone_type = 'fun_caves:stone_with_lichen', stone_depth = 1, underwater = true, }, moss = { biome_val_low = -0.5, biome_val_high = -0.3, + ceiling_node = 'fun_caves:stone_with_moss', deco = 'fun_caves:glowing_fungal_stone', deco_chance = 50, + floor_node = 'fun_caves:stone_with_moss', fluid = 'default:water_source', fluid_chance = 300, stalactite = 'fun_caves:stalactite_mossy', stalactite_chance = 12, stalagmite = 'fun_caves:stalagmite_mossy', stalagmite_chance = 12, - stone_type = 'fun_caves:stone_with_moss', stone_depth = 1, underwater = true, }, salt = { biome_val_low = 0.2, biome_val_high = 0.35, + ceiling_node = 'fun_caves:stone_with_salt', deco = 'fun_caves:radioactive_ore', deco_chance = 500, - stone_type = 'fun_caves:stone_with_salt', + floor_node = 'fun_caves:stone_with_salt', stone_depth = 2, underwater = false, }, sand = { biome_val_low = 0.35, biome_val_high = 0.5, - stone_type = 'default:sand', + ceiling_node = 'default:sand', + floor_node = 'default:sand', stone_depth = 2, underwater = true, }, @@ -282,7 +293,7 @@ local function generate(p_minp, p_maxp, seed) local write = false local write_p2 = false - local underzone = nil + local underzone for _, uz in pairs(fun_caves.underzones) do local avg = (minp.y + maxp.y) / 2 if avg <= uz.upper_bound and avg >= uz.lower_bound then diff --git a/nodes.lua b/nodes.lua index ba9319c..17fbd9d 100644 --- a/nodes.lua +++ b/nodes.lua @@ -80,22 +80,24 @@ minetest.register_node("fun_caves:leaves_black", newnode) newnode = fun_caves.clone_node("default:water_source") newnode.description = "Poisonous Water" -newnode.tiles[1].name = "fun_caves_water_poison_source_animated.png" -newnode.special_tiles[1].name = "fun_caves_water_poison_source_animated.png" +newnode.groups.poison = 3 +newnode.light_source = 6 newnode.liquid_alternative_flowing = "fun_caves:water_poison_flowing" newnode.liquid_alternative_source = "fun_caves:water_poison_source" -newnode.light_source = 6 -newnode.groups.poison = 3 +newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64} +newnode.special_tiles[1].name = "fun_caves_water_poison_source_animated.png" +newnode.tiles[1].name = "fun_caves_water_poison_source_animated.png" minetest.register_node("fun_caves:water_poison_source", newnode) newnode = fun_caves.clone_node("default:water_flowing") newnode.description = "Poisonous Water" -newnode.tiles[1] = "fun_caves_water_poison.png" -newnode.special_tiles[1].name = "fun_caves_water_poison_flowing_animated.png" +newnode.groups.poison = 3 +newnode.light_source = 6 newnode.liquid_alternative_flowing = "fun_caves:water_poison_flowing" newnode.liquid_alternative_source = "fun_caves:water_poison_source" -newnode.light_source = 6 -newnode.groups.poison = 3 +newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64} +newnode.special_tiles[1].name = "fun_caves_water_poison_flowing_animated.png" +newnode.tiles[1] = "fun_caves_water_poison.png" minetest.register_node("fun_caves:water_poison_flowing", newnode) --minetest.register_node("fun_caves:bright_air", { diff --git a/textures/fun_caves_water_poison.png b/textures/fun_caves_water_poison.png index 58eaf97..c4197c9 100644 Binary files a/textures/fun_caves_water_poison.png and b/textures/fun_caves_water_poison.png differ diff --git a/textures/fun_caves_water_poison_flowing_animated.png b/textures/fun_caves_water_poison_flowing_animated.png index cd733c9..15178ab 100644 Binary files a/textures/fun_caves_water_poison_flowing_animated.png and b/textures/fun_caves_water_poison_flowing_animated.png differ diff --git a/textures/fun_caves_water_poison_source_animated.png b/textures/fun_caves_water_poison_source_animated.png index 2f69f9d..2327d8d 100644 Binary files a/textures/fun_caves_water_poison_source_animated.png and b/textures/fun_caves_water_poison_source_animated.png differ