ashscript_types/structures/
factory.rs

1use hashbrown::HashMap;
2use hexx::Hex;
3use serde::Serialize;
4use uuid::Uuid;
5
6use crate::{objects::{GameObjectKind, HasHealth, HasHex, HasId, HasStorage}, player::OwnerId, storage::Storage};
7
8pub type Factories = HashMap<Hex, Factory>;
9
10#[derive(Serialize, Default, Clone)]
11pub struct Factory {
12    pub id: Uuid,
13    pub kind: GameObjectKind,
14    pub owner_id: OwnerId,
15    pub energy: u32,
16    pub hex: Hex,
17    pub progress: u32,
18    pub health: u32,
19    pub storage: Storage,
20    #[serde(skip)]
21    pub future_health: u32,
22    #[serde(skip)]
23    pub future_energy: u32,
24}
25
26impl HasHealth for Factory {
27    fn health(&self) -> u32 {
28        self.health
29    }
30}
31
32impl HasId for Factory {
33    fn id(&self) -> Uuid {
34        self.id
35    }
36}
37
38impl HasHex for Factory {
39    fn hex(&self) -> Hex {
40        self.hex
41    }
42}
43
44impl HasStorage for Factory {
45    fn storage(&self) -> &Storage {
46        &self.storage
47    }
48}
49
50impl Factory {
51    
52}