mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added flower and grass items
This commit is contained in:
parent
7f4e587215
commit
a2758b091c
@ -94,6 +94,21 @@ impl Consumable {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Ingredient {
|
||||
Flower,
|
||||
Grass,
|
||||
}
|
||||
|
||||
impl Ingredient {
|
||||
pub fn name(&self) -> &'static str {
|
||||
match self {
|
||||
Ingredient::Flower => "flower",
|
||||
Ingredient::Grass => "grass",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Debug {
|
||||
Boost,
|
||||
@ -114,7 +129,9 @@ pub enum Item {
|
||||
kind: Consumable,
|
||||
effect: Effect,
|
||||
},
|
||||
Ingredient,
|
||||
Ingredient {
|
||||
kind: Ingredient,
|
||||
},
|
||||
Debug(Debug),
|
||||
}
|
||||
|
||||
@ -123,8 +140,8 @@ impl Item {
|
||||
match self {
|
||||
Item::Tool { kind, .. } => kind.name(),
|
||||
Item::Armor { kind, .. } => kind.name(),
|
||||
Item::Consumable { .. } => "<consumable>",
|
||||
Item::Ingredient => "<ingredient>",
|
||||
Item::Consumable { kind, .. } => kind.name(),
|
||||
Item::Ingredient { kind } => kind.name(),
|
||||
Item::Debug(_) => "Debugging item",
|
||||
}
|
||||
}
|
||||
@ -134,7 +151,7 @@ impl Item {
|
||||
Item::Tool { .. } => "tool",
|
||||
Item::Armor { .. } => "armour",
|
||||
Item::Consumable { .. } => "consumable",
|
||||
Item::Ingredient => "ingredient",
|
||||
Item::Ingredient { .. } => "ingredient",
|
||||
Item::Debug(_) => "debug",
|
||||
}
|
||||
}
|
||||
@ -148,6 +165,16 @@ impl Item {
|
||||
BlockKind::Apple => Some(Self::apple()),
|
||||
BlockKind::Mushroom => Some(Self::mushroom()),
|
||||
BlockKind::Velorite => Some(Self::velorite()),
|
||||
BlockKind::BlueFlower => Some(Self::flower()),
|
||||
BlockKind::PinkFlower => Some(Self::flower()),
|
||||
BlockKind::PurpleFlower => Some(Self::flower()),
|
||||
BlockKind::RedFlower => Some(Self::flower()),
|
||||
BlockKind::WhiteFlower => Some(Self::flower()),
|
||||
BlockKind::YellowFlower => Some(Self::flower()),
|
||||
BlockKind::Sunflower => Some(Self::flower()),
|
||||
BlockKind::LongGrass => Some(Self::grass()),
|
||||
BlockKind::MediumGrass => Some(Self::grass()),
|
||||
BlockKind::ShortGrass => Some(Self::grass()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@ -174,6 +201,18 @@ impl Item {
|
||||
effect: Effect::Xp(250),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn flower() -> Self {
|
||||
Item::Ingredient {
|
||||
kind: Ingredient::Flower,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn grass() -> Self {
|
||||
Item::Ingredient {
|
||||
kind: Ingredient::Grass,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Item {
|
||||
|
@ -131,6 +131,16 @@ impl BlockKind {
|
||||
|
||||
pub fn is_collectible(&self) -> bool {
|
||||
match self {
|
||||
BlockKind::BlueFlower => true,
|
||||
BlockKind::PinkFlower => true,
|
||||
BlockKind::PurpleFlower => true,
|
||||
BlockKind::RedFlower => true,
|
||||
BlockKind::WhiteFlower => true,
|
||||
BlockKind::YellowFlower => true,
|
||||
BlockKind::Sunflower => true,
|
||||
BlockKind::LongGrass => true,
|
||||
BlockKind::MediumGrass => true,
|
||||
BlockKind::ShortGrass => true,
|
||||
BlockKind::Apple => true,
|
||||
BlockKind::Mushroom => true,
|
||||
BlockKind::Velorite => true,
|
||||
|
Loading…
Reference in New Issue
Block a user