add trim advancements

This commit is contained in:
chmodsayshello 2023-10-21 22:25:30 +02:00
parent 712a6d6c66
commit ec7e99019e
17 changed files with 103 additions and 15 deletions

21
mods/HUD/mcl_achievements/init.lua Normal file → Executable file
View File

@ -431,6 +431,27 @@ awards.register_achievement("mcl:wax_off", {
group = "Husbandry", 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.) -- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.)
if non_pc_achievements then if non_pc_achievements then

View File

@ -51,3 +51,7 @@ Bring Home the Beacon=Den Nachbarn heimleuchten
Use a beacon.=Benutzen Sie ein Leuchtfeuer. Use a beacon.=Benutzen Sie ein Leuchtfeuer.
Beaconator=Leuchtturmwärter Beaconator=Leuchtturmwärter
Use a fully powered beacon.=Benutzen Sie ein vollständiges Leuchtfeuer. 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

4
mods/HUD/mcl_achievements/locale/template.txt Normal file → Executable file
View File

@ -111,3 +111,7 @@ Voluntary Exile=
Kill a raid captain. Maybe consider staying away from the local villages for the time being...= Kill a raid captain. Maybe consider staying away from the local villages for the time being...=
Tactical Fishing= Tactical Fishing=
Catch a fish... without a fishing rod!= 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=

8
mods/ITEMS/mcl_armor/api.lua Normal file → Executable file
View File

@ -326,7 +326,7 @@ end
tt.register_snippet(function(itemstring, toolcaps, stack) tt.register_snippet(function(itemstring, toolcaps, stack)
if not stack then return nil end if not stack then return nil end
local meta = stack:get_meta() 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 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 -- 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 -- this is fine here as this code gets only executed when you put armor and a trim in a smithing table
@ -334,3 +334,9 @@ tt.register_snippet(function(itemstring, toolcaps, stack)
local trim_name = full_overlay:match("%((.-)%_") local trim_name = full_overlay:match("%((.-)%_")
return "Upgrade:\n " .. trim_name:gsub("^%l", string.upper) .. " Armor Trim" return "Upgrade:\n " .. trim_name:gsub("^%l", string.upper) .. " Armor Trim"
end) 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

View File

@ -60,7 +60,7 @@ mcl_armor = {
trims = { trims = {
core_textures = {}, core_textures = {},
blacklisted = {["mcl_armor:elytra"]=true, ["mcl_armor:elytra_enchanted"]=true}, 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"}, colors = {["amethyst"]="#8246a5",["gold"]="#ce9627",["emerald"]="#1b9958",["copper"]="#c36447",["diamond"]="#5faed8",["iron"]="#938e88",["lapis"]="#1c306b",["netherite"]="#302a26",["quartz"]="#c9bcb9",["redstone"]="#af2c23"},
}, },
} }

View File

@ -44,3 +44,21 @@ minetest.register_craft({
{"mcl_core:diamond","mcl_core:diamond","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"},
}
})

53
mods/ITEMS/mcl_smithing_table/init.lua Normal file → Executable file
View File

@ -90,6 +90,17 @@ local smithing_materials = {
["mcl_nether:quartz"] = "quartz" ["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) function mcl_smithing_table.upgrade_trimmed(itemstack, color_mineral, template)
--get information required --get information required
local material_name = color_mineral:get_name() local material_name = color_mineral:get_name()
@ -189,19 +200,43 @@ minetest.register_node("mcl_smithing_table:table", {
end end
if listname == "upgraded_item" then 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("upgrade_item")
take_item("mineral") take_item("mineral")
take_item("template") take_item("template")
-- ToDo: make epic sound
minetest.sound_play("mcl_smithing_table_upgrade", { pos = pos, max_hear_distance = 16 })
end 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) reset_upgraded_item(pos)
end, end,

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

BIN
textures/silence_boots.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

BIN
textures/silence_helmet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B