Expand description

Typed bindings to the Screeps in-game API for WASM Rust AIs.

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:

[dependencies]
screeps-game-api = { version = "0.3", features = ["check-all-casts"] }

Re-exports

pub use crate::traits::FromExpectedType;
pub use crate::traits::IntoExpectedType;
pub use crate::constants::*;
pub use crate::objects::*;

Modules

Constants, most copied from the game constants.

Get global Screeps resources.

inter_shard_memoryinter-shard-memory

An interface for communicating between shards.

Typed JavaScript collection wrappers.

Pure-data structures relating to Screeps.

This file groups all macros used throughout the library. Since interop with javascript often gets unwieldy, macros are used extensively to follow DRY principles.

Interface with Screeps’ Memory global variable

Screeps object wrappers.

Manually accessing the PathFinder API

Traits which implement base functionalities for Screeps types.

Interface for Screeps RawMemory global object.

Useful traits for interacting with JavaScript beyond what stdweb provides.

Macros

Get a value from memory given a path, returning None if any thing along the way does not exist.

Set a value in memory given a path, creating dicts for intermediate places if they do not exist.

Structs

Reference to a JavaScript array which is expected to contain a specific type of item.

Represents an Object ID and a type that the ID points to.

Represents a position in a particular room in Screeps.

Represents an Object ID using a packed 12-byte representation

A structure representing a room name.

Enums

An error representing when a string can’t be parsed into a RoomName.

Type Definitions

An alias for Position for those used to the JavaScript RoomPosition type.