diff --git a/abms.lua b/abms.lua index 7c914e4..c306a0b 100644 --- a/abms.lua +++ b/abms.lua @@ -241,6 +241,46 @@ minetest.register_abm({ end }) +-- meteor strikes +minetest.register_abm({ + nodenames = {"default:dirt_with_grass", "default:dirt_with_dry_grass"}, + neighbors = {"air"}, + interval = 100000 * fun_caves.time_factor, + catch_up = false, + chance = 10000, + action = function(pos, node) + local ps = {} + local players = minetest.get_connected_players() + for i = 1, #players do + local pp = players[i]:getpos() + if pp and pp.y > 0 then + local sky = {} + sky.bgcolor, sky.type, sky.textures = players[i]:get_sky() + ps[#ps+1] = { p = players[i], sky = sky } + players[i]:set_sky(0xffffff, "plain", {}) + end + end + + minetest.set_node(pos, {name="fun_caves:meteorite_crater"}) + --print('Fun Caves: meteorite impact '..pos.x..','..pos.y..','..pos.z) + + minetest.after(1, function() + for i = 1, #ps do + ps[i].p:set_sky(ps[i].sky.bgcolor, ps[i].sky.type, ps[i].sky.textures) + end + end) + end +}) + +minetest.register_abm({ + nodenames = {"fun_caves:meteorite_crater"}, + interval = 100 * fun_caves.time_factor, + chance = 10, + action = function(pos, node) + minetest.set_node(pos, {name="default:dirt"}) + end +}) + -- new mushrooms minetest.register_abm({ nodenames = {"default:dirt"}, diff --git a/fortress.lua b/fortress.lua index 8b17396..5de7d53 100644 --- a/fortress.lua +++ b/fortress.lua @@ -2,6 +2,12 @@ local rand = math.random local floor = math.floor +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,6 +22,7 @@ fun_caves.fortress = function(minp, maxp, data, area, node) local inner_floor = node['fun_caves:dungeon_floor_1'] local outer_wall = node['fun_caves:dungeon_wall_2'] local inner_wall = node['fun_caves:dungeon_wall_1'] + local treasure_count = 0 for y2 = 0, n-1 do --for y2 = 0, 0 do @@ -40,7 +47,12 @@ fun_caves.fortress = function(minp, maxp, data, area, node) end elseif (z - minp.z) % 5 == 0 or (x - minp.x) % 5 == 0 then --data[ivm] = fun_caves.DEBUG and node["default:glass"] or inner_wall - data[ivm] = inner_wall + if y2 == 0 and rand(3000) == 1 then + treasure_count = treasure_count + 1 + data[ivm] = node[treasures[rand(#treasures)]] + else + data[ivm] = inner_wall + end else data[ivm] = node["air"] end @@ -88,4 +100,5 @@ fun_caves.fortress = function(minp, maxp, data, area, node) end end end + --print(treasure_count) end diff --git a/mapgen.lua b/mapgen.lua index 13fffe1..0efba13 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -48,6 +48,7 @@ fun_caves.is_fortress = function(pos, cs, debug) -- Fix this to get csize, somehow. -- Remember that this function may be called -- before any chunks are generated. + local cs = cs or {x=80, y=80, z=80} local offset = floor(cs.y / 2) - 8 + 1 @@ -63,10 +64,11 @@ fun_caves.is_fortress = function(pos, cs, debug) local z = floor((pos.z + offset) / cs.z) local n = minetest.get_perlin(fortress_noise):get3d({x=x, y=y, z=z}) - if debug then - print(x, y, z, n, floor((n * 10000) % 19)) + if fun_caves.DEBUG and floor((n * 10000) % 4) == 1 then + print('fortress ('..x..','..y..','..zn..')') + return true end - if floor((n * 10000) % 19) == 1 or fun_caves.DEBUG then + if floor((n * 10000) % 19) == 1 then return true end diff --git a/nodes.lua b/nodes.lua index 8d05569..bae3436 100644 --- a/nodes.lua +++ b/nodes.lua @@ -159,12 +159,12 @@ local function teleporter(user, area, power) end end -minetest.register_craftitem("fun_caves:teleporter_steel_aquamarine", { - description = "Steel and Aquamarine Teleporter", +minetest.register_craftitem("fun_caves:teleporter_iron_aquamarine", { + description = "Iron and Aquamarine Teleporter", drawtype = "plantlike", paramtype = "light", - tiles = {"fun_caves_tesseract_steel_aqua.png"}, - inventory_image = "fun_caves_tesseract_steel_aqua.png", + tiles = {"fun_caves_tesseract_iron_aqua.png"}, + inventory_image = "fun_caves_tesseract_iron_aqua.png", groups = {dig_immediate = 3}, sounds = default.node_sound_stone_defaults(), on_use = function(itemstack, user, pointed_thing) @@ -172,8 +172,27 @@ minetest.register_craftitem("fun_caves:teleporter_steel_aquamarine", { end, }) -minetest.register_craftitem("fun_caves:pure_steel", { - description = "Incredibly Pure Steel", +minetest.register_craft({ + output = 'fun_caves:teleporter_iron_aquamarine', + recipe = { + {'fun_caves:sky_iron', 'default:copper_ingot', 'fun_caves:sky_iron'}, + {'fun_caves:perfect_aquamarine', 'fun_caves:perfect_aquamarine', 'fun_caves:perfect_aquamarine'}, + {'fun_caves:sky_iron', 'default:obsidian_shard', 'fun_caves:sky_iron'}, + } +}) + +minetest.register_craftitem("fun_caves:meteorite", { + description = "Iron Meteorite", + drawtype = "plantlike", + paramtype = "light", + tiles = {"fun_caves_meteorite.png"}, + inventory_image = "fun_caves_meteorite.png", + groups = {dig_immediate = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_craftitem("fun_caves:sky_iron", { + description = "Sky Iron", drawtype = "plantlike", paramtype = "light", tiles = {"default_steel_ingot.png"}, @@ -182,6 +201,76 @@ minetest.register_craftitem("fun_caves:pure_steel", { sounds = default.node_sound_stone_defaults(), }) +local newnode = fun_caves.clone_node("default:stone_with_iron") +newnode.description = "Stone With Sky Iron" +newnode.drop = "fun_caves:sky_iron" +minetest.register_node("fun_caves:stone_with_sky_iron", newnode) + +minetest.register_craftitem("fun_caves:meteoritic_iron_crucible", { + description = "Crucible of Meteoritic Iron", + drawtype = "plantlike", + paramtype = "light", + tiles = {"crucible.png"}, + inventory_image = "crucible.png", + groups = {dig_immediate = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_craft({ + output = 'fun_caves:meteoritic_iron_crucible', + recipe = { + {'fun_caves:meteorite', 'fun_caves:meteorite', 'fun_caves:meteorite'}, + {'fun_caves:meteorite', 'fun_caves:meteorite', 'fun_caves:meteorite'}, + {'fun_caves:meteorite', 'fun_caves:crucible', 'fun_caves:meteorite'}, + } +}) + +minetest.register_craft({ + type = "cooking", + output = "fun_caves:sky_iron", + recipe = "fun_caves:meteoritic_iron_crucible", + cooktime = 30, +}) + + +minetest.register_craftitem("fun_caves:crucible", { + description = "Crucible", + drawtype = "plantlike", + paramtype = "light", + tiles = {"crucible.png"}, + inventory_image = "crucible.png", + groups = {dig_immediate = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_craft({ + output = 'fun_caves:crucible', + recipe = { + {'default:clay', '', 'default:clay'}, + {'default:clay', '', 'default:clay'}, + {'', 'default:clay', ''}, + } +}) + +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 = 30 * 30 * 30, + 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", @@ -192,11 +281,9 @@ minetest.register_craftitem("fun_caves:perfect_aquamarine", { sounds = default.node_sound_glass_defaults(), }) -minetest.register_craft({ - output = 'fun_caves:teleporter_steel_aquamarine', - recipe = { - {'fun_caves:pure_steel', 'default:copper_ingot', 'fun_caves:pure_steel'}, - {'fun_caves:perfect_aquamarine', 'fun_caves:perfect_aquamarine', 'fun_caves:perfect_aquamarine'}, - {'fun_caves:pure_steel', 'default:obsidianbrick', 'fun_caves:pure_steel'}, - } -}) +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) diff --git a/textures/crucible.png b/textures/crucible.png new file mode 100644 index 0000000..fb34412 Binary files /dev/null and b/textures/crucible.png differ diff --git a/textures/default_grass.png b/textures/default_grass.png new file mode 100644 index 0000000..1fbeabe Binary files /dev/null and b/textures/default_grass.png differ diff --git a/textures/default_grass_side.png b/textures/default_grass_side.png new file mode 100644 index 0000000..338c688 Binary files /dev/null and b/textures/default_grass_side.png differ diff --git a/textures/fun_caves_crater.png b/textures/fun_caves_crater.png new file mode 100644 index 0000000..31793e6 Binary files /dev/null and b/textures/fun_caves_crater.png differ diff --git a/textures/fun_caves_grassy_crater.png b/textures/fun_caves_grassy_crater.png new file mode 100644 index 0000000..c28cb2a Binary files /dev/null and b/textures/fun_caves_grassy_crater.png differ diff --git a/textures/fun_caves_meteorite.png b/textures/fun_caves_meteorite.png new file mode 100644 index 0000000..e29fd33 Binary files /dev/null and b/textures/fun_caves_meteorite.png differ diff --git a/textures/fun_caves_tesseract_steel_aqua.png b/textures/fun_caves_tesseract_iron_aqua.png similarity index 100% rename from textures/fun_caves_tesseract_steel_aqua.png rename to textures/fun_caves_tesseract_iron_aqua.png diff --git a/textures/image_credits.txt b/textures/image_credits.txt index a060fa9..e3cca53 100644 --- a/textures/image_credits.txt +++ b/textures/image_credits.txt @@ -1,3 +1,4 @@ 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