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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! `screeps-game-api`
//!
//! # Cargo Features
//!
//! ## `check-all-casts`
//!
//! By default, `screeps-game-api` assumes that the Screeps JavaScript API calls return the types
//! that they are documented to return and bypasses `instanceof` checks when constructing rust
//! wrappers for those return values.
//!
//! To enable checking all types on all API calls, even ones when the screeps server reliably
//! returns the expected type, depend on `screeps-game-api` with the `"check-all-casts"` feature
//! flag:
//!
//! ```toml
//! [dependencies]
//! # ...
//! screeps-game-api = { version = "0.3", features = ["check-all-casts"] }
//! ```
#![recursion_limit = "128"]
#[macro_use]
extern crate log;
#[macro_use]
extern crate num_derive;
extern crate num_traits;
#[macro_use]
extern crate scoped_tls;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[macro_use]
extern crate stdweb;
#[macro_use]
extern crate stdweb_derive;

#[macro_use]
mod macros;

pub mod constants;
pub mod game;
pub mod js_collections;
pub mod memory;
pub mod objects;
pub mod pathfinder;
mod positions;
pub mod raw_memory;
pub mod traits;

pub use {
    constants::*,
    js_collections::JsVec,
    objects::*,
    positions::{LocalRoomName, LocalRoomPosition},
    traits::{FromExpectedType, IntoExpectedType},
};

pub(crate) use stdweb::private::ConversionError;

/// Useful for `use screeps::prelude::*;` to bring in screeps traits. Does not contain any
/// structures in order to minimize namespace polution.
pub mod prelude {
    pub use objects::{
        CanDecay, CanStoreEnergy, HasCooldown, HasId, HasPosition, HasStore,
        OwnedStructureProperties, RoomObjectProperties, StructureProperties,
    };
}