mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Crafting
This commit is contained in:
parent
d5bfae886e
commit
8d6b442193
@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Added spin attack for axe
|
- Added spin attack for axe
|
||||||
- Creature specific stats
|
- Creature specific stats
|
||||||
- Minimap compass
|
- Minimap compass
|
||||||
|
- Initial crafting system implementation
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -2,11 +2,10 @@ Item(
|
|||||||
name: "Large Potion",
|
name: "Large Potion",
|
||||||
description: "Restores 100 Health\n\n<Right-Click to use>",
|
description: "Restores 100 Health\n\n<Right-Click to use>",
|
||||||
kind: Consumable(
|
kind: Consumable(
|
||||||
kind: PotionMinor,
|
kind: PotionLarge,
|
||||||
effect: Health((
|
effect: Health((
|
||||||
amount: 100,
|
amount: 100,
|
||||||
cause: Item,
|
cause: Item,
|
||||||
)),
|
)),
|
||||||
,
|
|
||||||
),
|
),
|
||||||
)
|
)
|
@ -2,7 +2,7 @@ Item(
|
|||||||
name: "Medium Potion",
|
name: "Medium Potion",
|
||||||
description: "Restores 70 Health\n\n<Right-Click to use>",
|
description: "Restores 70 Health\n\n<Right-Click to use>",
|
||||||
kind: Consumable(
|
kind: Consumable(
|
||||||
kind: PotionMinor,
|
kind: PotionMed,
|
||||||
effect: Health((
|
effect: Health((
|
||||||
amount: 70,
|
amount: 70,
|
||||||
cause: Item,
|
cause: Item,
|
7
assets/common/items/crafting_ing/empty_vial.ron
Normal file
7
assets/common/items/crafting_ing/empty_vial.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Empty Vial",
|
||||||
|
description: "Can be filled with fluids.",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: EmptyVial,
|
||||||
|
)
|
||||||
|
)
|
7
assets/common/items/crafting_ing/leather_scraps.ron
Normal file
7
assets/common/items/crafting_ing/leather_scraps.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Leather Scraps",
|
||||||
|
description: "Used to craft various items.",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: LeatherScraps,
|
||||||
|
)
|
||||||
|
)
|
7
assets/common/items/crafting_ing/shiny_gem.ron
Normal file
7
assets/common/items/crafting_ing/shiny_gem.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Shiny Gem",
|
||||||
|
description: "It's so shiny!",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: ShinyGem,
|
||||||
|
)
|
||||||
|
)
|
7
assets/common/items/crafting_ing/stones.ron
Normal file
7
assets/common/items/crafting_ing/stones.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Stones",
|
||||||
|
description: "Pebbles from the ground.",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: Stones,
|
||||||
|
)
|
||||||
|
)
|
7
assets/common/items/crafting_ing/twigs.ron
Normal file
7
assets/common/items/crafting_ing/twigs.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Twigs",
|
||||||
|
description: "Dry.",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: Twigs,
|
||||||
|
)
|
||||||
|
)
|
7
assets/common/items/crafting_tools/craftsman_hammer.ron
Normal file
7
assets/common/items/crafting_tools/craftsman_hammer.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Craftsman Hammer",
|
||||||
|
description: "Used to craft various items.",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: CraftsmanHammer,
|
||||||
|
)
|
||||||
|
)
|
7
assets/common/items/crafting_tools/mortar_pestle.ron
Normal file
7
assets/common/items/crafting_tools/mortar_pestle.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Mortar and Pestle",
|
||||||
|
description: "Crushes and grinds things into\na fine powder or paste.\nUsed to craft various items.",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: MortarPestle,
|
||||||
|
)
|
||||||
|
)
|
7
assets/common/items/debug/empty_vial.ron
Normal file
7
assets/common/items/debug/empty_vial.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Empty Vial",
|
||||||
|
description: "Can be filled with fluids.",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: EmptyVial,
|
||||||
|
)
|
||||||
|
)
|
7
assets/common/items/debug/leather_scraps.ron
Normal file
7
assets/common/items/debug/leather_scraps.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Leather Scraps",
|
||||||
|
description: "Used to craft various items.",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: LeatherScraps,
|
||||||
|
)
|
||||||
|
)
|
7
assets/common/items/debug/shiny_gem.ron
Normal file
7
assets/common/items/debug/shiny_gem.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Shiny Gem",
|
||||||
|
description: "It's so shiny!",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: ShinyGem,
|
||||||
|
)
|
||||||
|
)
|
7
assets/common/items/debug/stones.ron
Normal file
7
assets/common/items/debug/stones.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Stones",
|
||||||
|
description: "Pebbles from the ground.",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: Stones,
|
||||||
|
)
|
||||||
|
)
|
7
assets/common/items/debug/twigs.ron
Normal file
7
assets/common/items/debug/twigs.ron
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Item(
|
||||||
|
name: "Twigs",
|
||||||
|
description: "Dry.",
|
||||||
|
kind: Ingredient(
|
||||||
|
kind: Twigs,
|
||||||
|
)
|
||||||
|
)
|
11
assets/common/items/food/apple_mushroom_curry.ron
Normal file
11
assets/common/items/food/apple_mushroom_curry.ron
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Item(
|
||||||
|
name: "Mushroom Curry",
|
||||||
|
description: "Restores 120 Health\n\nWho could say no to that?\n\n<Right-Click to use>",
|
||||||
|
kind: Consumable(
|
||||||
|
kind: AppleShroomCurry,
|
||||||
|
effect: Health((
|
||||||
|
amount: 120,
|
||||||
|
cause: Item,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)
|
11
assets/common/items/food/apple_stick.ron
Normal file
11
assets/common/items/food/apple_stick.ron
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Item(
|
||||||
|
name: "Apple Stick",
|
||||||
|
description: "Restores 60 Health\n\n<Right-Click to use>",
|
||||||
|
kind: Consumable(
|
||||||
|
kind: AppleStick,
|
||||||
|
effect: Health((
|
||||||
|
amount: 60,
|
||||||
|
cause: Item,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)
|
11
assets/common/items/food/mushroom_stick.ron
Normal file
11
assets/common/items/food/mushroom_stick.ron
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Item(
|
||||||
|
name: "Mushroom Stick",
|
||||||
|
description: "Restores 50 Health\n\n<Right-Click to use>",
|
||||||
|
kind: Consumable(
|
||||||
|
kind: MushroomStick,
|
||||||
|
effect: Health((
|
||||||
|
amount: 50,
|
||||||
|
cause: Item,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)
|
@ -1,18 +1,23 @@
|
|||||||
[
|
[
|
||||||
// All loot rates go here
|
// All loot rates go here
|
||||||
// food
|
// food
|
||||||
(3, "common.items.cheese"),
|
(3, "common.items.food.cheese"),
|
||||||
(3, "common.items.apple"),
|
(3, "common.items.food.apple"),
|
||||||
(3, "common.items.mushroom"),
|
(3, "common.items.food.mushroom"),
|
||||||
|
(1, "common.items.food.coconut"),
|
||||||
// miscellaneous
|
// miscellaneous
|
||||||
(0.4, "common.items.velorite"),
|
(0.4, "common.items.ore.velorite"),
|
||||||
(0.6, "common.items.veloritefrag"),
|
(0.6, "common.items.ore.veloritefrag"),
|
||||||
(0.6, "common.items.cheese"),
|
(0.1, "common.items.consumable.potion_minor"),
|
||||||
(0.6, "common.items.apple"),
|
(0.01, "common.items.utility.collar"),
|
||||||
(1.5, "common.items.potion_minor"),
|
(0.01, "common.items.utility.bomb_pile"),
|
||||||
(0.5, "common.items.collar"),
|
(0.1, "common.items.utility.bomb"),
|
||||||
(0.5, "common.items.bomb_pile"),
|
// crafting ingredients
|
||||||
(1, "common.items.bomb"),
|
(0.5, "common.items.crafting_ing.shiny_gem"),
|
||||||
|
(2, "common.items.crafting_ing.leather_scraps"),
|
||||||
|
(1, "common.items.crafting_ing.empty_vial"),
|
||||||
|
(2, "common.items.crafting_ing.stones"),
|
||||||
|
(3, "common.items.crafting_ing.twigs"),
|
||||||
// swords
|
// swords
|
||||||
(0.1, "common.items.weapons.sword.starter_sword"),
|
(0.1, "common.items.weapons.sword.starter_sword"),
|
||||||
(0.1, "common.items.weapons.sword.wood_sword"),
|
(0.1, "common.items.weapons.sword.wood_sword"),
|
||||||
|
12
assets/common/recipe_book.ron
Normal file
12
assets/common/recipe_book.ron
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"crafting_hammer": (("common.items.crafting_tools.craftsman_hammer", 1),[("common.items.crafting_ing.twigs", 10), ("common.items.crafting_ing.stones", 10)]),
|
||||||
|
"mortar_pestle": (("common.items.crafting_tools.mortar_pestle", 1), [("common.items.crafting_ing.stones", 6), ("common.items.food.coconut", 2), ("common.items.crafting_tools.craftsman_hammer", 0)]),
|
||||||
|
"velorite_frag": (("common.items.ore.veloritefrag", 2), [("common.items.ore.velorite", 1), ("common.items.crafting_tools.craftsman_hammer", 0)]),
|
||||||
|
"potion_s": (("common.items.consumable.potion_minor", 1), [("common.items.crafting_ing.empty_vial", 1), ("common.items.ore.veloritefrag", 2)]),
|
||||||
|
"potion_m": (("common.items.consumable.potion_med", 1), [("common.items.consumable.potion_minor", 2), ("common.items.ore.veloritefrag", 4)]),
|
||||||
|
"collar_basic": (("common.items.utility.collar", 1), [("common.items.crafting_ing.leather_scraps", 5), ("common.items.crafting_ing.shiny_gem", 1)]),
|
||||||
|
"bomb_coconut": (("common.items.utility.bomb", 1), [("common.items.crafting_ing.stones", 10), ("common.items.food.coconut", 2), ("common.items.ore.veloritefrag", 2), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
||||||
|
"apple_shroom_curry": (("common.items.food.apple_mushroom_curry", 1), [("common.items.food.mushroom", 10), ("common.items.food.coconut", 1), ("common.items.food.apple", 5), ("common.items.crafting_tools.mortar_pestle", 0)]),
|
||||||
|
"apples_stick": (("common.items.food.apple_stick", 1),[("common.items.crafting_ing.twigs", 1), ("common.items.food.apple", 3)]),
|
||||||
|
"mushroom_stick": (("common.items.food.mushroom_stick", 1),[("common.items.crafting_ing.twigs", 1), ("common.items.food.mushroom", 5)]),
|
||||||
|
}
|
BIN
assets/voxygen/audio/sfx/crafting/hammer.wav
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/audio/sfx/crafting/hammer.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/background/bg_8.png
(Stored with Git LFS)
BIN
assets/voxygen/background/bg_8.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/animation/gears/1.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/animation/gears/1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/animation/gears/2.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/animation/gears/2.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/animation/gears/3.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/animation/gears/3.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/animation/gears/4.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/animation/gears/4.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/animation/gears/5.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/animation/gears/5.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/buttons/anvil.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/buttons/anvil.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/buttons/anvil_hover.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/buttons/anvil_hover.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/buttons/anvil_press.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/buttons/anvil_press.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/frames/selection.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/frames/selection.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/frames/selection.vox
(Stored with Git LFS)
BIN
assets/voxygen/element/frames/selection.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/frames/selection_frame.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/frames/selection_frame.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/frames/selection_frame.vox
(Stored with Git LFS)
BIN
assets/voxygen/element/frames/selection_frame.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/frames/selection_hover.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/frames/selection_hover.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/frames/selection_hover.vox
(Stored with Git LFS)
BIN
assets/voxygen/element/frames/selection_hover.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/frames/selection_press.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/frames/selection_press.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/frames/selection_press.vox
(Stored with Git LFS)
BIN
assets/voxygen/element/frames/selection_press.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/frames/tt_test_corner_tr.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/frames/tt_test_corner_tr.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/frames/tt_test_corner_tr.vox
(Stored with Git LFS)
BIN
assets/voxygen/element/frames/tt_test_corner_tr.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/frames/tt_test_edge.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/frames/tt_test_edge.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/frames/tt_test_edge.vox
(Stored with Git LFS)
BIN
assets/voxygen/element/frames/tt_test_edge.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/2hsword_m1.png
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/2hsword_m1.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/2hsword_m2.png
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/2hsword_m2.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/2hsword_slash.png
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/2hsword_slash.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/anvil.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/anvil.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/bow_aoe.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/bow_aoe.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/bow_m1.png
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/bow_m1.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/bow_m2.png
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/bow_m2.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/gem.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/gem.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/heal_0.png
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/heal_0.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/item_apple.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/item_apple.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/item_apple.vox
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/item_apple.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/item_apple_curry.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/item_apple_curry.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/item_apple_stick.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/item_apple_stick.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/item_cheese.png
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/item_cheese.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/item_cheese.vox
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/item_cheese.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/item_leather0.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/item_leather0.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/item_mortarpestlecoco.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/item_mortarpestlecoco.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/item_shroom_stick.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/item_shroom_stick.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/skill_charge_3.png
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/skill_charge_3.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/skill_sword_pierce.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/skill_sword_pierce.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/staff_m1.png
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/staff_m1.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/icons/staff_m2.png
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/staff_m2.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/misc_bg/crafting.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/misc_bg/crafting.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/misc_bg/crafting_frame.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/misc_bg/crafting_frame.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/misc_bg/inv_bg.png
(Stored with Git LFS)
BIN
assets/voxygen/element/misc_bg/inv_bg.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/misc_bg/map_bg.png
(Stored with Git LFS)
BIN
assets/voxygen/element/misc_bg/map_bg.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/misc_bg/window.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/misc_bg/window.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -304,6 +304,8 @@ magischen Gegenstände ergattern?"#,
|
|||||||
"hud.settings.audio_device": "Ausgabegerät",
|
"hud.settings.audio_device": "Ausgabegerät",
|
||||||
|
|
||||||
"hud.settings.awaitingkey": "Drückt eine Taste...",
|
"hud.settings.awaitingkey": "Drückt eine Taste...",
|
||||||
|
"hud.settings.unbound": "-",
|
||||||
|
"hud.settings.reset_keybinds": "Auf Standard zurücksetzen",
|
||||||
|
|
||||||
"hud.social": "Sozial",
|
"hud.social": "Sozial",
|
||||||
"hud.social.online": "Online",
|
"hud.social.online": "Online",
|
||||||
@ -314,6 +316,12 @@ magischen Gegenstände ergattern?"#,
|
|||||||
|
|
||||||
"hud.spell": "Zauber",
|
"hud.spell": "Zauber",
|
||||||
|
|
||||||
|
"hud.crafting": "Herstellen",
|
||||||
|
"hud.crafting.recipes": "Rezepte",
|
||||||
|
"hud.crafting.ingredients": "Zutaten:",
|
||||||
|
"hud.crafting.craft": "Herstellen",
|
||||||
|
"hud.crafting.tool_cata": "Benötigt:",
|
||||||
|
|
||||||
"hud.free_look_indicator": "Freie Sicht aktiv",
|
"hud.free_look_indicator": "Freie Sicht aktiv",
|
||||||
"hud.auto_walk_indicator": "Automatisches Laufen aktiv",
|
"hud.auto_walk_indicator": "Automatisches Laufen aktiv",
|
||||||
|
|
||||||
|
@ -118,8 +118,6 @@ Thanks for taking the time to read this notice, we hope you enjoy the game!
|
|||||||
// Login process description
|
// Login process description
|
||||||
"main.login_process": r#"Information on the Login Process:
|
"main.login_process": r#"Information on the Login Process:
|
||||||
|
|
||||||
If you are having issues signing in:
|
|
||||||
|
|
||||||
Please note that you now need an account
|
Please note that you now need an account
|
||||||
to play on auth-enabled servers.
|
to play on auth-enabled servers.
|
||||||
|
|
||||||
@ -313,6 +311,12 @@ magically infused items?"#,
|
|||||||
"hud.social.faction": "Faction",
|
"hud.social.faction": "Faction",
|
||||||
"hud.social.play_online_fmt": "{nb_player} player(s) online",
|
"hud.social.play_online_fmt": "{nb_player} player(s) online",
|
||||||
|
|
||||||
|
"hud.crafting": "Crafting",
|
||||||
|
"hud.crafting.recipes": "Recipes",
|
||||||
|
"hud.crafting.ingredients": "Ingredients:",
|
||||||
|
"hud.crafting.craft": "Craft",
|
||||||
|
"hud.crafting.tool_cata": "Requires:",
|
||||||
|
|
||||||
"hud.spell": "Spells",
|
"hud.spell": "Spells",
|
||||||
|
|
||||||
"hud.free_look_indicator": "Free look active",
|
"hud.free_look_indicator": "Free look active",
|
||||||
|
@ -743,24 +743,30 @@
|
|||||||
),
|
),
|
||||||
// Consumables
|
// Consumables
|
||||||
Consumable(Apple):
|
Consumable(Apple):
|
||||||
VoxTrans(
|
Png(
|
||||||
"element.icons.item_apple",
|
"element.icons.item_apple",
|
||||||
(0.0, 0.0, 0.0), (-90.0, 90.0, 0.0), 1.0,
|
|
||||||
),
|
),
|
||||||
Consumable(Coconut): Png(
|
Consumable(Coconut): Png(
|
||||||
"element.icons.item_coconut",
|
"element.icons.item_coconut",
|
||||||
),
|
),
|
||||||
|
Consumable(PotionMed): VoxTrans(
|
||||||
|
"voxel.object.potion_red",
|
||||||
|
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.7,
|
||||||
|
),
|
||||||
Consumable(PotionMinor): VoxTrans(
|
Consumable(PotionMinor): VoxTrans(
|
||||||
"voxel.object.potion_red",
|
"voxel.object.potion_red",
|
||||||
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.8,
|
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.5,
|
||||||
|
),
|
||||||
|
Consumable(PotionLarge): VoxTrans(
|
||||||
|
"voxel.object.potion_red",
|
||||||
|
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.9,
|
||||||
),
|
),
|
||||||
Consumable(PotionExp): VoxTrans(
|
Consumable(PotionExp): VoxTrans(
|
||||||
"voxel.object.potion_turq",
|
"voxel.object.potion_turq",
|
||||||
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.8,
|
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.8,
|
||||||
),
|
),
|
||||||
Consumable(Cheese): VoxTrans(
|
Consumable(Cheese): Png(
|
||||||
"element.icons.item_cheese",
|
"element.icons.item_cheese",
|
||||||
(0.0, 0.0, 0.0), (-90.0, 90.0, 0.0), 0.9,
|
|
||||||
),
|
),
|
||||||
Consumable(Potion): VoxTrans(
|
Consumable(Potion): VoxTrans(
|
||||||
"voxel.object.potion_red",
|
"voxel.object.potion_red",
|
||||||
@ -776,18 +782,32 @@
|
|||||||
),
|
),
|
||||||
Consumable(VeloriteFrag): VoxTrans(
|
Consumable(VeloriteFrag): VoxTrans(
|
||||||
"voxel.sprite.velorite.velorite_1",
|
"voxel.sprite.velorite.velorite_1",
|
||||||
(0.0, -1.0, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
(0.0, 0.0, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
||||||
),
|
),
|
||||||
|
Consumable(AppleShroomCurry): Png(
|
||||||
|
"element.icons.item_apple_curry",
|
||||||
|
),
|
||||||
|
Consumable(AppleStick): Png(
|
||||||
|
"element.icons.item_apple_stick",
|
||||||
|
),
|
||||||
|
Consumable(MushroomStick): Png(
|
||||||
|
"element.icons.item_shroom_stick",
|
||||||
|
),
|
||||||
|
|
||||||
// Throwables
|
// Throwables
|
||||||
Throwable(Bomb): VoxTrans(
|
Throwable(Bomb): VoxTrans(
|
||||||
"voxel.object.bomb",
|
"voxel.object.bomb",
|
||||||
(0.0, -1.0, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
(0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
||||||
),
|
),
|
||||||
Throwable(TrainingDummy): VoxTrans(
|
Throwable(TrainingDummy): VoxTrans(
|
||||||
"voxel.object.training_dummy",
|
"voxel.object.training_dummy",
|
||||||
(0.0, -1.0, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
(0.0, -1.0, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
||||||
),
|
),
|
||||||
// Ingredients
|
// Ingredients
|
||||||
|
Ingredient(CraftsmanHammer): VoxTrans( //TODO This should be a 1h hammer!
|
||||||
|
"voxel.weapon.hammer.craftsman",
|
||||||
|
(1.0, 1.0, 0.0), (-135.0, 90.0, 0.0), 1.0,
|
||||||
|
),
|
||||||
Ingredient(Flower): VoxTrans(
|
Ingredient(Flower): VoxTrans(
|
||||||
"voxel.sprite.flowers.flower_red_2",
|
"voxel.sprite.flowers.flower_red_2",
|
||||||
(0.0, -1.0, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
(0.0, -1.0, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
||||||
@ -796,6 +816,27 @@
|
|||||||
"voxel.sprite.grass.grass_long_5",
|
"voxel.sprite.grass.grass_long_5",
|
||||||
(0.0, 0.0, 0.0), (-90.0, 50.0, 0.0), 1.0,
|
(0.0, 0.0, 0.0), (-90.0, 50.0, 0.0), 1.0,
|
||||||
),
|
),
|
||||||
|
Ingredient(Stones): VoxTrans(
|
||||||
|
"voxel.sprite.rocks.rock-0",
|
||||||
|
(0.0, 0.0, 0.0), (-50.0, 40.0, 20.0), 0.8,
|
||||||
|
),
|
||||||
|
Ingredient(Twigs): VoxTrans(
|
||||||
|
"voxel.sprite.twigs.twigs-0",
|
||||||
|
(0.0, 0.0, 0.0), (-20.0, 10.0, 20.0), 0.9,
|
||||||
|
),
|
||||||
|
Ingredient(LeatherScraps): Png(
|
||||||
|
"element.icons.item_leather0",
|
||||||
|
),
|
||||||
|
Ingredient(ShinyGem): Png(
|
||||||
|
"element.icons.gem",
|
||||||
|
),
|
||||||
|
Ingredient(MortarPestle): Png(
|
||||||
|
"element.icons.item_mortarpestlecoco",
|
||||||
|
),
|
||||||
|
Ingredient(EmptyVial): VoxTrans(
|
||||||
|
"voxel.object.potion_empty",
|
||||||
|
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.8,
|
||||||
|
),
|
||||||
// Debug Items
|
// Debug Items
|
||||||
Tool(Debug(Boost)): VoxTrans(
|
Tool(Debug(Boost)): VoxTrans(
|
||||||
"voxel.weapon.tool.broom_belzeshrub_purple",
|
"voxel.weapon.tool.broom_belzeshrub_purple",
|
||||||
|
@ -176,6 +176,10 @@
|
|||||||
vox_spec: ("weapon.hammer.rusty_2h", (-2.5, -5.5, -4.0)),
|
vox_spec: ("weapon.hammer.rusty_2h", (-2.5, -5.5, -4.0)),
|
||||||
color: None
|
color: None
|
||||||
),
|
),
|
||||||
|
/*Dagger(Craftsman): ( //TODO This should be a 1h hammer!
|
||||||
|
vox_spec: ("weapon.hammer.craftsman", (-2.0, -5.0, -5.5)),
|
||||||
|
color: None
|
||||||
|
),*/
|
||||||
// Daggers
|
// Daggers
|
||||||
Dagger(BasicDagger): (
|
Dagger(BasicDagger): (
|
||||||
vox_spec: ("weapon.dagger.dagger_rusty", (-1.5, -3.0, -3.0)),
|
vox_spec: ("weapon.dagger.dagger_rusty", (-1.5, -3.0, -3.0)),
|
||||||
|
BIN
assets/voxygen/voxel/object/potion_empty.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/object/potion_empty.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/gem/gem_blue.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/gem/gem_blue.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/gem/gem_green.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/gem/gem_green.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/gem/gem_red.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/gem/gem_red.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/rocks/rock-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/rocks/rock-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/rocks/rock-1.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/rocks/rock-1.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/rocks/rock-2.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/rocks/rock-2.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/twigs/twigs-0.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/twigs/twigs-0.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/twigs/twigs-1.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/twigs/twigs-1.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/twigs/twigs-2.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/sprite/twigs/twigs-2.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/weapon/hammer/craftsman.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/weapon/hammer/craftsman.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![feature(label_break_value)]
|
#![feature(label_break_value, option_zip)]
|
||||||
|
|
||||||
pub mod cmd;
|
pub mod cmd;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
@ -25,6 +25,7 @@ use common::{
|
|||||||
PlayerInfo, PlayerListUpdate, RegisterError, RequestStateError, ServerInfo, ServerMsg,
|
PlayerInfo, PlayerListUpdate, RegisterError, RequestStateError, ServerInfo, ServerMsg,
|
||||||
MAX_BYTES_CHAT_MSG,
|
MAX_BYTES_CHAT_MSG,
|
||||||
},
|
},
|
||||||
|
recipe::RecipeBook,
|
||||||
state::State,
|
state::State,
|
||||||
sync::{Uid, UidAllocator, WorldSyncExt},
|
sync::{Uid, UidAllocator, WorldSyncExt},
|
||||||
terrain::{block::Block, TerrainChunk, TerrainChunkSize},
|
terrain::{block::Block, TerrainChunk, TerrainChunkSize},
|
||||||
@ -33,7 +34,7 @@ use common::{
|
|||||||
use futures_executor::block_on;
|
use futures_executor::block_on;
|
||||||
use futures_timer::Delay;
|
use futures_timer::Delay;
|
||||||
use futures_util::{select, FutureExt};
|
use futures_util::{select, FutureExt};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::{HashMap, HashSet};
|
||||||
use image::DynamicImage;
|
use image::DynamicImage;
|
||||||
use network::{
|
use network::{
|
||||||
Network, Participant, Pid, ProtocolAddr, Stream, PROMISES_CONSISTENCY, PROMISES_ORDERED,
|
Network, Participant, Pid, ProtocolAddr, Stream, PROMISES_CONSISTENCY, PROMISES_ORDERED,
|
||||||
@ -75,6 +76,8 @@ pub struct Client {
|
|||||||
pub player_list: HashMap<Uid, PlayerInfo>,
|
pub player_list: HashMap<Uid, PlayerInfo>,
|
||||||
pub character_list: CharacterList,
|
pub character_list: CharacterList,
|
||||||
pub active_character_id: Option<i32>,
|
pub active_character_id: Option<i32>,
|
||||||
|
recipe_book: RecipeBook,
|
||||||
|
available_recipes: HashSet<String>,
|
||||||
|
|
||||||
_network: Network,
|
_network: Network,
|
||||||
participant: Option<Participant>,
|
participant: Option<Participant>,
|
||||||
@ -123,7 +126,7 @@ impl Client {
|
|||||||
let mut stream = block_on(participant.open(10, PROMISES_ORDERED | PROMISES_CONSISTENCY))?;
|
let mut stream = block_on(participant.open(10, PROMISES_ORDERED | PROMISES_CONSISTENCY))?;
|
||||||
|
|
||||||
// Wait for initial sync
|
// Wait for initial sync
|
||||||
let (state, entity, server_info, world_map) = block_on(async {
|
let (state, entity, server_info, world_map, recipe_book) = block_on(async {
|
||||||
loop {
|
loop {
|
||||||
match stream.recv().await? {
|
match stream.recv().await? {
|
||||||
ServerMsg::InitialSync {
|
ServerMsg::InitialSync {
|
||||||
@ -131,6 +134,7 @@ impl Client {
|
|||||||
server_info,
|
server_info,
|
||||||
time_of_day,
|
time_of_day,
|
||||||
world_map: (map_size, world_map),
|
world_map: (map_size, world_map),
|
||||||
|
recipe_book,
|
||||||
} => {
|
} => {
|
||||||
// TODO: Display that versions don't match in Voxygen
|
// TODO: Display that versions don't match in Voxygen
|
||||||
if &server_info.git_hash != *common::util::GIT_HASH {
|
if &server_info.git_hash != *common::util::GIT_HASH {
|
||||||
@ -174,7 +178,13 @@ impl Client {
|
|||||||
);
|
);
|
||||||
debug!("Done preparing image...");
|
debug!("Done preparing image...");
|
||||||
|
|
||||||
break Ok((state, entity, server_info, (world_map, map_size)));
|
break Ok((
|
||||||
|
state,
|
||||||
|
entity,
|
||||||
|
server_info,
|
||||||
|
(world_map, map_size),
|
||||||
|
recipe_book,
|
||||||
|
));
|
||||||
},
|
},
|
||||||
ServerMsg::TooManyPlayers => break Err(Error::TooManyPlayers),
|
ServerMsg::TooManyPlayers => break Err(Error::TooManyPlayers),
|
||||||
err => {
|
err => {
|
||||||
@ -200,6 +210,8 @@ impl Client {
|
|||||||
player_list: HashMap::new(),
|
player_list: HashMap::new(),
|
||||||
character_list: CharacterList::default(),
|
character_list: CharacterList::default(),
|
||||||
active_character_id: None,
|
active_character_id: None,
|
||||||
|
recipe_book,
|
||||||
|
available_recipes: HashSet::default(),
|
||||||
|
|
||||||
_network: network,
|
_network: network,
|
||||||
participant: Some(participant),
|
participant: Some(participant),
|
||||||
@ -372,6 +384,40 @@ impl Client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn recipe_book(&self) -> &RecipeBook { &self.recipe_book }
|
||||||
|
|
||||||
|
pub fn available_recipes(&self) -> &HashSet<String> { &self.available_recipes }
|
||||||
|
|
||||||
|
pub fn can_craft_recipe(&self, recipe: &str) -> bool {
|
||||||
|
self.recipe_book
|
||||||
|
.get(recipe)
|
||||||
|
.zip(self.inventories().get(self.entity))
|
||||||
|
.map(|(recipe, inv)| inv.contains_ingredients(&*recipe).is_ok())
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn craft_recipe(&mut self, recipe: &str) -> bool {
|
||||||
|
if self.can_craft_recipe(recipe) {
|
||||||
|
self.singleton_stream
|
||||||
|
.send(ClientMsg::ControlEvent(ControlEvent::InventoryManip(
|
||||||
|
InventoryManip::CraftRecipe(recipe.to_string()),
|
||||||
|
)))
|
||||||
|
.unwrap();
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_available_recipes(&mut self) {
|
||||||
|
self.available_recipes = self
|
||||||
|
.recipe_book
|
||||||
|
.iter()
|
||||||
|
.map(|(name, _)| name.clone())
|
||||||
|
.filter(|name| self.can_craft_recipe(name))
|
||||||
|
.collect();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn toggle_lantern(&mut self) {
|
pub fn toggle_lantern(&mut self) {
|
||||||
self.singleton_stream
|
self.singleton_stream
|
||||||
.send(ClientMsg::ControlEvent(ControlEvent::ToggleLantern))
|
.send(ClientMsg::ControlEvent(ControlEvent::ToggleLantern))
|
||||||
@ -949,6 +995,8 @@ impl Client {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.update_available_recipes();
|
||||||
|
|
||||||
frontend_events.push(Event::InventoryUpdated(event));
|
frontend_events.push(Event::InventoryUpdated(event));
|
||||||
},
|
},
|
||||||
ServerMsg::TerrainChunkUpdate { key, chunk } => {
|
ServerMsg::TerrainChunkUpdate { key, chunk } => {
|
||||||
|
@ -80,13 +80,14 @@ pub fn load_map<A: Asset + 'static, F: FnOnce(A) -> A>(
|
|||||||
specifier: &str,
|
specifier: &str,
|
||||||
f: F,
|
f: F,
|
||||||
) -> Result<Arc<A>, Error> {
|
) -> Result<Arc<A>, Error> {
|
||||||
let mut assets_write = ASSETS.write().unwrap();
|
let assets_write = ASSETS.read().unwrap();
|
||||||
match assets_write.get(specifier) {
|
match assets_write.get(specifier) {
|
||||||
Some(asset) => Ok(Arc::clone(asset).downcast()?),
|
Some(asset) => Ok(Arc::clone(asset).downcast()?),
|
||||||
None => {
|
None => {
|
||||||
|
drop(assets_write); // Drop the asset hashmap to permit recursive loading
|
||||||
let asset = Arc::new(f(A::parse(load_file(specifier, A::ENDINGS)?)?));
|
let asset = Arc::new(f(A::parse(load_file(specifier, A::ENDINGS)?)?));
|
||||||
let clone = Arc::clone(&asset);
|
let clone = Arc::clone(&asset);
|
||||||
assets_write.insert(specifier.to_owned(), clone);
|
ASSETS.write().unwrap().insert(specifier.to_owned(), clone);
|
||||||
Ok(asset)
|
Ok(asset)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ pub enum InventoryManip {
|
|||||||
Use(Slot),
|
Use(Slot),
|
||||||
Swap(Slot, Slot),
|
Swap(Slot, Slot),
|
||||||
Drop(Slot),
|
Drop(Slot),
|
||||||
|
CraftRecipe(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
@ -349,5 +349,14 @@ pub enum Armor {
|
|||||||
Tabard(Tabard),
|
Tabard(Tabard),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Armor {
|
||||||
|
/// Determines whether two pieces of armour are superficially equivalent to
|
||||||
|
/// one another (i.e: one may be substituted for the other in crafting
|
||||||
|
/// recipes or item possession checks).
|
||||||
|
pub fn superficially_eq(&self, other: &Self) -> bool {
|
||||||
|
std::mem::discriminant(self) == std::mem::discriminant(other)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
pub struct Stats(pub u32);
|
pub struct Stats(pub u32);
|
||||||
|
@ -26,7 +26,12 @@ pub enum Consumable {
|
|||||||
Velorite,
|
Velorite,
|
||||||
VeloriteFrag,
|
VeloriteFrag,
|
||||||
PotionMinor,
|
PotionMinor,
|
||||||
|
PotionMed,
|
||||||
|
PotionLarge,
|
||||||
PotionExp,
|
PotionExp,
|
||||||
|
AppleShroomCurry,
|
||||||
|
AppleStick,
|
||||||
|
MushroomStick,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
@ -44,6 +49,13 @@ pub enum Utility {
|
|||||||
pub enum Ingredient {
|
pub enum Ingredient {
|
||||||
Flower,
|
Flower,
|
||||||
Grass,
|
Grass,
|
||||||
|
EmptyVial,
|
||||||
|
LeatherScraps,
|
||||||
|
ShinyGem,
|
||||||
|
Stones,
|
||||||
|
Twigs,
|
||||||
|
MortarPestle,
|
||||||
|
CraftsmanHammer,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
@ -159,13 +171,25 @@ impl Item {
|
|||||||
|
|
||||||
pub fn description(&self) -> &str { &self.description }
|
pub fn description(&self) -> &str { &self.description }
|
||||||
|
|
||||||
|
pub fn amount(&self) -> u32 {
|
||||||
|
match &self.kind {
|
||||||
|
ItemKind::Tool(_) => 1,
|
||||||
|
ItemKind::Lantern(_) => 1,
|
||||||
|
ItemKind::Armor { .. } => 1,
|
||||||
|
ItemKind::Consumable { amount, .. } => *amount,
|
||||||
|
ItemKind::Throwable { amount, .. } => *amount,
|
||||||
|
ItemKind::Utility { amount, .. } => *amount,
|
||||||
|
ItemKind::Ingredient { amount, .. } => *amount,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn try_reclaim_from_block(block: Block) -> Option<Self> {
|
pub fn try_reclaim_from_block(block: Block) -> Option<Self> {
|
||||||
match block.kind() {
|
match block.kind() {
|
||||||
BlockKind::Apple => Some(assets::load_expect_cloned("common.items.apple")),
|
BlockKind::Apple => Some(assets::load_expect_cloned("common.items.food.apple")),
|
||||||
BlockKind::Mushroom => Some(assets::load_expect_cloned("common.items.mushroom")),
|
BlockKind::Mushroom => Some(assets::load_expect_cloned("common.items.food.mushroom")),
|
||||||
BlockKind::Velorite => Some(assets::load_expect_cloned("common.items.velorite")),
|
BlockKind::Velorite => Some(assets::load_expect_cloned("common.items.ore.velorite")),
|
||||||
BlockKind::VeloriteFrag => {
|
BlockKind::VeloriteFrag => {
|
||||||
Some(assets::load_expect_cloned("common.items.veloritefrag"))
|
Some(assets::load_expect_cloned("common.items.ore.veloritefrag"))
|
||||||
},
|
},
|
||||||
BlockKind::BlueFlower => Some(assets::load_expect_cloned("common.items.flowers.blue")),
|
BlockKind::BlueFlower => Some(assets::load_expect_cloned("common.items.flowers.blue")),
|
||||||
BlockKind::PinkFlower => Some(assets::load_expect_cloned("common.items.flowers.pink")),
|
BlockKind::PinkFlower => Some(assets::load_expect_cloned("common.items.flowers.pink")),
|
||||||
@ -185,16 +209,44 @@ impl Item {
|
|||||||
Some(assets::load_expect_cloned("common.items.grasses.medium"))
|
Some(assets::load_expect_cloned("common.items.grasses.medium"))
|
||||||
},
|
},
|
||||||
BlockKind::ShortGrass => Some(assets::load_expect_cloned("common.items.grasses.short")),
|
BlockKind::ShortGrass => Some(assets::load_expect_cloned("common.items.grasses.short")),
|
||||||
BlockKind::Coconut => Some(assets::load_expect_cloned("common.items.coconut")),
|
BlockKind::Coconut => Some(assets::load_expect_cloned("common.items.food.coconut")),
|
||||||
BlockKind::Chest => {
|
BlockKind::Chest => {
|
||||||
let chosen = assets::load_expect::<lottery::Lottery<_>>("common.loot_table");
|
let chosen = assets::load_expect::<lottery::Lottery<_>>("common.loot_table");
|
||||||
let chosen = chosen.choose();
|
let chosen = chosen.choose();
|
||||||
|
|
||||||
Some(assets::load_expect_cloned(chosen))
|
Some(assets::load_expect_cloned(chosen))
|
||||||
},
|
},
|
||||||
|
BlockKind::Stones => Some(assets::load_expect_cloned(
|
||||||
|
"common.items.crafting_ing.stones",
|
||||||
|
)),
|
||||||
|
BlockKind::Twigs => Some(assets::load_expect_cloned(
|
||||||
|
"common.items.crafting_ing.twigs",
|
||||||
|
)),
|
||||||
|
BlockKind::ShinyGem => Some(assets::load_expect_cloned(
|
||||||
|
"common.items.crafting_ing.shiny_gem",
|
||||||
|
)),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Determines whether two items are superficially equivalent to one another
|
||||||
|
/// (i.e: one may be substituted for the other in crafting recipes or
|
||||||
|
/// item possession checks).
|
||||||
|
pub fn superficially_eq(&self, other: &Self) -> bool {
|
||||||
|
match (&self.kind, &other.kind) {
|
||||||
|
(ItemKind::Tool(a), ItemKind::Tool(b)) => a.superficially_eq(b),
|
||||||
|
// TODO: Differentiate between lantern colors?
|
||||||
|
(ItemKind::Lantern(_), ItemKind::Lantern(_)) => true,
|
||||||
|
(ItemKind::Armor { kind: a, .. }, ItemKind::Armor { kind: b, .. }) => {
|
||||||
|
a.superficially_eq(b)
|
||||||
|
},
|
||||||
|
(ItemKind::Consumable { kind: a, .. }, ItemKind::Consumable { kind: b, .. }) => a == b,
|
||||||
|
(ItemKind::Throwable { kind: a, .. }, ItemKind::Throwable { kind: b, .. }) => a == b,
|
||||||
|
(ItemKind::Utility { kind: a, .. }, ItemKind::Utility { kind: b, .. }) => a == b,
|
||||||
|
(ItemKind::Ingredient { kind: a, .. }, ItemKind::Ingredient { kind: b, .. }) => a == b,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Component for Item {
|
impl Component for Item {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user