From ec7e99019ed14903be0f1ce04818014659c1bdb6 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Sat, 21 Oct 2023 22:25:30 +0200 Subject: [PATCH] add trim advancements --- mods/HUD/mcl_achievements/init.lua | 21 +++++++ .../locale/mcl_achievements.de.tr | 4 ++ mods/HUD/mcl_achievements/locale/template.txt | 4 ++ mods/ITEMS/mcl_armor/api.lua | 10 ++- mods/ITEMS/mcl_armor/init.lua | 2 +- mods/ITEMS/mcl_armor/trims.lua | 18 ++++++ mods/ITEMS/mcl_smithing_table/init.lua | 59 ++++++++++++++---- .../silence_armor_trim_smithing_template.png | Bin 0 -> 279 bytes textures/silence_boots.png | Bin 0 -> 302 bytes textures/silence_chestplate.png | Bin 0 -> 617 bytes textures/silence_helmet.png | Bin 0 -> 529 bytes textures/silence_leggings.png | Bin 0 -> 575 bytes ...wayfinder_armor_trim_smithing_template.png | Bin 0 -> 238 bytes textures/wayfinder_boots.png | Bin 0 -> 310 bytes textures/wayfinder_chestplate.png | Bin 0 -> 390 bytes textures/wayfinder_helmet.png | Bin 0 -> 321 bytes textures/wayfinder_leggings.png | Bin 0 -> 276 bytes 17 files changed, 103 insertions(+), 15 deletions(-) mode change 100644 => 100755 mods/HUD/mcl_achievements/init.lua mode change 100644 => 100755 mods/HUD/mcl_achievements/locale/mcl_achievements.de.tr mode change 100644 => 100755 mods/HUD/mcl_achievements/locale/template.txt mode change 100644 => 100755 mods/ITEMS/mcl_armor/api.lua mode change 100644 => 100755 mods/ITEMS/mcl_smithing_table/init.lua create mode 100644 textures/silence_armor_trim_smithing_template.png create mode 100644 textures/silence_boots.png create mode 100644 textures/silence_chestplate.png create mode 100644 textures/silence_helmet.png create mode 100644 textures/silence_leggings.png create mode 100644 textures/wayfinder_armor_trim_smithing_template.png create mode 100644 textures/wayfinder_boots.png create mode 100644 textures/wayfinder_chestplate.png create mode 100644 textures/wayfinder_helmet.png create mode 100644 textures/wayfinder_leggings.png diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua old mode 100644 new mode 100755 index 4d272fe86..61ef9a9f2 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -431,6 +431,27 @@ awards.register_achievement("mcl:wax_off", { group = "Husbandry", }) +-- Triggered in mcl_smithing_table +awards.register_achievement("mcl:trim", { + title = S("Crafting a New Look"), + description = S("Craft a trimmed armor at a Smithing Table"), + icon = "dune_armor_trim_smithing_template.png", + type = "Advancement", + group = "Adventure", +}) + +awards.register_achievement("mcl:lots_of_trimming", { + title = S("Smithing with Style"), + description = S("Apply these smithing templates at least once: Spire, Snout, Rib, Ward, Silence, Vex, Tide, Wayfinder"), + icon = "silence_armor_trim_smithing_template.png", + type = "Advancement", + group = "Adventure", + on_unlock = function(name, awdef) + -- delete json that is no longer needed + minetest.get_player_by_name(name):get_meta():set_string("mcl_smithing_table:achievement_trims", "") + end, +}) + -- 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 old mode 100644 new mode 100755 index 1c6f668e5..7b73d1887 --- a/mods/HUD/mcl_achievements/locale/mcl_achievements.de.tr +++ b/mods/HUD/mcl_achievements/locale/mcl_achievements.de.tr @@ -51,3 +51,7 @@ 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. +Crafting a New Look=Ein neues Aussehen +Craft a trimmed armor at a Smithing Table=Versieh ein Rüstungsteil an einem Schmiedetisch mit einem Rüstungsbesatz +Smithing with Style=Schmieden mit Stil +Apply these smithing templates at least once: Spire, Snout, Rib, Ward, Silence, Vex, Tide, Wayfinder=Wende jede dieser Schmiedevorlagen mindestens einmal an: Turmspitze, Schnauze, Rippe, Warthof, Stille, Plagegeist, Gezeiten und Wegfinder \ No newline at end of file diff --git a/mods/HUD/mcl_achievements/locale/template.txt b/mods/HUD/mcl_achievements/locale/template.txt old mode 100644 new mode 100755 index d865b1668..89c422a08 --- a/mods/HUD/mcl_achievements/locale/template.txt +++ b/mods/HUD/mcl_achievements/locale/template.txt @@ -111,3 +111,7 @@ Voluntary Exile= Kill a raid captain. Maybe consider staying away from the local villages for the time being...= Tactical Fishing= Catch a fish... without a fishing rod!= +Crafting a New Look= +Craft a trimmed armor at a Smithing Table= +Smithing with Style= +Apply these smithing templates at least once: Spire, Snout, Rib, Ward, Silence, Vex, Tide, Wayfinder= \ No newline at end of file diff --git a/mods/ITEMS/mcl_armor/api.lua b/mods/ITEMS/mcl_armor/api.lua old mode 100644 new mode 100755 index 558607785..1e88643f1 --- a/mods/ITEMS/mcl_armor/api.lua +++ b/mods/ITEMS/mcl_armor/api.lua @@ -326,11 +326,17 @@ end tt.register_snippet(function(itemstring, toolcaps, stack) if not stack then return nil end local meta = stack:get_meta() - if meta:get_string("mcl_armor:trim_overlay") == "" then return nil end -- remember, get_string returns "" if the key doesn't exist + if not mcl_armor.is_trimmed(stack) then return nil end -- we need to get the part of the overlay image between the overlay begin ( and the trim name end _ -- we COULD easily store this info in meta, but that would bloat the meta storage, as the same few values would be stored over and over again on every trimmed item -- this is fine here as this code gets only executed when you put armor and a trim in a smithing table local full_overlay = meta:get_string("mcl_armor:trim_overlay") local trim_name = full_overlay:match("%((.-)%_") return "Upgrade:\n " .. trim_name:gsub("^%l", string.upper) .. " Armor Trim" -end) \ No newline at end of file +end) + +function mcl_armor.is_trimmed(itemstack) + -- this meta value will be there for every trimmed armor piece + -- remember, get_string returns "" if the key doesn't exist + return itemstack:get_meta():get_string("mcl_armor:trim_overlay") ~= "" +end \ No newline at end of file diff --git a/mods/ITEMS/mcl_armor/init.lua b/mods/ITEMS/mcl_armor/init.lua index e85158f6c..402d9eef3 100644 --- a/mods/ITEMS/mcl_armor/init.lua +++ b/mods/ITEMS/mcl_armor/init.lua @@ -60,7 +60,7 @@ mcl_armor = { trims = { core_textures = {}, blacklisted = {["mcl_armor:elytra"]=true, ["mcl_armor:elytra_enchanted"]=true}, - overlays = {"sentry","dune","coast","wild","tide","ward","vex","rib","snout","eye","spire"}, + overlays = {"sentry","dune","coast","wild","tide","ward","vex","rib","snout","eye","spire","silence","wayfinder"}, colors = {["amethyst"]="#8246a5",["gold"]="#ce9627",["emerald"]="#1b9958",["copper"]="#c36447",["diamond"]="#5faed8",["iron"]="#938e88",["lapis"]="#1c306b",["netherite"]="#302a26",["quartz"]="#c9bcb9",["redstone"]="#af2c23"}, }, } diff --git a/mods/ITEMS/mcl_armor/trims.lua b/mods/ITEMS/mcl_armor/trims.lua index 9e8e32625..76d37deb0 100644 --- a/mods/ITEMS/mcl_armor/trims.lua +++ b/mods/ITEMS/mcl_armor/trims.lua @@ -43,4 +43,22 @@ minetest.register_craft({ {"mcl_core:diamond","mcl_core:goldblock","mcl_core:diamond"}, {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, } +}) + +minetest.register_craft({ + output = mod_registername .. "silence", + recipe = { + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + {"mcl_core:diamond", mod_registername.."ward","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } +}) + +minetest.register_craft({ + output = mod_registername .. "wayfinder", + recipe = { + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + {"mcl_core:diamond", "mcl_maps:empty_map","mcl_core:diamond"}, + {"mcl_core:diamond","mcl_core:diamond","mcl_core:diamond"}, + } }) \ No newline at end of file diff --git a/mods/ITEMS/mcl_smithing_table/init.lua b/mods/ITEMS/mcl_smithing_table/init.lua old mode 100644 new mode 100755 index 4690a1ed6..1794f8791 --- a/mods/ITEMS/mcl_smithing_table/init.lua +++ b/mods/ITEMS/mcl_smithing_table/init.lua @@ -88,7 +88,18 @@ local smithing_materials = { ["mcl_copper:copper_ingot"] = "copper", ["mcl_core:emerald"] = "emerald", ["mcl_nether:quartz"] = "quartz" -} +} + +local achievement_trims = { + ["mcl_armor:spire"] = true, + ["mcl_armor:snout"] = true, + ["mcl_armor:rib"] = true, + ["mcl_armor:ward"] = true, + ["mcl_armor:silence"] = true, + ["mcl_armor:vex"] = true, + ["mcl_armor:tide"] = true, + ["mcl_armor:wayfinder"] = true +} function mcl_smithing_table.upgrade_trimmed(itemstack, color_mineral, template) --get information required @@ -181,27 +192,51 @@ minetest.register_node("mcl_smithing_table:table", { on_metadata_inventory_take = function(pos, listname, index, stack, player) local inv = minetest.get_meta(pos):get_inventory() - + local function take_item(listname) local itemstack = inv:get_stack(listname, 1) itemstack:take_item() inv:set_stack(listname, 1, itemstack) end - + if listname == "upgraded_item" then + -- ToDo: make epic sound + minetest.sound_play("mcl_smithing_table_upgrade", { pos = pos, max_hear_distance = 16 }) + + if stack:get_name() == "mcl_farming:hoe_netherite" then + awards.unlock(player:get_player_name(), "mcl:seriousDedication") + elseif mcl_armor.is_trimmed(stack) then + local template_name = inv:get_stack("template", 1):get_name() + local playername = player:get_player_name() + awards.unlock(playername, "mcl:trim") + + if not awards.players[playername].unlocked["mcl:lots_of_trimming"] and achievement_trims[template_name] then + local meta = player:get_meta() + local used_achievement_trims = minetest.deserialize(meta:get_string("mcl_smithing_table:achievement_trims")) or {} + if not used_achievement_trims[template_name] then + used_achievement_trims[template_name] = true + end + + local used_all = true + for name, _ in pairs(achievement_trims) do + if not used_achievement_trims[name] then + used_all = false + break + end + end + + if used_all then + awards.unlock(playername, "mcl:lots_of_trimming") + else + meta:set_string("mcl_smithing_table:achievement_trims", minetest.serialize(used_achievement_trims)) + end + end + end + take_item("upgrade_item") take_item("mineral") take_item("template") - - -- ToDo: make epic sound - minetest.sound_play("mcl_smithing_table_upgrade", { pos = pos, max_hear_distance = 16 }) end - if listname == "upgraded_item" then - if stack:get_name() == "mcl_farming:hoe_netherite" then - awards.unlock(player:get_player_name(), "mcl:seriousDedication") - end - end - reset_upgraded_item(pos) end, diff --git a/textures/silence_armor_trim_smithing_template.png b/textures/silence_armor_trim_smithing_template.png new file mode 100644 index 0000000000000000000000000000000000000000..77e72d074b3c83e8e38e6351e99087e8b496d4d7 GIT binary patch literal 279 zcmV+y0qFjTP)P)t-s00009 zY;@_JNa2M(v{)GnDl!TqDg_S|QBO`uM@Cv$RtOs;Iyg9};{SKf`$0cHU#{5O?)+Am z!~_ZtG%_+SEiDHV8&83)MslAwog&fz000GaQchC<{QUgNklnXkN4%+G-&Ns=TbTW`^5;_Oz}73Tw9|vmVh8m6!ylPXI-Nobo_j%N8=DG$0@~GW>;)RlLuoa;Wwol< zQG3bU8*i8~<2v>NnHHg7;}?EoV^GI{4I>t6LIF{n>>Uc4@RK_y{1B9VBKaU&m1%O3e+Drr$4gdfE07*qoM6N<$f+5|8 A8vp+;4MJ`2bE~|yje&u7B|DS*6K~7FiPEJlvPEO8$ zrmt5)@~u$-ZAr`KZ8l0FDKP!6B0fG?TPNK)dmFAnGTOMHi(z8E61KF+SBgrQ(g6bm zO--USqXFB~BIv9r&#h*cU($G?fnEt6)1Z(tDGyl@?1tUukz16Dim5Ef7cCkNu&x1` zoQax8`+L1Z5)3M=yN!6nl^f`YZiK#648suLcDczjL&w8kQnEW*HJIVC)ihvUZO*KO5; zKf52pKo?)0Sd$5dy_X_>_d+0*g3Q>kf-|2TdjP;)?y-NgLD+H=;%8sM4=X7KH8;UN z-vv(5&#DAQ3<*PQMy2kdB@9M8#~ulQ6TJ#--Y^6=%$6;fCmsv3<%SQw7IS=NJWk@K zHZ@^9tNbw%2v1u~0Mceks!;-3(y}d^2hI literal 0 HcmV?d00001 diff --git a/textures/silence_helmet.png b/textures/silence_helmet.png new file mode 100644 index 0000000000000000000000000000000000000000..ad2de6ab0b9962270d5481b57a93525ad094a243 GIT binary patch literal 529 zcmV+s0`C2ZP)Iq%2#3trBBu;`+lGf#YhwUINvCiP6c@}nkFn)k9V8i9C&mWQ1J$nv@0$Z_ccq^Wpc{IES=+rE( z%sh<&Nu)+GT_F{e~c7lkC$0DuBQT0o#a+P5OLm7WaR_M?&8ovP$f{s05 z+ZLMzHP~Wb9`xGZp=t#!aE*#q2?q8|nU@Fi7EItLw5q=ANyp)J%=P)b+cPzFXfeM4*2R#7y0N((3rHA|9^<(u^tEm9-2tb1? zM#F`-06BCEGBC1)S;jNaI)=~0yRN4maA3XcCj(SV%c5ep_?UOj=^hkIKhrusy4;XK zg{Ha(m}T$NbK9MFCyr_f*5x0|Y81HSA8P*hQ?})`e*hXk^$#H95YT{5^uPj|_0&^) z@kZ2BLv8imz@x)jK@IYW4x>IfflCW4icC>u033I@+I`Q?>fKa;iwU@L#`*=&yT1m* zXZpmNUHp5V19W>fNV@MGlB;h2ss7&q$f4TE-D zls5&?jN?SYyjCB|&ku|YC`kKe2X_*5VoT6L3Kh&ZOblX}U%FNMlP0=auVR oP@A`z1;u;xng8FT>`&g+4aEEdmvlY4>;M1&07*qoM6N<$g1Ycrh5!Hn literal 0 HcmV?d00001 diff --git a/textures/wayfinder_boots.png b/textures/wayfinder_boots.png new file mode 100644 index 0000000000000000000000000000000000000000..5e8717ccb612bea99fc55d38ca4a7ddba3e942a5 GIT binary patch literal 310 zcmV-60m=S}P)7%D%q7qobpel9J2H$fKj9q@<*zq@;+5h+|`8oSdBF1&(dPYV@W@ctqR#uCPi*j;uaBy&7U|_MZu8N9^KtMoJQc`1MV{vhD zX&G&Q0000abW%=J00jyK1qyXP3UGA>KL&Mh3O{f^b#Om*Ky^QGbw3IP3JL`Zq5#Ok z00010NklLzSEWBNgl)BNS_Wd$~12aZ!-Ur^ZswVIuDTL1t607*qo IM6N<$g2X9)e*gdg literal 0 HcmV?d00001 diff --git a/textures/wayfinder_chestplate.png b/textures/wayfinder_chestplate.png new file mode 100644 index 0000000000000000000000000000000000000000..6f5f5f2eaa9104cabf6a2a9d784e88d4b3dd6892 GIT binary patch literal 390 zcmV;10eSw3P)t<807*qoM6N<$f&`VT6951J literal 0 HcmV?d00001 diff --git a/textures/wayfinder_helmet.png b/textures/wayfinder_helmet.png new file mode 100644 index 0000000000000000000000000000000000000000..d2e7fe7654128b03ef4920c2cd576c1d4ecdead9 GIT binary patch literal 321 zcmV-H0lxl;P)@E=f<;i4?3(1km$1J;OqR=?MY+Qw zz624+#xM+Fimp7xAZsRXP~?2dfpa*V9~@9hssA7{kpMKLBLH^>;K2ZNq#*#;a%#TY z4bq=qFD?{5eBf>f?HGZ3&HKW0EkibckWAD<+a`8X^xJodlD#U_1x7qX(xT*32Uy)0 zN_MIz=EXOi80oE;{(sIR^FdDrI3&N1p1yPL&KZoD#661;2jW}C#vsROK- z{VqT#5PR5`7Ki?8*6Z~uYz_96az~TgS{QH@E|=1O;77_*mR~xplu}A5_2+y7$*E7F TZJi}e00000NkvXXu0mjfL5+%Z literal 0 HcmV?d00001 diff --git a/textures/wayfinder_leggings.png b/textures/wayfinder_leggings.png new file mode 100644 index 0000000000000000000000000000000000000000..64dbe2015ccbc1bcc7ad8473581edb28197608e0 GIT binary patch literal 276 zcmV+v0qg#WP)