screeps/objects/impls/
structure_extension.rs

1use wasm_bindgen::prelude::*;
2
3use crate::{
4    objects::{OwnedStructure, RoomObject, Store, Structure},
5    prelude::*,
6};
7
8#[wasm_bindgen]
9extern "C" {
10    /// An object representing a [`StructureExtension`], which can store energy
11    /// to be used by spawns in the room to spawn creeps.
12    ///
13    /// [Screeps documentation](https://docs.screeps.com/api/#StructureExtension)
14    #[wasm_bindgen(extends = RoomObject, extends = Structure, extends = OwnedStructure)]
15    #[derive(Clone, Debug)]
16    pub type StructureExtension;
17
18    /// The [`Store`] of the extension, which contains information about the
19    /// amount of energy in it.
20    ///
21    /// [Screeps documentation](https://docs.screeps.com/api/#StructureExtension.store)
22    #[wasm_bindgen(method, getter)]
23    pub fn store(this: &StructureExtension) -> Store;
24}
25
26impl HasStore for StructureExtension {
27    fn store(&self) -> Store {
28        Self::store(self)
29    }
30}
31
32impl Attackable for StructureExtension {}
33impl Dismantleable for StructureExtension {}
34impl Repairable for StructureExtension {}
35impl Transferable for StructureExtension {}
36impl Withdrawable for StructureExtension {}