From 4af1094eedd431201bd580bf3af36628d17f9529 Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 2 Jun 2022 03:12:14 +0200 Subject: [PATCH 1/4] Add shipwrecks schematics by chmodsayshello --- mods/MAPGEN/mcl_shipwrecks/init.lua | 104 ++++++++++++++++++ mods/MAPGEN/mcl_shipwrecks/mod.conf | 3 + .../shipwreck_full_back_damaged.mts | Bin 0 -> 1203 bytes .../schematics/shipwreck_full_damaged.mts | Bin 0 -> 1518 bytes .../schematics/shipwreck_full_normal.mts | Bin 0 -> 1545 bytes .../schematics/shipwreck_half_back.mts | Bin 0 -> 1248 bytes .../schematics/shipwreck_half_front.mts | Bin 0 -> 903 bytes 7 files changed, 107 insertions(+) create mode 100644 mods/MAPGEN/mcl_shipwrecks/init.lua create mode 100644 mods/MAPGEN/mcl_shipwrecks/mod.conf create mode 100644 mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_back_damaged.mts create mode 100644 mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_damaged.mts create mode 100644 mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_normal.mts create mode 100644 mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_back.mts create mode 100644 mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_front.mts diff --git a/mods/MAPGEN/mcl_shipwrecks/init.lua b/mods/MAPGEN/mcl_shipwrecks/init.lua new file mode 100644 index 000000000..e9b957095 --- /dev/null +++ b/mods/MAPGEN/mcl_shipwrecks/init.lua @@ -0,0 +1,104 @@ +local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) +--local S = minetest.get_translator(modname) + +local mgp = minetest.get_mapgen_params() +local pr = PseudoRandom(mgp.seed) + +--schematics by chmodsayshello +local schems = { + "shipwreck_full_damaged", + "shipwreck_full_normal", + "shipwreck_full_back_damaged", + "shipwreck_half_front", + "shipwreck_half_back", +} + +local loottable_supply = { + 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 }, + { itemstring = "mcl_armor:chestplate_leather_enchanted", weight = 3 }, + { itemstring = "mcl_armor:leggings_leather_enchanted", weight = 3 }, + { itemstring = "mcl_armor:boots_leather_enchanted", weight = 3 }, + --{ 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 }, + + } +} + +local loottable_treasure = { + 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 }, + } +} + +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 = loottable_supply + if pr:next(1,10) == 1 then loot = loottable_treasure end + mcl_loot.fill_inventory(inv, "main", mcl_loot.get_multi_loot({loot}, pr), pr) + end +end + +local function get_ocean_biomes() + local r = {} + for k,_ in pairs(minetest.registered_biomes) do + if k:find("_ocean") then table.insert(r,k) end + end + return r +end + +minetest.register_node("mcl_shipwrecks:structblock", {drawtype="airlike",groups = {structblock=1,not_in_creative_inventory=1},}) + +minetest.register_decoration({ + decoration = "mcl_shipwrecks:structblock", + deco_type = "simple", + place_on = {"group:sand","mcl_core:gravel"}, + spawn_by = {"group:water"}, + num_spawn_by = 4, + sidelen = 80, + fill_ratio = 0.00002, + flags = "place_center_x, place_center_z, force_placement", + biomes = get_ocean_biomes(), + y_max=mgp.water_level-4, +}) + +minetest.register_lbm({ + name = "mcl_shipwrecks:struct_lbm", + run_at_every_load = true, + nodenames = {"mcl_shipwrecks:structblock"}, + action = function(pos, node) + minetest.set_node(pos,{name="air"}) + local file = modpath.."/schematics/"..schems[pr:next(1,#schems)]..".mts" + local pp = vector.offset(pos,0,pr:next(-4,-2),0) + mcl_structures.place_schematic(pp, file, "random", nil, true, "place_center_x,place_center_z", function() + fill_chests(vector.offset(pos,-20,-5,-20),vector.offset(pos,20,15,20)) + end)-- pr, callback_param + end +}) diff --git a/mods/MAPGEN/mcl_shipwrecks/mod.conf b/mods/MAPGEN/mcl_shipwrecks/mod.conf new file mode 100644 index 000000000..a3ca2c02c --- /dev/null +++ b/mods/MAPGEN/mcl_shipwrecks/mod.conf @@ -0,0 +1,3 @@ +name = mcl_shipwrecks +author = cora +depends = mcl_loot, mcl_structures diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_back_damaged.mts b/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_back_damaged.mts new file mode 100644 index 0000000000000000000000000000000000000000..12f3c9b1397a55b114129633349306c427bef496 GIT binary patch literal 1203 zcmeYb3HD`RVNhg{WZgehPyy zNHRIUDAfu{P!c4VlAjOK09G1bQj}N#5@3)*HY_JG3E3<`xLGNQMcH8E!6u>D4VMxJ zsZLAHOHPH`0_HJDpj!dgA_tPe>aO_wg48^SZBQdYn&R^lv!RB9wZa^N>hAcG`~n6U zT$X}m!A^pNQb|!}K|yK?)ZYwZAbrUhsl_G5R$wZ=I5#mThd~xB4h~mT9q~ztMcEZ| z-rl`kHrqhJAu#cH?xbsPxfSQ1UO#>I4lgO*pctQXX;XI?^i0)ZQ#{aV$N&O19v6LA z>McLP!0M>hJPZYOEC0IAlXO zztu&23?83X&#XJIw)btR>f5h#-(;rI`g;})5o_QwjhzK%(jVW`M+-_d{h z`HUCuALqQEk@5cVj3d7--dX>j#nU6pa3KF*Owq02qrZQz`DuKv?9$iBw_DAxPiCIQ zvvx}Q)jPMD8TwLwiS&K@Y_a#s`NulHcmJJ#oRMKpY~Ov$1I8D?fy%(Z@POgfE-~kQ zb_^C%cCGEcRkUVam=*IemA|VT9M*|3SF)79I@+h7`=)Ef^cvq8_s-wtcv#I)#QlDg zq2R(@5iAvcr=MJ!sk=1$pyQJ8a}@`^Pwx{{TDEJVmUG7HUO^>>#y!`$pL-rU86j?X z=Fjt}vS)9DvKGpI=6P3_J!j|rrSsTbrig8A-|*v9m&aCfrSg8|t;`-%9{QZ+NS;&J zo8O~cmUT&@-Ra=QmUXJ%86Vl%FZ=NJOHfypo!cii zsi{Br&t{PEy?M{#ZIy zgso4@J=UeA=Et<~`Dfo43m9q~;drp{$=|>(jc?C?7&t#vc@nTi`B7}qpSyu`;-@Mq zDIK}}c*+-x3bm^ad}jm&18ekRWDXRsJa(wcBlRbfhD?q5)gFmQ{?3^U#fG(#3=9V* L|6o_S_)r`GO-&xP literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_damaged.mts b/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_damaged.mts new file mode 100644 index 0000000000000000000000000000000000000000..5c8a3e105cee2ff2ec228e7b5e4e786cea5fd6a2 GIT binary patch literal 1518 zcmeYb3HD`RVNhg{WZgehPyy zNHRIUDAfu{P!c4VlAjOK09G1bQj}N#5@3)(HY_JGDLy5!C>v~&I7lWfH7_|8t_#d# zkV4mjWRoCB4s1Q#9I)jm&V@_K;WjD0B)@<`3~X9PYH>-i6_|=I&P~k8f#}2PpZNTO z)I5llP^W_|i_cHYhB{sb-Ab5az!r)koS&JPo1d4Gl#`#F4GAPjpq3P678InWK>ds* zWI@h~Pl`9fB~=n{R59o6+|IJu1_G|E_hwyLd$~B~dGXJ$vwS^fU1U14?(Ln`YJ4v; zC)Aiov2Doau`vk^zZOuQDx0ml=KbMc-x(Pmgsz-pl$-nJz0KBOt&NY)ZQYP_Rz6xc z*M8fbIB)yDRI#$_o9x~(GTiCX3OW^iN_4kgjQQVf(i`L6Z#KL0jXhe8@2J?ScPH3C zI|n||+481M{-&M3eD<+TEJ-{Jcji6)_$W7Z4@Y$0ZQ-94fvkm2X&k@LWJLYly>%P! zqu!U>EnuSfK88JV@w4O4Y!BqEJi6lD^}hvAy`M@fX0(G>KPz?HTY4{LM_gTCqb2sN;7!+?!y@_LxECEi*Iju;p5a2p=TrL2mspgf zKdPNww)NNAm~bnXbJyIt-POa6c%M3U@fm+!TG6Jjf8*bCN>?4R?PAf^ z>ssv|%~|*M@l9{fBbKT6FYjp;TPt7Jw)uV4mg#J7b}Z?QUC`q?=jGg+>m)cCYV7l7 zKAy7XNaF8#{SKz~$A2o9tdu#PQY7=a!Lsifdyx!7MNQm$yFUMuwR29+>ai$(|M2gcWOz{h!Q%X?lj`ix>{c&xol|*!Ri7*@k#~Wv!=@4Ia=;qxUv9k_XY`z>^;+HB@|8a5m zyy^?n=_#WCPXwLj<*s105%T?H~wdQtM9 z@ZaW<{4bWwak_TebIp&VcRGZv`hITeP-a`m-D$C*Wy<}U%s%6{94ujJ(i%+VQSK}| z71dZInHfGuK8<|z=)j}ZS!z;AJ65sjcf1$B`P+g!|I3og^H$v7&1581VK(XE0*?ce znV|vWfA(k1zx%Na6*}i+4}0Hn&bi7Pn^A0inL#m~ee0#$Voe40*9=V@f4i>Pnb{wG zz}EAZYlV=gmRf~l&O#?`sn2Idvjd;ag|H?>;CX=(~oPtIZx4ibX#Xer!DQ8}{r+EarRI@%P+F7ysuj(4{&;KT^ zevJT)cFjf^ws~Dk(p#-tmG&n?pJH+;gy^4G^cV+g!{&0xjDwO^)-h48}900Rrp|=14 literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_normal.mts b/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_normal.mts new file mode 100644 index 0000000000000000000000000000000000000000..3d997c83b1da1a4e85e73616813b3a45a4190f5b GIT binary patch literal 1545 zcmeYb3HD`RVNhg{WZgehPyy zNHRIUDAfu{P!c4VlAjOK09G1bQj}N#5@3)(HY_JGDLy5!C>v~&I7lWfH7_|8t_#d# zkV4mjWRoCB4s1Q#9I)jm&V@_K;WjD0B)@<`3~X9PYH>-i6_|=I&P~k8fjAoC$&#YX zf`Zf(s2dUuYL1d} z8zXufLxXP`wcnand8XH(p6~O1eg=kqucuQAv&;X^T3+V0bV{aRn?+uBCd=Y)`iozG zFVWln^}UkK{L?k}nHeIu-s;4bEt8w_P;&Q|J+HstWxf96cMi|?|Bkv#1+}a{9sCm{ zvXeu6-tY4p>gS!yZY$!h;9<}?|F-U<(PjOV^NH0e@5QG+7rvE0_1nz7J72`Fzc?@C zyl4F9-)m<*eiFvJwR9GvOnR;ich>nAhyw;q#F>gikT zYS1~8N16X^^W!%;J8gc~>b1M{T)Lkay7!ZBr$MWE^dZZhy3P9!+Rn2*f4IJ;K&GKj zeEpw7ude33Lhpb5kb4+^`}q28{LeSvJNQIqx!w%+whKGXK@X0}q>I}4*G z&ohhP*?+&@G2P<$=GzjlEsozS?0f$2<5lk$77u0mZobddIkY=`@!7-i58u4)`Swc2 zN2Tq(dGq5V$}xL(ruYX5o>DlpS1DuTHW|ik$E>bdB)|Nj9dh})#eb&Qtlng^9mg&{ zJ0O*A8S$9m4tLyf$* zLj_Ar|LxB7Kep$taQw05V>s~X!#rl$J>=?Q}tjb^+Q^NZ^x}RVv0|k?A7x`bJ5S5yB+Ul z-QkS2@XJtj7wX*1#?|+0g^TEmu7AfboMMhu^P8{Scfg`kdAjkj@ZEw}Oe9#d9(@U2 zEBHC%_`7)y(O-WwoskLCmIyt~B{wZ3DB~@+MPKBZ!lt^QGK-j!-~7MiW4K-RL7$25qXpBZHZGd@H8TGq%XIT3Row(% zmCsIbE}loz|3{>Y=6M8eG07Px@_gW&XKO z{r)RCj2Cew+X$$fd&SBB`p-uV(cQ17_nit}(Yd%c=;kZC!aowbranoFYVC>*TX>dB z;X#R2cgEZO@+e005>=tQi0R literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_back.mts b/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_back.mts new file mode 100644 index 0000000000000000000000000000000000000000..f58376f3009eb49fb9bbb3e71668aee3205aa9ef GIT binary patch literal 1248 zcmeYb3HD`RVNhg{WZgehPyy zNHRIUDAfu{Py$&;PGVAgN@7tqSh+YzCM`8DIkgz70m5UD1WBai=Y#A3n;u_Mlvn@~ zU=V~`0XGJ$8pTO)DLHhz5$=jF$uD3K1DlqST3k|W1*YPQa}#rN7^HCPV~|0YgV_c) z5$qVKpFk4v`H9(3Ux5Px5;`SCnFR%@DNyHN@h`})@k#MUxTH$rjVk86y_;A(+kmGb z(K+Z^>D_Owi|wcH-`CX0ba0Zc^Rx@!KUVFWm&<6)J#|9Ra|RIDF?mtG<*9v7PxemO z&;Rp3KSM#-(KVKrcW#GCw5%e$ru0f^WA{#V`+}Pj0JlhEjwCucZIm7X|nBRgRnVS zS#z&Q-2E{>cuV)fS327>R$E-ZSso(8@O*Qu{u@!{uTo1T)@dJ``EO5tXMpZ27q6DW z`Nyqh#}(GBJu|U>o&0_O&u`BPeB8C7@`^k|be#Cx@cSj9|0nO5zj=-L#^<+B?LD8> zy7twc@3&9w{Jk-@uuk1Yqka8$%|%bSo^N}!OKF@b*+4$(p`oc>Ez03?7*OdS5-_<|4Y+dyIP8&n`cBq%imqi*ikGsK!m%J1#jj z2fSBUL_LboJ~zeUVQfgB#9tb>|<>jek*fd4r@P-e3eCtm!tSkHwko0L0@4kmR z-*>I3dQe>%&U?Rens}jkQfTe!d%5woZ}simTyS|M0nO9ZR*ExZ#1M2tWG` z(re=~PRIGq>DW`aZsP8f95ypnq}I;Y`TdEDQEDOgGqPFlhz}xHF4O ziZTldQd6LwU=Rb#WTY0C6kCC*_~P8eoE(S_m|-BNz|5+c^Y-q=yju2Xqw+g2GQ23znQSx??-}bG3B|X!` z`gVI)PYlhjSa(!aSMefe^y%B8Tix7OE?ro7>32k#u*iptS9^WtTq=Cz^1DIqQT80Z z>;E3ATo8Wab2-&@+vZtHiww)917D|GKo+{V!Ku)zIE`{`iVV6VB`~^D|qVE6?k0*>bxfNKaNv u%F9Ql>`Bqfi{`wdyl2^WU%V7yYvmn(FkWx^j-O|gL6+S+nSU%V(*yuqfRd5` literal 0 HcmV?d00001 From b7419dc207ee1e9b16f6f69aed4b72430ab019eb Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 2 Jun 2022 12:30:51 +0200 Subject: [PATCH 2/4] randomly enchant treasure --- mods/MAPGEN/mcl_shipwrecks/init.lua | 84 ++++++++++++++++------------- mods/MAPGEN/mcl_shipwrecks/mod.conf | 2 +- 2 files changed, 47 insertions(+), 39 deletions(-) diff --git a/mods/MAPGEN/mcl_shipwrecks/init.lua b/mods/MAPGEN/mcl_shipwrecks/init.lua index e9b957095..731a43793 100644 --- a/mods/MAPGEN/mcl_shipwrecks/init.lua +++ b/mods/MAPGEN/mcl_shipwrecks/init.lua @@ -14,45 +14,53 @@ local schems = { "shipwreck_half_back", } -local loottable_supply = { - 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 }, - { itemstring = "mcl_armor:chestplate_leather_enchanted", weight = 3 }, - { itemstring = "mcl_armor:leggings_leather_enchanted", weight = 3 }, - { itemstring = "mcl_armor:boots_leather_enchanted", weight = 3 }, - --{ 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 }, - +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 loottable_treasure = { - 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 }, +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 @@ -60,8 +68,8 @@ local function fill_chests(p1,p2) minetest.registered_nodes["mcl_chests:chest_small"].on_construct(p) end local inv = minetest.get_inventory( {type="node", pos=p} ) - local loot = loottable_supply - if pr:next(1,10) == 1 then loot = loottable_treasure end + 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 diff --git a/mods/MAPGEN/mcl_shipwrecks/mod.conf b/mods/MAPGEN/mcl_shipwrecks/mod.conf index a3ca2c02c..79940c744 100644 --- a/mods/MAPGEN/mcl_shipwrecks/mod.conf +++ b/mods/MAPGEN/mcl_shipwrecks/mod.conf @@ -1,3 +1,3 @@ name = mcl_shipwrecks author = cora -depends = mcl_loot, mcl_structures +depends = mcl_loot, mcl_structures, mcl_enchanting From d4e4bc870878d5f17827a60f47073c66016f561f Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 4 Jun 2022 14:20:53 +0200 Subject: [PATCH 3/4] add rarer beached shipwreck --- mods/MAPGEN/mcl_shipwrecks/init.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mods/MAPGEN/mcl_shipwrecks/init.lua b/mods/MAPGEN/mcl_shipwrecks/init.lua index 731a43793..12ab0539c 100644 --- a/mods/MAPGEN/mcl_shipwrecks/init.lua +++ b/mods/MAPGEN/mcl_shipwrecks/init.lua @@ -81,6 +81,13 @@ local function get_ocean_biomes() end return r end +local function get_beach_biomes() + local r = {} + for k,_ in pairs(minetest.registered_biomes) do + if k:find("_beach") or k:find("_shore") then table.insert(r,k) end + end + return r +end minetest.register_node("mcl_shipwrecks:structblock", {drawtype="airlike",groups = {structblock=1,not_in_creative_inventory=1},}) @@ -97,6 +104,21 @@ minetest.register_decoration({ y_max=mgp.water_level-4, }) +--rare beached variant +minetest.register_decoration({ + decoration = "mcl_shipwrecks:structblock", + deco_type = "simple", + place_on = {"group:sand","mcl_core:gravel","group:dirt"}, + spawn_by = {"group:water","air"}, + num_spawn_by = 4, + sidelen = 80, + fill_ratio=0.000001, + flags = "place_center_x, place_center_z, force_placement", + biomes = get_beach_biomes(), + y_max = mgp.water_level + 4, + y_min = mgp.water_level - 1, +}) + minetest.register_lbm({ name = "mcl_shipwrecks:struct_lbm", run_at_every_load = true, From 4bff9710a043af9341d2cf09a33b60f1b9f579d5 Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 6 Jun 2022 01:04:08 +0200 Subject: [PATCH 4/4] Make structblock non walk- and pointable --- mods/MAPGEN/mcl_shipwrecks/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/MAPGEN/mcl_shipwrecks/init.lua b/mods/MAPGEN/mcl_shipwrecks/init.lua index 12ab0539c..9227680b4 100644 --- a/mods/MAPGEN/mcl_shipwrecks/init.lua +++ b/mods/MAPGEN/mcl_shipwrecks/init.lua @@ -89,7 +89,7 @@ local function get_beach_biomes() return r end -minetest.register_node("mcl_shipwrecks:structblock", {drawtype="airlike",groups = {structblock=1,not_in_creative_inventory=1},}) +minetest.register_node("mcl_shipwrecks:structblock", {drawtype="airlike", walkable = false, pointable = false,groups = {structblock=1,not_in_creative_inventory=1}}) minetest.register_decoration({ decoration = "mcl_shipwrecks:structblock", @@ -129,6 +129,6 @@ minetest.register_lbm({ local pp = vector.offset(pos,0,pr:next(-4,-2),0) mcl_structures.place_schematic(pp, file, "random", nil, true, "place_center_x,place_center_z", function() fill_chests(vector.offset(pos,-20,-5,-20),vector.offset(pos,20,15,20)) - end)-- pr, callback_param + end,pr) end })