screeps/objects/impls/
structure_extractor.rs

1use wasm_bindgen::prelude::*;
2
3use crate::{
4    objects::{OwnedStructure, RoomObject, Structure},
5    prelude::*,
6};
7
8#[wasm_bindgen]
9extern "C" {
10    /// An object representing a [`StructureExtractor`], which can be placed on
11    /// top of a [`Mineral`] to extract resources.
12    ///
13    /// [Screeps documentation](https://docs.screeps.com/api/#StructureExtractor)
14    ///
15    /// [`Mineral`]: crate::objects::Mineral
16    #[wasm_bindgen(extends = RoomObject, extends = Structure, extends = OwnedStructure)]
17    #[derive(Clone, Debug)]
18    pub type StructureExtractor;
19
20    /// Ticks until this extractor can be used to [`Creep::harvest`] its
21    /// [`Mineral`] after a previous harvest.
22    ///
23    /// [Screeps documentation](https://docs.screeps.com/api/#StructureExtractor.cooldown)
24    ///
25    /// [`Creep::harvest`]: crate::objects::Creep::harvest
26    /// [`Mineral`]: crate::objects::Mineral
27    #[wasm_bindgen(method, getter)]
28    pub fn cooldown(this: &StructureExtractor) -> u32;
29}
30
31impl HasCooldown for StructureExtractor {
32    fn cooldown(&self) -> u32 {
33        Self::cooldown(self)
34    }
35}
36
37impl Attackable for StructureExtractor {}
38impl Dismantleable for StructureExtractor {}
39impl Repairable for StructureExtractor {}