add trim advancements
|
@ -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
|
||||||
|
|
|
@ -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
|
|
@ -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=
|
|
@ -326,11 +326,17 @@ 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
|
||||||
local full_overlay = meta:get_string("mcl_armor:trim_overlay")
|
local full_overlay = meta:get_string("mcl_armor:trim_overlay")
|
||||||
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
|
|
@ -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"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,4 +43,22 @@ minetest.register_craft({
|
||||||
{"mcl_core:diamond","mcl_core:goldblock","mcl_core:diamond"},
|
{"mcl_core:diamond","mcl_core:goldblock","mcl_core:diamond"},
|
||||||
{"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"},
|
||||||
|
}
|
||||||
})
|
})
|
|
@ -88,7 +88,18 @@ local smithing_materials = {
|
||||||
["mcl_copper:copper_ingot"] = "copper",
|
["mcl_copper:copper_ingot"] = "copper",
|
||||||
["mcl_core:emerald"] = "emerald",
|
["mcl_core:emerald"] = "emerald",
|
||||||
["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
|
||||||
|
@ -181,27 +192,51 @@ minetest.register_node("mcl_smithing_table:table", {
|
||||||
|
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
|
|
||||||
local function take_item(listname)
|
local function take_item(listname)
|
||||||
local itemstack = inv:get_stack(listname, 1)
|
local itemstack = inv:get_stack(listname, 1)
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
inv:set_stack(listname, 1, itemstack)
|
inv:set_stack(listname, 1, itemstack)
|
||||||
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,
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 279 B |
After Width: | Height: | Size: 302 B |
After Width: | Height: | Size: 617 B |
After Width: | Height: | Size: 529 B |
After Width: | Height: | Size: 575 B |
After Width: | Height: | Size: 238 B |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 390 B |
After Width: | Height: | Size: 321 B |
After Width: | Height: | Size: 276 B |