screeps/objects/impls/
structure_power_bank.rs

1use wasm_bindgen::prelude::*;
2
3use crate::{
4    objects::{RoomObject, Structure},
5    prelude::*,
6};
7
8#[wasm_bindgen]
9extern "C" {
10    /// An object representing a [`StructurePowerBank`], which can be destroyed
11    /// for power resources.
12    ///
13    /// [Screeps documentation](https://docs.screeps.com/api/#StructurePowerBank)
14    #[wasm_bindgen(extends = RoomObject, extends = Structure)]
15    #[derive(Clone, Debug)]
16    pub type StructurePowerBank;
17
18    /// The amount of power contained within the [`StructurePowerBank`].
19    ///
20    /// [Screeps documentation](https://docs.screeps.com/api/#StructurePowerBank.power)
21    #[wasm_bindgen(method, getter)]
22    pub fn power(this: &StructurePowerBank) -> u32;
23
24    /// The number of ticks until the [`StructurePowerBank`] will decay.
25    ///
26    /// [Screeps documentation](https://docs.screeps.com/api/#StructurePowerBank.ticksToDecay)
27    #[wasm_bindgen(method, getter = ticksToDecay)]
28    pub fn ticks_to_decay(this: &StructurePowerBank) -> u32;
29}
30
31impl CanDecay for StructurePowerBank {
32    fn ticks_to_decay(&self) -> u32 {
33        Self::ticks_to_decay(self)
34    }
35}
36
37impl Attackable for StructurePowerBank {}
38impl Dismantleable for StructurePowerBank {}
39impl Repairable for StructurePowerBank {}