From 17053a8420721e44b4cbacb22b043f4b2fe8fd2b Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Fri, 22 Jul 2022 18:46:37 +0000 Subject: [PATCH 01/33] add mod.conf --- mods/ITEMS/mcl_beacons/mod.conf | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 mods/ITEMS/mcl_beacons/mod.conf diff --git a/mods/ITEMS/mcl_beacons/mod.conf b/mods/ITEMS/mcl_beacons/mod.conf new file mode 100644 index 000000000..98bd645ee --- /dev/null +++ b/mods/ITEMS/mcl_beacons/mod.conf @@ -0,0 +1,2 @@ +author=chmodsayshello +depends=mcl_formspec, mcl_init, mcl_wip, mesecons_mvps, mcl_core, mcl_sounds From f31039567518f8b435c96fac64ab0ef3789648e3 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Fri, 22 Jul 2022 18:47:35 +0000 Subject: [PATCH 02/33] upload textures 1/2 --- mods/ITEMS/mcl_beacons/textures/beacon_bottom.png | Bin 0 -> 338 bytes mods/ITEMS/mcl_beacons/textures/beacon_side_1.png | Bin 0 -> 339 bytes mods/ITEMS/mcl_beacons/textures/beacon_side_2.png | Bin 0 -> 337 bytes mods/ITEMS/mcl_beacons/textures/beacon_side_3.png | Bin 0 -> 340 bytes mods/ITEMS/mcl_beacons/textures/beacon_side_4.png | Bin 0 -> 338 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_bottom.png create mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_side_1.png create mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_side_2.png create mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_side_3.png create mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_side_4.png diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_bottom.png b/mods/ITEMS/mcl_beacons/textures/beacon_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..af02df21f452d59e4da9bff12d639f64a8176b86 GIT binary patch literal 338 zcmV-Y0j>UtP)z*OXqHZ*#r&Hlau>z{C6pX zN2oEw`Q7gs+>@lhnn3_&z_!np43{1~!XAh)1LBHoz_x)5fB}#}&oA&W5HvuDj~g6_ zPRh%{8eV?52R7rKY(6*;-+lUu-vwU0$HCE<>2elsJ19KXUkm_8EnXKOCnT6|^aKSG k$C(bu$rsekOysx#0O0qJ5rf4y0RR9107*qoM6N<$f`40#VgLXD literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_side_1.png b/mods/ITEMS/mcl_beacons/textures/beacon_side_1.png new file mode 100644 index 0000000000000000000000000000000000000000..dfd93ef984fd95848a4d210c5576a49a86c9e667 GIT binary patch literal 339 zcmV-Z0j&OsP)DhGE(K*d4^kn_L&_=Vp9 zkPH5ZYQQy$O3H%SAj4kmoy$Pb1t0?i^;{WVKYz?1rDqM+{OrN zkamb;cz&%tICoRtL!;=4~@@w;GmyZ|^Fch!5rZ3l%%^sLL^sKx67)D l;yBX*Ir)ORnTZ@1000P5j}Z`X6JY=V002ovPDHLkV1kqLjfMaK literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_side_2.png b/mods/ITEMS/mcl_beacons/textures/beacon_side_2.png new file mode 100644 index 0000000000000000000000000000000000000000..8a348a97c4033a7b2ffb28bbe68617bafecb3b18 GIT binary patch literal 337 zcmV-X0j~auP)!S$gSV4|(?|HrT2V9gwCtSE*ci=Vmr z0Ji~~7I8B~r2S@CF$>iIn3!MOR|dQWaB;AKy|8MzBLfGEEZh}-p^F$m&j0q~7k&dk zF8IT#0oN!h05Jq)*z?Ep7znxmWPqTgE5qv#j~Qe|tiYNdzc~hG6Er|aRr>#oi3|+J z2B8e^pYLXnluZI_1_77>ZV?|CuH1f#JrH3ASeq1qZ37tq10aJ~zTaRVXn+tOH#iWd zPFDeIxcBk{*o@9j5pW>B`}7sR3wEs#07v7_&0cWZLE#Y-dl?+HcwK;;kYKve6BI}s jXF4D!Ur;wQk>dgYjy{bM3m*3v00000NkvXXu0mjf8QX%x literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_side_3.png b/mods/ITEMS/mcl_beacons/textures/beacon_side_3.png new file mode 100644 index 0000000000000000000000000000000000000000..22d4cad5c3f1551a7cfbc49c616b3cc3a1da3981 GIT binary patch literal 340 zcmV-a0jvIrP)X{_ysnDfrAaM2Fynm zKPM)M+koHohZy)fT^K%=??G_|OpLYBjsdR$TpVm*FR0Hu!XV3waK)Zba|V#}zy0`y z-vE#c48*^{Z5Nf11+zhh%{%alfuIXO2DlmvGQ58Bn88R>39R|t^?P78K?Ag&Jo^2) zaw$Woy)nb?v+o&_9K^tyK>%jJ-)c*SYcg`!0}*CGk&gw~Hjn`@05a&pOCAP-1_<$S zg9A~hX*pQKhc6Hp=q=0#2jaU=U-7$ux%D_W8qHRnh1(7akNZUd;Hbsx0_21Q(~X{> mz=4V@A(4}(sGFI{aRC6i_LosNM62}x0000UtP)JC}i=3qS@4y1Ftve*Kz3&Da>M`PSL9U^YPm)D#u|&HT&2 zU>q9C@P7Ah2C3v^ux1c|8Q}W)1H-NR53mO!%mAC>Vz6x>17HAT5YL4R3i_@%07*qoM6N<$f}ZS Date: Fri, 22 Jul 2022 18:48:01 +0000 Subject: [PATCH 03/33] upload textures 2/2 --- mods/ITEMS/mcl_beacons/textures/beacon_top.png | Bin 0 -> 340 bytes .../textures/custom_beacom_symbol_1.png | Bin 0 -> 635 bytes .../textures/custom_beacom_symbol_2.png | Bin 0 -> 635 bytes .../textures/custom_beacom_symbol_3.png | Bin 0 -> 641 bytes .../textures/custom_beacom_symbol_4.png | Bin 0 -> 635 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_top.png create mode 100644 mods/ITEMS/mcl_beacons/textures/custom_beacom_symbol_1.png create mode 100644 mods/ITEMS/mcl_beacons/textures/custom_beacom_symbol_2.png create mode 100644 mods/ITEMS/mcl_beacons/textures/custom_beacom_symbol_3.png create mode 100644 mods/ITEMS/mcl_beacons/textures/custom_beacom_symbol_4.png diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_top.png b/mods/ITEMS/mcl_beacons/textures/beacon_top.png new file mode 100644 index 0000000000000000000000000000000000000000..ec4e5151b929f7cc35f0f2b818db578785cfbbc6 GIT binary patch literal 340 zcmV-a0jvIrP)86igzB7nkzQF=hfZ~FOs!D%;{Q3=+<6vV&F$7s$ z{`NiG1_bWoX4vWVo56h>ssS*u^-f1>UQCwCO%mx{@@7X*Cf-V3VpeN|c@bd9%25mJXu;#0`&Vktk4Y(;U`^RDt z1B1VDD8r@qyBVCMlE9il0A|2)n-2`?4M3@1|Hbr3DKnB17$e@=z7Z?Z{AjHQF z4n+TXI$#a=?|lH9@v=e$9Ek5eeZ}vB$Rh&aXe>SM1-Bg(9*e?GgQFI&3y>2MOgDOh m0*T{H2jt`_>SiW#TmS%B*^-g#@etGi00000)+jEP)EX>4Tx04R}tkv&MmKpe$iTcsi`4h9kFkfAzR5EXIMDionYs1;guFuC*#ni!H4 z7e~Rh;NZt%)xpJCR|i)?5c~jfbaGO3krMxx6k5c1aNLh~_a1lefMBD_G^=Y2&~)3( zq>^GTzaoZT5yk+bh(VB;;BvB z;Ji;Pu(GTYpA(OobV1@rt}7nDaW1(W)|5Tqat9cEGGtSBr4Y?vu?W1M(KqFR{#&4T)$6UbkJASrOI@XJfP+I| zq(s?kKJV`7?Csw(t^R%hP)Bl^2b(^{00006VoOIv0Q&&l059k#K?wi=010qNS#tmY zE+YT{E+YYWr9XB6000McNliru<_8uHAU2tOqyzu}02y>eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{002`-L_t(I%VYfi|33pRAbb7Ae+C8yhR2!`jJVV=F;ECb z4HygtFycxFf9@HeNU$hfV5E-=6u-#+$EV>w&tpc~xPXw&xLiWH3lu)f{2$PC005I= V9zJ6?%i#b3002ovPDHLkV1m=71myq# literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_beacons/textures/custom_beacom_symbol_2.png b/mods/ITEMS/mcl_beacons/textures/custom_beacom_symbol_2.png new file mode 100644 index 0000000000000000000000000000000000000000..efbec37766d1c8802b25db96b134aa2fd9f845ec GIT binary patch literal 635 zcmV->0)+jEP)EX>4Tx04R}tkv&MmKpe$iTcsi`4h9kFkfAzR5EXIMDionYs1;guFuC*#ni!H4 z7e~Rh;NZt%)xpJCR|i)?5c~jfbaGO3krMxx6k5c1aNLh~_a1lefMBD_G^=Y2&~)3( zq>^GTzaoZT5yk+bh(VB;;BvB z;Ji;Pu(GTYpA(OobV1@rt}7nDaW1(W)|5Tqat9cEGGtSBr4Y?vu?W1M(KqFR{#&4T)$6UbkJASrOI@XJfP+I| zq(s?kKJV`7?Csw(t^R%hP)Bl^2b(^{00006VoOIv03ZPK034eE1-$?O010qNS#tmY zE+YT{E+YYWr9XB6000McNliru<_8uHA^{WjV~GF&02y>eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{002`-L_t(I%VYfi|33pRAbb7Ae+C8yhR2!`jJVV=F;ECb z4HygtFycxFf9@HeNU$hfV5E-=6u-#+$EV>w&tpc~xPXw&xLiWH3z7@d{|{(7005a; V9!kG@j+_7h002ovPDHLkV1h7+1K|Jw literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_beacons/textures/custom_beacom_symbol_3.png b/mods/ITEMS/mcl_beacons/textures/custom_beacom_symbol_3.png new file mode 100644 index 0000000000000000000000000000000000000000..9750133844662b297714a892670b5953fe2df671 GIT binary patch literal 641 zcmV-{0)G98P)EX>4Tx04R}tkv&MmKpe$iTcsi`4h9kFkfAzR5EXIMDionYs1;guFuC*#ni!H4 z7e~Rh;NZt%)xpJCR|i)?5c~jfbaGO3krMxx6k5c1aNLh~_a1lefMBD_G^=Y2&~)3( zq>^GTzaoZT5yk+bh(VB;;BvB z;Ji;Pu(GTYpA(OobV1@rt}7nDaW1(W)|5Tqat9cEGGtSBr4Y?vu?W1M(KqFR{#&4T)$6UbkJASrOI@XJfP+I| zq(s?kKJV`7?Csw(t^R%hP)Bl^2b(^{00006VoOIv0Am1g0B4~zKz;xK010qNS#tmY zE+YT{E+YYWr9XB6000McNliru<_8uHBLeSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{003D@L_t(I%VYfi|33pRAbb7Ae+C8yhR2!`jJVV=F;ECb z4HygtFycxFf9@HeNU$hfV5E-=6u-#+$EV>w&tpc~xFDq{<3A}H=k(2Bq>c-c3)BA( bXgUA@o0%R;f~C=o00000NkvXXu0mjf(4Pm4 literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_beacons/textures/custom_beacom_symbol_4.png b/mods/ITEMS/mcl_beacons/textures/custom_beacom_symbol_4.png new file mode 100644 index 0000000000000000000000000000000000000000..42c471c35df65f1f3fc503cfba0469a9f464bf11 GIT binary patch literal 635 zcmV->0)+jEP)EX>4Tx04R}tkv&MmKpe$iTcsi`4h9kFkfAzR5EXIMDionYs1;guFuC*#ni!H4 z7e~Rh;NZt%)xpJCR|i)?5c~jfbaGO3krMxx6k5c1aNLh~_a1lefMBD_G^=Y2&~)3( zq>^GTzaoZT5yk+bh(VB;;BvB z;Ji;Pu(GTYpA(OobV1@rt}7nDaW1(W)|5Tqat9cEGGtSBr4Y?vu?W1M(KqFR{#&4T)$6UbkJASrOI@XJfP+I| zq(s?kKJV`7?Csw(t^R%hP)Bl^2b(^{00006VoOIv03ZPK034eE1-$?O010qNS#tmY zE+YT{E+YYWr9XB6000McNliru<_8uHA}+WmUeEvl02y>eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{002`-L_t(I%VYfi|33pRAbb7Ae+C8yhR2!`jJVV=F;ECb z4HygtFycxFf9@HeNU$hfV5E-=Qi?ME Date: Fri, 22 Jul 2022 18:48:36 +0000 Subject: [PATCH 04/33] upload mod (mcl_beacons) itself --- mods/ITEMS/mcl_beacons/init.lua | 221 ++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 mods/ITEMS/mcl_beacons/init.lua diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua new file mode 100644 index 000000000..950abc9fa --- /dev/null +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -0,0 +1,221 @@ +--[[ +there are strings in meta, which are being used to see which effect will be given to the player(s) +Valid strings: + swiftness + leaping + strenght + regeneration +]]-- +--TODO: add beacon beam +--TODO: beacons should only work when there are no blocks (few exceptions) above them! +--TODO: add translation + + +local formspec_string= + "size[11,14]".. + + "label[4.5,0.5;Beacon:]".. + "label[0.5,1;Primary Power:]".. + "label[0.5,8.25;Inventory:]".. + + "image[1,1.5;1,1;custom_beacom_symbol_4.png]".. + "image[1,3;1,1;custom_beacom_symbol_3.png]".. + "image[1,4.5;1,1;custom_beacom_symbol_2.png]".. + "image[1,6;1,1;custom_beacom_symbol_1.png]".. + + "image_button[5.2,1.5;1,1;mcl_potions_effect_swift.png;swiftness;]".. + "image_button[5.2,3;1,1;mcl_potions_effect_leaping.png;leaping;]".. + "image_button[5.2,4.5;1,1;mcl_potions_effect_strong.png;strenght;]".. + "image_button[5.2,6;1,1;mcl_potions_effect_regenerating.png;regeneration;]".. + + "item_image[1,7;1,1;mcl_core:diamond]".. + "item_image[2.2,7;1,1;mcl_core:emerald]".. + "item_image[3.4,7;1,1;mcl_core:iron_ingot]".. + "item_image[4.6,7;1,1;mcl_core:gold_ingot]".. + + mcl_formspec.get_itemslot_bg(6,7,1,1).. + "list[context;input;6,7;1,1;]".. + mcl_formspec.get_itemslot_bg(1,9,9,3).. + "list[current_player;main;1,9;9,3;9]".. + mcl_formspec.get_itemslot_bg(1,12.5,9,1).. + "list[current_player;main;1,12.5;9,1;]" + + + +local function beacon_blockcheck(pos) + for y_offset = 1,4 do + local block_y = pos.y - y_offset + for block_x = (pos.x-y_offset),(pos.x+y_offset) do + for block_z = (pos.z-y_offset),(pos.z+y_offset) do + local valid_block = false --boolean to which stores if block is valid or not + for _, beacon_block in pairs(beacon_blocklist) do + if beacon_block == minetest.get_node({x=block_x,y=block_y,z=block_z}).name and not valid_block then --is the block in the pyramid a valid beacon block + valid_block =true + end + end + if not valid_block then + return y_offset -1 --the last layer is complete, this one is missing or incomplete + end + end + end + if y_offset == 4 then --all checks are done, beacon is maxed + return y_offset + end + end +end + + + +minetest.register_node("mcl_beacons:beacon", { + --glasslike drawtype? + description = "Beacon", + tiles = { + "beacon_top.png", + "beacon_bottom.png", + "beacon_side_1.png", + "beacon_side_2.png", + "beacon_side_3.png", + "beacon_side_4.png" + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + inv:set_size("input", 1) + local form = formspec_string + meta:set_string("formspec", form) + end, + on_receive_fields = function(pos, formname, fields, sender) + if fields.swiftness or fields.regeneration or fields.leaping or fields.strenght then + minetest.log("field recived") + local sender_name = sender:get_player_name() + local power_level = beacon_blockcheck(pos) + if minetest.is_protected(pos, sender_name) then + minetest.record_protection_violation(pos, sender_name) + minetest.log("returned prot") + return + elseif power_level == 0 then + minetest.log("returned pw") + return + end + + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local input = inv:get_stack("input",1) + + if input:is_empty() then + return + end + minetest.log("Not empty!") + + local valid_item = false + + for _, item in ipairs(beacon_fuellist) do + if input:get_name() == item then + valid_item = true + end + end + + if valid_item ~= true then + return + end + + local successful = false + if fields.swiftness then + if power_level == 4 then + minetest.get_meta(pos):set_int("effect_level",2) + else + minetest.get_meta(pos):set_int("effect_level",1) + end + minetest.get_meta(pos):set_string("effect","swiftness") + successful = true + elseif fields.leaping and power_level >= 2 then + if power_level == 4 then + minetest.get_meta(pos):set_int("effect_level",2) + else + minetest.get_meta(pos):set_int("effect_level",1) + end + minetest.get_meta(pos):set_string("effect","leaping") + successful = true + elseif fields.strenght and power_level >= 3 then + if power_level == 4 then + minetest.get_meta(pos):set_int("effect_level",2) + else + minetest.get_meta(pos):set_int("effect_level",1) + end + minetest.get_meta(pos):set_string("effect","strenght") + successful = true + elseif fields.regeneration and power_level == 4 then + minetest.get_meta(pos):set_int("effect_level",2) + minetest.get_meta(pos):set_string("effect","regeneration") + successful = true + end + if successful then + input:take_item() + inv:set_stack("input",1,input) + end + end + end, + light_source = 15, + sounds = mcl_sounds.node_sound_glass_defaults(), +}) + +mesecon.register_mvps_stopper("mcl_beacons:beacon") +mcl_wip.register_wip_item("mcl_beacons:beacon") + +beacon_blocklist = {"mcl_core:diamondblock","mcl_core:ironblock","mcl_core:goldblock","mcl_core:emeraldblock"}--this is supposed to be a global, don't change that! || TODO: add netherite blocks once implemented! +beacon_fuellist ={"mcl_core:diamond","mcl_core:emerald","mcl_core:iron_ingot","mcl_core:gold_ingot"} + +function register_beaconblock (itemstring)--API function for other mods + table.insert(beacon_blocklist, itemstring) +end + +function register_beaconfuel(itemstring) + table.insert(beacon_fuellist, itemstring) +end + +local function effect_player(effect,pos,power_level, effect_level) + local all_objects = minetest.get_objects_inside_radius(pos, (power_level+1)*10) + for _,obj2 in ipairs(all_objects) do + if obj2:is_player() then + if effect == "swiftness" then + mcl_potions.swiftness_func(obj2,effect_level,16) + return + elseif effect == "leaping" then + mcl_potions.leaping_func(obj2, effect_level, 16) + return + elseif effect == "strenght" then + mcl_potions.strength_func(obj2, effect_level, 16) + return + elseif effect == "regeneration" then + mcl_potions.regeneration_func(obj2, effect_level, 16) + return + else + minetest.log("invalid effect") + end + end + end + + +end + + +local function abm_function(pos) + local power_level = beacon_blockcheck(pos) + local meta = minetest.get_meta(pos) + local effect_string = meta:get_string("effect") + if meta:get_int("effect_level") == 2 and power_level < 4 then + return + else + effect_player(effect_string,pos,power_level,meta:get_int("effect_level")) + end + +end + + +minetest.register_abm{ + label = "beacon check & apply effect(s)", + nodenames = {"mcl_beacons:beacon"}, + interval = 5, + chance = 1, + action = abm_function, +} \ No newline at end of file From ef659bc5a9470d67da33d7505f87815facb96626 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Fri, 22 Jul 2022 19:07:49 +0000 Subject: [PATCH 05/33] remove debug logging --- mods/ITEMS/mcl_beacons/init.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 950abc9fa..cebcd66f2 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -86,15 +86,12 @@ minetest.register_node("mcl_beacons:beacon", { end, on_receive_fields = function(pos, formname, fields, sender) if fields.swiftness or fields.regeneration or fields.leaping or fields.strenght then - minetest.log("field recived") local sender_name = sender:get_player_name() local power_level = beacon_blockcheck(pos) if minetest.is_protected(pos, sender_name) then minetest.record_protection_violation(pos, sender_name) - minetest.log("returned prot") return elseif power_level == 0 then - minetest.log("returned pw") return end @@ -105,7 +102,6 @@ minetest.register_node("mcl_beacons:beacon", { if input:is_empty() then return end - minetest.log("Not empty!") local valid_item = false @@ -189,8 +185,6 @@ local function effect_player(effect,pos,power_level, effect_level) elseif effect == "regeneration" then mcl_potions.regeneration_func(obj2, effect_level, 16) return - else - minetest.log("invalid effect") end end end From 6a7626e122cfbb52d493b91896a07d042f7edc89 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sat, 23 Jul 2022 10:46:02 +0000 Subject: [PATCH 06/33] use globalstep instead of abm --- mods/ITEMS/mcl_beacons/init.lua | 95 ++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 43 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index cebcd66f2..007e6cc51 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -63,7 +63,42 @@ local function beacon_blockcheck(pos) end end end - + +local function effect_player(effect,pos,power_level, effect_level) + local all_objects = minetest.get_objects_inside_radius(pos, (power_level+1)*10) + for _,obj2 in ipairs(all_objects) do + if obj2:is_player() then + if effect == "swiftness" then + mcl_potions.swiftness_func(obj2,effect_level,16) + return + elseif effect == "leaping" then + mcl_potions.leaping_func(obj2, effect_level, 16) + return + elseif effect == "strenght" then + mcl_potions.strength_func(obj2, effect_level, 16) + return + elseif effect == "regeneration" then + mcl_potions.regeneration_func(obj2, effect_level, 16) + return + end + end + end +end + + +local function globalstep_function(pos, forceexecute) + local meta = minetest.get_meta(pos) + if(meta:get_int("last-effect-cycle")+10 < os.time() or forceexecute) then + meta:set_int("last-effect-cycle", os.time()) + local power_level = beacon_blockcheck(pos) + local effect_string = meta:get_string("effect") + if meta:get_int("effect_level") == 2 and power_level < 4 then + return + else + effect_player(effect_string,pos,power_level,meta:get_int("effect_level")) + end + end +end minetest.register_node("mcl_beacons:beacon", { @@ -83,6 +118,8 @@ minetest.register_node("mcl_beacons:beacon", { inv:set_size("input", 1) local form = formspec_string meta:set_string("formspec", form) + + meta:set_int("last-effect-cycle", os.time()-10) end, on_receive_fields = function(pos, formname, fields, sender) if fields.swiftness or fields.regeneration or fields.leaping or fields.strenght then @@ -148,6 +185,7 @@ minetest.register_node("mcl_beacons:beacon", { if successful then input:take_item() inv:set_stack("input",1,input) + globalstep_function(pos,true)--call it once outside the globalstep so the player gets the effect right after selecting it end end end, @@ -169,47 +207,18 @@ function register_beaconfuel(itemstring) table.insert(beacon_fuellist, itemstring) end -local function effect_player(effect,pos,power_level, effect_level) - local all_objects = minetest.get_objects_inside_radius(pos, (power_level+1)*10) - for _,obj2 in ipairs(all_objects) do - if obj2:is_player() then - if effect == "swiftness" then - mcl_potions.swiftness_func(obj2,effect_level,16) - return - elseif effect == "leaping" then - mcl_potions.leaping_func(obj2, effect_level, 16) - return - elseif effect == "strenght" then - mcl_potions.strength_func(obj2, effect_level, 16) - return - elseif effect == "regeneration" then - mcl_potions.regeneration_func(obj2, effect_level, 16) - return - end +local timer = 0 + +minetest.register_globalstep(function(dtime) + timer = timer + dtime + if timer >= 3 then + for _, player in ipairs(minetest.get_connected_players()) do + local player_pos = player.get_pos(player) + local pos_list = minetest.find_nodes_in_area({x=player_pos.x-50, y=player_pos.y-50, z=player_pos.z-50}, {x=player_pos.x+50, y=player_pos.y+50, z=player_pos.z+50},"mcl_beacons:beacon") + for _, pos in ipairs(pos_list) do + globalstep_function(pos, false) + end end + timer = 0 end - - -end - - -local function abm_function(pos) - local power_level = beacon_blockcheck(pos) - local meta = minetest.get_meta(pos) - local effect_string = meta:get_string("effect") - if meta:get_int("effect_level") == 2 and power_level < 4 then - return - else - effect_player(effect_string,pos,power_level,meta:get_int("effect_level")) - end - -end - - -minetest.register_abm{ - label = "beacon check & apply effect(s)", - nodenames = {"mcl_beacons:beacon"}, - interval = 5, - chance = 1, - action = abm_function, -} \ No newline at end of file +end) \ No newline at end of file From 9433cbe5a51be21f71fda709472e24355a0abe6b Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sat, 23 Jul 2022 11:06:47 +0000 Subject: [PATCH 07/33] remove unnecessary code --- mods/ITEMS/mcl_beacons/init.lua | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 007e6cc51..7a12552f8 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -86,17 +86,14 @@ local function effect_player(effect,pos,power_level, effect_level) end -local function globalstep_function(pos, forceexecute) - local meta = minetest.get_meta(pos) - if(meta:get_int("last-effect-cycle")+10 < os.time() or forceexecute) then - meta:set_int("last-effect-cycle", os.time()) - local power_level = beacon_blockcheck(pos) - local effect_string = meta:get_string("effect") - if meta:get_int("effect_level") == 2 and power_level < 4 then - return - else - effect_player(effect_string,pos,power_level,meta:get_int("effect_level")) - end +local function globalstep_function(pos) + local meta = minetest.get_meta(pos) + local power_level = beacon_blockcheck(pos) + local effect_string = meta:get_string("effect") + if meta:get_int("effect_level") == 2 and power_level < 4 then + return + else + effect_player(effect_string,pos,power_level,meta:get_int("effect_level")) end end @@ -118,8 +115,6 @@ minetest.register_node("mcl_beacons:beacon", { inv:set_size("input", 1) local form = formspec_string meta:set_string("formspec", form) - - meta:set_int("last-effect-cycle", os.time()-10) end, on_receive_fields = function(pos, formname, fields, sender) if fields.swiftness or fields.regeneration or fields.leaping or fields.strenght then @@ -148,7 +143,7 @@ minetest.register_node("mcl_beacons:beacon", { end end - if valid_item ~= true then + if not valid_item then return end @@ -185,7 +180,7 @@ minetest.register_node("mcl_beacons:beacon", { if successful then input:take_item() inv:set_stack("input",1,input) - globalstep_function(pos,true)--call it once outside the globalstep so the player gets the effect right after selecting it + globalstep_function(pos)--call it once outside the globalstep so the player gets the effect right after selecting it end end end, @@ -216,7 +211,7 @@ minetest.register_globalstep(function(dtime) local player_pos = player.get_pos(player) local pos_list = minetest.find_nodes_in_area({x=player_pos.x-50, y=player_pos.y-50, z=player_pos.z-50}, {x=player_pos.x+50, y=player_pos.y+50, z=player_pos.z+50},"mcl_beacons:beacon") for _, pos in ipairs(pos_list) do - globalstep_function(pos, false) + globalstep_function(pos) end end timer = 0 From a33d3e68a208f15730afb131b576442da7822d22 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sat, 23 Jul 2022 21:07:18 +0000 Subject: [PATCH 08/33] check if there are no blocks above beacons --- mods/ITEMS/mcl_beacons/init.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 7a12552f8..4b5d8bced 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -7,7 +7,6 @@ Valid strings: regeneration ]]-- --TODO: add beacon beam ---TODO: beacons should only work when there are no blocks (few exceptions) above them! --TODO: add translation @@ -85,7 +84,6 @@ local function effect_player(effect,pos,power_level, effect_level) end end - local function globalstep_function(pos) local meta = minetest.get_meta(pos) local power_level = beacon_blockcheck(pos) @@ -93,11 +91,20 @@ local function globalstep_function(pos) if meta:get_int("effect_level") == 2 and power_level < 4 then return else + local obstructed = false + for y=pos.y+1, pos.y+301 do + if y >= 31000 then return end + local nodename = minetest.get_node({x=pos.x,y=y, z = pos.z}).name + if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "ignore" then --ignore means not loaded, let's just assume that's air + obstructed = true + return + end + end + if obstructed then return end effect_player(effect_string,pos,power_level,meta:get_int("effect_level")) end end - minetest.register_node("mcl_beacons:beacon", { --glasslike drawtype? description = "Beacon", From cc877e1264d68e8b7058c58c83a88c9aff0fd1fb Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sat, 23 Jul 2022 22:15:17 +0000 Subject: [PATCH 09/33] fix mayor multiplayer bug because i escape the loop using return after applying the effect to ONE player, which causes the other ones to not get the effect --- mods/ITEMS/mcl_beacons/init.lua | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 4b5d8bced..158995e91 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -64,21 +64,17 @@ local function beacon_blockcheck(pos) end local function effect_player(effect,pos,power_level, effect_level) - local all_objects = minetest.get_objects_inside_radius(pos, (power_level+1)*10) - for _,obj2 in ipairs(all_objects) do - if obj2:is_player() then + local all_objects = minetest.get_objects_inside_radius(pos, ((power_level+1)*10)) + for _,obj in ipairs(all_objects) do + if obj:is_player() then if effect == "swiftness" then - mcl_potions.swiftness_func(obj2,effect_level,16) - return + mcl_potions.swiftness_func(obj,effect_level,16) elseif effect == "leaping" then - mcl_potions.leaping_func(obj2, effect_level, 16) - return + mcl_potions.leaping_func(obj, effect_level, 16) elseif effect == "strenght" then - mcl_potions.strength_func(obj2, effect_level, 16) - return + mcl_potions.strength_func(obj, effect_level, 16) elseif effect == "regeneration" then - mcl_potions.regeneration_func(obj2, effect_level, 16) - return + mcl_potions.regeneration_func(obj, effect_level, 16) end end end From 74e3dfa0d77c9d69af55ef61a317becc067e7b85 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sun, 24 Jul 2022 12:32:20 +0200 Subject: [PATCH 10/33] beacon related achievements --- mods/HUD/mcl_achievements/init.lua | 13 +++++++ .../locale/mcl_achievements.de.tr | 4 ++ mods/HUD/mcl_achievements/locale/template.txt | 4 ++ mods/ITEMS/mcl_beacons/init.lua | 37 ++++++++++--------- mods/ITEMS/mcl_beacons/mod.conf | 2 +- 5 files changed, 41 insertions(+), 19 deletions(-) diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index a70ee5b40..9e7f6811b 100644 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -272,6 +272,19 @@ awards.register_achievement("mcl:enchanter", { icon = "mcl_enchanting_book_enchanted.png", }) +--Triggered in mcl_beacons +awards.register_achievement("mcl:beacon", { + title = S("Bring Home the Beacon"), + description = S("Use a beacon."), + icon = "beacon_side_3.png", +}) + +awards.register_achievement("mcl:maxed_beacon", { + title = S("Beaconator"), + description = S("Use a fully powered beacon."), + icon = "beacon_side_4.png", +}) + -- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.) if non_pc_achievements then diff --git a/mods/HUD/mcl_achievements/locale/mcl_achievements.de.tr b/mods/HUD/mcl_achievements/locale/mcl_achievements.de.tr index 49c486e48..885bf1d7e 100644 --- a/mods/HUD/mcl_achievements/locale/mcl_achievements.de.tr +++ b/mods/HUD/mcl_achievements/locale/mcl_achievements.de.tr @@ -47,3 +47,7 @@ Use a crafting table to craft a wooden hoe from wooden planks and sticks.=Benutz Use a crafting table to craft a wooden pickaxe from wooden planks and sticks.=Benutzen Sie eine Werkbank, um eine Holzspitzhacke aus Holzplanken und Stöcken zu fertigen. Use obsidian and a fire starter to construct a Nether portal.=Benutzen Sie Obsidian und ein Feuerzeug, um ein Netherportal zu errichten. Use wheat to craft a bread.=Benutzen Sie Weizen, um ein Brot zu machen. +Bring Home the Beacon=Den Nachbarn heimleuchten +Use a beacon.=Benutzen Sie ein Leuchtfeuer. +Beaconator=Leuchtturmwärter +Use a fully powered beacon.=Benutzen Sie ein vollständiges Leuchtfeuer. diff --git a/mods/HUD/mcl_achievements/locale/template.txt b/mods/HUD/mcl_achievements/locale/template.txt index 4bbe5db3e..5fcef4238 100644 --- a/mods/HUD/mcl_achievements/locale/template.txt +++ b/mods/HUD/mcl_achievements/locale/template.txt @@ -75,3 +75,7 @@ Local Brewery= Brew a Potion.@nHint: Take a potion or glass bottle out of the brewing stand.= Enchanter= Enchant an item using an Enchantment Table.= +Bring Home the Beacon= +Use a beacon.= +Beaconator= +Use a fully powered beacon.= diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 158995e91..9262c7641 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -63,24 +63,21 @@ local function beacon_blockcheck(pos) end end -local function effect_player(effect,pos,power_level, effect_level) - local all_objects = minetest.get_objects_inside_radius(pos, ((power_level+1)*10)) - for _,obj in ipairs(all_objects) do - if obj:is_player() then - if effect == "swiftness" then - mcl_potions.swiftness_func(obj,effect_level,16) - elseif effect == "leaping" then - mcl_potions.leaping_func(obj, effect_level, 16) - elseif effect == "strenght" then - mcl_potions.strength_func(obj, effect_level, 16) - elseif effect == "regeneration" then - mcl_potions.regeneration_func(obj, effect_level, 16) - end - end +local function effect_player(effect,pos,power_level, effect_level,player) + local distance = vector.distance(player:get_pos(), pos) + if distance > (power_level+1)*10 then return end + if effect == "swiftness" then + mcl_potions.swiftness_func(player,effect_level,16) + elseif effect == "leaping" then + mcl_potions.leaping_func(player, effect_level, 16) + elseif effect == "strenght" then + mcl_potions.strength_func(player, effect_level, 16) + elseif effect == "regeneration" then + mcl_potions.regeneration_func(player, effect_level, 16) end end -local function globalstep_function(pos) +local function globalstep_function(pos,player) local meta = minetest.get_meta(pos) local power_level = beacon_blockcheck(pos) local effect_string = meta:get_string("effect") @@ -97,7 +94,7 @@ local function globalstep_function(pos) end end if obstructed then return end - effect_player(effect_string,pos,power_level,meta:get_int("effect_level")) + effect_player(effect_string,pos,power_level,meta:get_int("effect_level"),player) end end @@ -181,9 +178,13 @@ minetest.register_node("mcl_beacons:beacon", { successful = true end if successful then + if power_level == 4 then + awards.unlock(sender:get_player_name(),"mcl:maxed_beacon") + end + awards.unlock(sender:get_player_name(),"mcl:beacon") input:take_item() inv:set_stack("input",1,input) - globalstep_function(pos)--call it once outside the globalstep so the player gets the effect right after selecting it + globalstep_function(pos,sender)--call it once outside the globalstep so the player gets the effect right after selecting it end end end, @@ -214,7 +215,7 @@ minetest.register_globalstep(function(dtime) local player_pos = player.get_pos(player) local pos_list = minetest.find_nodes_in_area({x=player_pos.x-50, y=player_pos.y-50, z=player_pos.z-50}, {x=player_pos.x+50, y=player_pos.y+50, z=player_pos.z+50},"mcl_beacons:beacon") for _, pos in ipairs(pos_list) do - globalstep_function(pos) + globalstep_function(pos,player) end end timer = 0 diff --git a/mods/ITEMS/mcl_beacons/mod.conf b/mods/ITEMS/mcl_beacons/mod.conf index 98bd645ee..edb641946 100644 --- a/mods/ITEMS/mcl_beacons/mod.conf +++ b/mods/ITEMS/mcl_beacons/mod.conf @@ -1,2 +1,2 @@ author=chmodsayshello -depends=mcl_formspec, mcl_init, mcl_wip, mesecons_mvps, mcl_core, mcl_sounds +depends=mcl_formspec, mcl_init, mcl_wip, mesecons_mvps, mcl_core, mcl_sounds, awards, mcl_achievements From a3adb3d80a348fa3d53390239308ff9921299e71 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sun, 24 Jul 2022 12:45:30 +0200 Subject: [PATCH 11/33] beacon crafting recipie --- mods/ITEMS/mcl_beacons/init.lua | 11 ++++++++++- mods/ITEMS/mcl_beacons/mod.conf | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 9262c7641..4494440e8 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -220,4 +220,13 @@ minetest.register_globalstep(function(dtime) end timer = 0 end -end) \ No newline at end of file +end) + +minetest.register_craft({ + output = "mcl_beacons:beacon", + recipe = { + {"mcl_core:glass", "mcl_core:glass", "mcl_core:glass"}, + {"mcl_core:glass", "mcl_mobitems:nether_star", "mcl_core:glass"}, + {"mcl_core:obsidian", "mcl_core:obsidian", "mcl_core:obsidian"} + } +}) \ No newline at end of file diff --git a/mods/ITEMS/mcl_beacons/mod.conf b/mods/ITEMS/mcl_beacons/mod.conf index edb641946..e66b74b9f 100644 --- a/mods/ITEMS/mcl_beacons/mod.conf +++ b/mods/ITEMS/mcl_beacons/mod.conf @@ -1,2 +1,2 @@ author=chmodsayshello -depends=mcl_formspec, mcl_init, mcl_wip, mesecons_mvps, mcl_core, mcl_sounds, awards, mcl_achievements +depends=mcl_formspec, mcl_init, mcl_wip, mesecons_mvps, mcl_core, mcl_sounds, awards, mcl_achievements, mcl_mobitems From 18888d3ad8268ede9a712907a33324d55d66162e Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sun, 24 Jul 2022 12:52:57 +0200 Subject: [PATCH 12/33] make beacons mineable --- mods/ITEMS/mcl_beacons/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 4494440e8..f2cdfd665 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -189,7 +189,10 @@ minetest.register_node("mcl_beacons:beacon", { end end, light_source = 15, + groups = {handy=1}, + drop = "mcl_beacons:beacon", sounds = mcl_sounds.node_sound_glass_defaults(), + _mcl_hardness = 3, }) mesecon.register_mvps_stopper("mcl_beacons:beacon") From f6ce37f2b98f7ddbd95505820a5eb0a7f79acf42 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sun, 24 Jul 2022 13:00:58 +0200 Subject: [PATCH 13/33] add netherite to beacon materials --- mods/ITEMS/mcl_beacons/init.lua | 9 +++++---- mods/ITEMS/mcl_beacons/mod.conf | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index f2cdfd665..68936dade 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -31,9 +31,10 @@ local formspec_string= "item_image[2.2,7;1,1;mcl_core:emerald]".. "item_image[3.4,7;1,1;mcl_core:iron_ingot]".. "item_image[4.6,7;1,1;mcl_core:gold_ingot]".. + "item_image[5.8,7;1,1;mcl_nether:netherite_ingot]".. - mcl_formspec.get_itemslot_bg(6,7,1,1).. - "list[context;input;6,7;1,1;]".. + mcl_formspec.get_itemslot_bg(7.2,7,1,1).. + "list[context;input;7.2,7;1,1;]".. mcl_formspec.get_itemslot_bg(1,9,9,3).. "list[current_player;main;1,9;9,3;9]".. mcl_formspec.get_itemslot_bg(1,12.5,9,1).. @@ -198,8 +199,8 @@ minetest.register_node("mcl_beacons:beacon", { mesecon.register_mvps_stopper("mcl_beacons:beacon") mcl_wip.register_wip_item("mcl_beacons:beacon") -beacon_blocklist = {"mcl_core:diamondblock","mcl_core:ironblock","mcl_core:goldblock","mcl_core:emeraldblock"}--this is supposed to be a global, don't change that! || TODO: add netherite blocks once implemented! -beacon_fuellist ={"mcl_core:diamond","mcl_core:emerald","mcl_core:iron_ingot","mcl_core:gold_ingot"} +beacon_blocklist = {"mcl_core:diamondblock","mcl_core:ironblock","mcl_core:goldblock","mcl_core:emeraldblock","mcl_nether:netheriteblock"}--this is supposed to be a global, don't change that! +beacon_fuellist ={"mcl_core:diamond","mcl_core:emerald","mcl_core:iron_ingot","mcl_core:gold_ingot","mcl_nether:netherite_ingot"} function register_beaconblock (itemstring)--API function for other mods table.insert(beacon_blocklist, itemstring) diff --git a/mods/ITEMS/mcl_beacons/mod.conf b/mods/ITEMS/mcl_beacons/mod.conf index e66b74b9f..139a264b3 100644 --- a/mods/ITEMS/mcl_beacons/mod.conf +++ b/mods/ITEMS/mcl_beacons/mod.conf @@ -1,2 +1,2 @@ author=chmodsayshello -depends=mcl_formspec, mcl_init, mcl_wip, mesecons_mvps, mcl_core, mcl_sounds, awards, mcl_achievements, mcl_mobitems +depends=mcl_formspec, mcl_init, mcl_wip, mesecons_mvps, mcl_core, mcl_sounds, awards, mcl_achievements, mcl_mobitems, mcl_nether From f7028bc836130590680977ec67590b03e8b412ba Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Mon, 25 Jul 2022 11:59:19 +0200 Subject: [PATCH 14/33] 'fix' beacon texture --- mods/HUD/mcl_achievements/init.lua | 4 ++-- mods/ITEMS/mcl_beacons/init.lua | 9 ++------- mods/ITEMS/mcl_beacons/textures/beacon_bottom.png | Bin 338 -> 0 bytes .../{beacon_side_3.png => beacon_overlay.png} | Bin mods/ITEMS/mcl_beacons/textures/beacon_side_1.png | Bin 339 -> 0 bytes mods/ITEMS/mcl_beacons/textures/beacon_side_2.png | Bin 337 -> 0 bytes mods/ITEMS/mcl_beacons/textures/beacon_side_4.png | Bin 338 -> 0 bytes mods/ITEMS/mcl_beacons/textures/beacon_top.png | Bin 340 -> 0 bytes 8 files changed, 4 insertions(+), 9 deletions(-) delete mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_bottom.png rename mods/ITEMS/mcl_beacons/textures/{beacon_side_3.png => beacon_overlay.png} (100%) delete mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_side_1.png delete mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_side_2.png delete mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_side_4.png delete mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_top.png diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index 9e7f6811b..464e21c6b 100644 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -276,13 +276,13 @@ awards.register_achievement("mcl:enchanter", { awards.register_achievement("mcl:beacon", { title = S("Bring Home the Beacon"), description = S("Use a beacon."), - icon = "beacon_side_3.png", + icon = "beacon_overlay.png", }) awards.register_achievement("mcl:maxed_beacon", { title = S("Beaconator"), description = S("Use a fully powered beacon."), - icon = "beacon_side_4.png", + icon = "beacon_overlay.png", }) -- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 68936dade..77b815b27 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -100,15 +100,10 @@ local function globalstep_function(pos,player) end minetest.register_node("mcl_beacons:beacon", { - --glasslike drawtype? description = "Beacon", + drawtype = "glasslike", tiles = { - "beacon_top.png", - "beacon_bottom.png", - "beacon_side_1.png", - "beacon_side_2.png", - "beacon_side_3.png", - "beacon_side_4.png" + "default_glass.png^beacon_overlay.png" }, on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_bottom.png b/mods/ITEMS/mcl_beacons/textures/beacon_bottom.png deleted file mode 100644 index af02df21f452d59e4da9bff12d639f64a8176b86..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 338 zcmV-Y0j>UtP)z*OXqHZ*#r&Hlau>z{C6pX zN2oEw`Q7gs+>@lhnn3_&z_!np43{1~!XAh)1LBHoz_x)5fB}#}&oA&W5HvuDj~g6_ zPRh%{8eV?52R7rKY(6*;-+lUu-vwU0$HCE<>2elsJ19KXUkm_8EnXKOCnT6|^aKSG k$C(bu$rsekOysx#0O0qJ5rf4y0RR9107*qoM6N<$f`40#VgLXD diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_side_3.png b/mods/ITEMS/mcl_beacons/textures/beacon_overlay.png similarity index 100% rename from mods/ITEMS/mcl_beacons/textures/beacon_side_3.png rename to mods/ITEMS/mcl_beacons/textures/beacon_overlay.png diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_side_1.png b/mods/ITEMS/mcl_beacons/textures/beacon_side_1.png deleted file mode 100644 index dfd93ef984fd95848a4d210c5576a49a86c9e667..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 339 zcmV-Z0j&OsP)DhGE(K*d4^kn_L&_=Vp9 zkPH5ZYQQy$O3H%SAj4kmoy$Pb1t0?i^;{WVKYz?1rDqM+{OrN zkamb;cz&%tICoRtL!;=4~@@w;GmyZ|^Fch!5rZ3l%%^sLL^sKx67)D l;yBX*Ir)ORnTZ@1000P5j}Z`X6JY=V002ovPDHLkV1kqLjfMaK diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_side_2.png b/mods/ITEMS/mcl_beacons/textures/beacon_side_2.png deleted file mode 100644 index 8a348a97c4033a7b2ffb28bbe68617bafecb3b18..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 337 zcmV-X0j~auP)!S$gSV4|(?|HrT2V9gwCtSE*ci=Vmr z0Ji~~7I8B~r2S@CF$>iIn3!MOR|dQWaB;AKy|8MzBLfGEEZh}-p^F$m&j0q~7k&dk zF8IT#0oN!h05Jq)*z?Ep7znxmWPqTgE5qv#j~Qe|tiYNdzc~hG6Er|aRr>#oi3|+J z2B8e^pYLXnluZI_1_77>ZV?|CuH1f#JrH3ASeq1qZ37tq10aJ~zTaRVXn+tOH#iWd zPFDeIxcBk{*o@9j5pW>B`}7sR3wEs#07v7_&0cWZLE#Y-dl?+HcwK;;kYKve6BI}s jXF4D!Ur;wQk>dgYjy{bM3m*3v00000NkvXXu0mjf8QX%x diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_side_4.png b/mods/ITEMS/mcl_beacons/textures/beacon_side_4.png deleted file mode 100644 index d8523a2ac1b57583140dd3825729bb1835a233ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 338 zcmV-Y0j>UtP)JC}i=3qS@4y1Ftve*Kz3&Da>M`PSL9U^YPm)D#u|&HT&2 zU>q9C@P7Ah2C3v^ux1c|8Q}W)1H-NR53mO!%mAC>Vz6x>17HAT5YL4R3i_@%07*qoM6N<$f}ZS86igzB7nkzQF=hfZ~FOs!D%;{Q3=+<6vV&F$7s$ z{`NiG1_bWoX4vWVo56h>ssS*u^-f1>UQCwCO%mx{@@7X*Cf-V3VpeN|c@bd9%25mJXu;#0`&Vktk4Y(;U`^RDt z1B1VDD8r@qyBVCMlE9il0A|2)n-2`?4M3@1|Hbr3DKnB17$e@=z7Z?Z{AjHQF z4n+TXI$#a=?|lH9@v=e$9Ek5eeZ}vB$Rh&aXe>SM1-Bg(9*e?GgQFI&3y>2MOgDOh m0*T{H2jt`_>SiW#TmS%B*^-g#@etGi0000 Date: Mon, 25 Jul 2022 12:20:15 +0200 Subject: [PATCH 15/33] drop items once beacon gets destroyed --- mods/ITEMS/mcl_beacons/init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 77b815b27..b27bf4fb1 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -112,6 +112,14 @@ minetest.register_node("mcl_beacons:beacon", { local form = formspec_string meta:set_string("formspec", form) end, + on_destruct = function(pos) + local meta = minetest.get_meta(pos) + local input = meta:get_inventory():get_stack("input",1) + if not input:is_empty() then + local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} --from mcl_anvils + minetest.add_item(p, input) + end + end, on_receive_fields = function(pos, formname, fields, sender) if fields.swiftness or fields.regeneration or fields.leaping or fields.strenght then local sender_name = sender:get_player_name() From a5e1a00cd88218e6fc5b82e3043085aed08c47d7 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Mon, 25 Jul 2022 12:31:30 +0200 Subject: [PATCH 16/33] Use overlay properly in mcl_achievements --- mods/HUD/mcl_achievements/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index 464e21c6b..7633ceae2 100644 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -276,13 +276,13 @@ awards.register_achievement("mcl:enchanter", { awards.register_achievement("mcl:beacon", { title = S("Bring Home the Beacon"), description = S("Use a beacon."), - icon = "beacon_overlay.png", + icon = "default_glass.png^beacon_overlay.png", }) awards.register_achievement("mcl:maxed_beacon", { title = S("Beaconator"), description = S("Use a fully powered beacon."), - icon = "beacon_overlay.png", + icon = "default_glass.png^beacon_overlay.png", }) -- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.) From 154da96cb093fbde228c11491d66117bbd3e75ff Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Mon, 25 Jul 2022 17:20:51 +0200 Subject: [PATCH 17/33] add beacon beam --- mods/ITEMS/mcl_beacons/init.lua | 72 +++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index b27bf4fb1..0f48597f8 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -9,6 +9,41 @@ Valid strings: --TODO: add beacon beam --TODO: add translation +--[[ +cyan: #cdf4e9 +white: #f9fcfb +brown: #7c5e3d +dark-blue: #1826c9 +light-blue: #16f4f4 +pink: #f483fc +purple: #9712bc +red: #ea1212 +light-gray: #adadad +gray: #535454 +light-green: #19e52a +green: #549159 +orange: #ef8813 +yellow: #ebf704 +black: #000000 +magenta: #e502d6 +default: #e8e3e3 +--]] + +minetest.register_node("mcl_beacons:beacon_beam", { + tiles = {"^[colorize:#cdf4e9"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.1250, -0.5000, -0.1250, 0.1250, 0.5000, 0.1250} + } + }, + light_source = 15, + walkable = false, + groups = {not_in_creative_inventory=1}, + _mcl_blast_resistance = 1200, +}) + local formspec_string= "size[11,14]".. @@ -40,7 +75,21 @@ local formspec_string= mcl_formspec.get_itemslot_bg(1,12.5,9,1).. "list[current_player;main;1,12.5;9,1;]" - +local function remove_beacon_beam(pos) --beacon pos + for y=pos.y+1, pos.y+301 do + local node = minetest.get_node({x=pos.x,y=y,z=pos.z}) + if node.name ~= "air" and node.name ~= "mcl_core:bedrock" then + if node.name == "ignore" then + minetest.get_voxel_manip():read_from_map({x=pos.x,y=y,z=pos.z}, {x=pos.x,y=y,z=pos.z}) + node = minetest.get_node({x=pos.x,y=y,z=pos.z}) + end + + if node.name == "mcl_beacons:beacon_beam" then + minetest.remove_node({x=pos.x,y=y,z=pos.z}) + end + end + end +end local function beacon_blockcheck(pos) for y_offset = 1,4 do @@ -89,12 +138,15 @@ local function globalstep_function(pos,player) for y=pos.y+1, pos.y+301 do if y >= 31000 then return end local nodename = minetest.get_node({x=pos.x,y=y, z = pos.z}).name - if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "ignore" then --ignore means not loaded, let's just assume that's air + if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "mcl_beacons:beacon_beam" and nodename ~= "ignore" then --ignore means not loaded, let's just assume that's air obstructed = true + remove_beacon_beam(pos) return end end - if obstructed then return end + if obstructed then + return + end effect_player(effect_string,pos,power_level,meta:get_int("effect_level"),player) end end @@ -119,6 +171,7 @@ minetest.register_node("mcl_beacons:beacon", { local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} --from mcl_anvils minetest.add_item(p, input) end + remove_beacon_beam(pos) end, on_receive_fields = function(pos, formname, fields, sender) if fields.swiftness or fields.regeneration or fields.leaping or fields.strenght then @@ -188,6 +241,19 @@ minetest.register_node("mcl_beacons:beacon", { awards.unlock(sender:get_player_name(),"mcl:beacon") input:take_item() inv:set_stack("input",1,input) + + for y = pos.y +1, pos.y + 301 do + local node = minetest.get_node({x=pos.x,y=y,z=pos.z}) + if node.name == ignore then + minetest.get_voxel_manip():read_from_map({x=pos.x,y=y,z=pos.z}, {x=pos.x,y=y,z=pos.z}) + node = minetest.get_node({x=pos.x,y=y,z=pos.z}) + end + + if node.name == "air" then + minetest.set_node({x=pos.x,y=y,z=pos.z},{name="mcl_beacons:beacon_beam"}) + end + end + globalstep_function(pos,sender)--call it once outside the globalstep so the player gets the effect right after selecting it end end From 38d4e7afc9de39a150c1227addb4bd145f669f8a Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Mon, 25 Jul 2022 17:23:28 +0200 Subject: [PATCH 18/33] changing some comments --- mods/ITEMS/mcl_beacons/init.lua | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 0f48597f8..dd631ec07 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -6,28 +6,6 @@ Valid strings: strenght regeneration ]]-- ---TODO: add beacon beam ---TODO: add translation - ---[[ -cyan: #cdf4e9 -white: #f9fcfb -brown: #7c5e3d -dark-blue: #1826c9 -light-blue: #16f4f4 -pink: #f483fc -purple: #9712bc -red: #ea1212 -light-gray: #adadad -gray: #535454 -light-green: #19e52a -green: #549159 -orange: #ef8813 -yellow: #ebf704 -black: #000000 -magenta: #e502d6 -default: #e8e3e3 ---]] minetest.register_node("mcl_beacons:beacon_beam", { tiles = {"^[colorize:#cdf4e9"}, @@ -75,7 +53,7 @@ local formspec_string= mcl_formspec.get_itemslot_bg(1,12.5,9,1).. "list[current_player;main;1,12.5;9,1;]" -local function remove_beacon_beam(pos) --beacon pos +local function remove_beacon_beam(pos) for y=pos.y+1, pos.y+301 do local node = minetest.get_node({x=pos.x,y=y,z=pos.z}) if node.name ~= "air" and node.name ~= "mcl_core:bedrock" then @@ -96,7 +74,7 @@ local function beacon_blockcheck(pos) local block_y = pos.y - y_offset for block_x = (pos.x-y_offset),(pos.x+y_offset) do for block_z = (pos.z-y_offset),(pos.z+y_offset) do - local valid_block = false --boolean to which stores if block is valid or not + local valid_block = false --boolean which stores if block is valid or not for _, beacon_block in pairs(beacon_blocklist) do if beacon_block == minetest.get_node({x=block_x,y=block_y,z=block_z}).name and not valid_block then --is the block in the pyramid a valid beacon block valid_block =true From e0a205bdcc115eb7b4c722a8d31740202a02ce45 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Mon, 25 Jul 2022 17:47:36 +0200 Subject: [PATCH 19/33] translation template + german translation --- mods/ITEMS/mcl_beacons/init.lua | 9 +++++---- mods/ITEMS/mcl_beacons/locale/mcl_beacons.de.tr | 5 +++++ mods/ITEMS/mcl_beacons/locale/template.txt | 6 ++++++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 mods/ITEMS/mcl_beacons/locale/mcl_beacons.de.tr create mode 100644 mods/ITEMS/mcl_beacons/locale/template.txt diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index dd631ec07..0dcf8a550 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -1,3 +1,4 @@ +local S = minetest.get_translator(minetest.get_current_modname()) --[[ there are strings in meta, which are being used to see which effect will be given to the player(s) Valid strings: @@ -26,9 +27,9 @@ minetest.register_node("mcl_beacons:beacon_beam", { local formspec_string= "size[11,14]".. - "label[4.5,0.5;Beacon:]".. - "label[0.5,1;Primary Power:]".. - "label[0.5,8.25;Inventory:]".. + "label[4.5,0.5;"..minetest.formspec_escape(S("Beacon:")).."]".. + "label[0.5,1;"..minetest.formspec_escape(S("Primary Power:")).."]".. + "label[0.5,8.25;"..minetest.formspec_escape( S("Inventory:")).."]".. "image[1,1.5;1,1;custom_beacom_symbol_4.png]".. "image[1,3;1,1;custom_beacom_symbol_3.png]".. @@ -130,7 +131,7 @@ local function globalstep_function(pos,player) end minetest.register_node("mcl_beacons:beacon", { - description = "Beacon", + description = S"Beacon", drawtype = "glasslike", tiles = { "default_glass.png^beacon_overlay.png" diff --git a/mods/ITEMS/mcl_beacons/locale/mcl_beacons.de.tr b/mods/ITEMS/mcl_beacons/locale/mcl_beacons.de.tr new file mode 100644 index 000000000..d6f194a6c --- /dev/null +++ b/mods/ITEMS/mcl_beacons/locale/mcl_beacons.de.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_beacons +Beacon=Leuchtfeuer +Beacon:=Leuchtfeuer: +Primary Power:=Primäre Kraft: +Inventory:=Inventar: diff --git a/mods/ITEMS/mcl_beacons/locale/template.txt b/mods/ITEMS/mcl_beacons/locale/template.txt new file mode 100644 index 000000000..8f604d598 --- /dev/null +++ b/mods/ITEMS/mcl_beacons/locale/template.txt @@ -0,0 +1,6 @@ +# textdomain: mcl_beacons +Beacon= +Beacon:= +Primary Power:= +Inventory:= + From 56f3f0503e36f4d3b9466897dce2128ebbfae152 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Mon, 25 Jul 2022 17:54:15 +0200 Subject: [PATCH 20/33] minor changes --- mods/ITEMS/mcl_beacons/init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 0dcf8a550..615afbce3 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -232,7 +232,6 @@ minetest.register_node("mcl_beacons:beacon", { minetest.set_node({x=pos.x,y=y,z=pos.z},{name="mcl_beacons:beacon_beam"}) end end - globalstep_function(pos,sender)--call it once outside the globalstep so the player gets the effect right after selecting it end end @@ -264,7 +263,7 @@ minetest.register_globalstep(function(dtime) timer = timer + dtime if timer >= 3 then for _, player in ipairs(minetest.get_connected_players()) do - local player_pos = player.get_pos(player) + local player_pos = player:get_pos() local pos_list = minetest.find_nodes_in_area({x=player_pos.x-50, y=player_pos.y-50, z=player_pos.z-50}, {x=player_pos.x+50, y=player_pos.y+50, z=player_pos.z+50},"mcl_beacons:beacon") for _, pos in ipairs(pos_list) do globalstep_function(pos,player) From 1fdd6a4707a82ebacf7d0ee5be4cb406c98edcb5 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Mon, 25 Jul 2022 21:35:15 +0200 Subject: [PATCH 21/33] glass changes color of beacon beam --- mods/ITEMS/mcl_beacons/init.lua | 106 +++++++++++++++++++++++++------- 1 file changed, 84 insertions(+), 22 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 615afbce3..5fef4abc5 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -8,20 +8,65 @@ Valid strings: regeneration ]]-- -minetest.register_node("mcl_beacons:beacon_beam", { - tiles = {"^[colorize:#cdf4e9"}, - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-0.1250, -0.5000, -0.1250, 0.1250, 0.5000, 0.1250} - } - }, - light_source = 15, - walkable = false, - groups = {not_in_creative_inventory=1}, - _mcl_blast_resistance = 1200, -}) + +local color_list = {"cdf4e9","f9fcfb","7c5e3d","1826c9","16f4f4","f483fc","9712bc","ea1212","adadad","535454","19e52a","549159","ef8813","ebf704","000000","e502d6","e8e3e3"} + +local function get_beacon_beam(glass_nodename) + if string.match(glass_nodename, "cyan") then + return "mcl_beacons:beacon_beam_cdf4e9" + elseif string.match(glass_nodename,"white") then + return "mcl_beacons:beacon_beam_f9fcfb" + elseif string.match(glass_nodename,"brown") then + return "mcl_beacons:beacon_beam_7c5e3d" + elseif string.match(glass_nodename,"blue") and not string.match(glass_nodename, "light") then + return "mcl_beacons:beacon_beam_1826c9" + elseif string.match(glass_nodename,"light_blue") then + return "mcl_beacons:beacon_beam_16f4f4" + elseif string.match(glass_nodename,"pink") then + return "mcl_beacons:beacon_beam_f483fc" + elseif string.match(glass_nodename, "purple") then + return "mcl_beacons:beacon_beam_9712bc" + elseif string.match(glass_nodename, "red") then + return "mcl_beacons:beacon_beam_ea1212" + elseif string.match(glass_nodename, "silver") then + return "mcl_beacons:beacon_beam_adadad" + elseif string.match(glass_nodename, "gray") then + return "mcl_beacons:beacon_beam_535454" + elseif string.match(glass_nodename, "lime") then + return "mcl_beacons:beacon_beam_19e52a" + elseif string.match(glass_nodename, "green") then + return "mcl_beacons:beacon_beam_549159" + elseif string.match(glass_nodename, "orange") then + return "mcl_beacons:beacon_beam_ef8813" + elseif string.match(glass_nodename, "yellow") then + return "mcl_beacons:beacon_beam_ebf704" + elseif string.match(glass_nodename, "black") then + return "mcl_beacons:beacon_beam_000000" + elseif string.match(glass_nodename, "magenta") then + return "mcl_beacons:beacon_beam_e502d6" + else + return "mcl_beacons:beacon_beam_e8e3e3" + end +end + + + +for _, color in ipairs(color_list) do + minetest.register_node("mcl_beacons:beacon_beam_"..color, { + tiles = {"^[colorize:#"..color}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.1250, -0.5000, -0.1250, 0.1250, 0.5000, 0.1250} + } + }, + light_source = 15, + walkable = false, + groups = {not_in_creative_inventory=1}, + _mcl_blast_resistance = 1200, + }) +end local formspec_string= @@ -55,7 +100,7 @@ local formspec_string= "list[current_player;main;1,12.5;9,1;]" local function remove_beacon_beam(pos) - for y=pos.y+1, pos.y+301 do + for y=pos.y+1, pos.y+501 do local node = minetest.get_node({x=pos.x,y=y,z=pos.z}) if node.name ~= "air" and node.name ~= "mcl_core:bedrock" then if node.name == "ignore" then @@ -63,7 +108,7 @@ local function remove_beacon_beam(pos) node = minetest.get_node({x=pos.x,y=y,z=pos.z}) end - if node.name == "mcl_beacons:beacon_beam" then + if string.match(node.name,"mcl_beacons:beacon_beam_") then minetest.remove_node({x=pos.x,y=y,z=pos.z}) end end @@ -114,13 +159,17 @@ local function globalstep_function(pos,player) return else local obstructed = false - for y=pos.y+1, pos.y+301 do + for y=pos.y+1, pos.y+501 do if y >= 31000 then return end local nodename = minetest.get_node({x=pos.x,y=y, z = pos.z}).name - if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "mcl_beacons:beacon_beam" and nodename ~= "ignore" then --ignore means not loaded, let's just assume that's air - obstructed = true - remove_beacon_beam(pos) - return + if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "ignore" then --ignore means not loaded, let's just assume that's air + if not string.match(nodename,"mcl_beacons:beacon_beam_") then + if minetest.get_item_group(nodename,"glass") == 0 then + obstructed = true + remove_beacon_beam(pos) + return + end + end end end if obstructed then @@ -214,12 +263,15 @@ minetest.register_node("mcl_beacons:beacon", { successful = true end if successful then + minetest.log("1") if power_level == 4 then awards.unlock(sender:get_player_name(),"mcl:maxed_beacon") end awards.unlock(sender:get_player_name(),"mcl:beacon") input:take_item() inv:set_stack("input",1,input) + + local beam_itemstring = "mcl_beacons:beacon_beam_e8e3e3" for y = pos.y +1, pos.y + 301 do local node = minetest.get_node({x=pos.x,y=y,z=pos.z}) @@ -228,8 +280,18 @@ minetest.register_node("mcl_beacons:beacon", { node = minetest.get_node({x=pos.x,y=y,z=pos.z}) end + + if y == pos.y+1 then + if minetest.get_item_group(node.name, "glass") ~= 0 then + beam_itemstring = get_beacon_beam(node.name) + elseif node.name == air then + minetest.set_node({x=pos.x,y=y,z=pos.z},{name=beam_itemstring}) + end + end + + --if minetest.get_node_group(nodename, "glass") ~= 0 then if node.name == "air" then - minetest.set_node({x=pos.x,y=y,z=pos.z},{name="mcl_beacons:beacon_beam"}) + minetest.set_node({x=pos.x,y=y,z=pos.z},{name=beam_itemstring}) end end globalstep_function(pos,sender)--call it once outside the globalstep so the player gets the effect right after selecting it From d15ad610381d6b06bfa4a4202aa12d5962c48402 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Mon, 25 Jul 2022 21:37:05 +0200 Subject: [PATCH 22/33] remove unnecessary minetest.log call --- mods/ITEMS/mcl_beacons/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 5fef4abc5..b476f3f06 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -263,7 +263,6 @@ minetest.register_node("mcl_beacons:beacon", { successful = true end if successful then - minetest.log("1") if power_level == 4 then awards.unlock(sender:get_player_name(),"mcl:maxed_beacon") end From 2d407f88977b13391372e18d1e9c9918756c1fe4 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Mon, 25 Jul 2022 21:47:03 +0200 Subject: [PATCH 23/33] change 301 to 501 here as well --- mods/ITEMS/mcl_beacons/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index b476f3f06..121da607c 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -272,7 +272,7 @@ minetest.register_node("mcl_beacons:beacon", { local beam_itemstring = "mcl_beacons:beacon_beam_e8e3e3" - for y = pos.y +1, pos.y + 301 do + for y = pos.y +1, pos.y + 501 do local node = minetest.get_node({x=pos.x,y=y,z=pos.z}) if node.name == ignore then minetest.get_voxel_manip():read_from_map({x=pos.x,y=y,z=pos.z}, {x=pos.x,y=y,z=pos.z}) From 65171a34a8ddeed81af5bf2e557dfedc69dab6e5 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Mon, 25 Jul 2022 21:52:07 +0200 Subject: [PATCH 24/33] prevent pistons from pushing beacon beams --- mods/ITEMS/mcl_beacons/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 121da607c..936e187d5 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -66,6 +66,7 @@ for _, color in ipairs(color_list) do groups = {not_in_creative_inventory=1}, _mcl_blast_resistance = 1200, }) + mesecon.register_mvps_stopper("mcl_beacons:beacon_beam_"..color) end From dd9e6e5d6b802bde8ff69fe86e199638c175620d Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Tue, 26 Jul 2022 10:40:45 +0200 Subject: [PATCH 25/33] mesh by Sumi --- mods/HUD/mcl_achievements/init.lua | 4 ++-- mods/ITEMS/mcl_beacons/init.lua | 9 ++++----- mods/ITEMS/mcl_beacons/textures/beacon_UV.png | Bin 0 -> 1014 bytes .../textures/beacon_achievement_icon.png | Bin 0 -> 2284 bytes .../mcl_beacons/textures/beacon_overlay.png | Bin 340 -> 0 bytes mods/ITEMS/mcl_beacons/textures/mcl_beacon.b3d | Bin 0 -> 2189 bytes 6 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_UV.png create mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_achievement_icon.png delete mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_overlay.png create mode 100644 mods/ITEMS/mcl_beacons/textures/mcl_beacon.b3d diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index 7633ceae2..7fb166e2b 100644 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -276,13 +276,13 @@ awards.register_achievement("mcl:enchanter", { awards.register_achievement("mcl:beacon", { title = S("Bring Home the Beacon"), description = S("Use a beacon."), - icon = "default_glass.png^beacon_overlay.png", + icon = "beacon_achievement_icon.png", }) awards.register_achievement("mcl:maxed_beacon", { title = S("Beaconator"), description = S("Use a fully powered beacon."), - icon = "default_glass.png^beacon_overlay.png", + icon = "beacon_achievement_icon.png", }) -- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 936e187d5..3dce00cb0 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -182,10 +182,10 @@ end minetest.register_node("mcl_beacons:beacon", { description = S"Beacon", - drawtype = "glasslike", - tiles = { - "default_glass.png^beacon_overlay.png" - }, + drawtype = "mesh", + collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + mesh = "mcl_beacon.b3d", + tiles = {"beacon_UV.png"}, on_construct = function(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() @@ -289,7 +289,6 @@ minetest.register_node("mcl_beacons:beacon", { end end - --if minetest.get_node_group(nodename, "glass") ~= 0 then if node.name == "air" then minetest.set_node({x=pos.x,y=y,z=pos.z},{name=beam_itemstring}) end diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_UV.png b/mods/ITEMS/mcl_beacons/textures/beacon_UV.png new file mode 100644 index 0000000000000000000000000000000000000000..e65e7b3ed5c0bfd084ca4f580f7e3b9436ee47b8 GIT binary patch literal 1014 zcmVEX>4Tx04R}tkv&MmKpe$iQ>7vm2aBjUM5s;{L`5963Pq?8YK2xEOfGFLG-*gu zTpR`0f`cE6RRpZjxksX2=Q0g-ry8KzCVPCT_~ z8=UuvBWy!fiO-2gO}ZfQBi9v=-#8as7IU7)NgP!*o$`f@ z$13M7&RVI$8u#Qc4CnOaC9cyPL;?#~gai=^Dk!1^oBAq3C&faF_TxVO0oN~)OCeVg zj2!bQLxb%4!T;cQw^n{)+)E0_f%X^2`4|R5yFk6_IN!&PQ$GQM&%l-5^p|VE^e5@n zrWQQ{y0?Lg>!zmc0hc>K-;*JmvMU8?3i&+nen#Jv1$u6Q&Q-6s#y(CTfHZZLya5gl zfsq1bulc;YqqVnx&ouh`0l6V^!vU6`;s5{u24YJ`L;(K){{a7>y{D4^000SaNLh0L z04^f{04^f|c%?sf00007bV*G`2j&MF04xxt%R(Li000?uMObu0Z*6U5Zgc=ca%Ew3 zWn>_CX>@2HM@dakSAh-}0005aNklBb5S_UkB7t1NH57!(1UqX(An_+y zT7eCJ!hd3=6(y~miH2ZfVaFv}U`Vt%3L+l|#aNJ)z2kOo_qcVgGAR_SuL?uUOCl{mx{PzBc001TfAtJbb@wS|_`irf_cjw2LR0hmoM=_t3E*MWe z>G;odA{{T}EqMUUtc?GAvP$O;7&7oucHP1PO6>@km9hZ#(dPTx+hYdyX@+jO?d=Ho zl&6(`VE~iW`qJ^hX;pzR191U^b*@CkVN}W!N+EA;5zNQeD<($8QJ_)5@D39z!zfBk zObt7ZO8@{@RU1chlBThoL+m&%)hornzMBUJ0RZkVPod|AFR$5~;f*EV`cnJcmzQwIy)E5 z<=+!bORP*dyP7(?(lOQd#6hc|=MorfBWRf%P_9#$hpDO zstyCP-#%Im1i`mp>iJ8EIyao}uUCpVoay~<;I*OMsD^8Ssy>LcKvf@vTCi&=^6D2U k#~NzLy!z%3XRuSSzjIgIG($JcApigX07*qoM6N<$f-PFR*8l(j literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_achievement_icon.png b/mods/ITEMS/mcl_beacons/textures/beacon_achievement_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..dd10a549344b841b9cbb976c29962c1121646177 GIT binary patch literal 2284 zcmV zaB^>EX>4U6ba`-PAZ2)IW&i+q+ND=lvLq=C{O1&V1SFg|4mM(Mu*cuT6z$*i%oNdu zDL{!*hF0yrf4lkz4;yQhbwPaeUgNRRMowsmUQe2D(ssUgM_-MHadkd0h74-6y5jeE z!#HC;@A0ztNf>u`8^yLiWP_Gln z9+CA^<7G`??>q&Iw`CoIk7x^P8=$v3fcC<1taEwo^W0b0R0bw)hK!zXSt!l;u}P={ z-fTSPVGi2H#5oeDezgK+fB@ui>$d5m%?I5aR^C7An`3Qrc%b{Vwi&3G4^L*`+a5Ph z?Dl*c9#;PtlqZEq7ps$mqN{PCnHXDTsFj{ULP%{@cb4I+Q8V3d1T8w*Xjamp(skX#82XXpoy&0}9<#v*3V9=e0$4bh9lpi8h$$P%r1EP}lmgk%eprFl0c1 z_GBD+(t$Y;L6HK25@|skBmm9(y{hZB}2(Z?Hz2HJ(h3dEu~z(GXUxroCX3!5J81 zOJF<<24K)UIMYJb@?dUorX#~E90Q~q+*HzuJX>XKBX*q*cQ@vKi#O%%kG%1>%&9@$ zUotm&Q_bD+_J*}O(sr4QEiW88)dt?zZAmPNbJeBqRc62 zq}`9Tdi$Y^@v~WMi>8%((FUrRy=Ys%VCcEgY+Sf>UDF5(`~t|S)wdJh0?#GQW|gM= z1%_KC>&Qv0JQ~)G8^w2ZD7YW}=9;s%HaD9v48%H8qcgnH-|&Rm`!ziVH^;k8p}@)J zKKi+)CMwP)0XeK%Y9Xv{ZlPrPu3^wdz)c zgl~r9iue#ypGwCNSZ-hpR#Q9%5CGo z4UX$^TLYOV7Wp4oxVlXI8-1JYUKSVr(&Ey7a|U2Vy|tT9`aXf+6}@`#_&d#B!Rt=L zPfmaHJO$T#!rZ0okY!5uuc0NqHEsp#K2bB!PAPVT$6}VDw-ym|f0gId)9Qx=_hV9g z%7x19Oy? zhTX{sQRz<^?{-UBC$jpsZ_(FX>s;;B*LS;L)av=pm$xhFR&JJF%@zHmeAr9jFLtjH zcJM#yOlYBW$pFs)00Dz(LqkwWLqi~Na&Km7Y-Iodc$|HaJxIeq9K~N#r9~-!m6rn<>6nNgNw7S4z7YA_yOYRuow^!iD#K%+Qb{g)0?)zd7n7S%Cbs)PCRDP1&JTIu6X>$x#Y6IGoxlU zGfx~P7E4{MbTKQN8u1iyT-9{S7jhn}oVPe@)jDh6lfN)h&{vkZPIDM3EMf@~L@21E zf+}nzXw^xvkfHsgk3Z)6C2}d`s(_JW0X1llT|f9A{O;B&PEL49ktERj;y528Kxh|e zH5}*r*l}7XK=2v3(mVcI6PWoVz0uL)N5H@~aBw3ZuF^Na!67hOqU?2_cZa)s`}a({zaLHBa+rDL9cKUl00v@9 zM??Vs0RI60puMM)00009a7bBm001r{001r{0eGc9b^rhX2XskIMF-{w8VDyJ*pt`% z0000PbVXQnLvL+uWo~o;Lvm$dbY)~9cWHEJAV*0}P*;Ht7XSbOGD$>1R5;6}Q?W|J zP!v5kRAWfV&@3H7kz(nnLl*}renvM1zo6gHxnJPm)-P}s#6bt0oJvtd0(NPKkdOw4 z>kwYwyGcw154_iZO?%&0-&5Y6T*KI^nJxl2@sFlBB40M~dB zQLRZs9b#r&K4rpba$@7+aZ?iAoF0%cFwt^t0Km8hOc#2uuuiga1x1W|!1V{LYzd1lL*7^08Q5uylE!>%3pt@s_6dxS@1v9fOD5$$>FO20000X{_ysnDfrAaM2Fynm zKPM)M+koHohZy)fT^K%=??G_|OpLYBjsdR$TpVm*FR0Hu!XV3waK)Zba|V#}zy0`y z-vE#c48*^{Z5Nf11+zhh%{%alfuIXO2DlmvGQ58Bn88R>39R|t^?P78K?Ag&Jo^2) zaw$Woy)nb?v+o&_9K^tyK>%jJ-)c*SYcg`!0}*CGk&gw~Hjn`@05a&pOCAP-1_<$S zg9A~hX*pQKhc6Hp=q=0#2jaU=U-7$ux%D_W8qHRnh1(7akNZUd;Hbsx0_21Q(~X{> mz=4V@A(4}(sGFI{aRC6i_LosNM62}x0000X)7S5ICdEJW}iqBp_0NRi|Bki=(=@pQ1V`Vf%eU@)fU29td>KhgBPE%NC7%Soe# znK$Temax7$db|x2cYQt_kM>wA1|N{+&Wk#;z%p!(b(w0CJFP?>2Q~9Xtq9uZPrvA= zW;~zA+c=I_Ixo@!&uhlB`r;l5FN2XI>=AiUOL)|bm$^Kv&ou7A;dxODJj+XXb~p4z zufGH1nb-5mv=*)T1RnQ2%8Oc&kB4ic?U=y#9bdnk!klZ4vxqZ@(};6%&G|*d1q2#Z zF2yzHR}ohbml1Pu&G~i2HN-q(A+9;UiMWASMBIvN&e_lt6v2iLpA9q=*!@%dabE(P z`Yw#t)L)J?bz63Dq5EYkJZIp|GS#|Sqg6fA>iR2ksvg6<)DG$?H1qD4nwRn#t?KE# zo9R<|B0FHK*LYqdpOJd0RlS2ym({F1&C|0P&uhj@y~?xm>K&x#rIzyS933?9W^P{H zYctW5N3D~m`_kJ9P56N?7vo5Qk9F}Zckfyiu}Zj6I>SO zd`YIUiBzlWDRPR~Sn8$ryZ#7Gz2s?L%4;+>3^{D9hKHuf%xgTaS$(OOd(7DEfu}WV zeay478P99ROTEgo^Ln1YE904_HO-@8=x@#;@+N5MzSIhQtp4ulE$|Wgdr_X%qQ5E6 QG_6m0={c15KmUUs0#1QG8UO$Q literal 0 HcmV?d00001 From 6ae9e6f873e5e7b417797a3b47bf3e5fb8c84b64 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Tue, 26 Jul 2022 11:01:39 +0200 Subject: [PATCH 26/33] minor optimisations --- mods/ITEMS/mcl_beacons/init.lua | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 3dce00cb0..9b4774fdf 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -101,9 +101,9 @@ local formspec_string= "list[current_player;main;1,12.5;9,1;]" local function remove_beacon_beam(pos) - for y=pos.y+1, pos.y+501 do + for y=pos.y+1, pos.y+401 do local node = minetest.get_node({x=pos.x,y=y,z=pos.z}) - if node.name ~= "air" and node.name ~= "mcl_core:bedrock" then + if node.name ~= "air" and node.name ~= "mcl_core:bedrock" and node.name ~= "mcl_core:void" then if node.name == "ignore" then minetest.get_voxel_manip():read_from_map({x=pos.x,y=y,z=pos.z}, {x=pos.x,y=y,z=pos.z}) node = minetest.get_node({x=pos.x,y=y,z=pos.z}) @@ -160,10 +160,9 @@ local function globalstep_function(pos,player) return else local obstructed = false - for y=pos.y+1, pos.y+501 do - if y >= 31000 then return end + for y=pos.y+1, pos.y+301 do local nodename = minetest.get_node({x=pos.x,y=y, z = pos.z}).name - if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "ignore" then --ignore means not loaded, let's just assume that's air + if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "ignore" and nodename ~= "mcl_core:void" then --ignore means not loaded, let's just assume that's air if not string.match(nodename,"mcl_beacons:beacon_beam_") then if minetest.get_item_group(nodename,"glass") == 0 then obstructed = true @@ -273,7 +272,7 @@ minetest.register_node("mcl_beacons:beacon", { local beam_itemstring = "mcl_beacons:beacon_beam_e8e3e3" - for y = pos.y +1, pos.y + 501 do + for y = pos.y +1, pos.y + 401 do local node = minetest.get_node({x=pos.x,y=y,z=pos.z}) if node.name == ignore then minetest.get_voxel_manip():read_from_map({x=pos.x,y=y,z=pos.z}, {x=pos.x,y=y,z=pos.z}) @@ -284,8 +283,6 @@ minetest.register_node("mcl_beacons:beacon", { if y == pos.y+1 then if minetest.get_item_group(node.name, "glass") ~= 0 then beam_itemstring = get_beacon_beam(node.name) - elseif node.name == air then - minetest.set_node({x=pos.x,y=y,z=pos.z},{name=beam_itemstring}) end end From 022fa1d7949a0b49292c976c41d88db22eb49876 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Tue, 26 Jul 2022 11:07:45 +0200 Subject: [PATCH 27/33] remove last beam completly before placing a new one --- mods/ITEMS/mcl_beacons/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 9b4774fdf..cb349839d 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -271,7 +271,7 @@ minetest.register_node("mcl_beacons:beacon", { inv:set_stack("input",1,input) local beam_itemstring = "mcl_beacons:beacon_beam_e8e3e3" - + remove_beacon_beam(pos) for y = pos.y +1, pos.y + 401 do local node = minetest.get_node({x=pos.x,y=y,z=pos.z}) if node.name == ignore then From b9cb3a4d70661b186d8416b4e36d688c28428e9f Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sun, 31 Jul 2022 13:38:07 +0200 Subject: [PATCH 28/33] optimisations --- mods/ITEMS/mcl_beacons/init.lua | 112 +++++++++++------- .../textures/beacon_beam_palette.png | Bin 0 -> 613 bytes 2 files changed, 66 insertions(+), 46 deletions(-) create mode 100644 mods/ITEMS/mcl_beacons/textures/beacon_beam_palette.png diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index cb349839d..332c05215 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -9,66 +9,67 @@ Valid strings: ]]-- -local color_list = {"cdf4e9","f9fcfb","7c5e3d","1826c9","16f4f4","f483fc","9712bc","ea1212","adadad","535454","19e52a","549159","ef8813","ebf704","000000","e502d6","e8e3e3"} +--local color_list = {"cdf4e9","f9fcfb","7c5e3d","1826c9","16f4f4","f483fc","9712bc","ea1212","adadad","535454","19e52a","549159","ef8813","ebf704","000000","e502d6","e8e3e3"} local function get_beacon_beam(glass_nodename) if string.match(glass_nodename, "cyan") then - return "mcl_beacons:beacon_beam_cdf4e9" + return 1 elseif string.match(glass_nodename,"white") then - return "mcl_beacons:beacon_beam_f9fcfb" + return 2 elseif string.match(glass_nodename,"brown") then - return "mcl_beacons:beacon_beam_7c5e3d" + return 3 elseif string.match(glass_nodename,"blue") and not string.match(glass_nodename, "light") then - return "mcl_beacons:beacon_beam_1826c9" + return 4 elseif string.match(glass_nodename,"light_blue") then - return "mcl_beacons:beacon_beam_16f4f4" + return 5 elseif string.match(glass_nodename,"pink") then - return "mcl_beacons:beacon_beam_f483fc" + return 6 elseif string.match(glass_nodename, "purple") then - return "mcl_beacons:beacon_beam_9712bc" + return 7 elseif string.match(glass_nodename, "red") then - return "mcl_beacons:beacon_beam_ea1212" + return 8 elseif string.match(glass_nodename, "silver") then - return "mcl_beacons:beacon_beam_adadad" + return 9 elseif string.match(glass_nodename, "gray") then - return "mcl_beacons:beacon_beam_535454" + return 10 elseif string.match(glass_nodename, "lime") then - return "mcl_beacons:beacon_beam_19e52a" + return 11 elseif string.match(glass_nodename, "green") then - return "mcl_beacons:beacon_beam_549159" + return 12 elseif string.match(glass_nodename, "orange") then - return "mcl_beacons:beacon_beam_ef8813" + return 13 elseif string.match(glass_nodename, "yellow") then - return "mcl_beacons:beacon_beam_ebf704" + return 14 elseif string.match(glass_nodename, "black") then - return "mcl_beacons:beacon_beam_000000" + return 15 elseif string.match(glass_nodename, "magenta") then - return "mcl_beacons:beacon_beam_e502d6" + return 16 else - return "mcl_beacons:beacon_beam_e8e3e3" + return 0 end end +minetest.register_node("mcl_beacons:beacon_beam", { + tiles = {"^[colorize:#b8bab9"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.1250, -0.5000, -0.1250, 0.1250, 0.5000, 0.1250} + } + }, + pointable= false, + light_source = 15, + walkable = false, + groups = {not_in_creative_inventory=1}, + _mcl_blast_resistance = 1200, + paramtype2 = "color", + palette = "beacon_beam_palette.png", + palette_index = 0, + buildable_to = true, +}) - -for _, color in ipairs(color_list) do - minetest.register_node("mcl_beacons:beacon_beam_"..color, { - tiles = {"^[colorize:#"..color}, - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-0.1250, -0.5000, -0.1250, 0.1250, 0.5000, 0.1250} - } - }, - light_source = 15, - walkable = false, - groups = {not_in_creative_inventory=1}, - _mcl_blast_resistance = 1200, - }) - mesecon.register_mvps_stopper("mcl_beacons:beacon_beam_"..color) -end - +mesecon.register_mvps_stopper("mcl_beacons:beacon_beam") local formspec_string= "size[11,14]".. @@ -101,7 +102,7 @@ local formspec_string= "list[current_player;main;1,12.5;9,1;]" local function remove_beacon_beam(pos) - for y=pos.y+1, pos.y+401 do + for y=pos.y, pos.y+301 do local node = minetest.get_node({x=pos.x,y=y,z=pos.z}) if node.name ~= "air" and node.name ~= "mcl_core:bedrock" and node.name ~= "mcl_core:void" then if node.name == "ignore" then @@ -109,7 +110,7 @@ local function remove_beacon_beam(pos) node = minetest.get_node({x=pos.x,y=y,z=pos.z}) end - if string.match(node.name,"mcl_beacons:beacon_beam_") then + if node.name == "mcl_beacons:beacon_beam" then minetest.remove_node({x=pos.x,y=y,z=pos.z}) end end @@ -159,11 +160,13 @@ local function globalstep_function(pos,player) if meta:get_int("effect_level") == 2 and power_level < 4 then return else + local colorblock = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) local obstructed = false - for y=pos.y+1, pos.y+301 do + for y=pos.y+1, pos.y+200 do + local nodename = minetest.get_node({x=pos.x,y=y, z = pos.z}).name - if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "ignore" and nodename ~= "mcl_core:void" then --ignore means not loaded, let's just assume that's air - if not string.match(nodename,"mcl_beacons:beacon_beam_") then + if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "mcl_core:void" and nodename ~= "ignore" then --ignore means not loaded, let's just assume that's air + if nodename ~="mcl_beacons:beacon_beam" then if minetest.get_item_group(nodename,"glass") == 0 then obstructed = true remove_beacon_beam(pos) @@ -270,9 +273,9 @@ minetest.register_node("mcl_beacons:beacon", { input:take_item() inv:set_stack("input",1,input) - local beam_itemstring = "mcl_beacons:beacon_beam_e8e3e3" + local beam_palette_index = 0 remove_beacon_beam(pos) - for y = pos.y +1, pos.y + 401 do + for y = pos.y +1, pos.y + 201 do local node = minetest.get_node({x=pos.x,y=y,z=pos.z}) if node.name == ignore then minetest.get_voxel_manip():read_from_map({x=pos.x,y=y,z=pos.z}, {x=pos.x,y=y,z=pos.z}) @@ -282,12 +285,12 @@ minetest.register_node("mcl_beacons:beacon", { if y == pos.y+1 then if minetest.get_item_group(node.name, "glass") ~= 0 then - beam_itemstring = get_beacon_beam(node.name) + beam_palette_index = get_beacon_beam(node.name) end end if node.name == "air" then - minetest.set_node({x=pos.x,y=y,z=pos.z},{name=beam_itemstring}) + minetest.set_node({x=pos.x,y=y,z=pos.z},{name="mcl_beacons:beacon_beam",param2=beam_palette_index}) end end globalstep_function(pos,sender)--call it once outside the globalstep so the player gets the effect right after selecting it @@ -331,6 +334,23 @@ minetest.register_globalstep(function(dtime) end end) +minetest.register_abm{ + label="update beacon beam", + nodenames = {"mcl_beacons:beacon_beam"}, + interval = 1, + chance = 1, + action = function(pos) + local node_below = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) + local node_above = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) + + if node_below.name == "air" then + remove_beacon_beam(pos) + elseif node_above.name == "air" then + minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="mcl_beacons:beacon_beam",param2=node_above.param2}) + end + end, +} + minetest.register_craft({ output = "mcl_beacons:beacon", recipe = { diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_beam_palette.png b/mods/ITEMS/mcl_beacons/textures/beacon_beam_palette.png new file mode 100644 index 0000000000000000000000000000000000000000..099c85e4b67d7844562b1b9095bd8e1816a7aa52 GIT binary patch literal 613 zcmV-r0-F7aP)EX>4Tx04R}tkv&MmKpe$iQ>9WW4t5Yx%ut;yNELC^DionYs1;guFuC*#nlvOS zE{=k0!NHHks)LKOt`4q(Aou~|=;Wm6A|?JWEwqU7;J6>}?mh0_0YbgZG^=X@&~)2O zCE{WxyDA1=5x@w77)DHHmN6$uNqCO0d-(Wz7v)*r=l&eMYR+PSPb8jYhG`RT5KnK~ z2Iqa^Fe}O`@j3ChNf#u3x%kia6AAVGwJDoQBBMwC{a6bmWZk9+tBUB5&wg=bb;{@gF Date: Sun, 31 Jul 2022 13:42:42 +0200 Subject: [PATCH 29/33] fix color palette --- mods/ITEMS/mcl_beacons/init.lua | 3 --- .../textures/beacon_beam_palette.png | Bin 613 -> 624 bytes 2 files changed, 3 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 332c05215..0bd3ed61d 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -8,9 +8,6 @@ Valid strings: regeneration ]]-- - ---local color_list = {"cdf4e9","f9fcfb","7c5e3d","1826c9","16f4f4","f483fc","9712bc","ea1212","adadad","535454","19e52a","549159","ef8813","ebf704","000000","e502d6","e8e3e3"} - local function get_beacon_beam(glass_nodename) if string.match(glass_nodename, "cyan") then return 1 diff --git a/mods/ITEMS/mcl_beacons/textures/beacon_beam_palette.png b/mods/ITEMS/mcl_beacons/textures/beacon_beam_palette.png index 099c85e4b67d7844562b1b9095bd8e1816a7aa52..3cb9ecab62cd3069188cdafbdb19d4c52d8106ea 100644 GIT binary patch delta 85 zcmaFL@_}W;6Gm=sEjF8T{!$DK47rovGrHKW-@o}!dP2gF^B< Date: Sun, 31 Jul 2022 11:55:49 +0000 Subject: [PATCH 30/33] decrease blockcheck by 25 nodes that way, even with the lowest possible render distance, all nodes are loaded, if there are no nodes above the beacon (excluding glass etc.), it sets the meta and places the beam 175 blocks high, it extends all the way until the next non-air block if the player is near enoght... Signed-off-by: chmodsayshello --- mods/ITEMS/mcl_beacons/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 0bd3ed61d..0ddd71664 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -159,7 +159,7 @@ local function globalstep_function(pos,player) else local colorblock = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) local obstructed = false - for y=pos.y+1, pos.y+200 do + for y=pos.y+1, pos.y+170 do local nodename = minetest.get_node({x=pos.x,y=y, z = pos.z}).name if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "mcl_core:void" and nodename ~= "ignore" then --ignore means not loaded, let's just assume that's air From 1462c39092bcff39eb9dd73958f4fd351ea4160e Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sun, 31 Jul 2022 12:00:44 +0000 Subject: [PATCH 31/33] remove unnecessary minetest.get_node --- mods/ITEMS/mcl_beacons/init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 0ddd71664..b82fca706 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -157,9 +157,8 @@ local function globalstep_function(pos,player) if meta:get_int("effect_level") == 2 and power_level < 4 then return else - local colorblock = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) local obstructed = false - for y=pos.y+1, pos.y+170 do + for y=pos.y+1, pos.y+175 do local nodename = minetest.get_node({x=pos.x,y=y, z = pos.z}).name if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "mcl_core:void" and nodename ~= "ignore" then --ignore means not loaded, let's just assume that's air From 1830ca881582503b8517b45ce91713db775e52ec Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sun, 31 Jul 2022 12:25:57 +0000 Subject: [PATCH 32/33] 'fix' beacon beam abm --- mods/ITEMS/mcl_beacons/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index b82fca706..7f909edd0 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -158,7 +158,7 @@ local function globalstep_function(pos,player) return else local obstructed = false - for y=pos.y+1, pos.y+175 do + for y=pos.y+1, pos.y+100 do local nodename = minetest.get_node({x=pos.x,y=y, z = pos.z}).name if nodename ~= "mcl_core:bedrock" and nodename ~= "air" and nodename ~= "mcl_core:void" and nodename ~= "ignore" then --ignore means not loaded, let's just assume that's air @@ -342,7 +342,7 @@ minetest.register_abm{ if node_below.name == "air" then remove_beacon_beam(pos) elseif node_above.name == "air" then - minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="mcl_beacons:beacon_beam",param2=node_above.param2}) + minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="mcl_beacons:beacon_beam",param2=node_below.param2}) end end, } From 4d52c0d9c6c4014dd7f122905df483f6f078115f Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sun, 31 Jul 2022 12:34:23 +0000 Subject: [PATCH 33/33] glass no longer has to be right on top of the beacon --- mods/ITEMS/mcl_beacons/init.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_beacons/init.lua b/mods/ITEMS/mcl_beacons/init.lua index 7f909edd0..b23c55471 100644 --- a/mods/ITEMS/mcl_beacons/init.lua +++ b/mods/ITEMS/mcl_beacons/init.lua @@ -279,10 +279,8 @@ minetest.register_node("mcl_beacons:beacon", { end - if y == pos.y+1 then - if minetest.get_item_group(node.name, "glass") ~= 0 then - beam_palette_index = get_beacon_beam(node.name) - end + if minetest.get_item_group(node.name, "glass") ~= 0 then + beam_palette_index = get_beacon_beam(node.name) end if node.name == "air" then