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
37
38
39
use wasm_bindgen::prelude::*;

use crate::{
    objects::{OwnedStructure, RoomObject, Structure},
    prelude::*,
};

#[wasm_bindgen]
extern "C" {
    /// An object representing a [`StructureExtractor`], which can be placed on
    /// top of a [`Mineral`] to extract resources.
    ///
    /// [Screeps documentation](https://docs.screeps.com/api/#StructureExtractor)
    ///
    /// [`Mineral`]: crate::objects::Mineral
    #[wasm_bindgen(extends = RoomObject, extends = Structure, extends = OwnedStructure)]
    #[derive(Clone, Debug)]
    pub type StructureExtractor;

    /// Ticks until this extractor can be used to [`Creep::harvest`] its
    /// [`Mineral`] after a previous harvest.
    ///
    /// [Screeps documentation](https://docs.screeps.com/api/#StructureExtractor.cooldown)
    ///
    /// [`Creep::harvest`]: crate::objects::Creep::harvest
    /// [`Mineral`]: crate::objects::Mineral
    #[wasm_bindgen(method, getter)]
    pub fn cooldown(this: &StructureExtractor) -> u32;
}

impl HasCooldown for StructureExtractor {
    fn cooldown(&self) -> u32 {
        Self::cooldown(self)
    }
}

impl Attackable for StructureExtractor {}
impl Dismantleable for StructureExtractor {}
impl Repairable for StructureExtractor {}