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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Typed bindings to the Screeps in-game API for WASM Rust AIs.
//!
//! # Cargo Features
//!
//! ## `generate-pixel`
//!
//! Enables the function to generate pixels, which is only present on the
//! Screeps: World official servers.
//!
//! ## `inter-shard-memory`
//!
//! Enables interacting with `IntershardMemory`, which is not present in most
//! private server environments.
//!
//! ## `score`
//!
//! Enables the score resource and entities, introduced for Screeps Seasonal's
//! first season.
//!
//! ## `symbols`
//!
//! Enables the symbol resources and entities, introduced for Screeps Seasonal's
//! second season.
//!
//! ## `mmo`
//!
//! Enables the `generate-pixel` and `inter-shard-memory` features, which are
//! present on the Screeps: World official servers but not on private servers.
//!
//! ## `seasonal-season-1`
//!
//! Enables the `score` feature, a mechanic introduced for Screeps Seasonal's
//! first season, as well as enabling constants relevant to season 1.
//!
//! ## `seasonal-season-2`
//!
//! Enables the `symbols` feature, a mechanic introduced for Screeps Seasonal's
//! second season, as well as enabling constants relevant to season 2.
#![recursion_limit = "128"]
// to build locally with doc_cfg enabled, run:
// `RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features`
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

pub mod console;
pub mod constants;
pub mod enums;
pub mod game;
#[cfg(feature = "inter-shard-memory")]
pub mod inter_shard_memory;
pub mod js_collections;
pub mod local;
pub mod memory;
pub mod objects;
pub mod pathfinder;
pub(crate) mod prototypes;
pub mod raw_memory;
pub mod traits;

pub use crate::{
    constants::*, enums::*, game::*, js_collections::*, local::*, objects::*, pathfinder::*,
    raw_memory::*, traits::*,
};

#[cfg(feature = "inter-shard-memory")]
pub use crate::inter_shard_memory::*;

/// Traits which implement base functionalities for Screeps types.
///
/// # Example
///
/// ```no_run
/// use js_sys::{JsString, Reflect};
/// use screeps::{game, prelude::*, Creep};
///
/// let c = game::creeps().get(String::from("Bob")).unwrap();
///
/// // `HasId` trait brought in from prelude
/// let id = c.try_id().unwrap();
/// ```
///
/// This module contains all base functionality traits, and no structures.
pub mod prelude {
    pub use crate::traits::*;
}