diff --git a/cavegen.lua b/cavegen.lua index d0b0b06..58481f8 100644 --- a/cavegen.lua +++ b/cavegen.lua @@ -69,7 +69,7 @@ fun_caves.cavegen = function(minp, maxp, data, area, node, heightmap, underzone) write = true elseif underzone and (y < underzone.ceiling + 10 - (underzone.vary and cave_3[index] or 0) and y > underzone.floor - 10 + (underzone.vary and cave_3[index] or 0)) then -- nop - elseif y < height - cave_3[index] and cave_1[index3d] * cave_2[index3d] > cave_width then + elseif ((y <= maxp.y and y >= minp.y) or (data[ivm] == node['default:stone'])) and y < height - cave_3[index] and cave_1[index3d] * cave_2[index3d] > cave_width then if y <= fun_caves.underzones['Styx'].sealevel then data[ivm] = node["default:water_source"] else diff --git a/fortress.lua b/fortress.lua index 5de7d53..0f846e7 100644 --- a/fortress.lua +++ b/fortress.lua @@ -1,13 +1,10 @@ local rand = math.random local floor = math.floor +local ceil = math.ceil +local max = math.max +local map_max = 31000 -local treasures = { - 'fun_caves:stone_with_aquamarines', - 'fun_caves:stone_with_sky_iron', - 'default:obsidian', -} - fun_caves.fortress = function(minp, maxp, data, area, node) -- invisible maze -- hungry maze @@ -16,7 +13,7 @@ fun_caves.fortress = function(minp, maxp, data, area, node) -- hidden doors/downs -- hot/ice floors -- - --local level = ceil(maxp.y / 3100) + local level = max(6, ceil(maxp.y / floor(map_max / 6))) local n = 16 local walls = {} local inner_floor = node['fun_caves:dungeon_floor_1'] @@ -49,7 +46,7 @@ fun_caves.fortress = function(minp, maxp, data, area, node) --data[ivm] = fun_caves.DEBUG and node["default:glass"] or inner_wall if y2 == 0 and rand(3000) == 1 then treasure_count = treasure_count + 1 - data[ivm] = node[treasures[rand(#treasures)]] + data[ivm] = node['fun_caves:coffer'] else data[ivm] = inner_wall end diff --git a/fungal_tree.lua b/fungal_tree.lua index 93a8cc0..757cfe7 100644 --- a/fungal_tree.lua +++ b/fungal_tree.lua @@ -43,6 +43,7 @@ local fruit = minetest.get_content_id("fun_caves:fungal_tree_fruit") function fun_caves.make_fungal_tree(data, area, ivm, height) local leaf = minetest.get_content_id(fungal_tree_leaves[rand(#fungal_tree_leaves)]) + local air = minetest.get_content_id('air') for y = 0, height do local radius = 1 if y > 1 and y < height - 2 then @@ -52,12 +53,14 @@ function fun_caves.make_fungal_tree(data, area, ivm, height) for x = -radius,radius do local sr = rand(1,100) local i = ivm + z*area.zstride + y*area.ystride + x - if x == 0 and y == 0 and z == 0 then - data[i] = leaf - elseif sr == 1 then - data[i] = fruit - elseif sr < 50 then - data[i] = leaf + if data[i] == air then + if x == 0 and y == 0 and z == 0 then + data[i] = leaf + elseif sr == 1 then + data[i] = fruit + elseif sr < 50 then + data[i] = leaf + end end end end diff --git a/mapgen.lua b/mapgen.lua index fc9289a..253b841 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -64,7 +64,7 @@ fun_caves.is_fortress = function(pos, cs, debug) local n = minetest.get_perlin(fortress_noise):get3d({x=x, y=y, z=z}) if fun_caves.DEBUG and floor((n * 10000) % 4) == 1 then - print('fortress ('..x..','..y..','..zn..')') + --print('fortress ('..x..','..y..','..z..')') return true end if floor((n * 10000) % 19) == 1 then diff --git a/nodes.lua b/nodes.lua index 0796aa7..05fc166 100644 --- a/nodes.lua +++ b/nodes.lua @@ -1,5 +1,6 @@ local get_node_or_nil = minetest.get_node_or_nil local get_item_group = minetest.get_item_group +local map_max = 31000 local old_is_protected = minetest.is_protected function minetest.is_protected(pos, name) @@ -200,6 +201,108 @@ minetest.register_craft({ cooktime = 5, }) +minetest.register_craftitem("fun_caves:teleporter_iron_garnet", { + description = "Iron and Garnet Teleporter", + drawtype = "plantlike", + paramtype = "light", + tiles = {"fun_caves_tesseract_iron_garnet.png"}, + inventory_image = "fun_caves_tesseract_iron_garnet.png", + groups = {dig_immediate = 3}, + sounds = default.node_sound_stone_defaults(), + on_use = function(itemstack, user, pointed_thing) + teleporter(user, 'underworld', 0) + end, +}) + +minetest.register_craft({ + output = 'fun_caves:teleporter_iron_garnet', + recipe = { + {'fun_caves:sky_iron', 'default:copper_ingot', 'fun_caves:sky_iron'}, + {'fun_caves:perfect_garnet', 'fun_caves:perfect_garnet', 'fun_caves:perfect_garnet'}, + {'fun_caves:sky_iron', 'default:obsidian_shard', 'fun_caves:sky_iron'}, + } +}) + +minetest.register_craftitem("fun_caves:perfect_garnet", { + description = "Perfect Garnet", + drawtype = "plantlike", + paramtype = "light", + tiles = {"fun_caves_garnet.png"}, + inventory_image = "fun_caves_garnet.png", + groups = {dig_immediate = 3}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_node("fun_caves:stone_with_garnets", { + description = "Garnet Ore", + tiles = {"default_stone.png^fun_caves_mineral_garnet.png"}, + groups = {cracky = 1}, + drop = "fun_caves:perfect_garnet", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_ore({ + ore_type = "scatter", + ore = "fun_caves:stone_with_garnets", + wherein = "default:stone", + clust_scarcity = 17 * 17 * 17, + clust_num_ores = 1, + clust_size = 1, + y_min = -31000, + y_max = 31000, +}) + +minetest.register_craftitem("fun_caves:teleporter_iron_zoisite", { + description = "Iron and Zoisite Teleporter", + drawtype = "plantlike", + paramtype = "light", + tiles = {"fun_caves_tesseract_iron_zois.png"}, + inventory_image = "fun_caves_tesseract_iron_zois.png", + groups = {dig_immediate = 3}, + sounds = default.node_sound_stone_defaults(), + on_use = function(itemstack, user, pointed_thing) + teleporter(user, 'underworld', 0) + end, +}) + +minetest.register_craft({ + output = 'fun_caves:teleporter_iron_zoisite', + recipe = { + {'fun_caves:sky_iron', 'default:copper_ingot', 'fun_caves:sky_iron'}, + {'fun_caves:perfect_zoisite', 'fun_caves:perfect_zoisite', 'fun_caves:perfect_zoisite'}, + {'fun_caves:sky_iron', 'default:obsidian_shard', 'fun_caves:sky_iron'}, + } +}) + +minetest.register_craftitem("fun_caves:perfect_zoisite", { + description = "Perfect Zoisite", + drawtype = "plantlike", + paramtype = "light", + tiles = {"fun_caves_zoisite.png"}, + inventory_image = "fun_caves_zoisite.png", + groups = {dig_immediate = 3}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_node("fun_caves:stone_with_zoisites", { + description = "Zoisite Ore", + tiles = {"default_stone.png^fun_caves_mineral_zoisite.png"}, + groups = {cracky = 1}, + drop = "fun_caves:perfect_zoisite", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_ore({ + ore_type = "scatter", + ore = "fun_caves:stone_with_zoisites", + wherein = "default:stone", + clust_scarcity = 17 * 17 * 17, + clust_num_ores = 1, + clust_size = 1, + y_min = -31000, + y_max = 31000, +}) + minetest.register_craftitem("fun_caves:teleporter_iron_aquamarine", { description = "Iron and Aquamarine Teleporter", drawtype = "plantlike", @@ -222,6 +325,35 @@ minetest.register_craft({ } }) +minetest.register_craftitem("fun_caves:perfect_aquamarine", { + description = "Perfect Aquamarine", + drawtype = "plantlike", + paramtype = "light", + tiles = {"fun_caves_aquamarine.png"}, + inventory_image = "fun_caves_aquamarine.png", + groups = {dig_immediate = 3}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_node("fun_caves:stone_with_aquamarines", { + description = "Aquamarine Ore", + tiles = {"default_stone.png^fun_caves_mineral_aquamarine.png"}, + groups = {cracky = 1}, + drop = "fun_caves:perfect_aquamarine", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_ore({ + ore_type = "scatter", + ore = "fun_caves:stone_with_aquamarines", + wherein = "default:stone", + clust_scarcity = 17 * 17 * 17, + clust_num_ores = 1, + clust_size = 1, + y_min = -31000, + y_max = 31000, +}) + minetest.register_craftitem("fun_caves:meteorite", { description = "Iron Meteorite", drawtype = "plantlike", @@ -293,38 +425,49 @@ minetest.register_craft({ } }) -minetest.register_node("fun_caves:stone_with_aquamarines", { - description = "Aquamarine Ore", - tiles = {"default_stone.png^default_mineral_diamond.png"}, - groups = {cracky = 1}, - drop = "fun_caves:perfect_aquamarine", - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_ore({ - ore_type = "scatter", - ore = "fun_caves:stone_with_aquamarines", - wherein = "default:stone", - clust_scarcity = 17 * 17 * 17, - clust_num_ores = 1, - clust_size = 1, - y_min = -6000, - y_max = 31000, -}) - -minetest.register_craftitem("fun_caves:perfect_aquamarine", { - description = "Perfect Aquamarine", - drawtype = "plantlike", - paramtype = "light", - tiles = {"default_diamond.png"}, - inventory_image = "default_diamond.png", - groups = {dig_immediate = 3}, - sounds = default.node_sound_glass_defaults(), -}) - local newnode = fun_caves.clone_node("default:dirt") newnode.description = "Meteor Crater" newnode.tiles = {"fun_caves_crater.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"} newnode.drop = "fun_caves:meteorite" newnode.groups.soil = 0 minetest.register_node("fun_caves:meteorite_crater", newnode) + +local treasures = { + {'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'fun_caves:sky_iron', 'fun_caves:sky_iron', 'fun_caves:sky_iron', 'fun_caves:sky_iron', 'default:obsidian'}, + {'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'fun_caves:pure_copper', 'fun_caves:pure_copper', 'fun_caves:pure_copper', 'fun_caves:pure_copper', 'default:obsidian'}, + {'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'default:obsidian'}, + {'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'default:obsidian'}, + {'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'default:obsidian'}, + {'fun_caves:perfect_aquamarine', 'fun_caves:perfect_garnet', 'fun_caves:perfect_zoisite', 'fun_caves:coral_gem', 'default:obsidian'}, +} +local filler = {'default:apple 10', 'default:coal_lump 10', 'default:wood 10'} +local chest_formspec = + "size[8,9]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[current_name;main;0,0.3;8,4;]" .. + "list[current_player;main;0,4.85;8,1;]" .. + "list[current_player;main;0,6.08;8,3;8]" .. + "listring[current_name;main]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,4.85) + +local newnode = fun_caves.clone_node("default:chest") +newnode.description = "Treasure Chest" +newnode.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + local meta = minetest.get_meta(pos) + local ready = meta:get_string('formspec') + if ready == '' then + local level = math.max(6, math.ceil(pos.y / math.floor(map_max / 6))) + local big_item = treasures[level][math.random(#treasures[level])] + meta:set_string("formspec", chest_formspec) + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + inv:add_item('main', big_item) + for i = 1, math.random(4) do + inv:add_item('main', filler[math.random(#filler)]) + end + end +end +minetest.register_node("fun_caves:coffer", newnode) diff --git a/textures/fun_caves_aquamarine.png b/textures/fun_caves_aquamarine.png new file mode 100644 index 0000000..40fe5cf Binary files /dev/null and b/textures/fun_caves_aquamarine.png differ diff --git a/textures/fun_caves_coral_gem.png b/textures/fun_caves_coral_gem.png index 9b6c9f1..f08594c 100644 Binary files a/textures/fun_caves_coral_gem.png and b/textures/fun_caves_coral_gem.png differ diff --git a/textures/fun_caves_garnet.png b/textures/fun_caves_garnet.png new file mode 100644 index 0000000..6993a37 Binary files /dev/null and b/textures/fun_caves_garnet.png differ diff --git a/textures/fun_caves_mineral_aquamarine.png b/textures/fun_caves_mineral_aquamarine.png new file mode 100644 index 0000000..f01d48e Binary files /dev/null and b/textures/fun_caves_mineral_aquamarine.png differ diff --git a/textures/fun_caves_mineral_garnet.png b/textures/fun_caves_mineral_garnet.png new file mode 100644 index 0000000..171f049 Binary files /dev/null and b/textures/fun_caves_mineral_garnet.png differ diff --git a/textures/fun_caves_mineral_zoisite.png b/textures/fun_caves_mineral_zoisite.png new file mode 100644 index 0000000..516d0cc Binary files /dev/null and b/textures/fun_caves_mineral_zoisite.png differ diff --git a/textures/fun_caves_zoisite.png b/textures/fun_caves_zoisite.png new file mode 100644 index 0000000..e0aec72 Binary files /dev/null and b/textures/fun_caves_zoisite.png differ diff --git a/textures/image_credits.txt b/textures/image_credits.txt index e3cca53..4d7e8ce 100644 --- a/textures/image_credits.txt +++ b/textures/image_credits.txt @@ -2,3 +2,6 @@ Original spider textures: AspireMint Original goblins textures and models: Francisco "FreeLikeGNU" Athens Original tesseract: Claudio Rocchini (cc-by-sa 2.5), https://en.wikipedia.org/wiki/File:Runci_trunc_tessaract.png Original meteorite: MeteoriteKid (cc-by-sa 3), https://en.wikipedia.org/wiki/File:Oriented_Taza_Meteorite.jpg +Original tanzanite: Chromalys (cc-by-sa 4), https://en.wikipedia.org/wiki/File:Trichroic_Tanzanite_Gem_-_blue,_violet_%26_purple.jpg +Original aquamarine: Diamondexpert (cc-by-sa 2.5), https://commons.wikimedia.org/wiki/File:Gems_aquamarine.jpg +Original garnet: von de Wela49 (cc-by-sa 3), https://en.wikipedia.org/wiki/File:Garnet_cut.JPG