screeps/objects/impls/
structure_nuker.rs1use wasm_bindgen::prelude::*;
2
3use crate::{
4 enums::action_error_codes::structure_nuker::*,
5 objects::{OwnedStructure, RoomObject, RoomPosition, Store, Structure},
6 prelude::*,
7};
8
9#[wasm_bindgen]
10extern "C" {
11 #[wasm_bindgen(extends = RoomObject, extends = Structure, extends = OwnedStructure)]
18 #[derive(Clone, Debug)]
19 pub type StructureNuker;
20
21 #[wasm_bindgen(method, getter)]
26 pub fn cooldown(this: &StructureNuker) -> u32;
27
28 #[wasm_bindgen(method, getter)]
33 pub fn store(this: &StructureNuker) -> Store;
34
35 #[wasm_bindgen(method, js_name = launchNuke)]
36 fn launch_nuke_internal(this: &StructureNuker, target: &RoomPosition) -> i8;
37}
38
39impl StructureNuker {
40 pub fn launch_nuke(&self, target: &RoomPosition) -> Result<(), LaunchNukeErrorCode> {
44 LaunchNukeErrorCode::result_from_i8(self.launch_nuke_internal(target))
45 }
46}
47
48impl HasCooldown for StructureNuker {
49 fn cooldown(&self) -> u32 {
50 Self::cooldown(self)
51 }
52}
53
54impl HasStore for StructureNuker {
55 fn store(&self) -> Store {
56 Self::store(self)
57 }
58}
59
60impl Attackable for StructureNuker {}
61impl Dismantleable for StructureNuker {}
62impl Repairable for StructureNuker {}
63impl Transferable for StructureNuker {}