1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::ops::{Deref, DerefMut};

use super::Monster;

/// An enum of all creeper states
#[allow(missing_docs)]
#[repr(i8)]
#[derive(PartialEq, Default)]
pub enum CreeperState {
    #[default] Idle = -1,
    Fuse = 1,
}

/// An instance of a creeper
#[derive(PartialEq, Default)]
pub struct Creeper {
    monster: Monster,
    /// The state of the creeper
    pub state: CreeperState,
    /// Whether it is charging or not
    pub charged: bool,
    /// Whether it is ignited or not
    pub ignited: bool,
}
impl Deref for Creeper {
    type Target = Monster;

    fn deref(&self) -> &Self::Target {
        &self.monster
    }
}
impl DerefMut for Creeper {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.monster
    }
}