Module constants

Source
Expand description

Constants, most copied from the game constants.

Last updated on 2020-12-13, at commit e4589666113334bb1f967b9a5540b642141b6dab.

Currently missing:

  • OBSTACLE_OBJECT_TYPES
  • WORLD_WIDTH / WORLD_HEIGHT (deprecated in Screeps)
  • POWER_INFO

Re-exports§

pub use self::find::FindConstant;
pub use self::look::LookConstant;
pub use self::extra::*;

Modules§

control
Re-export of all constants related to StructureController behavior and GCL.
creep
Re-export of all constants related to Creep behavior and operations.
extra
Additional constants representing internal game mechanics that aren’t included in the game’s constants
find
Constants for use with the Room::find function.
flags
Re-export of all constants related to Flags.
look
Constants for use with Room::look_for_at and related functions.
market
Re-export of all constants related to the market.
minerals
Re-export of all constants related to Mineral behavior and StructureLab operations.
nuke
Re-export of all constants related to StructureNuker and Nuke.
observer
Re-export of all constants related to StructureObserver operations.
portal
Re-export of all constants related to StructurePortal behavior.
power
Re-export of all constants related to power.
resource
Re-export of all constants related to Resources.
seasonal
Constants that are unique to object types or mechanics found in Screeps seasonal.
source
Re-export of all constants related to Source behavior.
spawn
Re-export of all constants related to StructureSpawn operations.
structure
Re-export of all constants related to structures.
tombstone
Re-export of all constants related to Tombstones.
tower
Re-export of all constants related to StructureTower operations.

Structs§

FactoryRecipe
Returned values from ResourceType::commodity_recipe representing a commodity that can be produced in factories.
InvalidConstantString

Enums§

Boost
Returned values from ResourceType::boost representing the effect of boosting a creep with the given resource.
Color
Translates COLOR_* and COLORS_ALL constants.
Density
Translates the DENSITY_* constants.
Direction
Translates direction constants.
EffectType
Translates effect types on room objects, which can include both PWR_* and EFFECT_* constants.
ErrorCode
Translates non-OK return codes.
ExitDirection
Type used for when the game returns a direction to an exit.
IntershardResourceType
Translates SUBSCRIPTION_TOKEN and INTERSHARD_RESOURCES constants.
MarketResourceType
Translates all resource types that can be used on the market.
NaturalEffectType
Translates the EFFECT_* constants, which are natural effect types
OrderType
Translates ORDER_* constants.
Part
Translates body part type and BODYPARTS_ALL constants
PowerCreepClass
Translates the POWER_CLASS constants, which are classes of power creeps
PowerType
Translates the PWR_* constants, which are types of powers used by power creeps
ResourceType
Translates the values of the RESOURCES_ALL constant, representing all possible in-game (non-intershard) resources.
StructureType
Translates STRUCTURE_* constants.
Terrain
Translates TERRAIN_* constants.

Constants§

