screeps/objects/impls/structure_road.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 [`StructureRoad`], which allows creeps to move
11 /// onto this position for half of the fatigue of moving onto a plains tile,
12 /// as well as through terrain walls.
13 ///
14 /// [Screeps documentation](https://docs.screeps.com/api/#StructureRoad)
15 #[wasm_bindgen(extends = RoomObject, extends = Structure)]
16 #[derive(Clone, Debug)]
17 pub type StructureRoad;
18
19 /// The number of ticks until the road will decay, losing
20 /// [`ROAD_DECAY_AMOUNT`] hits.
21 ///
22 /// [Screeps documentation](https://docs.screeps.com/api/#StructureRoad.ticksToDecay)
23 ///
24 /// [`ROAD_DECAY_AMOUNT`]: crate::constants::ROAD_DECAY_AMOUNT
25 #[wasm_bindgen(method, getter = ticksToDecay)]
26 pub fn ticks_to_decay(this: &StructureRoad) -> u32;
27}
28
29impl CanDecay for StructureRoad {
30 fn ticks_to_decay(&self) -> u32 {
31 Self::ticks_to_decay(self)
32 }
33}
34
35impl Attackable for StructureRoad {}
36impl Dismantleable for StructureRoad {}
37impl Repairable for StructureRoad {}