use js_sys::JsString;
use wasm_bindgen::prelude::*;
use crate::{
constants::ErrorCode,
local::RoomName,
objects::{OwnedStructure, RoomObject, Structure},
prelude::*,
};
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = RoomObject, extends = Structure, extends = OwnedStructure)]
#[derive(Clone, Debug)]
pub type StructureObserver;
#[wasm_bindgen(method, js_name = observeRoom)]
fn observe_room_internal(this: &StructureObserver, target: &JsString) -> i8;
}
impl StructureObserver {
pub fn observe_room(&self, target: RoomName) -> Result<(), ErrorCode> {
let target = target.into();
ErrorCode::result_from_i8(self.observe_room_internal(&target))
}
}
impl Attackable for StructureObserver {}
impl Dismantleable for StructureObserver {}
impl Repairable for StructureObserver {}