use std::collections::HashMap;
use bevy::prelude::Component;
use starkingdoms_common::PlanetType;
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum MaterialType {
Plasma, // Sun
Composite, // Mercury
Sulfur, // Venus
Silicon, // Moon
Iron, // Mars
Hydrogen, // Jupiter
Helium, // Saturn
Rubber, // Uranus
Methane, // Neptune
Ice, // Pluto
}
impl TryFrom<PlanetType> for MaterialType {
type Error = ();
fn try_from(value: PlanetType) -> Result<Self, ()> {
match value {
PlanetType::Sun => Ok(Self::Plasma),
PlanetType::Mercury => Ok(Self::Composite),
PlanetType::Venus => Ok(Self::Sulfur),
PlanetType::Moon => Ok(Self::Silicon),
PlanetType::Mars => Ok(Self::Iron),
PlanetType::Jupiter => Ok(Self::Hydrogen),
PlanetType::Saturn => Ok(Self::Helium),
PlanetType::Uranus => Ok(Self::Rubber),
PlanetType::Neptune => Ok(Self::Methane),
PlanetType::Pluto => Ok(Self::Ice),
_ => Err(()),
}
}
}
#[derive(Component, Debug, Clone)]
pub struct MaterialStorage {
pub material_type: MaterialType,
pub stored: u32,
pub capacity: u32,
}
#[derive(Component, Debug, Clone, Default)]
pub struct VarietyMaterialStorage {
pub materials: HashMap<MaterialType, u32>,
pub capacity: u32,
}
#[derive(Component, Debug, Clone, Default)]
pub struct IsMining(pub bool);