From ab1c43be847d02499ebd7a674e00e2eaa0ab77f7 Mon Sep 17 00:00:00 2001 From: BottledByte <6443024-BottledByte@users.noreply.gitlab.com> Date: Wed, 5 Aug 2020 01:21:42 +0200 Subject: [PATCH] Dehardcoded LanternKind, Consumable and Ingredient, fixed Sceptre hotbar Also fixed two wrong asset references and did some .ron formatting --- CHANGELOG.md | 1 + assets/common/items/armor/starter/lantern.ron | 2 +- assets/common/items/boss_drops/exp_flask.ron | 2 +- assets/common/items/boss_drops/lantern.ron | 2 +- assets/common/items/boss_drops/potions.ron | 2 +- assets/common/items/boss_drops/xp_potion.ron | 2 +- assets/common/items/consumable/potion_big.ron | 2 +- assets/common/items/consumable/potion_med.ron | 2 +- .../common/items/consumable/potion_minor.ron | 2 +- .../common/items/crafting_ing/empty_vial.ron | 2 +- .../items/crafting_ing/leather_scraps.ron | 2 +- .../common/items/crafting_ing/shiny_gem.ron | 2 +- assets/common/items/crafting_ing/stones.ron | 2 +- assets/common/items/crafting_ing/twigs.ron | 2 +- .../items/crafting_tools/craftsman_hammer.ron | 2 +- .../items/crafting_tools/mortar_pestle.ron | 2 +- assets/common/items/flowers/blue.ron | 2 +- assets/common/items/flowers/pink.ron | 2 +- assets/common/items/flowers/red.ron | 2 +- assets/common/items/flowers/sun.ron | 2 +- assets/common/items/flowers/white.ron | 2 +- assets/common/items/flowers/yellow.ron | 2 +- assets/common/items/food/apple.ron | 2 +- .../items/food/apple_mushroom_curry.ron | 2 +- assets/common/items/food/apple_stick.ron | 2 +- assets/common/items/food/cheese.ron | 2 +- assets/common/items/food/coconut.ron | 2 +- assets/common/items/food/mushroom.ron | 2 +- assets/common/items/food/mushroom_stick.ron | 2 +- assets/common/items/grasses/long.ron | 2 +- assets/common/items/grasses/medium.ron | 2 +- assets/common/items/grasses/short.ron | 2 +- assets/common/items/lantern/black_0.ron | 2 +- assets/common/items/lantern/blue_0.ron | 2 +- assets/common/items/lantern/green_0.ron | 2 +- assets/common/items/lantern/red_0.ron | 2 +- assets/common/items/ore/velorite.ron | 2 +- assets/common/items/ore/veloritefrag.ron | 2 +- assets/voxygen/audio/sfx.ron | 10 +-- assets/voxygen/item_image_manifest.ron | 81 +++++++++---------- .../voxel/humanoid_lantern_manifest.ron | 8 +- common/src/comp/inventory/item/mod.rs | 55 +------------ common/src/comp/inventory/mod.rs | 18 ++--- server/src/events/interaction.rs | 6 +- server/src/events/inventory_manip.rs | 2 +- voxygen/src/audio/sfx/mod.rs | 6 +- voxygen/src/hud/hotbar.rs | 4 +- voxygen/src/hud/item_imgs.rs | 14 ++-- voxygen/src/scene/figure/cache.rs | 6 +- voxygen/src/scene/figure/load.rs | 6 +- 50 files changed, 122 insertions(+), 169 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ee9530431..d39623f0c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,6 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated windowing library (winit 0.19 -> 0.22) - Bow M2 is now a charged attack that scales the longer it's held - Fixed window resizing on Mac OS X. +- Dehardcoded many item variants ### Removed diff --git a/assets/common/items/armor/starter/lantern.ron b/assets/common/items/armor/starter/lantern.ron index e9e67e729b..1b948eca89 100644 --- a/assets/common/items/armor/starter/lantern.ron +++ b/assets/common/items/armor/starter/lantern.ron @@ -3,7 +3,7 @@ Item( description: "Used by city guards.", kind: Lantern( ( - kind: Black0, + kind: "Black0", color: (r: 255, g: 190, b: 75), strength_thousandths: 3000, flicker_thousandths: 300, diff --git a/assets/common/items/boss_drops/exp_flask.ron b/assets/common/items/boss_drops/exp_flask.ron index f8625daef7..d96917c03a 100644 --- a/assets/common/items/boss_drops/exp_flask.ron +++ b/assets/common/items/boss_drops/exp_flask.ron @@ -2,7 +2,7 @@ Item( name: "Flask of Velorite Dusk", description: "Increases Exp by 250\n\nTake with plenty of water\n\n", kind: Consumable( - kind: PotionExp, + kind: "PotionExp", effect: Xp(250), ), ) diff --git a/assets/common/items/boss_drops/lantern.ron b/assets/common/items/boss_drops/lantern.ron index 3cdaa8ecca..26228ef77d 100644 --- a/assets/common/items/boss_drops/lantern.ron +++ b/assets/common/items/boss_drops/lantern.ron @@ -3,7 +3,7 @@ Item( description: "Illuminates even the darkest dungeon\nA great monster was slain for this item", kind: Lantern( ( - kind: Blue0, + kind: "Blue0", color: (r: 220, g: 220, b: 255), strength_thousandths: 6500, flicker_thousandths: 300, diff --git a/assets/common/items/boss_drops/potions.ron b/assets/common/items/boss_drops/potions.ron index 01650058e7..a66cbe5512 100644 --- a/assets/common/items/boss_drops/potions.ron +++ b/assets/common/items/boss_drops/potions.ron @@ -2,7 +2,7 @@ Item( name: "Potent Potion", description: "A potent healing potion.\n\nRestores 100 health on use.\n\n", kind: Consumable( - kind: Potion, + kind: "Potion", effect: Health(( amount: 1000, cause: Item, diff --git a/assets/common/items/boss_drops/xp_potion.ron b/assets/common/items/boss_drops/xp_potion.ron index 84cdcb223c..68f6a3099e 100644 --- a/assets/common/items/boss_drops/xp_potion.ron +++ b/assets/common/items/boss_drops/xp_potion.ron @@ -2,7 +2,7 @@ Item( name: "Potion of Skill", description: "Provides 250 XP to the drinker\n\n", kind: Consumable( - kind: Potion, + kind: "Potion", effect: Xp(250), ), ) diff --git a/assets/common/items/consumable/potion_big.ron b/assets/common/items/consumable/potion_big.ron index 7e903bb48a..b933c21917 100644 --- a/assets/common/items/consumable/potion_big.ron +++ b/assets/common/items/consumable/potion_big.ron @@ -2,7 +2,7 @@ Item( name: "Large Potion", description: "Restores 100 Health\n\n", kind: Consumable( - kind: PotionLarge, + kind: "PotionLarge", effect: Health(( amount: 1000, cause: Item, diff --git a/assets/common/items/consumable/potion_med.ron b/assets/common/items/consumable/potion_med.ron index 3ec58e046d..70071181f5 100644 --- a/assets/common/items/consumable/potion_med.ron +++ b/assets/common/items/consumable/potion_med.ron @@ -2,7 +2,7 @@ Item( name: "Medium Potion", description: "Restores 70 Health\n\n", kind: Consumable( - kind: PotionMed, + kind: "PotionMed", effect: Health(( amount: 700, cause: Item, diff --git a/assets/common/items/consumable/potion_minor.ron b/assets/common/items/consumable/potion_minor.ron index 5dca958483..c984d90656 100644 --- a/assets/common/items/consumable/potion_minor.ron +++ b/assets/common/items/consumable/potion_minor.ron @@ -2,7 +2,7 @@ Item( name: "Minor Potion", description: "Restores 50 Health\n\n", kind: Consumable( - kind: PotionMinor, + kind: "PotionMinor", effect: Health(( amount: 500, cause: Item, diff --git a/assets/common/items/crafting_ing/empty_vial.ron b/assets/common/items/crafting_ing/empty_vial.ron index 422a2870dd..a5396a3dee 100644 --- a/assets/common/items/crafting_ing/empty_vial.ron +++ b/assets/common/items/crafting_ing/empty_vial.ron @@ -2,6 +2,6 @@ Item( name: "Empty Vial", description: "Can be filled with fluids.", kind: Ingredient( - kind: EmptyVial, + kind: "EmptyVial", ) ) diff --git a/assets/common/items/crafting_ing/leather_scraps.ron b/assets/common/items/crafting_ing/leather_scraps.ron index cc546f8639..efec2df6b2 100644 --- a/assets/common/items/crafting_ing/leather_scraps.ron +++ b/assets/common/items/crafting_ing/leather_scraps.ron @@ -2,6 +2,6 @@ Item( name: "Leather Scraps", description: "Used to craft various items.", kind: Ingredient( - kind: LeatherScraps, + kind: "LeatherScraps", ) ) diff --git a/assets/common/items/crafting_ing/shiny_gem.ron b/assets/common/items/crafting_ing/shiny_gem.ron index ec396047fa..aec07575c3 100644 --- a/assets/common/items/crafting_ing/shiny_gem.ron +++ b/assets/common/items/crafting_ing/shiny_gem.ron @@ -2,6 +2,6 @@ Item( name: "Shiny Gem", description: "It's so shiny!", kind: Ingredient( - kind: ShinyGem, + kind: "ShinyGem", ) ) diff --git a/assets/common/items/crafting_ing/stones.ron b/assets/common/items/crafting_ing/stones.ron index 20d5842255..27efc702a3 100644 --- a/assets/common/items/crafting_ing/stones.ron +++ b/assets/common/items/crafting_ing/stones.ron @@ -2,6 +2,6 @@ Item( name: "Stones", description: "Pebbles from the ground.", kind: Ingredient( - kind: Stones, + kind: "Stones", ) ) diff --git a/assets/common/items/crafting_ing/twigs.ron b/assets/common/items/crafting_ing/twigs.ron index 3eaba0f24a..ecac83bccc 100644 --- a/assets/common/items/crafting_ing/twigs.ron +++ b/assets/common/items/crafting_ing/twigs.ron @@ -2,6 +2,6 @@ Item( name: "Twigs", description: "Dry.", kind: Ingredient( - kind: Twigs, + kind: "Twigs", ) ) diff --git a/assets/common/items/crafting_tools/craftsman_hammer.ron b/assets/common/items/crafting_tools/craftsman_hammer.ron index 30bdb55506..c5bfa8ce47 100644 --- a/assets/common/items/crafting_tools/craftsman_hammer.ron +++ b/assets/common/items/crafting_tools/craftsman_hammer.ron @@ -2,6 +2,6 @@ Item( name: "Craftsman Hammer", description: "Used to craft various items.", kind: Ingredient( - kind: CraftsmanHammer, + kind: "CraftsmanHammer", ) ) diff --git a/assets/common/items/crafting_tools/mortar_pestle.ron b/assets/common/items/crafting_tools/mortar_pestle.ron index d983f15b3f..60f8b60afd 100644 --- a/assets/common/items/crafting_tools/mortar_pestle.ron +++ b/assets/common/items/crafting_tools/mortar_pestle.ron @@ -2,6 +2,6 @@ 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, + kind: "MortarPestle", ) ) diff --git a/assets/common/items/flowers/blue.ron b/assets/common/items/flowers/blue.ron index 7f137e1892..075e1fd6f2 100644 --- a/assets/common/items/flowers/blue.ron +++ b/assets/common/items/flowers/blue.ron @@ -2,6 +2,6 @@ Item( name: "Blue Flower", description: "Matches the color of the sky.", kind: Ingredient( - kind: Flower, + kind: "Flower", ) ) diff --git a/assets/common/items/flowers/pink.ron b/assets/common/items/flowers/pink.ron index 79c3bada08..793869f784 100644 --- a/assets/common/items/flowers/pink.ron +++ b/assets/common/items/flowers/pink.ron @@ -2,6 +2,6 @@ Item( name: "Pink Flower", description: "Looks like a lollipop.", kind: Ingredient( - kind: Flower, + kind: "Flower", ) ) diff --git a/assets/common/items/flowers/red.ron b/assets/common/items/flowers/red.ron index b9ea9425c1..a3d32e486d 100644 --- a/assets/common/items/flowers/red.ron +++ b/assets/common/items/flowers/red.ron @@ -2,6 +2,6 @@ Item( name: "Red Flower", description: "Roses are red...", kind: Ingredient( - kind: Flower, + kind: "Flower", ) ) diff --git a/assets/common/items/flowers/sun.ron b/assets/common/items/flowers/sun.ron index 757db214a3..143ef7439b 100644 --- a/assets/common/items/flowers/sun.ron +++ b/assets/common/items/flowers/sun.ron @@ -2,6 +2,6 @@ Item( name: "Sunflower", description: "Smells like summer.", kind: Ingredient( - kind: Flower, + kind: "Flower", ) ) diff --git a/assets/common/items/flowers/white.ron b/assets/common/items/flowers/white.ron index 0b98d0f799..d772c6dc35 100644 --- a/assets/common/items/flowers/white.ron +++ b/assets/common/items/flowers/white.ron @@ -2,6 +2,6 @@ Item( name: "White flower", description: "Pure and precious.", kind: Ingredient( - kind: Flower, + kind: "Flower", ) ) diff --git a/assets/common/items/flowers/yellow.ron b/assets/common/items/flowers/yellow.ron index c9e799b32e..5897a9c50a 100644 --- a/assets/common/items/flowers/yellow.ron +++ b/assets/common/items/flowers/yellow.ron @@ -2,6 +2,6 @@ Item( name: "Yellow Flower", description: "Glows like the sun.", kind: Ingredient( - kind: Flower, + kind: "Flower", ) ) diff --git a/assets/common/items/food/apple.ron b/assets/common/items/food/apple.ron index 48b7d56a5a..e31d3ce549 100644 --- a/assets/common/items/food/apple.ron +++ b/assets/common/items/food/apple.ron @@ -2,7 +2,7 @@ Item( name: "Apple", description: "Restores 20 Health\n\nRed and juicy\n\n", kind: Consumable( - kind: Apple, + kind: "Apple", effect: Health(( amount: 200, cause: Item, diff --git a/assets/common/items/food/apple_mushroom_curry.ron b/assets/common/items/food/apple_mushroom_curry.ron index 03aed62d4b..ae0a04ef72 100644 --- a/assets/common/items/food/apple_mushroom_curry.ron +++ b/assets/common/items/food/apple_mushroom_curry.ron @@ -2,7 +2,7 @@ Item( name: "Mushroom Curry", description: "Restores 120 Health\n\nWho could say no to that?\n\n", kind: Consumable( - kind: AppleShroomCurry, + kind: "AppleShroomCurry", effect: Health(( amount: 1200, cause: Item, diff --git a/assets/common/items/food/apple_stick.ron b/assets/common/items/food/apple_stick.ron index 5d7b183e07..27caeea816 100644 --- a/assets/common/items/food/apple_stick.ron +++ b/assets/common/items/food/apple_stick.ron @@ -2,7 +2,7 @@ Item( name: "Apple Stick", description: "Restores 60 Health\n\n", kind: Consumable( - kind: AppleStick, + kind: "AppleStick", effect: Health(( amount: 600, cause: Item, diff --git a/assets/common/items/food/cheese.ron b/assets/common/items/food/cheese.ron index 037519d22b..20ccee968f 100644 --- a/assets/common/items/food/cheese.ron +++ b/assets/common/items/food/cheese.ron @@ -2,7 +2,7 @@ Item( name: "Dwarven Cheese", description: "Restores 15 Health\n\nAromatic and nutritious\n\n", kind: Consumable( - kind: Cheese, + kind: "Cheese", effect: Health(( amount: 150, cause: Item, diff --git a/assets/common/items/food/coconut.ron b/assets/common/items/food/coconut.ron index 103d4c9b38..37cb30b9e2 100644 --- a/assets/common/items/food/coconut.ron +++ b/assets/common/items/food/coconut.ron @@ -2,7 +2,7 @@ Item( name: "Coconut", description: "Restores 30 health\n\nReliable source of water and fat\n\n", kind: Consumable( - kind: Coconut, + kind: "Coconut", effect: Health(( amount: 300, cause: Item, diff --git a/assets/common/items/food/mushroom.ron b/assets/common/items/food/mushroom.ron index e612b1d2c7..2131683964 100644 --- a/assets/common/items/food/mushroom.ron +++ b/assets/common/items/food/mushroom.ron @@ -2,7 +2,7 @@ Item( name: "Mushroom", description: "Restores 10 Health\n\nHopefully this one is not poisonous\n\n", kind: Consumable( - kind: Mushroom, + kind: "Mushroom", effect: Health(( amount: 100, cause: Item, diff --git a/assets/common/items/food/mushroom_stick.ron b/assets/common/items/food/mushroom_stick.ron index 5f0577d855..41228a7ab9 100644 --- a/assets/common/items/food/mushroom_stick.ron +++ b/assets/common/items/food/mushroom_stick.ron @@ -2,7 +2,7 @@ Item( name: "Mushroom Stick", description: "Restores 50 Health\n\n", kind: Consumable( - kind: MushroomStick, + kind: "MushroomStick", effect: Health(( amount: 500, cause: Item, diff --git a/assets/common/items/grasses/long.ron b/assets/common/items/grasses/long.ron index e592ce9779..7a86cbbb97 100644 --- a/assets/common/items/grasses/long.ron +++ b/assets/common/items/grasses/long.ron @@ -2,6 +2,6 @@ Item( name: "Long Grass", description: "Greener than an orc's snout.", kind: Ingredient( - kind: Grass, + kind: "Grass", ) ) diff --git a/assets/common/items/grasses/medium.ron b/assets/common/items/grasses/medium.ron index ec67d4bb77..19252c11bf 100644 --- a/assets/common/items/grasses/medium.ron +++ b/assets/common/items/grasses/medium.ron @@ -2,6 +2,6 @@ Item( name: "Medium Grass", description: "Greener than an orc's snout.", kind: Ingredient( - kind: Grass, + kind: "Grass", ) ) diff --git a/assets/common/items/grasses/short.ron b/assets/common/items/grasses/short.ron index a1808c85f6..4b11ea3b6f 100644 --- a/assets/common/items/grasses/short.ron +++ b/assets/common/items/grasses/short.ron @@ -2,6 +2,6 @@ Item( name: "Short Grass", description: "Greener than an orc's snout.", kind: Ingredient( - kind: Grass, + kind: "Grass", ) ) diff --git a/assets/common/items/lantern/black_0.ron b/assets/common/items/lantern/black_0.ron index e9e67e729b..1b948eca89 100644 --- a/assets/common/items/lantern/black_0.ron +++ b/assets/common/items/lantern/black_0.ron @@ -3,7 +3,7 @@ Item( description: "Used by city guards.", kind: Lantern( ( - kind: Black0, + kind: "Black0", color: (r: 255, g: 190, b: 75), strength_thousandths: 3000, flicker_thousandths: 300, diff --git a/assets/common/items/lantern/blue_0.ron b/assets/common/items/lantern/blue_0.ron index 08b0ced767..31231f9e47 100644 --- a/assets/common/items/lantern/blue_0.ron +++ b/assets/common/items/lantern/blue_0.ron @@ -3,7 +3,7 @@ Item( description: "This lantern is surprisingly cold when lit.", kind: Lantern( ( - kind: Blue0, + kind: "Blue0", color: (r: 64, g: 127, b: 153), strength_thousandths: 4000, flicker_thousandths: 250, diff --git a/assets/common/items/lantern/green_0.ron b/assets/common/items/lantern/green_0.ron index 2b8bdccc01..6675d3ff77 100644 --- a/assets/common/items/lantern/green_0.ron +++ b/assets/common/items/lantern/green_0.ron @@ -3,7 +3,7 @@ Item( description: "It has an opening that could fit a ring...", kind: Lantern( ( - kind: Green0, + kind: "Green0", color: (r: 192, g: 255, b: 76), strength_thousandths: 4000, flicker_thousandths: 500, diff --git a/assets/common/items/lantern/red_0.ron b/assets/common/items/lantern/red_0.ron index 24da319e43..47ee0b73ba 100644 --- a/assets/common/items/lantern/red_0.ron +++ b/assets/common/items/lantern/red_0.ron @@ -3,7 +3,7 @@ Item( description: "Caution: contents hot", kind: Lantern( ( - kind: Red0, + kind: "Red0", color: (r: 255, g: 127, b: 51), strength_thousandths: 3500, flicker_thousandths: 1000, diff --git a/assets/common/items/ore/velorite.ron b/assets/common/items/ore/velorite.ron index 4a31cd56d8..9d609bea1b 100644 --- a/assets/common/items/ore/velorite.ron +++ b/assets/common/items/ore/velorite.ron @@ -2,7 +2,7 @@ Item( name: "Velorite", description: "Increases Exp by 20\n\nJust a slight touch makes you feel the knowledge of ancient times\n\n", kind: Consumable( - kind: Velorite, + kind: "Velorite", effect: Xp(20), ), ) diff --git a/assets/common/items/ore/veloritefrag.ron b/assets/common/items/ore/veloritefrag.ron index 74c2a0036f..104b1ee0c7 100644 --- a/assets/common/items/ore/veloritefrag.ron +++ b/assets/common/items/ore/veloritefrag.ron @@ -2,7 +2,7 @@ Item( name: "Velorite Fragment", description: "Increases Exp by 10\n\nSmall runes sparkle on its surface\n\n", kind: Consumable( - kind: VeloriteFrag, + kind: "VeloriteFrag", effect: Xp(10), ), ) diff --git a/assets/voxygen/audio/sfx.ron b/assets/voxygen/audio/sfx.ron index a9ea7d468b..c2725ba3cd 100644 --- a/assets/voxygen/audio/sfx.ron +++ b/assets/voxygen/audio/sfx.ron @@ -77,31 +77,31 @@ ], threshold: 0.3, ), - Inventory(Consumed(Potion)): ( + Inventory(Consumed("Potion")): ( files: [ "voxygen.audio.sfx.inventory.consumable.liquid", ], threshold: 0.3, ), - Inventory(Consumed(PotionMinor)): ( + Inventory(Consumed("PotionMinor")): ( files: [ "voxygen.audio.sfx.inventory.consumable.liquid", ], threshold: 0.3, ), - Inventory(Consumed(Apple)): ( + Inventory(Consumed("Apple")): ( files: [ "voxygen.audio.sfx.inventory.consumable.apple", ], threshold: 0.3, ), - Inventory(Consumed(Mushroom)): ( + Inventory(Consumed("Mushroom")): ( files: [ "voxygen.audio.sfx.inventory.consumable.food", ], threshold: 0.3, ), - Inventory(Consumed(Cheese)): ( + Inventory(Consumed("Cheese")): ( files: [ "voxygen.audio.sfx.inventory.consumable.food", ], diff --git a/assets/voxygen/item_image_manifest.ron b/assets/voxygen/item_image_manifest.ron index 478a908f27..5c71dde11b 100644 --- a/assets/voxygen/item_image_manifest.ron +++ b/assets/voxygen/item_image_manifest.ron @@ -461,11 +461,11 @@ (2.0, -1.0, 0.0), (-135.0, 90.0, 0.0), 1.1, ), Tool(Hammer("CobaltHammer0")): VoxTrans( - "voxel.weapon.hammer.2hhammer_Cobalt-0", + "voxel.weapon.hammer.2hhammer_cobalt-0", (2.0, -1.0, 0.0), (-135.0, 90.0, 0.0), 1.1, ), Tool(Hammer("CobaltHammer1")): VoxTrans( - "voxel.weapon.hammer.2hhammer_Cobalt-1", + "voxel.weapon.hammer.2hhammer_cobalt-1", (2.0, -1.0, 0.0), (-135.0, 90.0, 0.0), 1.1, ), Tool(Hammer("RunicHammer")): VoxTrans( @@ -508,16 +508,16 @@ (0.0, 0.0, 0.0), (-90.0, 90.0, 0.0), 2.4, ), // Lanterns - Lantern(Black0): Png( + Lantern("Black0"): Png( "element.icons.lantern_black-0", ), - Lantern(Green0): Png( + Lantern("Green0"): Png( "element.icons.lantern_green-0", ), - Lantern(Blue0): Png( + Lantern("Blue0"): Png( "element.icons.lantern_blue-0", ), - Lantern(Red0): Png( + Lantern("Red0"): Png( "element.icons.lantern_red-0", ), // Farming Equipment @@ -621,7 +621,7 @@ "voxel.armor.shoulder.cultist_right", (0.0, 0.0, 0.0), (-90.0, 180.0, 0.0), 1.2, ), - // Druid Set + // Druid Set Armor(Chest("Druid")): VoxTrans( "voxel.armor.chest.druid", (0.0, 0.0, 0.0), (-90.0, 180.0, 0.0), 1.2, @@ -762,7 +762,7 @@ "voxel.armor.hand.steel_right-0", (0.0, -1.0, 0.0), (-90.0, 135.0, 0.0), 1.0, ), - Armor(Shoulder("Steel0")): VoxTrans( + Armor(Shoulder("Steel0")): VoxTrans( "voxel.armor.shoulder.steel_right-0", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), @@ -787,7 +787,7 @@ "voxel.armor.hand.leather_right-0", (0.0, -1.0, 0.0), (-90.0, 135.0, 0.0), 1.0, ), - Armor(Shoulder("Leather0")): VoxTrans( + Armor(Shoulder("Leather0")): VoxTrans( "voxel.armor.shoulder.leather_right-0", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), @@ -817,7 +817,7 @@ "voxel.armor.hand.leather_right-2", (0.0, -1.0, 0.0), (-90.0, 135.0, 0.0), 1.0, ), - Armor(Shoulder("Leather2")): VoxTrans( + Armor(Shoulder("Leather2")): VoxTrans( "voxel.armor.shoulder.leather_right-2", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), @@ -871,7 +871,7 @@ "voxel.armor.shoulder.cloth_green_right-0", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), - Armor(Shoulder("ClothGreen0")): VoxTrans( + Armor(Shoulder("ClothGreen0")): VoxTrans( "voxel.armor.shoulder.cloth_green_right-0", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), @@ -900,19 +900,19 @@ "voxel.armor.shoulder.cloth_purple_right-0", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), - Armor(Shoulder("ClothBlue1")): VoxTrans( + Armor(Shoulder("ClothBlue1")): VoxTrans( "voxel.armor.shoulder.cloth_blue_right-1", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), - Armor(Shoulder("IronSpikes")): VoxTrans( + Armor(Shoulder("IronSpikes")): VoxTrans( "voxel.armor.shoulder.iron_spikes_right", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), - Armor(Shoulder("IronLeather3")): VoxTrans( + Armor(Shoulder("IronLeather3")): VoxTrans( "voxel.armor.shoulder.leather_iron_right-3", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), - Armor(Shoulder("IronLeather2")): VoxTrans( + Armor(Shoulder("IronLeather2")): VoxTrans( "voxel.armor.shoulder.leather_iron_right-2", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), @@ -978,7 +978,7 @@ "voxel.armor.hand.twigsleaves_glove_right", (0.0, -1.0, 0.0), (-90.0, 135.0, 0.0), 1.0, ), - Armor(Shoulder("LeafyShoulder")): VoxTrans( + Armor(Shoulder("LeafyShoulder")): VoxTrans( "voxel.armor.shoulder.twigsleaves_shoulder_right", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), @@ -1003,7 +1003,7 @@ "voxel.armor.hand.twigsflowers_glove_right", (0.0, -1.0, 0.0), (-90.0, 135.0, 0.0), 1.0, ), - Armor(Shoulder("FlowerShoulder")): VoxTrans( + Armor(Shoulder("FlowerShoulder")): VoxTrans( "voxel.armor.shoulder.twigsflowers_shoulder_right", (0.0, 0.0, 0.0), (-90.0, 130.0, 0.0), 1.2, ), @@ -1047,55 +1047,54 @@ (0.0, 0.0, 0.0), (-90.0, 180.0, 0.0), 1.0, ), // Consumables - Consumable(Apple): - Png( + Consumable("Apple"): Png( "element.icons.item_apple", ), - Consumable(Coconut): Png( + Consumable("Coconut"): Png( "element.icons.item_coconut", ), - Consumable(PotionMed): VoxTrans( + 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", (0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.5, ), - Consumable(PotionLarge): VoxTrans( + 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", (0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.8, ), - Consumable(Cheese): Png( + Consumable("Cheese"): Png( "element.icons.item_cheese", ), - Consumable(Potion): VoxTrans( + Consumable("Potion"): VoxTrans( "voxel.object.potion_red", (0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 1.0, ), - Consumable(Mushroom): VoxTrans( + Consumable("Mushroom"): VoxTrans( "voxel.sprite.mushrooms.mushroom-10", (0.0, 0.0, 0.0), (-50.0, 70.0, 40.0), 1.0, ), - Consumable(Velorite): VoxTrans( + Consumable("Velorite"): VoxTrans( "voxel.sprite.velorite.velorite_ore", (0.0, -1.0, 0.0), (-50.0, 40.0, 20.0), 0.8, ), - Consumable(VeloriteFrag): VoxTrans( + Consumable("VeloriteFrag"): VoxTrans( "voxel.sprite.velorite.velorite_1", (0.0, 0.0, 0.0), (-50.0, 40.0, 20.0), 0.8, ), - Consumable(AppleShroomCurry): Png( + Consumable("AppleShroomCurry"): Png( "element.icons.item_apple_curry", ), - Consumable(AppleStick): Png( + Consumable("AppleStick"): Png( "element.icons.item_apple_stick", ), - Consumable(MushroomStick): Png( + Consumable("MushroomStick"): Png( "element.icons.item_shroom_stick", ), @@ -1109,36 +1108,36 @@ (0.0, -1.0, 0.0), (-50.0, 40.0, 20.0), 0.8, ), // Ingredients - Ingredient(CraftsmanHammer): VoxTrans( //TODO This should be a 1h hammer! + 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", (0.0, -1.0, 0.0), (-50.0, 40.0, 20.0), 0.8, ), - Ingredient(Grass): VoxTrans( + Ingredient("Grass"): VoxTrans( "voxel.sprite.grass.grass_long_5", (0.0, 0.0, 0.0), (-90.0, 50.0, 0.0), 1.0, ), - Ingredient(Stones): VoxTrans( + 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( + 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( + Ingredient("LeatherScraps"): Png( "element.icons.item_leather0", ), - Ingredient(ShinyGem): Png( + Ingredient("ShinyGem"): Png( "element.icons.gem", ), - Ingredient(MortarPestle): Png( + Ingredient("MortarPestle"): Png( "element.icons.item_mortarpestlecoco", ), - Ingredient(EmptyVial): VoxTrans( + Ingredient("EmptyVial"): VoxTrans( "voxel.object.potion_empty", (0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.8, ), diff --git a/assets/voxygen/voxel/humanoid_lantern_manifest.ron b/assets/voxygen/voxel/humanoid_lantern_manifest.ron index 09069ef96b..3b3dbf5fe1 100644 --- a/assets/voxygen/voxel/humanoid_lantern_manifest.ron +++ b/assets/voxygen/voxel/humanoid_lantern_manifest.ron @@ -4,19 +4,19 @@ color: None ), map: { - Green0: ( + "Green0": ( vox_spec: ("armor.lantern.green-0", (-2.0, -2.0, -7.0)), color: None ), - Black0: ( + "Black0": ( vox_spec: ("armor.lantern.black-0", (-2.0, -2.0, -7.0)), color: None ), - Red0: ( + "Red0": ( vox_spec: ("armor.lantern.red-0", (-2.0, -2.0, -7.0)), color: None ), - Blue0: ( + "Blue0": ( vox_spec: ("armor.lantern.blue-0", (-2.0, -2.0, -7.0)), color: None ), diff --git a/common/src/comp/inventory/item/mod.rs b/common/src/comp/inventory/item/mod.rs index b7bb702e0b..3990e1c5d7 100644 --- a/common/src/comp/inventory/item/mod.rs +++ b/common/src/comp/inventory/item/mod.rs @@ -16,24 +16,6 @@ use specs_idvs::IdvStorage; use std::{fs::File, io::BufReader}; use vek::Rgb; -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub enum Consumable { - Coconut, - Apple, - Cheese, - Potion, - Mushroom, - Velorite, - VeloriteFrag, - PotionMinor, - PotionMed, - PotionLarge, - PotionExp, - AppleShroomCurry, - AppleStick, - MushroomStick, -} - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum Throwable { Bomb, @@ -45,43 +27,14 @@ pub enum Utility { Collar, } -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub enum Ingredient { - Flower, - Grass, - EmptyVial, - LeatherScraps, - ShinyGem, - Stones, - Twigs, - MortarPestle, - CraftsmanHammer, -} - -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] -#[repr(u32)] -pub enum LanternKind { - Black0 = 1, - Green0 = 2, - Red0 = 3, - Blue0 = 4, -} - -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct Lantern { - pub kind: LanternKind, + pub kind: String, color: Rgb, strength_thousandths: u32, flicker_thousandths: u32, } -pub const ALL_LANTERNS: [LanternKind; 4] = [ - LanternKind::Black0, - LanternKind::Green0, - LanternKind::Red0, - LanternKind::Blue0, -]; - impl Lantern { pub fn strength(&self) -> f32 { self.strength_thousandths as f32 / 1000_f32 } @@ -97,7 +50,7 @@ pub enum ItemKind { Lantern(Lantern), Armor(armor::Armor), Consumable { - kind: Consumable, + kind: String, effect: Effect, #[serde(default = "default_amount")] amount: u32, @@ -113,7 +66,7 @@ pub enum ItemKind { amount: u32, }, Ingredient { - kind: Ingredient, + kind: String, #[serde(default = "default_amount")] amount: u32, }, diff --git a/common/src/comp/inventory/mod.rs b/common/src/comp/inventory/mod.rs index 5516704514..12d2180f5f 100644 --- a/common/src/comp/inventory/mod.rs +++ b/common/src/comp/inventory/mod.rs @@ -2,7 +2,7 @@ pub mod item; pub mod slot; use crate::{assets, recipe::Recipe}; -use item::{Consumable, Item, ItemKind}; +use item::{Item, ItemKind}; use serde::{Deserialize, Serialize}; use specs::{Component, FlaggedStorage, HashMapStorage}; use specs_idvs::IdvStorage; @@ -38,7 +38,7 @@ impl Inventory { /// Adds a new item to the first fitting group of the inventory or starts a /// new group. Returns the item again if no space was found. pub fn push(&mut self, item: Item) -> Option { - let item = match item.kind { + let item = match &item.kind { ItemKind::Tool(_) | ItemKind::Armor { .. } | ItemKind::Lantern(_) => { self.add_to_first_empty(item) }, @@ -61,7 +61,7 @@ impl Inventory { .. }) = slot { - if item_kind == *kind { + if *item_kind == *kind { *amount += new_amount; self.recount_items(); return None; @@ -92,7 +92,7 @@ impl Inventory { .. }) = slot { - if item_kind == *kind { + if *item_kind == *kind { *amount += new_amount; self.recount_items(); return None; @@ -123,7 +123,7 @@ impl Inventory { .. }) = slot { - if item_kind == *kind { + if *item_kind == *kind { *amount += new_amount; self.recount_items(); return None; @@ -153,7 +153,7 @@ impl Inventory { .. }) = slot { - if item_kind == *kind { + if *item_kind == *kind { *amount += new_amount; self.recount_items(); return None; @@ -424,7 +424,7 @@ impl Inventory { } else { *amount -= 1; return_item.kind = ItemKind::Consumable { - kind: *kind, + kind: kind.clone(), effect: *effect, amount: 1, }; @@ -451,7 +451,7 @@ impl Inventory { } else { *amount -= 1; return_item.kind = ItemKind::Ingredient { - kind: *kind, + kind: kind.clone(), amount: 1, }; self.recount_items(); @@ -531,7 +531,7 @@ impl Component for Inventory { pub enum InventoryUpdateEvent { Init, Used, - Consumed(Consumable), + Consumed(String), Gave, Given, Swapped, diff --git a/server/src/events/interaction.rs b/server/src/events/interaction.rs index 878f2f6c67..04b92ae292 100644 --- a/server/src/events/interaction.rs +++ b/server/src/events/interaction.rs @@ -24,12 +24,12 @@ pub fn handle_lantern(server: &mut Server, entity: EcsEntity) { .write_storage::() .remove(entity); } else { - let lantern_opt = ecs - .read_storage::() + let loadout_storage = ecs.read_storage::(); + let lantern_opt = loadout_storage .get(entity) .and_then(|loadout| loadout.lantern.as_ref()) .and_then(|item| { - if let comp::item::ItemKind::Lantern(l) = item.kind { + if let comp::item::ItemKind::Lantern(l) = &item.kind { Some(l) } else { None diff --git a/server/src/events/inventory_manip.rs b/server/src/events/inventory_manip.rs index aebe689286..119ad8429b 100644 --- a/server/src/events/inventory_manip.rs +++ b/server/src/events/inventory_manip.rs @@ -157,7 +157,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv match &item.kind { ItemKind::Consumable { kind, effect, .. } => { maybe_effect = Some(*effect); - Some(comp::InventoryUpdateEvent::Consumed(*kind)) + Some(comp::InventoryUpdateEvent::Consumed(kind.clone())) }, ItemKind::Throwable { kind, .. } => { if let Some(pos) = diff --git a/voxygen/src/audio/sfx/mod.rs b/voxygen/src/audio/sfx/mod.rs index 3db1875736..b76c287cdb 100644 --- a/voxygen/src/audio/sfx/mod.rs +++ b/voxygen/src/audio/sfx/mod.rs @@ -88,7 +88,7 @@ use crate::audio::AudioFrontend; use common::{ assets, comp::{ - item::{Consumable, ItemKind, ToolCategory}, + item::{ItemKind, ToolCategory}, CharacterAbilityType, InventoryUpdateEvent, Ori, Pos, }, event::EventBus, @@ -153,7 +153,7 @@ pub enum SfxInventoryEvent { Collected, CollectedTool(ToolCategory), CollectFailed, - Consumed(Consumable), + Consumed(String), Debug, Dropped, Given, @@ -177,7 +177,7 @@ impl From<&InventoryUpdateEvent> for SfxEvent { SfxEvent::Inventory(SfxInventoryEvent::CollectFailed) }, InventoryUpdateEvent::Consumed(consumable) => { - SfxEvent::Inventory(SfxInventoryEvent::Consumed(*consumable)) + SfxEvent::Inventory(SfxInventoryEvent::Consumed(consumable.clone())) }, InventoryUpdateEvent::Debug => SfxEvent::Inventory(SfxInventoryEvent::Debug), InventoryUpdateEvent::Dropped => SfxEvent::Inventory(SfxInventoryEvent::Dropped), diff --git a/voxygen/src/hud/hotbar.rs b/voxygen/src/hud/hotbar.rs index 61485d5400..21840f79af 100644 --- a/voxygen/src/hud/hotbar.rs +++ b/voxygen/src/hud/hotbar.rs @@ -77,8 +77,8 @@ impl State { .filter(|kind| { use common::comp::item::{tool::ToolKind, ItemKind}; if let ItemKind::Tool(kind) = kind { - if let ToolKind::Staff(_) = &kind.kind { - true + if let ToolKind::Staff(kind) = &kind.kind { + kind != "Sceptre" } else if let ToolKind::Debug(kind) = &kind.kind { kind == "Boost" } else { diff --git a/voxygen/src/hud/item_imgs.rs b/voxygen/src/hud/item_imgs.rs index 405ad05e7a..48e99b22b9 100644 --- a/voxygen/src/hud/item_imgs.rs +++ b/voxygen/src/hud/item_imgs.rs @@ -4,7 +4,7 @@ use common::{ comp::item::{ armor::{Armor, ArmorKind}, tool::{Tool, ToolKind}, - Consumable, Ingredient, Item, ItemKind, Lantern, LanternKind, Throwable, Utility, + Item, ItemKind, Lantern, Throwable, Utility, }, figure::Segment, }; @@ -20,24 +20,24 @@ use vek::*; #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum ItemKey { Tool(ToolKind), - Lantern(LanternKind), + Lantern(String), Armor(ArmorKind), Utility(Utility), - Consumable(Consumable), + Consumable(String), Throwable(Throwable), - Ingredient(Ingredient), + Ingredient(String), Empty, } impl From<&Item> for ItemKey { fn from(item: &Item) -> Self { match &item.kind { ItemKind::Tool(Tool { kind, .. }) => ItemKey::Tool(kind.clone()), - ItemKind::Lantern(Lantern { kind, .. }) => ItemKey::Lantern(*kind), + ItemKind::Lantern(Lantern { kind, .. }) => ItemKey::Lantern(kind.clone()), ItemKind::Armor(Armor { kind, .. }) => ItemKey::Armor(kind.clone()), ItemKind::Utility { kind, .. } => ItemKey::Utility(*kind), - ItemKind::Consumable { kind, .. } => ItemKey::Consumable(*kind), + ItemKind::Consumable { kind, .. } => ItemKey::Consumable(kind.clone()), ItemKind::Throwable { kind, .. } => ItemKey::Throwable(*kind), - ItemKind::Ingredient { kind, .. } => ItemKey::Ingredient(*kind), + ItemKind::Ingredient { kind, .. } => ItemKey::Ingredient(kind.clone()), } } } diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index 864664065e..5aadd9efac 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -8,7 +8,7 @@ use anim::Skeleton; use common::{ assets::watch::ReloadIndicator, comp::{ - item::{armor::ArmorKind, tool::ToolKind, ItemKind, LanternKind}, + item::{armor::ArmorKind, tool::ToolKind, ItemKind}, Body, CharacterState, Loadout, }, figure::Segment, @@ -37,7 +37,7 @@ struct CharacterCacheKey { chest: Option, belt: Option, back: Option, - lantern: Option, + lantern: Option, hand: Option, pants: Option, foot: Option, @@ -86,7 +86,7 @@ impl CharacterCacheKey { lantern: if let Some(ItemKind::Lantern(lantern)) = loadout.lantern.as_ref().map(|i| &i.kind) { - Some(lantern.kind) + Some(lantern.kind.clone()) } else { None }, diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 88d412eb64..007a4c91ee 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -13,7 +13,7 @@ use common::{ item::{ armor::{Armor, ArmorKind}, tool::{Tool, ToolKind}, - ItemKind, Lantern, LanternKind, + ItemKind, Lantern, }, object, quadruped_low::{BodyType as QLBodyType, Species as QLSpecies}, @@ -268,7 +268,7 @@ pub struct HumArmorFootSpec(ArmorVoxSpecMap); #[derive(Serialize, Deserialize)] pub struct HumMainWeaponSpec(HashMap); #[derive(Serialize, Deserialize)] -pub struct HumArmorLanternSpec(ArmorVoxSpecMap); +pub struct HumArmorLanternSpec(ArmorVoxSpecMap); #[derive(Serialize, Deserialize)] pub struct HumArmorHeadSpec(ArmorVoxSpecMap); #[derive(Serialize, Deserialize)] @@ -841,7 +841,7 @@ impl HumArmorLanternSpec { let spec = if let Some(ItemKind::Lantern(Lantern { kind, .. })) = loadout.lantern.as_ref().map(|i| &i.kind) { - match self.0.map.get(&kind) { + match self.0.map.get(kind) { Some(spec) => spec, None => { error!(?kind, "No lantern specification exists");