ATTACK_POWER
Hits of damage per effective attack part per Creep::attack action.
BUILD_POWER
Construction site progress added per effective work part per Creep::build action.
CARRY_CAPACITY
Store capacity provided per effective carry part.
CONSTRUCTION_COST_ROAD_SWAMP_RATIO
Build, decay, and hits multiplier for roads built on swamp tiles.
CONSTRUCTION_COST_ROAD_WALL_RATIO
Build, decay, and hits multiplier for roads built on natural wall tiles (tunnels)
CONTAINER_CAPACITY
Store capacity of container structures.
CONTAINER_DECAY
Hits lost on the container per decay.
CONTAINER_DECAY_TIME
Ticks between hit loss due to decay in unowned rooms.
CONTAINER_DECAY_TIME_OWNED
Ticks between hit loss due to decay in owned rooms.
CONTAINER_HITS
Initial hits for container structures; consider using the StructureType::initial_hits function.
CONTROLLER_ATTACK_BLOCKED_UPGRADE
A controller cannot be attacked or upgraded for this number of ticks after one or more creeps successfully uses Creep::attack_controller against it.
CONTROLLER_CLAIM_DOWNGRADE
Additional decay of the StructureController::ticks_to_downgrade timer caused by each claim part used per Creep::attack_controller action.
CONTROLLER_DOWNGRADE_RESTORE
Ticks added to a StructureController::ticks_to_downgrade timer on each tick that at least one creep successfully used Creep::upgrade_controller.
CONTROLLER_DOWNGRADE_SAFEMODE_THRESHOLD
Ticks under 50% of controller_downgrade max that safe mode becomes unavailable.
CONTROLLER_MAX_UPGRADE_PER_TICK
Maxiumum energy per tick that can be spent on Creep::upgrade_controller at room control level 8 without power creep effects or boosts.
CONTROLLER_NUKE_BLOCKED_UPGRADE
Ticks a controller cannot be attacked or upgraded for after a nuke detonation in the room.
CONTROLLER_RESERVE
Reservation ticks added per claim part per Creep::reserve_controller action.
CONTROLLER_RESERVE_MAX
Maximum ticks of reservation allowed on a controller
CREEP_CLAIM_LIFE_TIME
Initial ticks_to_live of a creep with at least one claim part.
CREEP_CORPSE_RATE
Percentage of TTL-adjusted creep resource costs added to tombstone.
CREEP_LIFE_TIME
Initial ticks_to_live of a creep without any claim parts.
CREEP_PART_MAX_ENERGY
The upper limit of energy per body part considered for return in tombstones
CREEP_SPAWN_TIME
Ticks taken to spawn each creep body part, before power creep effects.
DEPOSIT_DECAY_TIME
Time since last harvest that a deposit will decay.
DEPOSIT_EXHAUST_MULTIPLY
Multiplier for deposit cooldown determination.
DEPOSIT_EXHAUST_POW
Exponential growth rate for deposit cooldown determination.
DISMANTLE_COST
Amount in energy returned to the dismantling creep per hit dismantled.
DISMANTLE_POWER
Hits removed per effective work part per Creep::dismantle action.
ENERGY_DECAY
The total amount of a resource that must be accumulated in a dropped Resource for one unit of that resource to decay each tick, rounded up.
ENERGY_REGEN_TIME
Ticks to source regen after first Creep::harvest since last regen.
EXTENSION_HITS
Initial hits for extension structures; consider using the StructureType::initial_hits function.
EXTRACTOR_COOLDOWN
Ticks of cooldown for the extractor timer after tick that at least one creep successfully used Creep::harvest.
EXTRACTOR_HITS
Initial hits for extractor structures; consider using the StructureType::initial_hits function.
FACTORY_CAPACITY
Store capacity of factory structures.
FACTORY_HITS
Initial hits for factory structures; consider using the StructureType::initial_hits function.
FLAGS_LIMIT
Maximum number of total flags a player is allowed to have on a shard.
GCL_MULTIPLY
Base growth rate of control points needed per global control level (GCL).
GCL_NOVICE
Maximum GCL for players allowed to spawn in a Novice area.
GCL_POW
Exponential growth rate of control points needed per global control level (GCL).
HARVEST_DEPOSIT_POWER
Amount harvested from a deposit per effective work part per Creep::harvest action.
HARVEST_MINERAL_POWER
Amount harvested from a mineral per effective work part per Creep::harvest action.
HARVEST_POWER
Energy harvested from a source per effective work part per Creep::harvest action.
HEAL_POWER
Hits of damage healed per effective heal part per Creep::heal action.
INVADERS_ENERGY_GOAL
Base value for calculating the energy harvest amount that will trigger invader spawns.
INVADER_CORE_CONTROLLER_DOWNGRADE
Duration of stronghold ‘deployment’, during which they are invulnerable.
INVADER_CORE_CONTROLLER_POWER
The reservation points added or removed per tick by invader cores.
INVADER_CORE_HITS
Initial hits for invader cores; consider using the StructureType::initial_hits function.
LAB_BOOST_ENERGY
Cost in energy to boost each creep body part.
LAB_BOOST_MINERAL
Cost in boost minerals to boost each creep body part.
LAB_ENERGY_CAPACITY
Store capacity for energy in lab structures.
LAB_HITS
Initial hits for lab structures; consider using the StructureType::initial_hits function.
LAB_MINERAL_CAPACITY
Store capacity for minerals in lab structures.
LAB_REACTION_AMOUNT
Amount of compounds consumed and produced per reaction, before power creep effects.
LAB_UNBOOST_ENERGY
Energy refunded by StructureLab::unboost_creep per creep body part (none).
LAB_UNBOOST_MINERAL
Minerals spent on boosts refunded by StructureLab::unboost_creep per creep body part.
LINK_CAPACITY
Energy capacity of link structures.
LINK_COOLDOWN
Ticks of link cooldown after transferring energy per distance to destination.
LINK_HITS
Initial hits for link structures; consider using the StructureType::initial_hits function.
LINK_LOSS_RATIO
Percentage of the energy that is lost when transferred by StructureLink::transfer_energy.
MARKET_FEE
Percentage of order value in credits charged as a fee for market listings.
MARKET_MAX_ORDERS
Maximum number of total orders a player is allowed to have on the market.
MARKET_ORDER_LIFE_TIME
Time, in milliseconds, after which a market order will expire (30 days).
MAX_CONSTRUCTION_SITES
Maximum allowed construction sites at once per player.
MAX_CREEP_SIZE
Maximum body parts per creep.
MINERAL_DENSITY_CHANGE
Percentage chance to randomly determine a new density when currently moderate or high density (a new density is always chosen when low or ultra).
MINERAL_RANDOM_FACTOR
Currently unused in game (see Density::probability instead).
MINERAL_REGEN_TIME
Ticks after depletion for minerals to regenerate.
NUKER_COOLDOWN
Cooldown for nuker structers after firing.
NUKER_ENERGY_CAPACITY
Energy capacity of the nuker, which is spent to fire a nuke.
NUKER_GHODIUM_CAPACITY
Ghodium capacity of the nuker, which is spent to fire a nuke.
NUKER_HITS
Initial hits for nuker structures; consider using the StructureType::initial_hits function.
NUKE_DAMAGE_RANGE_0
Damage in hits done by nukes at the point of impact.
NUKE_DAMAGE_RANGE_2
Damage in hits done by nukes within range 2.
NUKE_LAND_TIME
Tick until impact after firing a nuke.
NUKE_RANGE
Range in rooms of nukers.
OBSERVER_HITS
Initial hits for observer structures; consider using the StructureType::initial_hits function.
OBSERVER_RANGE
Maximum range in rooms for StructureObserver::observe_room.
PIXEL_CPU_COST
Cost, paid from CpuInfo::bucket, to generate a pixel using CpuInfo::generate_pixel
PORTAL_DECAY
Ticks that a portal that has reached the end of its stable lifetime will remain before decaying.
PORTAL_MAX_TIMEOUT
Maximum time after a portal decays in a center room that a new portal will appear, in milliseconds.
PORTAL_MIN_TIMEOUT
Minimum time after a portal decays in a center room that a new portal will appear, in milliseconds.
PORTAL_UNSTABLE
The amount of time after spawning, in milliseconds, that random center room portals will become unstable and begin to decay, disappearing PORTAL_DECAY ticks later.
POWER_BANK_CAPACITY_CRIT
Chance of adding an additional POWER_BANK_CAPACITY_MAX to the random power amount calculated when spawning a power bank. (source)
POWER_BANK_CAPACITY_MAX
Maximum power capacity for power banks, before accounting for POWER_BANK_CAPACITY_CRIT.
POWER_BANK_CAPACITY_MIN
Maximum power capacity for power banks.
POWER_BANK_DECAY
Ticks for a power bank to decay if not destroyed.
POWER_BANK_HITS
Initial hits for power bank structures; consider using the StructureType::initial_hits function.
POWER_BANK_HIT_BACK
Percentage of damage dealt to power banks that is dealt back to attacking creeps.
POWER_BANK_RESPAWN_TIME
Base value for power bank respawn time calculation.
POWER_CREEP_DELETE_COOLDOWN
Time, in milliseconds, after a deletion is started via AccountPowerCreep::delete that it can no longer be canceled.
POWER_CREEP_LIFE_TIME
Maximum ticks to live for power creeps
POWER_CREEP_MAX_LEVEL
Maximum level for power creeps.
POWER_CREEP_SPAWN_COOLDOWN
Time, in milliseconds, that a power creep must wait to respawn after dying.
POWER_LEVEL_MULTIPLY
Base growth rate of processed power needed per global power level (GPL).
POWER_LEVEL_POW
Exponential growth rate of processed power needed per global power level (GPL).
POWER_SPAWN_ENERGY_CAPACITY
Maximum energy capacity for a power spawn to use in StructurePowerSpawn::process_power.
POWER_SPAWN_ENERGY_RATIO
Energy consumed per point of power processed by StructurePowerSpawn::process_power.
POWER_SPAWN_HITS
Initial hits for power spawn structures; consider using the StructureType::initial_hits function.
POWER_SPAWN_POWER_CAPACITY
Maximum power capacity for a power spawn to use in StructurePowerSpawn::process_power.
RAMPART_DECAY_AMOUNT
Hits lost per decay period for ramparts
RAMPART_DECAY_TIME
Ticks between rampart decays, losing RAMPART_DECAY_AMOUNT hits.
RAMPART_HITS
Initial hits for rampart structures when built; consider using the StructureType::initial_hits function.
RAMPART_HITS_MAX_RCL2
Max rampart hits at RCL 2; consider using the rampart_hits_max function.
RAMPART_HITS_MAX_RCL3
Max rampart hits at RCL 3; consider using the rampart_hits_max function.
RAMPART_HITS_MAX_RCL4
Max rampart hits at RCL 4; consider using the rampart_hits_max function.
RAMPART_HITS_MAX_RCL5
Max rampart hits at RCL 5; consider using the rampart_hits_max function.
RAMPART_HITS_MAX_RCL6
Max rampart hits at RCL 6; consider using the rampart_hits_max function.
RAMPART_HITS_MAX_RCL7
Max rampart hits at RCL 7; consider using the rampart_hits_max function.
RAMPART_HITS_MAX_RCL8
Max rampart hits at RCL 8; consider using the rampart_hits_max function.
RANGED_ATTACK_POWER
Hits of damage per effective ranged attack part per Creep::ranged_attack action.
RANGED_HEAL_POWER
Hits of damage healed per effective heal part per Creep::ranged_heal action.
REPAIR_COST
Cost in energy for each hit repaired by creeps before boosts.
REPAIR_POWER
Hits repaired per effective work part per Creep::repair action.
RESOURCES_ALL
A collection of all resource types. This is a direct translation of the RESOURCES_ALL constant in game using the rust ResourceType enum.
ROAD_DECAY_AMOUNT
Hits lost upon decay for roads, before swamp/tunnel multipliers
ROAD_DECAY_TIME
Ticks between road decay events without traffic
ROAD_HITS
Maximum hits for road structures, before swamp/tunnel multipliers
ROAD_WEAROUT
Tick penalty to a road’s decay, per creep body part, when a creep steps on it.
ROAD_WEAROUT_POWER_CREEP
Tick penalty to a road’s decay when a power creep steps on it.
RUIN_DECAY
Ticks that ruins will last when structures are destroyed.
SAFE_MODE_COOLDOWN
Ticks since last safe mode activation before another is allowed.
SAFE_MODE_COST
Cost in Ghodium to add a safe mode activation to a controller via Creep::generate_safe_mode
SAFE_MODE_DURATION
Duration of safe mode once activated, in ticks.
SIGN_PLANNED_AREA
Text added to signs of unowned rooms when a novice or respawn area is planned for the sector.
SOURCE_ENERGY_CAPACITY
Source energy capacity immediately after regeneration in owned and reserved rooms.
SOURCE_ENERGY_KEEPER_CAPACITY
Source energy capacity immediately after regeneration in source keeper (sector center) rooms.
SOURCE_ENERGY_NEUTRAL_CAPACITY
Source energy capacity immediately after regeneration in neutral rooms.
SPAWN_ENERGY_CAPACITY
Maximum energy capacity of spawn structures.
SPAWN_ENERGY_START
Initial energy for spawn structures when built.
SPAWN_HITS
Initial hits for spawn structures; consider using the StructureType::initial_hits function.
SPAWN_RENEW_RATIO
Additional TTL bonus, and reduction in energy cost, when renewing a creep compared to spawning.
STORAGE_CAPACITY
Store capacity for storage structures without power creep effects.
STORAGE_HITS
Initial hits for storage structures; consider using the StructureType::initial_hits function.
STRONGHOLD_DECAY_TICKS
Average ticks until collapse for a stronghold.
SYSTEM_USERNAME
Owner username of system-owned structures and creeps.
TERMINAL_CAPACITY
Store capacity of terminal structures.
TERMINAL_COOLDOWN
Cooldown after a terminal is used before it can be used again.
TERMINAL_HITS
Initial hits for terminal structures; consider using the StructureType::initial_hits function.
TERMINAL_MIN_SEND
Currently unused in game.
TERMINAL_SEND_COST
Currently unused in game (see market::calc_transaction_cost and TERMINAL_SEND_COST_SCALE instead).
TOMBSTONE_DECAY_PER_PART
Ticks per body part in total creep size that a creep’s tombstone will remain before decaying.
TOMBSTONE_DECAY_POWER_CREEP
Ticks that a power creep’s tombstone will remain.
TOWER_CAPACITY
Energy capacity of tower structures.
TOWER_ENERGY_COST
Energy cost of each tower action.
TOWER_FALLOFF
Maximum percentage reduction in healing, repair, and attack effectiveness for towers due to range.
TOWER_FALLOFF_RANGE
Tower actions at a range greater than or equal to this distance suffer the maxium falloff penalties - see TOWER_FALLOFF.
TOWER_HITS
Initial hits for tower structures; consider using the StructureType::initial_hits function.
TOWER_OPTIMAL_RANGE
Tower actions at a range beyond this distance suffer falloff penalties - see TOWER_FALLOFF.
TOWER_POWER_ATTACK
Tower damage per StructureTower::attack before range reduction.
TOWER_POWER_HEAL
Hits healed per StructureTower::heal before range reduction.
TOWER_POWER_REPAIR
Hits healed per StructureTower::repair before range reduction.
UPGRADE_CONTROLLER_POWER
Control points added per effective work part per Creep::upgrade_controller action.
WALL_HITS
Initial hits for wall structures when built; consider using the StructureType::initial_hits function.
WALL_HITS_MAX
Maximum hits for wall structures.

Functions§

controller_downgrade
Translates the CONTROLLER_DOWNGRADE constant, the maximum value of StructureController::ticks_to_downgrade for each controller level.
controller_levels
Translates the CONTROLLER_LEVELS constant.
extension_energy_capacity
Translates the EXTENSION_ENERGY_CAPACITY constant, the energy capacity of each source structure at a given room control level.
invader_core_creep_spawn_time
Ticks per body part that invader cores of each level take to spawn defensive creeps.
invader_core_expand_time
Ticks between creation of invader cores in rooms in the sector for each level of stronghold.
mineral_min_amount
Translates the MINERAL_MIN_AMOUNT constant; currently unused in game (see Density::amount instead).
rampart_hits_max
Translates the RAMPART_HITS_MAX constant, the maximum rampart hits for a given room control level.
ruin_decay_structures
Structures with special rules for their ruins’ ticks to live, currently only power banks.
stronghold_rampart_hits
Rampart hits for each level of stronghold.