From f5cc0ef2dc7ed0739c63d7d51b790b15429eddfa Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 25 Jun 2022 00:31:28 +0200 Subject: [PATCH] Move shipwrecks to mcl_structures --- mods/MAPGEN/mcl_shipwrecks/init.lua | 179 ------------------ mods/MAPGEN/mcl_shipwrecks/mod.conf | 3 - mods/MAPGEN/mcl_structures/api.lua | 2 +- mods/MAPGEN/mcl_structures/init.lua | 2 + mods/MAPGEN/mcl_structures/jungle_temple.lua | 2 +- ...tructures_shipwreck_full_back_damaged.mts} | Bin ...mcl_structures_shipwreck_full_damaged.mts} | Bin .../mcl_structures_shipwreck_full_normal.mts} | Bin .../mcl_structures_shipwreck_half_back.mts} | Bin .../mcl_structures_shipwreck_half_front.mts} | Bin mods/MAPGEN/mcl_structures/shipwrecks.lua | 161 ++++++++++++++++ 11 files changed, 165 insertions(+), 184 deletions(-) delete mode 100644 mods/MAPGEN/mcl_shipwrecks/init.lua delete mode 100644 mods/MAPGEN/mcl_shipwrecks/mod.conf rename mods/MAPGEN/{mcl_shipwrecks/schematics/shipwreck_full_back_damaged.mts => mcl_structures/schematics/mcl_structures_shipwreck_full_back_damaged.mts} (100%) rename mods/MAPGEN/{mcl_shipwrecks/schematics/shipwreck_full_damaged.mts => mcl_structures/schematics/mcl_structures_shipwreck_full_damaged.mts} (100%) rename mods/MAPGEN/{mcl_shipwrecks/schematics/shipwreck_full_normal.mts => mcl_structures/schematics/mcl_structures_shipwreck_full_normal.mts} (100%) rename mods/MAPGEN/{mcl_shipwrecks/schematics/shipwreck_half_back.mts => mcl_structures/schematics/mcl_structures_shipwreck_half_back.mts} (100%) rename mods/MAPGEN/{mcl_shipwrecks/schematics/shipwreck_half_front.mts => mcl_structures/schematics/mcl_structures_shipwreck_half_front.mts} (100%) create mode 100644 mods/MAPGEN/mcl_structures/shipwrecks.lua diff --git a/mods/MAPGEN/mcl_shipwrecks/init.lua b/mods/MAPGEN/mcl_shipwrecks/init.lua deleted file mode 100644 index a3861a2c92..0000000000 --- a/mods/MAPGEN/mcl_shipwrecks/init.lua +++ /dev/null @@ -1,179 +0,0 @@ -local modname = minetest.get_current_modname() -local modpath = minetest.get_modpath(modname) ---local S = minetest.get_translator(modname) - -local seed = minetest.get_mapgen_setting("seed") -local water_level = minetest.get_mapgen_setting("water_level") -local pr = PseudoRandom(seed) - ---schematics by chmodsayshello -local schems = { - modpath.."/schematics/".."shipwreck_full_damaged"..".mts", - modpath.."/schematics/".."shipwreck_full_normal"..".mts", - modpath.."/schematics/".."shipwreck_full_back_damaged"..".mts", - modpath.."/schematics/".."shipwreck_half_front"..".mts", - modpath.."/schematics/".."shipwreck_half_back"..".mts", -} - -local function get_supply_loot() - return { - stacks_min = 3, - stacks_max = 10, - items = { - --{ itemstring = "TODO:sus_stew", weight = 10, amount_min = 1, amount_max = 1 }, - { itemstring = "mcl_core:paper", weight = 8, amount_min = 1, amount_max = 12 }, - { itemstring = "mcl_farming:wheat_item", weight = 7, amount_min = 8, amount_max = 21 }, - { itemstring = "mcl_farming:carrot_item", weight = 7, amount_min = 4, amount_max = 8 }, - { itemstring = "mcl_farming:potato_item_poison", weight = 7, amount_min = 2, amount_max = 6 }, - { itemstring = "mcl_farming:potato_item", weight = 7, amount_min = 2, amount_max = 6 }, - --{ itemstring = "TODO:moss_block", weight = 7, amount_min = 1, amount_max = 4 }, - { itemstring = "mcl_core:coal_lump", weight = 6, amount_min = 2, amount_max = 8 }, - { itemstring = "mcl_mobitems:rotten_flesh", weight = 5, amount_min = 5, amount_max = 24 }, - { itemstring = "mcl_farming:potato_item", weight = 3, amount_min = 1, amount_max = 5 }, - { itemstring = "mcl_armor:helmet_leather_enchanted", weight = 3, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, - { itemstring = "mcl_armor:chestplate_leather_enchanted", weight = 3, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, - { itemstring = "mcl_armor:leggings_leather_enchanted", weight = 3, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, - { itemstring = "mcl_armor:boots_leather_enchanted", weight = 3, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, - --{ itemstring = "TODO:bamboo", weight = 2, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_farming:pumpkin", weight = 2, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_tnt:tnt", weight = 1, amount_min = 1, amount_max = 2 }, - - } - } -end - -local function get_treasure_loot() - return { - stacks_min = 3, - stacks_max = 10, - items = { - { itemstring = "mcl_core:iron_ingot", weight = 8, amount_min = 1, amount_max = 5 }, - { itemstring = "mcl_core:iron_nugget", weight = 8, amount_min = 1, amount_max = 10 }, - { itemstring = "mcl_core:emerald", weight = 8, amount_min = 1, amount_max = 12 }, - { itemstring = "mcl_dye:blue", weight = 8, amount_min = 1, amount_max = 12 }, - { itemstring = "mcl_core:gold_ingot", weight = 8, amount_min = 1, amount_max = 5 }, - { itemstring = "mcl_core:gold_nugget", weight = 8, amount_min = 1, amount_max = 10 }, - { itemstring = "mcl_experience:bottle", weight = 8, amount_min = 1, amount_max = 10 }, - { itemstring = "mcl_core:diamond", weight = 8, amount_min = 1, amount_max = 10 }, - } - } -end - -local function fill_chests(p1,p2) - for _,p in pairs(minetest.find_nodes_in_area(p1,p2,{"mcl_chests:chest_small"})) do - if minetest.get_meta(p):get_string("infotext") ~= "Chest" then - minetest.registered_nodes["mcl_chests:chest_small"].on_construct(p) - end - local inv = minetest.get_inventory( {type="node", pos=p} ) - local loot = get_supply_loot() - if pr:next(1,10) == 1 then loot = get_treasure_loot() end - mcl_loot.fill_inventory(inv, "main", mcl_loot.get_multi_loot({loot}, pr), pr) - end -end - -local ocean_biomes = { - "RoofedForest_ocean", - "JungleEdgeM_ocean", - "BirchForestM_ocean", - "BirchForest_ocean", - "IcePlains_deep_ocean", - "Jungle_deep_ocean", - "Savanna_ocean", - "MesaPlateauF_ocean", - "ExtremeHillsM_deep_ocean", - "Savanna_deep_ocean", - "SunflowerPlains_ocean", - "Swampland_deep_ocean", - "Swampland_ocean", - "MegaSpruceTaiga_deep_ocean", - "ExtremeHillsM_ocean", - "JungleEdgeM_deep_ocean", - "SunflowerPlains_deep_ocean", - "BirchForest_deep_ocean", - "IcePlainsSpikes_ocean", - "Mesa_ocean", - "StoneBeach_ocean", - "Plains_deep_ocean", - "JungleEdge_deep_ocean", - "SavannaM_deep_ocean", - "Desert_deep_ocean", - "Mesa_deep_ocean", - "ColdTaiga_deep_ocean", - "Plains_ocean", - "MesaPlateauFM_ocean", - "Forest_deep_ocean", - "JungleM_deep_ocean", - "FlowerForest_deep_ocean", - "MushroomIsland_ocean", - "MegaTaiga_ocean", - "StoneBeach_deep_ocean", - "IcePlainsSpikes_deep_ocean", - "ColdTaiga_ocean", - "SavannaM_ocean", - "MesaPlateauF_deep_ocean", - "MesaBryce_deep_ocean", - "ExtremeHills+_deep_ocean", - "ExtremeHills_ocean", - "MushroomIsland_deep_ocean", - "Forest_ocean", - "MegaTaiga_deep_ocean", - "JungleEdge_ocean", - "MesaBryce_ocean", - "MegaSpruceTaiga_ocean", - "ExtremeHills+_ocean", - "Jungle_ocean", - "RoofedForest_deep_ocean", - "IcePlains_ocean", - "FlowerForest_ocean", - "ExtremeHills_deep_ocean", - "MesaPlateauFM_deep_ocean", - "Desert_ocean", - "Taiga_ocean", - "BirchForestM_deep_ocean", - "Taiga_deep_ocean", - "JungleM_ocean" -} - -local beach_biomes = { - "FlowerForest_beach", - "Forest_beach", - "StoneBeach", - "ColdTaiga_beach_water", - "Taiga_beach", - "Savanna_beach", - "Plains_beach", - "ExtremeHills_beach", - "ColdTaiga_beach", - "Swampland_shore", - "MushroomIslandShore", - "JungleM_shore", - "Jungle_shore" -} - -mcl_structures.register_structure("shipwreck",{ - place_on = {"group:sand","mcl_core:gravel"}, - spawn_by = {"group:water"}, - num_spawn_by = 4, - noise_params = { - offset = 0, - scale = 0.000022, - spread = {x = 250, y = 250, z = 250}, - seed = 3, - octaves = 3, - persist = 0.001, - flags = "absvalue", - }, - flags = "force_placement", - biomes = ocean_biomes, - y_max = water_level-4, - y_min = mcl_vars.mg_overworld_min, - filenames = schems, - y_offset = function(pr) return pr:next(-4,-2) end, - after_place = function(pos) - fill_chests(vector.offset(pos,-20,-5,-20),vector.offset(pos,20,15,20)) - end -}) diff --git a/mods/MAPGEN/mcl_shipwrecks/mod.conf b/mods/MAPGEN/mcl_shipwrecks/mod.conf deleted file mode 100644 index 79940c7448..0000000000 --- a/mods/MAPGEN/mcl_shipwrecks/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = mcl_shipwrecks -author = cora -depends = mcl_loot, mcl_structures, mcl_enchanting diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index dc1f905f2c..f0c4fa6a5c 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -145,7 +145,7 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it y_max = def.y_max, y_min = def.y_min }) - minetest.register_node(":"..structblock, {drawtype="normal", walkable = false, pointable = false,groups = sbgroups}) + minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups}) def.structblock = structblock def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) minetest.set_gen_notify({decoration=true}, { def.deco_id }) diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index d54fc2dea8..a996e440ab 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -232,6 +232,7 @@ local function dir_to_rotation(dir) end dofile(modpath.."/api.lua") +dofile(modpath.."/shipwrecks.lua") dofile(modpath.."/desert_temple.lua") dofile(modpath.."/jungle_temple.lua") dofile(modpath.."/ocean_ruins.lua") @@ -240,6 +241,7 @@ dofile(modpath.."/igloo.lua") dofile(modpath.."/geode.lua") + mcl_structures.register_structure("desert_well",{ place_on = {"group:sand"}, fill_ratio = 0.01, diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua index 1ac3bd1b47..aa5bf94127 100644 --- a/mods/MAPGEN/mcl_structures/jungle_temple.lua +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -4,7 +4,7 @@ local modpath = minetest.get_modpath(modname) mcl_structures.register_structure("jungle_temple",{ place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"}, - fill_ratio = 0.01, + fill_ratio = 0.1, flags = "place_center_x, place_center_z", solid_ground = true, make_foundation = true, diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_back_damaged.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_back_damaged.mts similarity index 100% rename from mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_back_damaged.mts rename to mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_back_damaged.mts diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_damaged.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_damaged.mts similarity index 100% rename from mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_damaged.mts rename to mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_damaged.mts diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_normal.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_normal.mts similarity index 100% rename from mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_normal.mts rename to mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_normal.mts diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_back.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_half_back.mts similarity index 100% rename from mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_back.mts rename to mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_half_back.mts diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_front.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_half_front.mts similarity index 100% rename from mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_front.mts rename to mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_half_front.mts diff --git a/mods/MAPGEN/mcl_structures/shipwrecks.lua b/mods/MAPGEN/mcl_structures/shipwrecks.lua new file mode 100644 index 0000000000..72823d8113 --- /dev/null +++ b/mods/MAPGEN/mcl_structures/shipwrecks.lua @@ -0,0 +1,161 @@ +local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) +--local S = minetest.get_translator(modname) + +local seed = minetest.get_mapgen_setting("seed") +local water_level = minetest.get_mapgen_setting("water_level") +local pr = PseudoRandom(seed) + +--schematics by chmodsayshello +local schems = { + modpath.."/schematics/mcl_structures_shipwreck_full_damaged.mts", + modpath.."/schematics/mcl_structures_shipwreck_full_normal.mts", + modpath.."/schematics/mcl_structures_shipwreck_full_back_damaged.mts", + modpath.."/schematics/mcl_structures_shipwreck_half_front.mts", + modpath.."/schematics/mcl_structures_shipwreck_half_back.mts", +} + +local ocean_biomes = { + "RoofedForest_ocean", + "JungleEdgeM_ocean", + "BirchForestM_ocean", + "BirchForest_ocean", + "IcePlains_deep_ocean", + "Jungle_deep_ocean", + "Savanna_ocean", + "MesaPlateauF_ocean", + "ExtremeHillsM_deep_ocean", + "Savanna_deep_ocean", + "SunflowerPlains_ocean", + "Swampland_deep_ocean", + "Swampland_ocean", + "MegaSpruceTaiga_deep_ocean", + "ExtremeHillsM_ocean", + "JungleEdgeM_deep_ocean", + "SunflowerPlains_deep_ocean", + "BirchForest_deep_ocean", + "IcePlainsSpikes_ocean", + "Mesa_ocean", + "StoneBeach_ocean", + "Plains_deep_ocean", + "JungleEdge_deep_ocean", + "SavannaM_deep_ocean", + "Desert_deep_ocean", + "Mesa_deep_ocean", + "ColdTaiga_deep_ocean", + "Plains_ocean", + "MesaPlateauFM_ocean", + "Forest_deep_ocean", + "JungleM_deep_ocean", + "FlowerForest_deep_ocean", + "MushroomIsland_ocean", + "MegaTaiga_ocean", + "StoneBeach_deep_ocean", + "IcePlainsSpikes_deep_ocean", + "ColdTaiga_ocean", + "SavannaM_ocean", + "MesaPlateauF_deep_ocean", + "MesaBryce_deep_ocean", + "ExtremeHills+_deep_ocean", + "ExtremeHills_ocean", + "MushroomIsland_deep_ocean", + "Forest_ocean", + "MegaTaiga_deep_ocean", + "JungleEdge_ocean", + "MesaBryce_ocean", + "MegaSpruceTaiga_ocean", + "ExtremeHills+_ocean", + "Jungle_ocean", + "RoofedForest_deep_ocean", + "IcePlains_ocean", + "FlowerForest_ocean", + "ExtremeHills_deep_ocean", + "MesaPlateauFM_deep_ocean", + "Desert_ocean", + "Taiga_ocean", + "BirchForestM_deep_ocean", + "Taiga_deep_ocean", + "JungleM_ocean" +} + +local beach_biomes = { + "FlowerForest_beach", + "Forest_beach", + "StoneBeach", + "ColdTaiga_beach_water", + "Taiga_beach", + "Savanna_beach", + "Plains_beach", + "ExtremeHills_beach", + "ColdTaiga_beach", + "Swampland_shore", + "MushroomIslandShore", + "JungleM_shore", + "Jungle_shore" +} + +mcl_structures.register_structure("shipwreck",{ + place_on = {"group:sand","mcl_core:gravel"}, + spawn_by = {"group:water"}, + num_spawn_by = 4, + noise_params = { + offset = 0, + scale = 0.000022, + spread = {x = 250, y = 250, z = 250}, + seed = 3, + octaves = 3, + persist = 0.001, + flags = "absvalue", + }, + sidelen = 16, + flags = "force_placement", + biomes = ocean_biomes, + y_max = water_level-4, + y_min = mcl_vars.mg_overworld_min, + filenames = schems, + y_offset = function(pr) return pr:next(-4,-2) end, + loot = { + ["mcl_chests:chest_small"] = { + stacks_min = 3, + stacks_max = 10, + items = { + { itemstring = "mcl_sus_stew:stew", weight = 10, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:paper", weight = 8, amount_min = 1, amount_max = 12 }, + { itemstring = "mcl_farming:wheat_item", weight = 7, amount_min = 8, amount_max = 21 }, + { itemstring = "mcl_farming:carrot_item", weight = 7, amount_min = 4, amount_max = 8 }, + { itemstring = "mcl_farming:potato_item_poison", weight = 7, amount_min = 2, amount_max = 6 }, + { itemstring = "mcl_farming:potato_item", weight = 7, amount_min = 2, amount_max = 6 }, + --{ itemstring = "TODO:moss_block", weight = 7, amount_min = 1, amount_max = 4 }, + { itemstring = "mcl_core:coal_lump", weight = 6, amount_min = 2, amount_max = 8 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 5, amount_min = 5, amount_max = 24 }, + { itemstring = "mcl_farming:potato_item", weight = 3, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_armor:helmet_leather_enchanted", weight = 3, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + { itemstring = "mcl_armor:chestplate_leather_enchanted", weight = 3, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + { itemstring = "mcl_armor:leggings_leather_enchanted", weight = 3, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + { itemstring = "mcl_armor:boots_leather_enchanted", weight = 3, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + --{ itemstring = "TODO:bamboo", weight = 2, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_farming:pumpkin", weight = 2, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_tnt:tnt", weight = 1, amount_min = 1, amount_max = 2 }, + + }, + { + stacks_min = 3, + stacks_max = 10, + items = { + { itemstring = "mcl_core:iron_ingot", weight = 8, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:iron_nugget", weight = 8, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_core:emerald", weight = 8, amount_min = 1, amount_max = 12 }, + { itemstring = "mcl_dye:blue", weight = 8, amount_min = 1, amount_max = 12 }, + { itemstring = "mcl_core:gold_ingot", weight = 8, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:gold_nugget", weight = 8, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_experience:bottle", weight = 8, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_core:diamond", weight = 8, amount_min = 1, amount_max = 10 }, + } + } + } + } +})