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

use crate::objects::{OwnedStructure, RoomObject, Spawning, Structure};

#[wasm_bindgen]
extern "C" {
    /// An object representing a [`StructureInvaderCore`], which is at the
    /// center of NPC strongholds, as well as reserving neutral rooms.
    ///
    /// [Screeps documentation](https://docs.screeps.com/api/#StructureInvaderCore)
    #[wasm_bindgen(extends = RoomObject, extends = Structure, extends = OwnedStructure)]
    #[derive(Clone, Debug)]
    pub type StructureInvaderCore;

    /// The level of the [`StructureInvaderCore`]; 0 is a lesser invader core
    /// that simply reserves rooms, while levels 1-5 are strongholds which
    /// defend themselves.
    ///
    /// [Screeps documentation](https://docs.screeps.com/api/#StructureInvaderCore.level)
    #[wasm_bindgen(method, getter)]
    pub fn level(this: &StructureInvaderCore) -> u8;

    /// The number of ticks until the [`StructureInvaderCore`] is fully deployed
    /// and can be attacked.
    ///
    /// [Screeps documentation](https://docs.screeps.com/api/#StructureInvaderCore.ticksToDeploy)
    #[wasm_bindgen(method, getter = ticksToDeploy)]
    pub fn ticks_to_deploy(this: &StructureInvaderCore) -> u32;

    /// Information about the spawning creep, if one is currently being spawned.
    ///
    /// [Screeps documentation](https://docs.screeps.com/api/#StructureInvaderCore.spawning)
    #[wasm_bindgen(method, getter)]
    pub fn spawning(this: &StructureInvaderCore) -> Option<Spawning>;
}