Dehardcoded LanternKind, Consumable and Ingredient, fixed Sceptre hotbar

Also fixed two wrong asset references and did some .ron formatting
This commit is contained in:
BottledByte 2020-08-05 01:21:42 +02:00
parent a717276d81
commit ab1c43be84
50 changed files with 122 additions and 169 deletions

View File

@ -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) - Updated windowing library (winit 0.19 -> 0.22)
- Bow M2 is now a charged attack that scales the longer it's held - Bow M2 is now a charged attack that scales the longer it's held
- Fixed window resizing on Mac OS X. - Fixed window resizing on Mac OS X.
- Dehardcoded many item variants
### Removed ### Removed

View File

@ -3,7 +3,7 @@ Item(
description: "Used by city guards.", description: "Used by city guards.",
kind: Lantern( kind: Lantern(
( (
kind: Black0, kind: "Black0",
color: (r: 255, g: 190, b: 75), color: (r: 255, g: 190, b: 75),
strength_thousandths: 3000, strength_thousandths: 3000,
flicker_thousandths: 300, flicker_thousandths: 300,

View File

@ -2,7 +2,7 @@ Item(
name: "Flask of Velorite Dusk", name: "Flask of Velorite Dusk",
description: "Increases Exp by 250\n\nTake with plenty of water\n\n<Right-Click to use>", description: "Increases Exp by 250\n\nTake with plenty of water\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: PotionExp, kind: "PotionExp",
effect: Xp(250), effect: Xp(250),
), ),
) )

View File

@ -3,7 +3,7 @@ Item(
description: "Illuminates even the darkest dungeon\nA great monster was slain for this item", description: "Illuminates even the darkest dungeon\nA great monster was slain for this item",
kind: Lantern( kind: Lantern(
( (
kind: Blue0, kind: "Blue0",
color: (r: 220, g: 220, b: 255), color: (r: 220, g: 220, b: 255),
strength_thousandths: 6500, strength_thousandths: 6500,
flicker_thousandths: 300, flicker_thousandths: 300,

View File

@ -2,7 +2,7 @@ Item(
name: "Potent Potion", name: "Potent Potion",
description: "A potent healing potion.\n\nRestores 100 health on use.\n\n<Right-Click to use>", description: "A potent healing potion.\n\nRestores 100 health on use.\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: Potion, kind: "Potion",
effect: Health(( effect: Health((
amount: 1000, amount: 1000,
cause: Item, cause: Item,

View File

@ -2,7 +2,7 @@ Item(
name: "Potion of Skill", name: "Potion of Skill",
description: "Provides 250 XP to the drinker\n\n<Right-Click to use>", description: "Provides 250 XP to the drinker\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: Potion, kind: "Potion",
effect: Xp(250), effect: Xp(250),
), ),
) )

View File

@ -2,7 +2,7 @@ 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: PotionLarge, kind: "PotionLarge",
effect: Health(( effect: Health((
amount: 1000, amount: 1000,
cause: Item, cause: Item,

View File

@ -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: PotionMed, kind: "PotionMed",
effect: Health(( effect: Health((
amount: 700, amount: 700,
cause: Item, cause: Item,

View File

@ -2,7 +2,7 @@ Item(
name: "Minor Potion", name: "Minor Potion",
description: "Restores 50 Health\n\n<Right-Click to use>", description: "Restores 50 Health\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: PotionMinor, kind: "PotionMinor",
effect: Health(( effect: Health((
amount: 500, amount: 500,
cause: Item, cause: Item,

View File

@ -2,6 +2,6 @@ Item(
name: "Empty Vial", name: "Empty Vial",
description: "Can be filled with fluids.", description: "Can be filled with fluids.",
kind: Ingredient( kind: Ingredient(
kind: EmptyVial, kind: "EmptyVial",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Leather Scraps", name: "Leather Scraps",
description: "Used to craft various items.", description: "Used to craft various items.",
kind: Ingredient( kind: Ingredient(
kind: LeatherScraps, kind: "LeatherScraps",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Shiny Gem", name: "Shiny Gem",
description: "It's so shiny!", description: "It's so shiny!",
kind: Ingredient( kind: Ingredient(
kind: ShinyGem, kind: "ShinyGem",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Stones", name: "Stones",
description: "Pebbles from the ground.", description: "Pebbles from the ground.",
kind: Ingredient( kind: Ingredient(
kind: Stones, kind: "Stones",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Twigs", name: "Twigs",
description: "Dry.", description: "Dry.",
kind: Ingredient( kind: Ingredient(
kind: Twigs, kind: "Twigs",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Craftsman Hammer", name: "Craftsman Hammer",
description: "Used to craft various items.", description: "Used to craft various items.",
kind: Ingredient( kind: Ingredient(
kind: CraftsmanHammer, kind: "CraftsmanHammer",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Mortar and Pestle", name: "Mortar and Pestle",
description: "Crushes and grinds things into\na fine powder or paste.\nUsed to craft various items.", description: "Crushes and grinds things into\na fine powder or paste.\nUsed to craft various items.",
kind: Ingredient( kind: Ingredient(
kind: MortarPestle, kind: "MortarPestle",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Blue Flower", name: "Blue Flower",
description: "Matches the color of the sky.", description: "Matches the color of the sky.",
kind: Ingredient( kind: Ingredient(
kind: Flower, kind: "Flower",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Pink Flower", name: "Pink Flower",
description: "Looks like a lollipop.", description: "Looks like a lollipop.",
kind: Ingredient( kind: Ingredient(
kind: Flower, kind: "Flower",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Red Flower", name: "Red Flower",
description: "Roses are red...", description: "Roses are red...",
kind: Ingredient( kind: Ingredient(
kind: Flower, kind: "Flower",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Sunflower", name: "Sunflower",
description: "Smells like summer.", description: "Smells like summer.",
kind: Ingredient( kind: Ingredient(
kind: Flower, kind: "Flower",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "White flower", name: "White flower",
description: "Pure and precious.", description: "Pure and precious.",
kind: Ingredient( kind: Ingredient(
kind: Flower, kind: "Flower",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Yellow Flower", name: "Yellow Flower",
description: "Glows like the sun.", description: "Glows like the sun.",
kind: Ingredient( kind: Ingredient(
kind: Flower, kind: "Flower",
) )
) )

View File

@ -2,7 +2,7 @@ Item(
name: "Apple", name: "Apple",
description: "Restores 20 Health\n\nRed and juicy\n\n<Right-Click to use>", description: "Restores 20 Health\n\nRed and juicy\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: Apple, kind: "Apple",
effect: Health(( effect: Health((
amount: 200, amount: 200,
cause: Item, cause: Item,

View File

@ -2,7 +2,7 @@ Item(
name: "Mushroom Curry", name: "Mushroom Curry",
description: "Restores 120 Health\n\nWho could say no to that?\n\n<Right-Click to use>", description: "Restores 120 Health\n\nWho could say no to that?\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: AppleShroomCurry, kind: "AppleShroomCurry",
effect: Health(( effect: Health((
amount: 1200, amount: 1200,
cause: Item, cause: Item,

View File

@ -2,7 +2,7 @@ Item(
name: "Apple Stick", name: "Apple Stick",
description: "Restores 60 Health\n\n<Right-Click to use>", description: "Restores 60 Health\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: AppleStick, kind: "AppleStick",
effect: Health(( effect: Health((
amount: 600, amount: 600,
cause: Item, cause: Item,

View File

@ -2,7 +2,7 @@ Item(
name: "Dwarven Cheese", name: "Dwarven Cheese",
description: "Restores 15 Health\n\nAromatic and nutritious\n\n<Right-Click to use>", description: "Restores 15 Health\n\nAromatic and nutritious\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: Cheese, kind: "Cheese",
effect: Health(( effect: Health((
amount: 150, amount: 150,
cause: Item, cause: Item,

View File

@ -2,7 +2,7 @@ Item(
name: "Coconut", name: "Coconut",
description: "Restores 30 health\n\nReliable source of water and fat\n\n<Right-Click to use>", description: "Restores 30 health\n\nReliable source of water and fat\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: Coconut, kind: "Coconut",
effect: Health(( effect: Health((
amount: 300, amount: 300,
cause: Item, cause: Item,

View File

@ -2,7 +2,7 @@ Item(
name: "Mushroom", name: "Mushroom",
description: "Restores 10 Health\n\nHopefully this one is not poisonous\n\n<Right-Click to use>", description: "Restores 10 Health\n\nHopefully this one is not poisonous\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: Mushroom, kind: "Mushroom",
effect: Health(( effect: Health((
amount: 100, amount: 100,
cause: Item, cause: Item,

View File

@ -2,7 +2,7 @@ Item(
name: "Mushroom Stick", name: "Mushroom Stick",
description: "Restores 50 Health\n\n<Right-Click to use>", description: "Restores 50 Health\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: MushroomStick, kind: "MushroomStick",
effect: Health(( effect: Health((
amount: 500, amount: 500,
cause: Item, cause: Item,

View File

@ -2,6 +2,6 @@ Item(
name: "Long Grass", name: "Long Grass",
description: "Greener than an orc's snout.", description: "Greener than an orc's snout.",
kind: Ingredient( kind: Ingredient(
kind: Grass, kind: "Grass",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Medium Grass", name: "Medium Grass",
description: "Greener than an orc's snout.", description: "Greener than an orc's snout.",
kind: Ingredient( kind: Ingredient(
kind: Grass, kind: "Grass",
) )
) )

View File

@ -2,6 +2,6 @@ Item(
name: "Short Grass", name: "Short Grass",
description: "Greener than an orc's snout.", description: "Greener than an orc's snout.",
kind: Ingredient( kind: Ingredient(
kind: Grass, kind: "Grass",
) )
) )

View File

@ -3,7 +3,7 @@ Item(
description: "Used by city guards.", description: "Used by city guards.",
kind: Lantern( kind: Lantern(
( (
kind: Black0, kind: "Black0",
color: (r: 255, g: 190, b: 75), color: (r: 255, g: 190, b: 75),
strength_thousandths: 3000, strength_thousandths: 3000,
flicker_thousandths: 300, flicker_thousandths: 300,

View File

@ -3,7 +3,7 @@ Item(
description: "This lantern is surprisingly cold when lit.", description: "This lantern is surprisingly cold when lit.",
kind: Lantern( kind: Lantern(
( (
kind: Blue0, kind: "Blue0",
color: (r: 64, g: 127, b: 153), color: (r: 64, g: 127, b: 153),
strength_thousandths: 4000, strength_thousandths: 4000,
flicker_thousandths: 250, flicker_thousandths: 250,

View File

@ -3,7 +3,7 @@ Item(
description: "It has an opening that could fit a ring...", description: "It has an opening that could fit a ring...",
kind: Lantern( kind: Lantern(
( (
kind: Green0, kind: "Green0",
color: (r: 192, g: 255, b: 76), color: (r: 192, g: 255, b: 76),
strength_thousandths: 4000, strength_thousandths: 4000,
flicker_thousandths: 500, flicker_thousandths: 500,

View File

@ -3,7 +3,7 @@ Item(
description: "Caution: contents hot", description: "Caution: contents hot",
kind: Lantern( kind: Lantern(
( (
kind: Red0, kind: "Red0",
color: (r: 255, g: 127, b: 51), color: (r: 255, g: 127, b: 51),
strength_thousandths: 3500, strength_thousandths: 3500,
flicker_thousandths: 1000, flicker_thousandths: 1000,

View File

@ -2,7 +2,7 @@ Item(
name: "Velorite", name: "Velorite",
description: "Increases Exp by 20\n\nJust a slight touch makes you feel the knowledge of ancient times\n\n<Right-Click to use>", description: "Increases Exp by 20\n\nJust a slight touch makes you feel the knowledge of ancient times\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: Velorite, kind: "Velorite",
effect: Xp(20), effect: Xp(20),
), ),
) )

View File

@ -2,7 +2,7 @@ Item(
name: "Velorite Fragment", name: "Velorite Fragment",
description: "Increases Exp by 10\n\nSmall runes sparkle on its surface\n\n<Right-Click to use>", description: "Increases Exp by 10\n\nSmall runes sparkle on its surface\n\n<Right-Click to use>",
kind: Consumable( kind: Consumable(
kind: VeloriteFrag, kind: "VeloriteFrag",
effect: Xp(10), effect: Xp(10),
), ),
) )

View File

@ -77,31 +77,31 @@
], ],
threshold: 0.3, threshold: 0.3,
), ),
Inventory(Consumed(Potion)): ( Inventory(Consumed("Potion")): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.liquid", "voxygen.audio.sfx.inventory.consumable.liquid",
], ],
threshold: 0.3, threshold: 0.3,
), ),
Inventory(Consumed(PotionMinor)): ( Inventory(Consumed("PotionMinor")): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.liquid", "voxygen.audio.sfx.inventory.consumable.liquid",
], ],
threshold: 0.3, threshold: 0.3,
), ),
Inventory(Consumed(Apple)): ( Inventory(Consumed("Apple")): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.apple", "voxygen.audio.sfx.inventory.consumable.apple",
], ],
threshold: 0.3, threshold: 0.3,
), ),
Inventory(Consumed(Mushroom)): ( Inventory(Consumed("Mushroom")): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],
threshold: 0.3, threshold: 0.3,
), ),
Inventory(Consumed(Cheese)): ( Inventory(Consumed("Cheese")): (
files: [ files: [
"voxygen.audio.sfx.inventory.consumable.food", "voxygen.audio.sfx.inventory.consumable.food",
], ],

View File

@ -461,11 +461,11 @@
(2.0, -1.0, 0.0), (-135.0, 90.0, 0.0), 1.1, (2.0, -1.0, 0.0), (-135.0, 90.0, 0.0), 1.1,
), ),
Tool(Hammer("CobaltHammer0")): VoxTrans( 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, (2.0, -1.0, 0.0), (-135.0, 90.0, 0.0), 1.1,
), ),
Tool(Hammer("CobaltHammer1")): VoxTrans( 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, (2.0, -1.0, 0.0), (-135.0, 90.0, 0.0), 1.1,
), ),
Tool(Hammer("RunicHammer")): VoxTrans( Tool(Hammer("RunicHammer")): VoxTrans(
@ -508,16 +508,16 @@
(0.0, 0.0, 0.0), (-90.0, 90.0, 0.0), 2.4, (0.0, 0.0, 0.0), (-90.0, 90.0, 0.0), 2.4,
), ),
// Lanterns // Lanterns
Lantern(Black0): Png( Lantern("Black0"): Png(
"element.icons.lantern_black-0", "element.icons.lantern_black-0",
), ),
Lantern(Green0): Png( Lantern("Green0"): Png(
"element.icons.lantern_green-0", "element.icons.lantern_green-0",
), ),
Lantern(Blue0): Png( Lantern("Blue0"): Png(
"element.icons.lantern_blue-0", "element.icons.lantern_blue-0",
), ),
Lantern(Red0): Png( Lantern("Red0"): Png(
"element.icons.lantern_red-0", "element.icons.lantern_red-0",
), ),
// Farming Equipment // Farming Equipment
@ -1047,55 +1047,54 @@
(0.0, 0.0, 0.0), (-90.0, 180.0, 0.0), 1.0, (0.0, 0.0, 0.0), (-90.0, 180.0, 0.0), 1.0,
), ),
// Consumables // Consumables
Consumable(Apple): Consumable("Apple"): Png(
Png(
"element.icons.item_apple", "element.icons.item_apple",
), ),
Consumable(Coconut): Png( Consumable("Coconut"): Png(
"element.icons.item_coconut", "element.icons.item_coconut",
), ),
Consumable(PotionMed): VoxTrans( Consumable("PotionMed"): VoxTrans(
"voxel.object.potion_red", "voxel.object.potion_red",
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.7, (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.5, (0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.5,
), ),
Consumable(PotionLarge): VoxTrans( Consumable("PotionLarge"): VoxTrans(
"voxel.object.potion_red", "voxel.object.potion_red",
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.9, (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): Png( Consumable("Cheese"): Png(
"element.icons.item_cheese", "element.icons.item_cheese",
), ),
Consumable(Potion): VoxTrans( Consumable("Potion"): VoxTrans(
"voxel.object.potion_red", "voxel.object.potion_red",
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 1.0, (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", "voxel.sprite.mushrooms.mushroom-10",
(0.0, 0.0, 0.0), (-50.0, 70.0, 40.0), 1.0, (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", "voxel.sprite.velorite.velorite_ore",
(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,
), ),
Consumable(VeloriteFrag): VoxTrans( Consumable("VeloriteFrag"): VoxTrans(
"voxel.sprite.velorite.velorite_1", "voxel.sprite.velorite.velorite_1",
(0.0, 0.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( Consumable("AppleShroomCurry"): Png(
"element.icons.item_apple_curry", "element.icons.item_apple_curry",
), ),
Consumable(AppleStick): Png( Consumable("AppleStick"): Png(
"element.icons.item_apple_stick", "element.icons.item_apple_stick",
), ),
Consumable(MushroomStick): Png( Consumable("MushroomStick"): Png(
"element.icons.item_shroom_stick", "element.icons.item_shroom_stick",
), ),
@ -1109,36 +1108,36 @@
(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! Ingredient("CraftsmanHammer"): VoxTrans( //TODO This should be a 1h hammer!
"voxel.weapon.hammer.craftsman", "voxel.weapon.hammer.craftsman",
(1.0, 1.0, 0.0), (-135.0, 90.0, 0.0), 1.0, (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,
), ),
Ingredient(Grass): VoxTrans( Ingredient("Grass"): VoxTrans(
"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( Ingredient("Stones"): VoxTrans(
"voxel.sprite.rocks.rock-0", "voxel.sprite.rocks.rock-0",
(0.0, 0.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,
), ),
Ingredient(Twigs): VoxTrans( Ingredient("Twigs"): VoxTrans(
"voxel.sprite.twigs.twigs-0", "voxel.sprite.twigs.twigs-0",
(0.0, 0.0, 0.0), (-20.0, 10.0, 20.0), 0.9, (0.0, 0.0, 0.0), (-20.0, 10.0, 20.0), 0.9,
), ),
Ingredient(LeatherScraps): Png( Ingredient("LeatherScraps"): Png(
"element.icons.item_leather0", "element.icons.item_leather0",
), ),
Ingredient(ShinyGem): Png( Ingredient("ShinyGem"): Png(
"element.icons.gem", "element.icons.gem",
), ),
Ingredient(MortarPestle): Png( Ingredient("MortarPestle"): Png(
"element.icons.item_mortarpestlecoco", "element.icons.item_mortarpestlecoco",
), ),
Ingredient(EmptyVial): VoxTrans( Ingredient("EmptyVial"): VoxTrans(
"voxel.object.potion_empty", "voxel.object.potion_empty",
(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,
), ),

View File

@ -4,19 +4,19 @@
color: None color: None
), ),
map: { map: {
Green0: ( "Green0": (
vox_spec: ("armor.lantern.green-0", (-2.0, -2.0, -7.0)), vox_spec: ("armor.lantern.green-0", (-2.0, -2.0, -7.0)),
color: None color: None
), ),
Black0: ( "Black0": (
vox_spec: ("armor.lantern.black-0", (-2.0, -2.0, -7.0)), vox_spec: ("armor.lantern.black-0", (-2.0, -2.0, -7.0)),
color: None color: None
), ),
Red0: ( "Red0": (
vox_spec: ("armor.lantern.red-0", (-2.0, -2.0, -7.0)), vox_spec: ("armor.lantern.red-0", (-2.0, -2.0, -7.0)),
color: None color: None
), ),
Blue0: ( "Blue0": (
vox_spec: ("armor.lantern.blue-0", (-2.0, -2.0, -7.0)), vox_spec: ("armor.lantern.blue-0", (-2.0, -2.0, -7.0)),
color: None color: None
), ),

View File

@ -16,24 +16,6 @@ use specs_idvs::IdvStorage;
use std::{fs::File, io::BufReader}; use std::{fs::File, io::BufReader};
use vek::Rgb; 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)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Throwable { pub enum Throwable {
Bomb, Bomb,
@ -45,43 +27,14 @@ pub enum Utility {
Collar, Collar,
} }
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, 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)]
pub struct Lantern { pub struct Lantern {
pub kind: LanternKind, pub kind: String,
color: Rgb<u32>, color: Rgb<u32>,
strength_thousandths: u32, strength_thousandths: u32,
flicker_thousandths: u32, flicker_thousandths: u32,
} }
pub const ALL_LANTERNS: [LanternKind; 4] = [
LanternKind::Black0,
LanternKind::Green0,
LanternKind::Red0,
LanternKind::Blue0,
];
impl Lantern { impl Lantern {
pub fn strength(&self) -> f32 { self.strength_thousandths as f32 / 1000_f32 } pub fn strength(&self) -> f32 { self.strength_thousandths as f32 / 1000_f32 }
@ -97,7 +50,7 @@ pub enum ItemKind {
Lantern(Lantern), Lantern(Lantern),
Armor(armor::Armor), Armor(armor::Armor),
Consumable { Consumable {
kind: Consumable, kind: String,
effect: Effect, effect: Effect,
#[serde(default = "default_amount")] #[serde(default = "default_amount")]
amount: u32, amount: u32,
@ -113,7 +66,7 @@ pub enum ItemKind {
amount: u32, amount: u32,
}, },
Ingredient { Ingredient {
kind: Ingredient, kind: String,
#[serde(default = "default_amount")] #[serde(default = "default_amount")]
amount: u32, amount: u32,
}, },

View File

@ -2,7 +2,7 @@ pub mod item;
pub mod slot; pub mod slot;
use crate::{assets, recipe::Recipe}; use crate::{assets, recipe::Recipe};
use item::{Consumable, Item, ItemKind}; use item::{Item, ItemKind};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use specs::{Component, FlaggedStorage, HashMapStorage}; use specs::{Component, FlaggedStorage, HashMapStorage};
use specs_idvs::IdvStorage; 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 /// 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. /// new group. Returns the item again if no space was found.
pub fn push(&mut self, item: Item) -> Option<Item> { pub fn push(&mut self, item: Item) -> Option<Item> {
let item = match item.kind { let item = match &item.kind {
ItemKind::Tool(_) | ItemKind::Armor { .. } | ItemKind::Lantern(_) => { ItemKind::Tool(_) | ItemKind::Armor { .. } | ItemKind::Lantern(_) => {
self.add_to_first_empty(item) self.add_to_first_empty(item)
}, },
@ -61,7 +61,7 @@ impl Inventory {
.. ..
}) = slot }) = slot
{ {
if item_kind == *kind { if *item_kind == *kind {
*amount += new_amount; *amount += new_amount;
self.recount_items(); self.recount_items();
return None; return None;
@ -92,7 +92,7 @@ impl Inventory {
.. ..
}) = slot }) = slot
{ {
if item_kind == *kind { if *item_kind == *kind {
*amount += new_amount; *amount += new_amount;
self.recount_items(); self.recount_items();
return None; return None;
@ -123,7 +123,7 @@ impl Inventory {
.. ..
}) = slot }) = slot
{ {
if item_kind == *kind { if *item_kind == *kind {
*amount += new_amount; *amount += new_amount;
self.recount_items(); self.recount_items();
return None; return None;
@ -153,7 +153,7 @@ impl Inventory {
.. ..
}) = slot }) = slot
{ {
if item_kind == *kind { if *item_kind == *kind {
*amount += new_amount; *amount += new_amount;
self.recount_items(); self.recount_items();
return None; return None;
@ -424,7 +424,7 @@ impl Inventory {
} else { } else {
*amount -= 1; *amount -= 1;
return_item.kind = ItemKind::Consumable { return_item.kind = ItemKind::Consumable {
kind: *kind, kind: kind.clone(),
effect: *effect, effect: *effect,
amount: 1, amount: 1,
}; };
@ -451,7 +451,7 @@ impl Inventory {
} else { } else {
*amount -= 1; *amount -= 1;
return_item.kind = ItemKind::Ingredient { return_item.kind = ItemKind::Ingredient {
kind: *kind, kind: kind.clone(),
amount: 1, amount: 1,
}; };
self.recount_items(); self.recount_items();
@ -531,7 +531,7 @@ impl Component for Inventory {
pub enum InventoryUpdateEvent { pub enum InventoryUpdateEvent {
Init, Init,
Used, Used,
Consumed(Consumable), Consumed(String),
Gave, Gave,
Given, Given,
Swapped, Swapped,

View File

@ -24,12 +24,12 @@ pub fn handle_lantern(server: &mut Server, entity: EcsEntity) {
.write_storage::<comp::LightEmitter>() .write_storage::<comp::LightEmitter>()
.remove(entity); .remove(entity);
} else { } else {
let lantern_opt = ecs let loadout_storage = ecs.read_storage::<comp::Loadout>();
.read_storage::<comp::Loadout>() let lantern_opt = loadout_storage
.get(entity) .get(entity)
.and_then(|loadout| loadout.lantern.as_ref()) .and_then(|loadout| loadout.lantern.as_ref())
.and_then(|item| { .and_then(|item| {
if let comp::item::ItemKind::Lantern(l) = item.kind { if let comp::item::ItemKind::Lantern(l) = &item.kind {
Some(l) Some(l)
} else { } else {
None None

View File

@ -157,7 +157,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
match &item.kind { match &item.kind {
ItemKind::Consumable { kind, effect, .. } => { ItemKind::Consumable { kind, effect, .. } => {
maybe_effect = Some(*effect); maybe_effect = Some(*effect);
Some(comp::InventoryUpdateEvent::Consumed(*kind)) Some(comp::InventoryUpdateEvent::Consumed(kind.clone()))
}, },
ItemKind::Throwable { kind, .. } => { ItemKind::Throwable { kind, .. } => {
if let Some(pos) = if let Some(pos) =

View File

@ -88,7 +88,7 @@ use crate::audio::AudioFrontend;
use common::{ use common::{
assets, assets,
comp::{ comp::{
item::{Consumable, ItemKind, ToolCategory}, item::{ItemKind, ToolCategory},
CharacterAbilityType, InventoryUpdateEvent, Ori, Pos, CharacterAbilityType, InventoryUpdateEvent, Ori, Pos,
}, },
event::EventBus, event::EventBus,
@ -153,7 +153,7 @@ pub enum SfxInventoryEvent {
Collected, Collected,
CollectedTool(ToolCategory), CollectedTool(ToolCategory),
CollectFailed, CollectFailed,
Consumed(Consumable), Consumed(String),
Debug, Debug,
Dropped, Dropped,
Given, Given,
@ -177,7 +177,7 @@ impl From<&InventoryUpdateEvent> for SfxEvent {
SfxEvent::Inventory(SfxInventoryEvent::CollectFailed) SfxEvent::Inventory(SfxInventoryEvent::CollectFailed)
}, },
InventoryUpdateEvent::Consumed(consumable) => { InventoryUpdateEvent::Consumed(consumable) => {
SfxEvent::Inventory(SfxInventoryEvent::Consumed(*consumable)) SfxEvent::Inventory(SfxInventoryEvent::Consumed(consumable.clone()))
}, },
InventoryUpdateEvent::Debug => SfxEvent::Inventory(SfxInventoryEvent::Debug), InventoryUpdateEvent::Debug => SfxEvent::Inventory(SfxInventoryEvent::Debug),
InventoryUpdateEvent::Dropped => SfxEvent::Inventory(SfxInventoryEvent::Dropped), InventoryUpdateEvent::Dropped => SfxEvent::Inventory(SfxInventoryEvent::Dropped),

View File

@ -77,8 +77,8 @@ impl State {
.filter(|kind| { .filter(|kind| {
use common::comp::item::{tool::ToolKind, ItemKind}; use common::comp::item::{tool::ToolKind, ItemKind};
if let ItemKind::Tool(kind) = kind { if let ItemKind::Tool(kind) = kind {
if let ToolKind::Staff(_) = &kind.kind { if let ToolKind::Staff(kind) = &kind.kind {
true kind != "Sceptre"
} else if let ToolKind::Debug(kind) = &kind.kind { } else if let ToolKind::Debug(kind) = &kind.kind {
kind == "Boost" kind == "Boost"
} else { } else {

View File

@ -4,7 +4,7 @@ use common::{
comp::item::{ comp::item::{
armor::{Armor, ArmorKind}, armor::{Armor, ArmorKind},
tool::{Tool, ToolKind}, tool::{Tool, ToolKind},
Consumable, Ingredient, Item, ItemKind, Lantern, LanternKind, Throwable, Utility, Item, ItemKind, Lantern, Throwable, Utility,
}, },
figure::Segment, figure::Segment,
}; };
@ -20,24 +20,24 @@ use vek::*;
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ItemKey { pub enum ItemKey {
Tool(ToolKind), Tool(ToolKind),
Lantern(LanternKind), Lantern(String),
Armor(ArmorKind), Armor(ArmorKind),
Utility(Utility), Utility(Utility),
Consumable(Consumable), Consumable(String),
Throwable(Throwable), Throwable(Throwable),
Ingredient(Ingredient), Ingredient(String),
Empty, Empty,
} }
impl From<&Item> for ItemKey { impl From<&Item> for ItemKey {
fn from(item: &Item) -> Self { fn from(item: &Item) -> Self {
match &item.kind { match &item.kind {
ItemKind::Tool(Tool { kind, .. }) => ItemKey::Tool(kind.clone()), 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::Armor(Armor { kind, .. }) => ItemKey::Armor(kind.clone()),
ItemKind::Utility { kind, .. } => ItemKey::Utility(*kind), 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::Throwable { kind, .. } => ItemKey::Throwable(*kind),
ItemKind::Ingredient { kind, .. } => ItemKey::Ingredient(*kind), ItemKind::Ingredient { kind, .. } => ItemKey::Ingredient(kind.clone()),
} }
} }
} }

View File

@ -8,7 +8,7 @@ use anim::Skeleton;
use common::{ use common::{
assets::watch::ReloadIndicator, assets::watch::ReloadIndicator,
comp::{ comp::{
item::{armor::ArmorKind, tool::ToolKind, ItemKind, LanternKind}, item::{armor::ArmorKind, tool::ToolKind, ItemKind},
Body, CharacterState, Loadout, Body, CharacterState, Loadout,
}, },
figure::Segment, figure::Segment,
@ -37,7 +37,7 @@ struct CharacterCacheKey {
chest: Option<ArmorKind>, chest: Option<ArmorKind>,
belt: Option<ArmorKind>, belt: Option<ArmorKind>,
back: Option<ArmorKind>, back: Option<ArmorKind>,
lantern: Option<LanternKind>, lantern: Option<String>,
hand: Option<ArmorKind>, hand: Option<ArmorKind>,
pants: Option<ArmorKind>, pants: Option<ArmorKind>,
foot: Option<ArmorKind>, foot: Option<ArmorKind>,
@ -86,7 +86,7 @@ impl CharacterCacheKey {
lantern: if let Some(ItemKind::Lantern(lantern)) = lantern: if let Some(ItemKind::Lantern(lantern)) =
loadout.lantern.as_ref().map(|i| &i.kind) loadout.lantern.as_ref().map(|i| &i.kind)
{ {
Some(lantern.kind) Some(lantern.kind.clone())
} else { } else {
None None
}, },

View File

@ -13,7 +13,7 @@ use common::{
item::{ item::{
armor::{Armor, ArmorKind}, armor::{Armor, ArmorKind},
tool::{Tool, ToolKind}, tool::{Tool, ToolKind},
ItemKind, Lantern, LanternKind, ItemKind, Lantern,
}, },
object, object,
quadruped_low::{BodyType as QLBodyType, Species as QLSpecies}, quadruped_low::{BodyType as QLBodyType, Species as QLSpecies},
@ -268,7 +268,7 @@ pub struct HumArmorFootSpec(ArmorVoxSpecMap<String, ArmorVoxSpec>);
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub struct HumMainWeaponSpec(HashMap<ToolKind, ArmorVoxSpec>); pub struct HumMainWeaponSpec(HashMap<ToolKind, ArmorVoxSpec>);
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub struct HumArmorLanternSpec(ArmorVoxSpecMap<LanternKind, ArmorVoxSpec>); pub struct HumArmorLanternSpec(ArmorVoxSpecMap<String, ArmorVoxSpec>);
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub struct HumArmorHeadSpec(ArmorVoxSpecMap<String, ArmorVoxSpec>); pub struct HumArmorHeadSpec(ArmorVoxSpecMap<String, ArmorVoxSpec>);
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
@ -841,7 +841,7 @@ impl HumArmorLanternSpec {
let spec = if let Some(ItemKind::Lantern(Lantern { kind, .. })) = let spec = if let Some(ItemKind::Lantern(Lantern { kind, .. })) =
loadout.lantern.as_ref().map(|i| &i.kind) loadout.lantern.as_ref().map(|i| &i.kind)
{ {
match self.0.map.get(&kind) { match self.0.map.get(kind) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
error!(?kind, "No lantern specification exists"); error!(?kind, "No lantern specification exists");