mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Switched to item list as an input for modular components so that allowed items could be centralized.
This commit is contained in:
parent
b01e816c0d
commit
2aad3f3961
9
assets/common/crafting/metal_weapon_materials.ron
Normal file
9
assets/common/crafting/metal_weapon_materials.ron
Normal file
@ -0,0 +1,9 @@
|
||||
// Potentially make more fine grained later if needed
|
||||
([
|
||||
"common.items.mineral.ingot.bronze",
|
||||
"common.items.mineral.ingot.iron",
|
||||
"common.items.mineral.ingot.steel",
|
||||
"common.items.mineral.ingot.cobalt",
|
||||
"common.items.mineral.ingot.bloodsteel",
|
||||
"common.items.mineral.ingot.orichalcum",
|
||||
])
|
9
assets/common/crafting/wood_weapon_materials.ron
Normal file
9
assets/common/crafting/wood_weapon_materials.ron
Normal file
@ -0,0 +1,9 @@
|
||||
// Potentially make more fine grained later if needed
|
||||
([
|
||||
"common.items.log.wood",
|
||||
"common.items.log.bamboo",
|
||||
"common.items.log.hardwood",
|
||||
"common.items.log.ironwood",
|
||||
"common.items.log.frostwood",
|
||||
"common.items.log.eldwood",
|
||||
])
|
@ -1876,7 +1876,7 @@
|
||||
"longsword blade": (
|
||||
output: ("common.items.crafting_ing.modular.damage.sword.longsword", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
craft_sprite: Some(Anvil),
|
||||
@ -1885,7 +1885,7 @@
|
||||
"sawblade": (
|
||||
output: ("common.items.crafting_ing.modular.damage.sword.sawblade", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.sharp_fang"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -1895,7 +1895,7 @@
|
||||
"katana blade": (
|
||||
output: ("common.items.crafting_ing.modular.damage.sword.katana", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.claw"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -1905,7 +1905,7 @@
|
||||
"zweihander blade": (
|
||||
output: ("common.items.crafting_ing.modular.damage.sword.zweihander", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.long_tusk"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -1915,7 +1915,7 @@
|
||||
"sabre blade": (
|
||||
output: ("common.items.crafting_ing.modular.damage.sword.sabre", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.strong_pincer"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -1925,7 +1925,7 @@
|
||||
"greatsword blade": (
|
||||
output: ("common.items.crafting_ing.modular.damage.sword.greatsword", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.large_horn"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -1935,7 +1935,7 @@
|
||||
"ornate sword blade": (
|
||||
output: ("common.items.crafting_ing.modular.damage.sword.ornate", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.elegant_crest"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -1974,7 +1974,7 @@
|
||||
"hammer head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.hammer.hammer", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
craft_sprite: Some(Anvil),
|
||||
@ -1983,7 +1983,7 @@
|
||||
"spiked mace head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.hammer.spikedmace", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.sharp_fang"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -1993,7 +1993,7 @@
|
||||
"warhammer head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.hammer.warhammer", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.claw"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -2003,7 +2003,7 @@
|
||||
"maul head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.hammer.maul", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.long_tusk"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -2013,7 +2013,7 @@
|
||||
"great mace head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.hammer.greatmace", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.strong_pincer"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -2023,7 +2023,7 @@
|
||||
"greathammer head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.hammer.greathammer", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.large_horn"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -2033,7 +2033,7 @@
|
||||
"ornate hammer head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.hammer.ornate", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.elegant_crest"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -2072,7 +2072,7 @@
|
||||
"axe head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.axe.axe", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.sharp_fang"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -2082,7 +2082,7 @@
|
||||
"jagged axe head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.axe.jagged", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
craft_sprite: Some(Anvil),
|
||||
@ -2091,7 +2091,7 @@
|
||||
"battleaxe head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.axe.battleaxe", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.claw"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -2101,7 +2101,7 @@
|
||||
"poleaxe head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.axe.poleaxe", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.long_tusk"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -2111,7 +2111,7 @@
|
||||
"labrys axe head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.axe.labrys", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.strong_pincer"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -2121,7 +2121,7 @@
|
||||
"greataxe head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.axe.greataxe", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.large_horn"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -2131,7 +2131,7 @@
|
||||
"ornate axe head": (
|
||||
output: ("common.items.crafting_ing.modular.damage.axe.ornate", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Metal)), 5, true),
|
||||
(ListSameItem("common.crafting.metal_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.elegant_crest"), 1, false),
|
||||
(Item("common.items.tool.craftsman_hammer"), 0, false),
|
||||
],
|
||||
@ -2170,7 +2170,7 @@
|
||||
"bow limbs": (
|
||||
output: ("common.items.crafting_ing.modular.damage.bow.bow", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.sticky_thread"), 3, false),
|
||||
],
|
||||
craft_sprite: Some(CraftingBench),
|
||||
@ -2179,7 +2179,7 @@
|
||||
"composite bow limbs": (
|
||||
output: ("common.items.crafting_ing.modular.damage.bow.composite", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.sharp_fang"), 1, false),
|
||||
(Item("common.items.crafting_ing.sticky_thread"), 3, false),
|
||||
],
|
||||
@ -2189,7 +2189,7 @@
|
||||
"greatbow limbs": (
|
||||
output: ("common.items.crafting_ing.modular.damage.bow.greatbow", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.large_horn"), 1, false),
|
||||
(Item("common.items.crafting_ing.sticky_thread"), 3, false),
|
||||
],
|
||||
@ -2199,7 +2199,7 @@
|
||||
"longbow limbs": (
|
||||
output: ("common.items.crafting_ing.modular.damage.bow.longbow", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.long_tusk"), 1, false),
|
||||
(Item("common.items.crafting_ing.sticky_thread"), 3, false),
|
||||
],
|
||||
@ -2209,7 +2209,7 @@
|
||||
"ornate bow limbs": (
|
||||
output: ("common.items.crafting_ing.modular.damage.bow.ornate", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.elegant_crest"), 1, false),
|
||||
(Item("common.items.crafting_ing.sticky_thread"), 3, false),
|
||||
],
|
||||
@ -2219,7 +2219,7 @@
|
||||
"shortbow limbs": (
|
||||
output: ("common.items.crafting_ing.modular.damage.bow.shortbow", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.claw"), 1, false),
|
||||
(Item("common.items.crafting_ing.sticky_thread"), 3, false),
|
||||
],
|
||||
@ -2229,7 +2229,7 @@
|
||||
"warbow limbs": (
|
||||
output: ("common.items.crafting_ing.modular.damage.bow.warbow", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.strong_pincer"), 1, false),
|
||||
(Item("common.items.crafting_ing.sticky_thread"), 3, false),
|
||||
],
|
||||
@ -2268,7 +2268,7 @@
|
||||
"brand shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.staff.brand", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.claw"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2278,7 +2278,7 @@
|
||||
"grandstaff shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.staff.grandstaff", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.large_horn"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2288,7 +2288,7 @@
|
||||
"longpole shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.staff.longpole", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.long_tusk"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2298,7 +2298,7 @@
|
||||
"ornate staff shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.staff.ornate", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.elegant_crest"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2308,7 +2308,7 @@
|
||||
"pole shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.staff.pole", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.sharp_fang"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2318,7 +2318,7 @@
|
||||
"rod shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.staff.rod", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.strong_pincer"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2328,7 +2328,7 @@
|
||||
"staff shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.staff.staff", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
craft_sprite: Some(CraftingBench),
|
||||
@ -2366,7 +2366,7 @@
|
||||
"arbor shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.sceptre.arbor", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.long_tusk"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2376,7 +2376,7 @@
|
||||
"cane shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.sceptre.cane", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.strong_pincer"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2386,7 +2386,7 @@
|
||||
"crook shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.sceptre.crook", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.sharp_fang"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2396,7 +2396,7 @@
|
||||
"crozier shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.sceptre.crozier", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.claw"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2406,7 +2406,7 @@
|
||||
"grandsceptre shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.sceptre.grandsceptre", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.large_horn"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2416,7 +2416,7 @@
|
||||
"ornate sceptre shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.sceptre.ornate", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.animal_misc.elegant_crest"), 1, false),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
@ -2426,7 +2426,7 @@
|
||||
"sceptre shaft": (
|
||||
output: ("common.items.crafting_ing.modular.held.sceptre.sceptre", 1),
|
||||
inputs: [
|
||||
(TagSameItem(MaterialKind(Wood)), 5, true),
|
||||
(ListSameItem("common.crafting.wood_weapon_materials"), 5, true),
|
||||
(Item("common.items.crafting_ing.leather.leather_strips"), 2, false),
|
||||
],
|
||||
craft_sprite: Some(CraftingBench),
|
||||
|
@ -840,6 +840,9 @@ impl Item {
|
||||
RecipeInput::TagSameItem(tag, amount) => {
|
||||
self.item_def.tags.contains(tag) && u32::from(self.amount) >= *amount
|
||||
},
|
||||
RecipeInput::ListSameItem(item_defs, amount) => item_defs.iter().any(|item_def| {
|
||||
self.is_same_item_def(item_def) && u32::from(self.amount) >= *amount
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,13 +219,19 @@ pub fn random_weapon(tool: ToolKind, material: super::Material, hands: Option<Ha
|
||||
.values()
|
||||
// Filter by recipes that have an output of the item of interest
|
||||
.filter(|recipe| recipe.output.0.eq(item))
|
||||
// Check that item is composed of material, uses heuristic that assumes all modular components use the TagSameItem recipe input
|
||||
// Check that item is composed of material, uses heuristic that assumes all modular components use the ListSameItem recipe input
|
||||
.any(|recipe| {
|
||||
recipe
|
||||
.inputs
|
||||
.iter()
|
||||
.any(|input| {
|
||||
matches!(input.0, recipe::RawRecipeInput::TagSameItem(item_tag) if item_tag == super::ItemTag::MaterialKind(material.material_kind()))
|
||||
match &input.0 {
|
||||
recipe::RawRecipeInput::ListSameItem(items) => {
|
||||
let assets = recipe::ItemList::load_expect_cloned(items).0;
|
||||
assets.iter().any(|asset| Some(asset.as_str()) == material.asset_identifier())
|
||||
},
|
||||
_ => false,
|
||||
}
|
||||
})
|
||||
})
|
||||
};
|
||||
|
@ -16,6 +16,9 @@ pub enum RecipeInput {
|
||||
Item(Arc<ItemDef>),
|
||||
Tag(ItemTag),
|
||||
TagSameItem(ItemTag, u32),
|
||||
// List similar to tag, but has items defined in centralized file
|
||||
// Intent is to make it harder for tag to be innocuously added to an item breaking a recipe
|
||||
ListSameItem(Vec<Arc<ItemDef>>, u32),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
@ -39,6 +42,7 @@ impl Recipe {
|
||||
) -> Result<Vec<Item>, Vec<(&RecipeInput, u32)>> {
|
||||
let mut slot_claims = HashMap::new();
|
||||
let mut unsatisfied_requirements = Vec::new();
|
||||
let mut component_slots = Vec::new();
|
||||
|
||||
// Checks each input against slots in the inventory. If the slots contain an
|
||||
// item that fulfills the need of the input, marks some of the item as claimed
|
||||
@ -48,7 +52,7 @@ impl Recipe {
|
||||
self.inputs
|
||||
.iter()
|
||||
.enumerate()
|
||||
.for_each(|(i, (input, mut required, _is_component))| {
|
||||
.for_each(|(i, (input, mut required, mut is_component))| {
|
||||
// Check used for recipes that have an input that is not consumed, e.g.
|
||||
// craftsman hammer
|
||||
let mut contains_any = false;
|
||||
@ -70,6 +74,13 @@ impl Recipe {
|
||||
let provided = available.min(required);
|
||||
required -= provided;
|
||||
*claimed += provided;
|
||||
// If input is a component and provided amount from this slot at least 1,
|
||||
// mark 1 piece as coming from that slot and set is_component to false to
|
||||
// indicate it has been claimed.
|
||||
if provided > 0 && is_component {
|
||||
component_slots.push(*slot);
|
||||
is_component = false;
|
||||
}
|
||||
contains_any = true;
|
||||
}
|
||||
}
|
||||
@ -84,6 +95,17 @@ impl Recipe {
|
||||
// recipe in the necessary quantity and remove the items that the recipe
|
||||
// consumes
|
||||
if unsatisfied_requirements.is_empty() {
|
||||
let mut components = Vec::new();
|
||||
for slot in component_slots.iter() {
|
||||
let component = inv
|
||||
.take(*slot, ability_map, msm)
|
||||
.expect("Expected item to exist in the inventory");
|
||||
components.push(component);
|
||||
let claimed = slot_claims
|
||||
.get_mut(slot)
|
||||
.expect("If marked in component slots, should be in slot claims");
|
||||
*claimed -= 1;
|
||||
}
|
||||
for (slot, to_remove) in slot_claims.iter() {
|
||||
for _ in 0..*to_remove {
|
||||
let _ = inv
|
||||
@ -92,7 +114,12 @@ impl Recipe {
|
||||
}
|
||||
}
|
||||
let (item_def, quantity) = &self.output;
|
||||
let crafted_item = Item::new_from_item_def(Arc::clone(item_def), &[], ability_map, msm);
|
||||
|
||||
let mut crafted_item =
|
||||
Item::new_from_item_def(Arc::clone(item_def), &[], ability_map, msm);
|
||||
for component in components {
|
||||
crafted_item.add_component(component, ability_map, msm);
|
||||
}
|
||||
let mut crafted_items = Vec::with_capacity(*quantity as usize);
|
||||
for _ in 0..*quantity {
|
||||
crafted_items.push(crafted_item.duplicate(ability_map, msm));
|
||||
@ -298,6 +325,7 @@ pub enum RawRecipeInput {
|
||||
Item(String),
|
||||
Tag(ItemTag),
|
||||
TagSameItem(ItemTag),
|
||||
ListSameItem(String),
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize)]
|
||||
@ -319,6 +347,15 @@ impl assets::Asset for RawRecipeBook {
|
||||
const EXTENSION: &'static str = "ron";
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone)]
|
||||
pub struct ItemList(pub Vec<String>);
|
||||
|
||||
impl assets::Asset for ItemList {
|
||||
type Loader = assets::RonLoader;
|
||||
|
||||
const EXTENSION: &'static str = "ron";
|
||||
}
|
||||
|
||||
impl assets::Compound for RecipeBook {
|
||||
fn load<S: assets::source::Source + ?Sized>(
|
||||
cache: &assets::AssetCache<S>,
|
||||
@ -338,6 +375,14 @@ impl assets::Compound for RecipeBook {
|
||||
RawRecipeInput::Item(name) => RecipeInput::Item(Arc::<ItemDef>::load_cloned(name)?),
|
||||
RawRecipeInput::Tag(tag) => RecipeInput::Tag(*tag),
|
||||
RawRecipeInput::TagSameItem(tag) => RecipeInput::TagSameItem(*tag, *amount),
|
||||
RawRecipeInput::ListSameItem(list) => {
|
||||
let assets = ItemList::load_expect_cloned(list).0;
|
||||
let items = assets
|
||||
.into_iter()
|
||||
.map(|asset| Arc::<ItemDef>::load_expect_cloned(&asset))
|
||||
.collect();
|
||||
RecipeInput::ListSameItem(items, *amount)
|
||||
},
|
||||
};
|
||||
Ok((def, *amount, *is_mod_comp))
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use conrod_core::{
|
||||
widget_ids, Color, Colorable, Labelable, Positionable, Sizeable, Widget, WidgetCommon,
|
||||
};
|
||||
use i18n::Localization;
|
||||
use std::sync::Arc;
|
||||
use std::{borrow::Cow, sync::Arc};
|
||||
|
||||
use strum::{EnumIter, IntoEnumIterator};
|
||||
|
||||
@ -470,6 +470,14 @@ impl<'a> Widget for Crafting<'a> {
|
||||
RecipeInput::Item(def) => def.name(),
|
||||
RecipeInput::Tag(tag) => tag.name(),
|
||||
RecipeInput::TagSameItem(tag, _) => tag.name(),
|
||||
// Works, but probably will have some...interesting false positives
|
||||
// Code reviewers probably required to do magic to make not hacky
|
||||
RecipeInput::ListSameItem(_defs, _) => {
|
||||
// Cow::Owned(defs.iter().flat_map(|def| def.name().chars()).collect())
|
||||
// Code reviewers: I require someone who can solve a temporary value
|
||||
// being created
|
||||
Cow::Borrowed("Input")
|
||||
},
|
||||
}
|
||||
.to_lowercase();
|
||||
search_keys
|
||||
@ -927,6 +935,28 @@ impl<'a> Widget for Crafting<'a> {
|
||||
.unwrap_or_else(|| tag.exemplar_identifier().to_string()),
|
||||
)
|
||||
},
|
||||
RecipeInput::ListSameItem(item_defs, _) => Arc::<ItemDef>::load_expect_cloned(
|
||||
&self
|
||||
.inventory
|
||||
.slots()
|
||||
.filter_map(|slot| {
|
||||
slot.as_ref().and_then(|item| {
|
||||
if item.matches_recipe_input(recipe_input) {
|
||||
Some(item.item_definition_id().to_string())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
})
|
||||
.next()
|
||||
.unwrap_or_else(|| {
|
||||
item_defs
|
||||
.first()
|
||||
.map(|i| i.item_definition_id())
|
||||
.unwrap_or("common.items.weapons.empty.empty")
|
||||
.to_string()
|
||||
}),
|
||||
),
|
||||
};
|
||||
|
||||
// Grey color for images and text if their amount is too low to craft the item
|
||||
@ -1028,6 +1058,13 @@ impl<'a> Widget for Crafting<'a> {
|
||||
RecipeInput::Tag(tag) | RecipeInput::TagSameItem(tag, _) => {
|
||||
format!("Any {} item", tag.name())
|
||||
},
|
||||
RecipeInput::ListSameItem(_item_defs, _) => {
|
||||
// format!("Any of {}", item_defs.iter().flat_map(|item_def|
|
||||
// item_def.name().chars()).collect::<String>())
|
||||
// Code reviewers: I require someone who can solve a temporary value
|
||||
// being created
|
||||
"Input".to_string()
|
||||
},
|
||||
};
|
||||
let input = format!(
|
||||
"{}x {} ({})",
|
||||
|
Loading…
Reference in New Issue
Block a user