Module game

Source
Expand description

The main interface to objects in the Screeps game world.

This contains all functionality from the Game object in Screeps. That generally means all state which is true this tick throughout the world.

§Safety

All returned game objects must be used only during the tick they are retreived or resolved. They are considered “stale” on subsequent ticks, and the behavior of stale game objects is undefined.

Screeps documentation

Modules§

cpu
Information about, and functions to manage, your code’s resource utilization
gcl
Global Control Level information.
gpl
Global Power Level information.
map
Game map related functionality.
market
Access the in-game market to buy or sell resources.
shard
Information about the current shard.

Functions§

construction_sites
Get a JsHashMap<ObjectId<ConstructionSite>, ConstructionSite> with all of your construction sites.
creeps
Get a JsHashMap<String, Creep> with all of your creeps, which has creep names as keys.
creeps_jsstring
Get a JsHashMap<JsString, Creep> with all of your creeps, which has creep names as keys.
flags
Get a JsHashMap<String, Flag> with all of your flags, which has flag names as keys.
flags_jsstring
Get a JsHashMap<JsString, Flag> with all of your flags, which has flag names as keys.
get_object_by_id_erased
Get the RoomObject represented by a given RawObjectId, if it’s still alive and visible.
get_object_by_id_typed
Get the typed object represented by a given ObjectId, if it’s still alive and visible.
get_object_by_js_id_typed
Get the typed object represented by a given JsObjectId, if it’s still alive and visible.
notify
Send an email message to yourself with a given message.
power_creeps
Get a JsHashMap<String, AccountPowerCreep> with all of your power creeps, which has power creep names as keys.
power_creeps_jsstring
Get a JsHashMap<JsString, AccountPowerCreep> with all of your power creeps, which has power creep names as keys.
resources
Get a JsHashMap<IntershardResourceType, u32> with all of your account resources.
rooms
Get a JsHashMap<RoomName, Room> with the rooms visible for the current tick.
scoreseasonal-season-2
Your current score, as determined by the symbols you have decoded.
spawns
Get a JsHashMap<String, StructureSpawn> with all of your spawns, which has spawn names as keys.
spawns_jsstring
Get a JsHashMap<JsString, StructureSpawn> with all of your spawns, which has spawn names as keys.
structures
Get a JsHashMap<ObjectId<Structure>, StructureObject> with all of your owned structures.
symbolsseasonal-season-2
The symbols you’ve decoded after multiplier adjustments, used to determine your score.
time
Get the current time, the number of ticks the game has been running.