Showing preview only (599K chars total). Download the full file or copy to clipboard to get everything.
Repository: screepers/typed-screeps
Branch: master
Commit: 77ad7692efe5
Files: 57
Total size: 575.6 KB
Directory structure:
gitextract_o_a42e6b/
├── .editorconfig
├── .gitattributes
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug-report.md
│ │ └── definition-changes.md
│ ├── PULL_REQUEST_TEMPLATE.md
│ └── workflows/
│ └── CI.yml
├── .gitignore
├── .husky/
│ └── pre-commit
├── .npmignore
├── .prettierrc
├── .vscode/
│ ├── extensions.json
│ └── settings.json
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── build/
│ └── concat.js
├── dist/
│ ├── .eslintrc.json
│ ├── .npmignore
│ ├── index.d.ts
│ ├── package.json
│ ├── screeps-tests.ts
│ └── tsconfig.json
├── eslint.config.mjs
├── eslint.config.test.mjs
├── package.json
├── src/
│ ├── constants.ts
│ ├── construction-site.ts
│ ├── creep.ts
│ ├── deposit.ts
│ ├── flag.ts
│ ├── game.ts
│ ├── helpers.ts
│ ├── inter-shard-memory.ts
│ ├── literals.ts
│ ├── map.ts
│ ├── market.ts
│ ├── memory.ts
│ ├── mineral.ts
│ ├── nuke.ts
│ ├── path-finder.ts
│ ├── power-creep.ts
│ ├── raw-memory.ts
│ ├── resource.ts
│ ├── room-object.ts
│ ├── room-position.ts
│ ├── room-terrain.ts
│ ├── room-visual.ts
│ ├── room.ts
│ ├── ruin.ts
│ ├── source.ts
│ ├── spawn.ts
│ ├── store.ts
│ ├── structure.ts
│ └── tombstone.ts
└── tsconfig.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[{package*.json,*.md}]
indent_style = space
indent_size = 2
================================================
FILE: .gitattributes
================================================
# Set end-of-line to LF
* text eol=lf
================================================
FILE: .github/ISSUE_TEMPLATE/bug-report.md
================================================
---
name: "Bug Report 🐛"
about: For reporting bugs/problems with the definition.
labels: "bug"
---
<!-- Please replace {Please write here} with your description. -->
### Expected Behavior
{Please write here}
### Actual Behavior
{Please write here}
### Sample code (if available)
```ts
// Please include your code within this block.
```
### Your Environment
- Node.js version: {Please write here}
- TypeScript version: {Please write here}
- {`typed-screeps` or `@types/screeps` delete as appropriate} version: {Please write here}
================================================
FILE: .github/ISSUE_TEMPLATE/definition-changes.md
================================================
---
name: "Declaration Changes 👨💻"
about: For changes/additions to the declaration files.
labels: "enhancement"
---
<!-- Please replace {Please write here} with your description. -->
### Brief Description
{Please write here}
### Reference to Screeps Changelog (if available)
{Please write here}
### Sample code (if available)
```ts
// Please include your code within this block.
```
================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
<!-- Thank you for your contribution to typed-screeps! Please replace {Please write here} with your description. -->
### Brief Description
{Please write here}
### Checklists
<!-- Put an 'x' inside the '[ ]' next to each completed items -->
- [ ] Test passed
- [ ] Coding style (indentation, etc)
- [ ] Edits have been made to `src/` files not `index.d.ts`
- [ ] Run `npm run compile` to update `index.d.ts`
================================================
FILE: .github/workflows/CI.yml
================================================
name: CI
on:
pull_request:
push:
branches: ["master"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm i
- name: Lint
run: pnpm lint
================================================
FILE: .gitignore
================================================
.idea
node_modules
npm-debug.log
*.*~
.DS_Store
test/typed-screeps-tests.js
dist/screeps.ts
dist/screeps.js
dist/screeps-tests.js
.vscode/tasks.json
================================================
FILE: .husky/pre-commit
================================================
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install lint-staged
npm run pre-commit
================================================
FILE: .npmignore
================================================
node_modules/
*.d.ts
*.log
*.tgz
.editorconfig
.gitattributes
tsconfig.json
eslint.config.*
src/
dist/screeps.ts
!dist/screeps.d.ts
================================================
FILE: .prettierrc
================================================
{
"semi": true,
"tabWidth": 4,
"printWidth": 140,
"useTabs": false,
"trailingComma": "all",
"overrides": [
{
"files": "package*.json",
"options": {
"tabWidth": 2,
"trailingComma": "none"
}
},
{
"files": "*.md",
"options": {
"tabWidth": 2
}
}
]
}
================================================
FILE: .vscode/extensions.json
================================================
{
"recommendations": [
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
]
}
================================================
FILE: .vscode/settings.json
================================================
{
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.rulers": [140],
"files.encoding": "utf8",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"search.exclude": {
"dist/**": true,
"node_modules/**": true,
"typings/**": true
}
}
================================================
FILE: CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [v3.4.0] - 2026-04-25
### Added
- Add type inference for params in filter callbacks ([#221](https://github.com/screepers/typed-screeps/pull/221))
- Add missing `MARKET_FEE` constant ([#213](https://github.com/screepers/typed-screeps/pull/213))
- Add `CommodityTypes` type and `CommidityEntry` interface ([#212](https://github.com/screepers/typed-screeps/pull/212))
- Add RoomTerrain.getRawBuffer() ([#247](https://github.com/screepers/typed-screeps/pull/247))
- Feat: Setting the Order type to ORDER_BUY | ORDER_SELL instead of string ([#255](https://github.com/screepers/typed-screeps/pull/255))
- Add restricted shard support by @tiennou in ([#290](https://github.com/screepers/typed-screeps/pull/290))
### Updated
- Update `PathFinder.CostMatrix` to be `CostMatrixConstructor` to separate static methods from `CostMatrix`. ([#214](https://github.com/screepers/typed-screeps/pull/214))
- Update `LOOK_STRUCTURES` return type to `AnyStructure` ([#217](https://github.com/screepers/typed-screeps/pull/217))
- Update `Game.structures` type to `OwnedStructure` ([#211](https://github.com/screepers/typed-screeps/pull/211))
- Refactor: Decoupling `FilterOption` and `FindConstant` and improve `FilterOption` ([#238](https://github.com/screepers/typed-screeps/pull/238))
- Fix: Mark `Spawning.directions` as optional ([#244](https://github.com/screepers/typed-screeps/pull/244))
- Fix: Unlimited stores have no notion of free capacity ([#208](https://github.com/screepers/typed-screeps/pull/208))
- Fix: `Room.getEventLog()` may return string ([#245](https://github.com/screepers/typed-screeps/pull/245))
- FIx: Mark `RoomObject.effects` as optional
- Fix: Update invader core-related constants to their actual values ([#249](https://github.com/screepers/typed-screeps/pull/249))
- Game.map.describeExits returns null for non-existent rooms ([#250](https://github.com/screepers/typed-screeps/pull/250))
- Fix: lookForAtArea matrix result type. ([#253](https://github.com/screepers/typed-screeps/pull/253))
- Update Game.market.deal documentation ([#256](https://github.com/screepers/typed-screeps/pull/256))
- Fix a transferEnergy type error where it suggested a creep. ([#258](https://github.com/screepers/typed-screeps/pull/258))
- Improve docs on Game.map.findRoute by @tiennou in ([#262](https://github.com/screepers/typed-screeps/pull/262))
- Cleanup unused code by @tiennou in ([#264](https://github.com/screepers/typed-screeps/pull/264))
- Type Mineral.density by @tiennou in ([#268](https://github.com/screepers/typed-screeps/pull/268))
- Document createOrder's parameter properly by @tiennou in ([#269](https://github.com/screepers/typed-screeps/pull/269))
- Improve documentation for methods and their return types by @tiennou in ([#270](https://github.com/screepers/typed-screeps/pull/270))
- Update the Game.market.calcTransactionCost formula by @tiennou in ([#277](https://github.com/screepers/typed-screeps/pull/277))
- Fix EVENT_BUILD data by @rmuchan in ([#279](https://github.com/screepers/typed-screeps/pull/279))
- Default heuristicWeight is 1.2, not 1 by @tiennou in ([#278](https://github.com/screepers/typed-screeps/pull/278))
### Removed
- None
## 3.3.2 to 3.3.8
These versions were pushed by DefinitelyTyped maintainers, has no effect on type definitions
- MarkoSulamagi resigns from DT side maintainers
## [3.3.1] - 2023-02-16
### Updated
- Update `ConcreteStructure` syntax to use map instead of conditional chain ([#209](https://github.com/screepers/typed-screeps/pull/209))
### Fixed
- Fix: brings removed `Game.getObjectById(id: string)` back to avoid breaking changes. ([#226](https://github.com/screepers/typed-screeps/pull/226))
## [3.3.0] - 2022-04-18
### Updated
- Updates `ticksToRegeneration` to be optional in `Minerals` ([#204](https://github.com/screepers/typed-screeps/pull/204))
- Updates `level` to be optional in `StructureFactory` ([#205](https://github.com/screepers/typed-screeps/pull/205))
- Updates `Id` type to only be used on types with an `id` property ([#207](https://github.com/screepers/typed-screeps/pull/207))
### Removed
- Removes deprecated `Game.getObjectById(id: string)` function. Use version with `Id<T>` typed ids. ([#207](https://github.com/screepers/typed-screeps/pull/207))
## [3.2.4] - 2021-08-21
### Added
- Add `Game.GetObjectById` support for union of Id's ([#201](https://github.com/screepers/typed-screeps/pull/201))
- Add support for type predicates in `room.find` and similar functions ([#199](https://github.com/screepers/typed-screeps/pull/199))
- Add explicit `| undefined` to undefined types that may exist with an undefined value.
### Fixed
- Fix typo in docstring in `Flag` interface ([#198](https://github.com/screepers/typed-screeps/pull/198))
- Fix function documentation. 10k per pixel ([#200](https://github.com/screepers/typed-screeps/pull/200))
## 3.2.3
This version was pushed by DefinitelyTyped maintainers, not present in this repository.
## [3.2.2] - 2021-03-14
### Added
- Added `StructureInvaderCore.Spawning` ([d798c56](https://github.com/screepers/typed-screeps/commit/d798c56f2724c21910b5b66e06a9b129e98020a7))
### Updated
- Updated `PIXEL_CPU_COST` constant to 10000 ([d798c56](https://github.com/screepers/typed-screeps/commit/d798c56f2724c21910b5b66e06a9b129e98020a7))
- MarketResourceConstant as argument for Game.market.getHistory ([#184](https://github.com/screepers/typed-screeps/pull/184))
- Updated `Deposit.depositType` documentation ([#189](https://github.com/screepers/typed-screeps/pull/189))
- Updated `Creep.build` documentation ([#186](https://github.com/screepers/typed-screeps/pull/186))
- Adds `import` and `export` to `RoomVisual` and `MapVisual` ([#181](https://github.com/screepers/typed-screeps/pull/181))
## [3.2.1] - 2020-09-24
### Added
- Adds `import` and `export` to `RoomVisual` and `MapVisual` ([#181](https://github.com/screepers/typed-screeps/pull/181))
- Add `InterShardResourceConstant`, fix resources missing from `MarketResourceConstant` ([#182](https://github.com/screepers/typed-screeps/pull/182))
### Fixed
- Adds `RESOURCE_ENERGY` to `COMMODITIES` record. ([#178](https://github.com/screepers/typed-screeps/pull/178))
- Fixes signature of `RoomPosition.findClosestByPath()` ([#179](https://github.com/screepers/typed-screeps/pull/179))
## [3.2.0] - 2020-09-06
### Added
- Add new `MapVisual` type for new map visual feature ([#177](https://github.com/screepers/typed-screeps/pull/177))
### Fixed
- Fix decumentation for `PWR_OPERATE_FACTORY` duration ([#174](https://github.com/screepers/typed-screeps/pull/174))
## [3.1.3] - 2020-06-22
### Added
- Add constants `CPU_UNLOCK`, `PIXEL`, `ACCESS_KEY` ([#172](https://github.com/screepers/typed-screeps/pull/172))
- Add `Game.cpu.generatePixel()` ([#172](https://github.com/screepers/typed-screeps/pull/172))
- Add `Game.cpu.unlock()`, `Game.cpu.unlocked`, and `Game.cpu.unlockedTime` ([#172](https://github.com/screepers/typed-screeps/pull/172))
### Fixed
- Fixed `tower.attack()` to allow targeting Structures ([#170](https://github.com/screepers/typed-screeps/pull/170))
## [3.1.2] - 2020-05-12
### Added
- Add `level?: number` to `COMMODITIES` record ([522a9ca](https://github.com/screepers/typed-screeps/commit/522a9ca1780ae2d6eade0311983c2e4933eeee68))
- Add `RESOURCE_ENERGY` to commodities components ([a3a59c9](https://github.com/screepers/typed-screeps/commit/a3a59c96ea3988d3362969ff9b7372624aa0a8f2))
### Fixed
- Fix `FindOpts.costCallback` type to `void | CostMatrix` ([32f051c](https://github.com/screepers/typed-screeps/commit/32f051c70b1572a507f5b483ea829a07bba344a5))
- Fix `StructureController.my` to be `boolean` ([062e4a4](https://github.com/screepers/typed-screeps/commit/062e4a4b8b8496979e073eb577fa6d023bba473d))
### Changed
- Slight change to `store` signatures to allow better type inference in certain editors ([#166](https://github.com/screepers/typed-screeps/pull/166))
## [3.1.1] - 2020-04-23
### Fixed
- Added type `Ruin` to `PowerCreep.withdraw` parameter `target`
## [3.1.0] - 2020-04-01
- Fixed `StructureSpawn.renewCreep()` documentation ([#158](https://github.com/screepers/typed-screeps/pull/158))
- Added missing `PWR_OPERATE_FACTORY` constant ([#161](https://github.com/screepers/typed-screeps/pull/161))
- Changed `BodyPartConstant` to allow inferred Boost type from part type ([#162](https://github.com/screepers/typed-screeps/pull/162))
- Added `ConcreteStructure<T>` type
- Change `owner` to allow undefined on `StructureController` ([#164](https://github.com/screepers/typed-screeps/pull/164))
- Various updates from 2020-03-24 game update ([#163](https://github.com/screepers/typed-screeps/pull/163))
- Added `Game.map.getRoomStauts(roomName)`
- Added `RoomStatus` type, a discriminated union on `status` of `RoomStatusTemporary` and `RoomStatusPermanent`.
- Added `StructureLab.reverseReaction(lab1,lab2)`
- Changed `room.name` to be readonly
- Changed typing of `StoreBase.getFreeCapacity()` to return `null` for invalid resources types on limited stores.
- Changed documentation of `store` functions
- Deprecated `Game.map.isRoomAvailable()`, see `Game.map.getRoomStatus()`
## [3.0.1] - 2019-11-27
- Fix POSSIBLE_RESSOURCES typo in store definition ([#151](https://github.com/screepers/typed-screeps/pull/151))
- Remove unecessary tslint:disable rules in OpaqueTag definition ([#151](https://github.com/screepers/typed-screeps/pull/151))
## [3.0.0] - 2019-11-23
### Added
- Add missing halt command to CPU ([#141](https://github.com/screepers/typed-screeps/pull/141))
- Add market price history and other updates ([#138](https://github.com/screepers/typed-screeps/pull/138))
- Add support for 'Natural Effects' on RoomObjects ([#135](https://github.com/screepers/typed-screeps/pull/135))
- Add support for Factories, Ruins, Deposits, and Strongholds ([#132](https://github.com/screepers/typed-screeps/pull/132))
### Changed
- Retype constants with same named types ([#143](https://github.com/screepers/typed-screeps/pull/143)), ([#147](https://github.com/screepers/typed-screeps/pull/147))
- Update StoreDefinition ([#130](https://github.com/screepers/typed-screeps/pull/130))
- Explicitly type game object Ids ([#139](https://github.com/screepers/typed-screeps/pull/139))
### Fixed
- Updated dependencies ([#133](https://github.com/screepers/typed-screeps/pull/133)), ([#134](https://github.com/screepers/typed-screeps/pull/134))
### Deprecated
- Deprecated use of string typed ids to get game objects ([#144](https://github.com/screepers/typed-screeps/pull/144))
- Deprecated `creep.carry` ([#130](https://github.com/screepers/typed-screeps/pull/130))
### Removed
- Remove deprecated FIND_DROPPED_ENERGY constant ([#129](https://github.com/screepers/typed-screeps/pull/129))
## [2.5.4] - 2019-05-12
### Added
- Add support for `PowerCreep`, `InterShardMemory` and an `AnyCreep` union ([#117](https://github.com/screepers/typed-screeps/pull/118))
## [2.5.3] - 2018-12-27
### Fixed
- Add missing properties to FindPathOpts (#106)
### Changed
- Change `EventType` to an interface with a type argument (#110)
## [2.5.2] - 2018-11-09
### Added
- Implements `Room.Terrain` and `room.getTerrain()` ([#103](https://github.com/screepers/typed-screeps/pull/103))
## [2.5.1] - 2018-10-11
### Fixed
- Fix definition of `RawMemory.segments`. ([#91](https://github.com/screepers/typed-screeps/pull/91))
- Fixed incorrect definition of `getEventLog()`. ([#101](https://github.com/screepers/typed-screeps/pull/101))
## [2.5.0] - 2018-10-04
### Added
- Added `getRoomTerrain` ([#98](https://github.com/screepers/typed-screeps/pull/98))
- Added WIP types for `room.eventLog` ([#88](https://github.com/screepers/typed-screeps/pull/88))
- Added missing safemode/downgrade constants ([#96](https://github.com/screepers/typed-screeps/pull/96))
### Changed
- `filterOptions` Revamp ([#87](https://github.com/screepers/typed-screeps/pull/87))
## [2.4.1] - 2018-08-24
### Added
- Added `INVADERS_ENERGY_GOAL` ([#83](https://github.com/screepers/typed-screeps/pull/83))
### Changed
- Update CREEP_CLAIM_LIFE_TIME to match with Screeps 2018-03-05 update ([#84](https://github.com/screepers/typed-screeps/pull/84))
## [2.4.0] - 2018-06-24
### Added
- Add inter-shard portals ([#74](https://github.com/screepers/typed-screeps/pull/74))
### Changed
- The findClosestBy\* functions potentially return null ([#69](https://github.com/screepers/typed-screeps/pull/69))
### Fixed
- Various improvements by @pmoehl (thank you!)
- Fix type of StructureLab.mineralType ([#73](https://github.com/screepers/typed-screeps/pull/73))
- Fix result type of Room.lookAtArea ([#75](https://github.com/screepers/typed-screeps/pull/75))
- Add subscription token as market resource types ([#76](https://github.com/screepers/typed-screeps/pull/76))
- Spawn options +directions ([#77](https://github.com/screepers/typed-screeps/pull/77))
- Add createConstructionSite name parameter ([#78](https://github.com/screepers/typed-screeps/pull/78))
- Updated Tombstone docs ([#79](https://github.com/screepers/typed-screeps/pull/79))
- Improve exit typings ([#80](https://github.com/screepers/typed-screeps/pull/80))
- Fixed missing Constructor extends declarations ([#71](https://github.com/screepers/typed-screeps/pull/71))
- Fixed createFlag method return type to include string ([#72](https://github.com/screepers/typed-screeps/pull/72))
- claimController() uses GCL, not RCL ([#81](https://github.com/screepers/typed-screeps/pull/81))
## [2.3.0] - 2018-04-16
### Added
- `TERMINAL_COOLDOWN` constant ([#64](https://github.com/screepers/typed-screeps/pull/64))
- Better tombstone support ([#60](https://github.com/screepers/typed-screeps/pull/60))
### Fixed
- Declare `Game` with `var` instead of `let` ([#62](https://github.com/screepers/typed-screeps/pull/62))
- `ERR_NOT_ENOUGH_RESOURCES` missing in return codes for creep build action ([#66](https://github.com/screepers/typed-screeps/pull/66))
## [2.2.2] - 2018-03-17
### Added
- Added IVM typings ([#55](https://github.com/screepers/typed-screeps/pull/55))
- Added Tombstone typings ([#48](https://github.com/screepers/typed-screeps/pull/48))
### Fixed
- Fixed some DefinitelyTyped linting errors ([#54](https://github.com/screepers/typed-screeps/pull/54))
## [2.2.1] - 2018-03-09
### Added
- Added `StructureSpawn.Spawning` ([#52](https://github.com/screepers/typed-screeps/pull/52))
### Changed
- Changed `StructureLab.mineralType` from `MineralConstant` to `_ResourceConstantSansEnergy | undefined`. ([#49](https://github.com/screepers/typed-screeps/pull/49))
### Fixed
- `RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE` has a typo ([#51](https://github.com/screepers/typed-screeps/pull/51))
## [2.2.0] - 2018-01-26
### Added
- Added missing constants: `EXTRACTOR_COOLDOWN`, `SYSTEM_USERNAME` ([#34](https://github.com/screepers/typed-screeps/pull/34))
- Added missing `ScreepsReturnCode` definition: `ERR_NAME_EXISTS` ([#44](https://github.com/screepers/typed-screeps/pull/44))
### Removed
- Remove `FIND_DROPPED_ENERGY` ([#39](https://github.com/screepers/typed-screeps/pull/39) [#40](https://github.com/screepers/typed-screeps/pull/40))
### Fixed
- `Creep.attackController()` returns `ERR_TIRED` if the controller has upgrade blocked ([#32](https://github.com/screepers/typed-screeps/pull/32))
- `PowerBank`s are considered to be owned structures (and are owned by "Power Bank") ([#33](https://github.com/screepers/typed-screeps/pull/33))
- Allow `creep.ticksToLive` to be undefined ([#36](https://github.com/screepers/typed-screeps/pull/36))
- Fixes for `PathFinder.search`, `LookAtTypes` ([#41](https://github.com/screepers/typed-screeps/pull/41), [#47](https://github.com/screepers/typed-screeps/pull/47))
## [2.1.0] - 2017-12-22
### Changed
- Restuctured project for DefinitelyTyped publishing ([#24](https://github.com/screepers/typed-screeps/pull/24))
### Fixed
- Allow `Game` interface to be extended ([#29](https://github.com/screepers/typed-screeps/pull/29))
- Allow controller sign + reservation to be undefined ([#28](https://github.com/screepers/typed-screeps/pull/28))
## [2.0.1] - 2017-12-13
### Fixed
- Reduce package size when installing via npm ([#25](https://github.com/screepers/typed-screeps/pull/25))
## [2.0.0] - 2017-12-05
### Added
- Added contributing guidelines and Issue/PR templates ([#18](https://github.com/screepers/typed-screeps/pull/18))
- Added CI tests (thanks, [@Arcath](https://github.com/Arcath)!)
- [Constants] Added `BuildableStructureConstant`, which is a subset of `StructureConstant` ([#17](https://github.com/screepers/typed-screeps/pull/17))
### Changed
- Improved build tooling around compiling scripts and running tests.
- [Room][roomposition] Improved generic-based overloads for `.find*()`, `lookAt()`, and `lookForAt()` functions ([#14](https://github.com/screepers/typed-screeps/pull/14), [#19](https://github.com/screepers/typed-screeps/pull/19))
- [Constants] `OBSTACLE_OBJECT_TYPES` are now strictly defined ([#17](https://github.com/screepers/typed-screeps/pull/17))
### Fixed
- [RawMemory] On `setActiveForeignSegment`, id should be optional. ([commit](https://github.com/screepers/typed-screeps/pull/16/commits/9aa7e3efe457f5500cd0eb6a76804bff657db1db))
## [1.0.4] - 2017-11-09
### Added
- Added `Game.resources`
- Added `Game.map.getWorldSize()`
- Added `RawMemory.interShardSegment`
### Deprecated
- Deprecated `spawn.canCreateCreep(body, [name])`
- Deprecated `spawn.createCreep(body, [name], [memory])`
- Deprecated `spawn.transferEnergy(target, [amount])`
- Deprecated `PathFinder.use(isEnabled)`
## [1.0.3] - 2017-11-05
### Fixed
- Emergency patch to fix mismatched `STRUCTURE_WALL` constant.
## [1.0.2] - 2017-11-05
### Added
- Added `Game.cpu.setShardLimits(limits)`
### Fixed
- [Constants] `STRUCTURE_WALL` should be `'constructedWall'`, not `'wall'`
## [1.0.1] - 2017-11-05
### Changed
- Added forgotten documentation material from v1.0.0
## 1.0.0 - 2017-11-05
### Added
- Initial public `npm` release.
[unreleased]: https://github.com/screepers/typed-screeps/compare/v3.3.1...HEAD
[3.3.1]: https://github.com/screepers/typed-screeps/compare/v3.3.0...v3.3.1
[3.3.0]: https://github.com/screepers/typed-screeps/compare/v3.2.4...v3.3.0
[3.2.4]: https://github.com/screepers/typed-screeps/compare/v3.2.2...v3.2.4
[3.2.2]: https://github.com/screepers/typed-screeps/compare/v3.2.1...v3.2.2
[3.2.1]: https://github.com/screepers/typed-screeps/compare/v3.2.0...v3.2.1
[3.2.0]: https://github.com/screepers/typed-screeps/compare/v3.1.3...v3.2.0
[3.1.3]: https://github.com/screepers/typed-screeps/compare/v3.1.2...v3.1.3
[3.1.2]: https://github.com/screepers/typed-screeps/compare/v3.1.1...v3.1.2
[3.1.1]: https://github.com/screepers/typed-screeps/compare/v3.1.0...v3.1.1
[3.1.0]: https://github.com/screepers/typed-screeps/compare/v3.0.1...v3.1.0
[3.0.1]: https://github.com/screepers/typed-screeps/compare/v3.0.0...v3.0.1
[3.0.0]: https://github.com/screepers/typed-screeps/compare/v2.5.4...v3.0.0
[2.5.4]: https://github.com/screepers/typed-screeps/compare/v2.5.3...v2.5.4
[2.5.3]: https://github.com/screepers/typed-screeps/compare/v2.5.2...v2.5.3
[2.5.2]: https://github.com/screepers/typed-screeps/compare/v2.5.1...v2.5.2
[2.5.1]: https://github.com/screepers/typed-screeps/compare/v2.5.0...v2.5.1
[2.5.0]: https://github.com/screepers/typed-screeps/compare/v2.4.1...v2.5.0
[2.4.1]: https://github.com/screepers/typed-screeps/compare/v2.4.0...v2.4.1
[2.4.0]: https://github.com/screepers/typed-screeps/compare/v2.3.0...v2.4.0
[2.3.0]: https://github.com/screepers/typed-screeps/compare/v2.2.2...v2.3.0
[2.2.2]: https://github.com/screepers/typed-screeps/compare/v2.2.1...v2.2.2
[2.2.1]: https://github.com/screepers/typed-screeps/compare/v2.2.0...v2.2.1
[2.2.0]: https://github.com/screepers/typed-screeps/compare/v2.1.0...v2.2.0
[2.1.0]: https://github.com/screepers/typed-screeps/compare/v2.0.1...v2.1.0
[2.0.1]: https://github.com/screepers/typed-screeps/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/screepers/typed-screeps/compare/v1.0.4...v2.0.0
[1.0.4]: https://github.com/screepers/typed-screeps/compare/v1.0.3...v1.0.4
[1.0.3]: https://github.com/screepers/typed-screeps/compare/v1.0.2...v1.0.3
[1.0.2]: https://github.com/screepers/typed-screeps/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/screepers/typed-screeps/compare/v1.0.0...v1.0.1
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at `resir014+screepers@gmail.com`. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
================================================
FILE: CONTRIBUTING.md
================================================
# Thank you for contributing to `typed-screeps`!
This document contains guides on getting started with developing `typed-screeps`, as well as the guidelines for contributing to this repository.
This library will stay up to date only with the help of you! If active players don't update it, it'll get lost.
## The Five Golden Rules
The simple steps of contributing to any GitHub project are as follows:
1. [Fork the repository](https://github.com/screepers/typed-screeps/fork)
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push -u origin my-new-feature`
5. Create a [Pull Request](https://github.com/screepers/typed-screeps/pulls)!
To keep your fork of in sync with this repository, [follow this guide](https://help.github.com/articles/syncing-a-fork/).
## Getting Started
To get started, just clone this repository, and install the required dependencies.
```bash
npm install
```
The code lives in the `src/` directory. Feel free to make your changes, and when you're done, run the following command to compile them:
```bash
npm run compile
```
## Running Tests
To test your changes, run the following command.
```bash
npm test
```
This command will compile your most recent changes, and then run linting checks. It will also test compiling against the `test/typed-screeps-tests.ts` file. The tests pass if all code is lint-checked and the tests file compiles without any errors.
The `test/typed-screeps-tests.ts` file also works as a sandbox for your additions. If you open this file and see no red squiggly lines, then you're good!
## Committing
This codebase uses [husky](https://github.com/typicode/husky) to auto-compile changes on commit. When you commit the changes, husky will first automatically run `npm run compile` and compile your changes.
## Filing Issues
We've created [a handy template](ISSUE_TEMPLATE.md) for you to submit any issues with. Please use it! It will assist us in triaging your issues.
## Submitting a Pull Request
We accept almost all pull requests, provided your code passes all of the tests, and your pull request description follows the [template](PULL_REQUEST_TEMPLATE.md) we've set up for you.
When adding new features, don't forget to add tests for them at the `dist/screeps-tests.ts` file. Likewise, don't forget to edit the [readme](README.md) if you are introducing any major changes or updates.
When making changes that are potentially breaking, careful discussion must be done with the community at large. Generally we do this either on the [#typescript](https://screeps.slack.com/messages/typescript/) channel on the Screeps Slack, or on the corresponding pull request discussion thread.
## Update checklist
If you are just submitting a PR, this isn't needed, but for new maintainers, when preparing a new version or updates:
1. Update the changelog with links to each relevant PR
2. Update the contributors list.
3. Update version numbers if required
4. (If releasing) Package a release / Update the relevant draft release
5. Close / Update relevant issues
6. (If publishing) Submit a PR to Definitely-Typed
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2016-2017 typed-screeps contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# typed-screeps
> Strong TypeScript declarations for the game Screeps: World.
[](https://github.com/screepers/typed-screeps/actions/workflows/CI.yml) [](https://www.npmjs.com/package/@types/screeps)
## Installation
The type definitions are published on [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped). To install them, run the following.
```bash
# npm
npm install @types/screeps
# yarn
yarn add @types/screeps
# pnpm
pnpm add @types/screeps
```
## Differences from **[Screeps-Typescript-Declarations](https://github.com/screepers/Screeps-Typescript-Declarations)**
This repo has more activity and is considerably more up-to-date.
### Breaking Changes:
- `Memory` is typed by default. The added typings are:
- `CreepMemory`
- `FlagMemory`
- `SpawnMemory`
- `RoomMemory`
If you like the idea of typed memory, but aren't ready to just jump fully in, you only need to make sure you define an interface for the above four types. Then you can extend them at a later time.
Example:
```TypeScript
interface CreepMemory { [name: string]: any };
interface FlagMemory { [name: string]: any };
interface SpawnMemory { [name: string]: any };
interface RoomMemory { [name: string]: any };
```
If you don't want to add types to the global `Memory` object, you will need to add the following interface along with the four above.
Example:
```Typescript
interface Memory { [key: string]: any };
```
- Any place in code that uses a constant (ex `STRUCTURE_EXTENSION` or `FIND_MY_SPAWNS` is now constrained to use literal types. Here is the list of the new types:
```
BodyPartConstant
BuildableStructureConstant (this is a subset of StructureConstant)
StructureConstant
FindConstant
LookConstant
DirectionConstant
ResourceConstant
MineralConstant (this is a subset of ResourceConstant)
ColorConstant
ScreepsReturnCode
Terrain
```
To update your code, you just need to change any `string` types to match one of the above. For example, if your code had:
```TypeScript
function getBody(): string[] {
return [ WORK, MOVE, CARRY ];
}
```
Change it to:
```TypeScript
function getBody(): BodyPartConstant[] { // this line changed
return [ WORK, MOVE, CARRY ];
}
```
- Some original functions were incorrectly typed to not include `null` as a possible return. You may need to update your code to reflect this update (ex. `findClosestByPath` or `findClosestByRange`)
#### Game.getObjectById()
- `Game.getObjectById()` now returns typed objects according to the type of the Id (ex. `Id<StructureTower>` returns `StructureTower` type).
Use of `string` typed Id, is deprecated and may be removed in the future. When using string Ids, the type of the returned game object is `unknown` which requires manual type assertion. Previously this function returned `any` typed objects which could accidently be left untyped;
If you have code like this (un-type-asserted use of `Game.getObjectById`)
```TypeScript
interface Memory{
towerIds: string[];
}
Memory.towerIds.forEach((towerId) => {
const tower = Game.getObjectById(towerId); // type of returned tower is 'unknown' instead of 'any'
tower.attack(targetCreep); // Error Object is of type unknown ts(2571)
})
```
Change it store typed Ids:
```TypeScript
interface Memory{
towerIds: Array<Id<StructureTower>>;
}
Memory.towerIds.forEach((towerId) => {
const tower = Game.getObjectById(towerId); // type of returned tower is StructureTower
tower.attack(targetCreep);
})
```
If you're already manually asserting the type of the game object, you're not required to change anything immediately however this is deprecated and may be removed in the future.
```TypeScript
const towerId: Id<StructureTower> = "" as Id<StructureTower>;
const tower1 = Game.getObjectById(towerId); // recommended use, returns StructureTower type
const tower2 = Game.getObjectById<StructureTower>(""); // @deprecated returns StructureTower type
const tower3 = Game.getObjectById("") as StructureTower; // @deprecated returns StructureTower type
```
`Id<T>` types are assignable to `string` but the reverse is not allowed implicitly. To assign a `string` type to an `Id<T>` type, you must explicitly assert the type.
```TypeScript
const typedId: Id<Creep> = "123" as Id<Creep>; // assertion required
const untypedId1: string = typedId; // no assertion required
```
- Game objects have typed id properties `id: Id<this>`. These typed ids can by passed to `Game.getObjectById()` to receive typed game objects matching the type of the Id. See above bullet for more details.
```TypeScript
creep.id // has type Id<Creep>
copy = Game.getObjectById(creep.id) // returns type Creep
tower.id // has type Id<StructureTower>
```
### Additional (non-breaking) Features:
- `ConstructionSite` can be optionally constrained by a structure type (ex. `ConstructionSite<STRUCTURE_CONTAINER>`). TypeScript will enforce that the `type` property of the `ConstructionSite` appropriately matches
- `Resource` can optionally be constrained (ex. `Resource<RESOURCE_ENERGY>`)
- `Mineral` can optionally be constrained by `MineralConstant` (ex. `Mineral<RESOURCE_GHODIUM>`)
- `Structure` can optionally be constrained (ex `Structure<STRUCTURE_SPAWN | STRUCTURE_EXTENSION>`)
- Screeps classes derived from `Structure` (ex `StructureContainer`) have their `type` property correspondingly constrained
- `LookAt` results are now constrained to the type looked for
- Results from `Find`-type functions are now constrained to have a `RoomPosition`
- Typings for new RawMemory and RoomVisuals
- New union type `AnyCreep` to represent `Creep` and `PowerCreep`
## Contribute
Issues and Pull Requests are welcome! Please read the [Contributing Guidelines](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md) beforehand.
================================================
FILE: build/concat.js
================================================
const fs = require("fs");
const path = require("path");
const HEADER = `// Please contribute types to https://github.com/screepers/typed-screeps`
fs.readdir(path.join(__dirname, "..", "src"), function (err, files) {
files = files.map(function (value) {
return path.join("src", value);
});
Promise.all(files.map((name) => fs.promises.readFile(name))).then(
(fileContents) => {
fs.writeFileSync(path.join(__dirname, "..", "dist", "index.d.ts"), HEADER + "\n\n" + Buffer.concat(fileContents));
},
(reason) => {
console.log(reason);
},
);
});
================================================
FILE: dist/.eslintrc.json
================================================
{
"rules": {
"@definitelytyped/no-any-union": "off",
"@definitelytyped/no-unnecessary-generics": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-misused-new": "off"
}
}
================================================
FILE: dist/.npmignore
================================================
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
================================================
FILE: dist/index.d.ts
================================================
// Please contribute types to https://github.com/screepers/typed-screeps
// Game Constants
declare const OK: OK;
declare const ERR_NOT_OWNER: ERR_NOT_OWNER;
declare const ERR_NO_PATH: ERR_NO_PATH;
declare const ERR_NAME_EXISTS: ERR_NAME_EXISTS;
declare const ERR_BUSY: ERR_BUSY;
declare const ERR_NOT_FOUND: ERR_NOT_FOUND;
declare const ERR_NOT_ENOUGH_RESOURCES: ERR_NOT_ENOUGH_RESOURCES;
declare const ERR_NOT_ENOUGH_ENERGY: ERR_NOT_ENOUGH_ENERGY;
declare const ERR_INVALID_TARGET: ERR_INVALID_TARGET;
declare const ERR_FULL: ERR_FULL;
declare const ERR_NOT_IN_RANGE: ERR_NOT_IN_RANGE;
declare const ERR_INVALID_ARGS: ERR_INVALID_ARGS;
declare const ERR_TIRED: ERR_TIRED;
declare const ERR_NO_BODYPART: ERR_NO_BODYPART;
declare const ERR_NOT_ENOUGH_EXTENSIONS: ERR_NOT_ENOUGH_EXTENSIONS;
declare const ERR_RCL_NOT_ENOUGH: ERR_RCL_NOT_ENOUGH;
declare const ERR_GCL_NOT_ENOUGH: ERR_GCL_NOT_ENOUGH;
declare const ERR_ACCESS_DENIED: ERR_ACCESS_DENIED;
declare const FIND_EXIT_TOP: FIND_EXIT_TOP;
declare const FIND_EXIT_RIGHT: FIND_EXIT_RIGHT;
declare const FIND_EXIT_BOTTOM: FIND_EXIT_BOTTOM;
declare const FIND_EXIT_LEFT: FIND_EXIT_LEFT;
declare const FIND_EXIT: FIND_EXIT;
declare const FIND_CREEPS: FIND_CREEPS;
declare const FIND_MY_CREEPS: FIND_MY_CREEPS;
declare const FIND_HOSTILE_CREEPS: FIND_HOSTILE_CREEPS;
declare const FIND_SOURCES_ACTIVE: FIND_SOURCES_ACTIVE;
declare const FIND_SOURCES: FIND_SOURCES;
declare const FIND_DROPPED_RESOURCES: FIND_DROPPED_RESOURCES;
declare const FIND_STRUCTURES: FIND_STRUCTURES;
declare const FIND_MY_STRUCTURES: FIND_MY_STRUCTURES;
declare const FIND_HOSTILE_STRUCTURES: FIND_HOSTILE_STRUCTURES;
declare const FIND_FLAGS: FIND_FLAGS;
declare const FIND_CONSTRUCTION_SITES: FIND_CONSTRUCTION_SITES;
declare const FIND_MY_SPAWNS: FIND_MY_SPAWNS;
declare const FIND_HOSTILE_SPAWNS: FIND_HOSTILE_SPAWNS;
declare const FIND_MY_CONSTRUCTION_SITES: FIND_MY_CONSTRUCTION_SITES;
declare const FIND_HOSTILE_CONSTRUCTION_SITES: FIND_HOSTILE_CONSTRUCTION_SITES;
declare const FIND_MINERALS: FIND_MINERALS;
declare const FIND_NUKES: FIND_NUKES;
declare const FIND_TOMBSTONES: FIND_TOMBSTONES;
declare const FIND_POWER_CREEPS: FIND_POWER_CREEPS;
declare const FIND_MY_POWER_CREEPS: FIND_MY_POWER_CREEPS;
declare const FIND_HOSTILE_POWER_CREEPS: FIND_HOSTILE_POWER_CREEPS;
declare const FIND_DEPOSITS: FIND_DEPOSITS;
declare const FIND_RUINS: FIND_RUINS;
declare const TOP: TOP;
declare const TOP_RIGHT: TOP_RIGHT;
declare const RIGHT: RIGHT;
declare const BOTTOM_RIGHT: BOTTOM_RIGHT;
declare const BOTTOM: BOTTOM;
declare const BOTTOM_LEFT: BOTTOM_LEFT;
declare const LEFT: LEFT;
declare const TOP_LEFT: TOP_LEFT;
declare const COLOR_RED: COLOR_RED;
declare const COLOR_PURPLE: COLOR_PURPLE;
declare const COLOR_BLUE: COLOR_BLUE;
declare const COLOR_CYAN: COLOR_CYAN;
declare const COLOR_GREEN: COLOR_GREEN;
declare const COLOR_YELLOW: COLOR_YELLOW;
declare const COLOR_ORANGE: COLOR_ORANGE;
declare const COLOR_BROWN: COLOR_BROWN;
declare const COLOR_GREY: COLOR_GREY;
declare const COLOR_WHITE: COLOR_WHITE;
declare const COLORS_ALL: ColorConstant[];
declare const CREEP_SPAWN_TIME: 3;
declare const CREEP_LIFE_TIME: 1500;
declare const CREEP_CLAIM_LIFE_TIME: 600;
declare const CREEP_CORPSE_RATE: 0.2;
declare const OBSTACLE_OBJECT_TYPES: [
"spawn",
"creep",
"powerCreep",
"source",
"mineral",
"deposit",
"controller",
"constructedWall",
"extension",
"link",
"storage",
"tower",
"observer",
"powerSpawn",
"powerBank",
"lab",
"terminal",
"nuker",
"factory",
"invaderCore",
];
declare const ENERGY_REGEN_TIME: 300;
declare const ENERGY_DECAY: 1000;
declare const REPAIR_COST: 0.01;
declare const RAMPART_DECAY_AMOUNT: 300;
declare const RAMPART_DECAY_TIME: 100;
declare const RAMPART_HITS: 1;
declare const RAMPART_HITS_MAX: {
[rcl: number]: number;
2: 300000;
3: 1000000;
4: 3000000;
5: 10000000;
6: 30000000;
7: 100000000;
8: 300000000;
};
declare const SPAWN_HITS: 5000;
declare const SPAWN_ENERGY_START: 300;
declare const SPAWN_ENERGY_CAPACITY: 300;
declare const SOURCE_ENERGY_CAPACITY: 3000;
declare const SOURCE_ENERGY_NEUTRAL_CAPACITY: 1500;
declare const SOURCE_ENERGY_KEEPER_CAPACITY: 4000;
declare const WALL_HITS: 1;
declare const WALL_HITS_MAX: 300000000;
declare const EXTENSION_HITS: 1000;
declare const EXTENSION_ENERGY_CAPACITY: {
[rcl: number]: number;
0: 50;
1: 50;
2: 50;
3: 50;
4: 50;
5: 50;
6: 50;
7: 100;
8: 200;
};
declare const ROAD_HITS: 5000;
declare const ROAD_WEAROUT: 1;
declare const ROAD_WEAROUT_POWER_CREEP: 100;
declare const ROAD_DECAY_AMOUNT: 100;
declare const ROAD_DECAY_TIME: 1000;
declare const LINK_HITS: 1000;
declare const LINK_HITS_MAX: 1000;
declare const LINK_CAPACITY: 800;
declare const LINK_COOLDOWN: 1;
declare const LINK_LOSS_RATIO: 0.03;
declare const STORAGE_CAPACITY: 1000000;
declare const STORAGE_HITS: 10000;
declare const FACTORY_HITS: 1000;
declare const FACTORY_CAPACITY: 50000;
declare const BODYPART_COST: Record<BodyPartConstant, number>;
declare const BODYPARTS_ALL: BodyPartConstant[];
declare const CARRY_CAPACITY: 50;
declare const HARVEST_POWER: 2;
declare const HARVEST_MINERAL_POWER: 1;
declare const HARVEST_DEPOSIT_POWER: 1;
declare const REPAIR_POWER: 100;
declare const DISMANTLE_POWER: 50;
declare const BUILD_POWER: 5;
declare const ATTACK_POWER: 30;
declare const UPGRADE_CONTROLLER_POWER: 1;
declare const RANGED_ATTACK_POWER: 10;
declare const HEAL_POWER: 12;
declare const RANGED_HEAL_POWER: 4;
declare const DISMANTLE_COST: 0.005;
declare const MOVE: MOVE;
declare const WORK: WORK;
declare const CARRY: CARRY;
declare const ATTACK: ATTACK;
declare const RANGED_ATTACK: RANGED_ATTACK;
declare const TOUGH: TOUGH;
declare const HEAL: HEAL;
declare const CLAIM: CLAIM;
declare const CONSTRUCTION_COST: Record<BuildableStructureConstant, number>;
declare const CONSTRUCTION_COST_ROAD_SWAMP_RATIO: 5;
declare const CONSTRUCTION_COST_ROAD_WALL_RATIO: 150;
declare const STRUCTURE_EXTENSION: STRUCTURE_EXTENSION;
declare const STRUCTURE_RAMPART: STRUCTURE_RAMPART;
declare const STRUCTURE_ROAD: STRUCTURE_ROAD;
declare const STRUCTURE_SPAWN: STRUCTURE_SPAWN;
declare const STRUCTURE_LINK: STRUCTURE_LINK;
declare const STRUCTURE_WALL: STRUCTURE_WALL;
declare const STRUCTURE_KEEPER_LAIR: STRUCTURE_KEEPER_LAIR;
declare const STRUCTURE_CONTROLLER: STRUCTURE_CONTROLLER;
declare const STRUCTURE_STORAGE: STRUCTURE_STORAGE;
declare const STRUCTURE_TOWER: STRUCTURE_TOWER;
declare const STRUCTURE_OBSERVER: STRUCTURE_OBSERVER;
declare const STRUCTURE_POWER_BANK: STRUCTURE_POWER_BANK;
declare const STRUCTURE_POWER_SPAWN: STRUCTURE_POWER_SPAWN;
declare const STRUCTURE_EXTRACTOR: STRUCTURE_EXTRACTOR;
declare const STRUCTURE_LAB: STRUCTURE_LAB;
declare const STRUCTURE_TERMINAL: STRUCTURE_TERMINAL;
declare const STRUCTURE_CONTAINER: STRUCTURE_CONTAINER;
declare const STRUCTURE_NUKER: STRUCTURE_NUKER;
declare const STRUCTURE_FACTORY: STRUCTURE_FACTORY;
declare const STRUCTURE_INVADER_CORE: STRUCTURE_INVADER_CORE;
declare const STRUCTURE_PORTAL: STRUCTURE_PORTAL;
declare const RESOURCE_ENERGY: RESOURCE_ENERGY;
declare const RESOURCE_POWER: RESOURCE_POWER;
declare const RESOURCE_OPS: RESOURCE_OPS;
declare const RESOURCE_UTRIUM: RESOURCE_UTRIUM;
declare const RESOURCE_LEMERGIUM: RESOURCE_LEMERGIUM;
declare const RESOURCE_KEANIUM: RESOURCE_KEANIUM;
declare const RESOURCE_GHODIUM: RESOURCE_GHODIUM;
declare const RESOURCE_ZYNTHIUM: RESOURCE_ZYNTHIUM;
declare const RESOURCE_OXYGEN: RESOURCE_OXYGEN;
declare const RESOURCE_HYDROGEN: RESOURCE_HYDROGEN;
declare const RESOURCE_CATALYST: RESOURCE_CATALYST;
declare const RESOURCE_HYDROXIDE: RESOURCE_HYDROXIDE;
declare const RESOURCE_ZYNTHIUM_KEANITE: RESOURCE_ZYNTHIUM_KEANITE;
declare const RESOURCE_UTRIUM_LEMERGITE: RESOURCE_UTRIUM_LEMERGITE;
declare const RESOURCE_UTRIUM_HYDRIDE: RESOURCE_UTRIUM_HYDRIDE;
declare const RESOURCE_UTRIUM_OXIDE: RESOURCE_UTRIUM_OXIDE;
declare const RESOURCE_KEANIUM_HYDRIDE: RESOURCE_KEANIUM_HYDRIDE;
declare const RESOURCE_KEANIUM_OXIDE: RESOURCE_KEANIUM_OXIDE;
declare const RESOURCE_LEMERGIUM_HYDRIDE: RESOURCE_LEMERGIUM_HYDRIDE;
declare const RESOURCE_LEMERGIUM_OXIDE: RESOURCE_LEMERGIUM_OXIDE;
declare const RESOURCE_ZYNTHIUM_HYDRIDE: RESOURCE_ZYNTHIUM_HYDRIDE;
declare const RESOURCE_ZYNTHIUM_OXIDE: RESOURCE_ZYNTHIUM_OXIDE;
declare const RESOURCE_GHODIUM_HYDRIDE: RESOURCE_GHODIUM_HYDRIDE;
declare const RESOURCE_GHODIUM_OXIDE: RESOURCE_GHODIUM_OXIDE;
declare const RESOURCE_UTRIUM_ACID: RESOURCE_UTRIUM_ACID;
declare const RESOURCE_UTRIUM_ALKALIDE: RESOURCE_UTRIUM_ALKALIDE;
declare const RESOURCE_KEANIUM_ACID: RESOURCE_KEANIUM_ACID;
declare const RESOURCE_KEANIUM_ALKALIDE: RESOURCE_KEANIUM_ALKALIDE;
declare const RESOURCE_LEMERGIUM_ACID: RESOURCE_LEMERGIUM_ACID;
declare const RESOURCE_LEMERGIUM_ALKALIDE: RESOURCE_LEMERGIUM_ALKALIDE;
declare const RESOURCE_ZYNTHIUM_ACID: RESOURCE_ZYNTHIUM_ACID;
declare const RESOURCE_ZYNTHIUM_ALKALIDE: RESOURCE_ZYNTHIUM_ALKALIDE;
declare const RESOURCE_GHODIUM_ACID: RESOURCE_GHODIUM_ACID;
declare const RESOURCE_GHODIUM_ALKALIDE: RESOURCE_GHODIUM_ALKALIDE;
declare const RESOURCE_CATALYZED_UTRIUM_ACID: RESOURCE_CATALYZED_UTRIUM_ACID;
declare const RESOURCE_CATALYZED_UTRIUM_ALKALIDE: RESOURCE_CATALYZED_UTRIUM_ALKALIDE;
declare const RESOURCE_CATALYZED_KEANIUM_ACID: RESOURCE_CATALYZED_KEANIUM_ACID;
declare const RESOURCE_CATALYZED_KEANIUM_ALKALIDE: RESOURCE_CATALYZED_KEANIUM_ALKALIDE;
declare const RESOURCE_CATALYZED_LEMERGIUM_ACID: RESOURCE_CATALYZED_LEMERGIUM_ACID;
declare const RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE: RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE;
declare const RESOURCE_CATALYZED_ZYNTHIUM_ACID: RESOURCE_CATALYZED_ZYNTHIUM_ACID;
declare const RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE: RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE;
declare const RESOURCE_CATALYZED_GHODIUM_ACID: RESOURCE_CATALYZED_GHODIUM_ACID;
declare const RESOURCE_CATALYZED_GHODIUM_ALKALIDE: RESOURCE_CATALYZED_GHODIUM_ALKALIDE;
declare const RESOURCE_BIOMASS: RESOURCE_BIOMASS;
declare const RESOURCE_METAL: RESOURCE_METAL;
declare const RESOURCE_MIST: RESOURCE_MIST;
declare const RESOURCE_SILICON: RESOURCE_SILICON;
declare const RESOURCE_UTRIUM_BAR: RESOURCE_UTRIUM_BAR;
declare const RESOURCE_LEMERGIUM_BAR: RESOURCE_LEMERGIUM_BAR;
declare const RESOURCE_ZYNTHIUM_BAR: RESOURCE_ZYNTHIUM_BAR;
declare const RESOURCE_KEANIUM_BAR: RESOURCE_KEANIUM_BAR;
declare const RESOURCE_GHODIUM_MELT: RESOURCE_GHODIUM_MELT;
declare const RESOURCE_OXIDANT: RESOURCE_OXIDANT;
declare const RESOURCE_REDUCTANT: RESOURCE_REDUCTANT;
declare const RESOURCE_PURIFIER: RESOURCE_PURIFIER;
declare const RESOURCE_BATTERY: RESOURCE_BATTERY;
declare const RESOURCE_COMPOSITE: RESOURCE_COMPOSITE;
declare const RESOURCE_CRYSTAL: RESOURCE_CRYSTAL;
declare const RESOURCE_LIQUID: RESOURCE_LIQUID;
declare const RESOURCE_WIRE: RESOURCE_WIRE;
declare const RESOURCE_SWITCH: RESOURCE_SWITCH;
declare const RESOURCE_TRANSISTOR: RESOURCE_TRANSISTOR;
declare const RESOURCE_MICROCHIP: RESOURCE_MICROCHIP;
declare const RESOURCE_CIRCUIT: RESOURCE_CIRCUIT;
declare const RESOURCE_DEVICE: RESOURCE_DEVICE;
declare const RESOURCE_CELL: RESOURCE_CELL;
declare const RESOURCE_PHLEGM: RESOURCE_PHLEGM;
declare const RESOURCE_TISSUE: RESOURCE_TISSUE;
declare const RESOURCE_MUSCLE: RESOURCE_MUSCLE;
declare const RESOURCE_ORGANOID: RESOURCE_ORGANOID;
declare const RESOURCE_ORGANISM: RESOURCE_ORGANISM;
declare const RESOURCE_ALLOY: RESOURCE_ALLOY;
declare const RESOURCE_TUBE: RESOURCE_TUBE;
declare const RESOURCE_FIXTURES: RESOURCE_FIXTURES;
declare const RESOURCE_FRAME: RESOURCE_FRAME;
declare const RESOURCE_HYDRAULICS: RESOURCE_HYDRAULICS;
declare const RESOURCE_MACHINE: RESOURCE_MACHINE;
declare const RESOURCE_CONDENSATE: RESOURCE_CONDENSATE;
declare const RESOURCE_CONCENTRATE: RESOURCE_CONCENTRATE;
declare const RESOURCE_EXTRACT: RESOURCE_EXTRACT;
declare const RESOURCE_SPIRIT: RESOURCE_SPIRIT;
declare const RESOURCE_EMANATION: RESOURCE_EMANATION;
declare const RESOURCE_ESSENCE: RESOURCE_ESSENCE;
declare const RESOURCES_ALL: ResourceConstant[];
declare const SUBSCRIPTION_TOKEN: SUBSCRIPTION_TOKEN;
declare const CPU_UNLOCK: CPU_UNLOCK;
declare const PIXEL: PIXEL;
declare const ACCESS_KEY: ACCESS_KEY;
declare const PIXEL_CPU_COST: 10000;
declare const CONTROLLER_LEVELS: { [level: number]: number };
declare const CONTROLLER_STRUCTURES: Record<BuildableStructureConstant, { [level: number]: number }>;
declare const CONTROLLER_DOWNGRADE: { [level: number]: number };
declare const CONTROLLER_DOWNGRADE_RESTORE: number;
declare const CONTROLLER_DOWNGRADE_SAFEMODE_THRESHOLD: number;
declare const CONTROLLER_CLAIM_DOWNGRADE: number;
declare const CONTROLLER_RESERVE: number;
declare const CONTROLLER_RESERVE_MAX: number;
declare const CONTROLLER_MAX_UPGRADE_PER_TICK: number;
declare const CONTROLLER_ATTACK_BLOCKED_UPGRADE: number;
declare const CONTROLLER_NUKE_BLOCKED_UPGRADE: number;
declare const SAFE_MODE_DURATION: 20000;
declare const SAFE_MODE_COOLDOWN: 50000;
declare const SAFE_MODE_COST: 1000;
declare const TOWER_HITS: number;
declare const TOWER_CAPACITY: number;
declare const TOWER_ENERGY_COST: number;
declare const TOWER_POWER_ATTACK: number;
declare const TOWER_POWER_HEAL: number;
declare const TOWER_POWER_REPAIR: number;
declare const TOWER_OPTIMAL_RANGE: number;
declare const TOWER_FALLOFF_RANGE: number;
declare const TOWER_FALLOFF: number;
declare const OBSERVER_HITS: number;
declare const OBSERVER_RANGE: number;
declare const POWER_BANK_HITS: number;
declare const POWER_BANK_CAPACITY_MAX: number;
declare const POWER_BANK_CAPACITY_MIN: number;
declare const POWER_BANK_CAPACITY_CRIT: number;
declare const POWER_BANK_DECAY: number;
declare const POWER_BANK_HIT_BACK: number;
declare const POWER_SPAWN_HITS: number;
declare const POWER_SPAWN_ENERGY_CAPACITY: number;
declare const POWER_SPAWN_POWER_CAPACITY: number;
declare const POWER_SPAWN_ENERGY_RATIO: number;
declare const EXTRACTOR_HITS: number;
declare const EXTRACTOR_COOLDOWN: number;
declare const LAB_HITS: number;
declare const LAB_MINERAL_CAPACITY: number;
declare const LAB_ENERGY_CAPACITY: number;
declare const LAB_BOOST_ENERGY: number;
declare const LAB_BOOST_MINERAL: number;
declare const LAB_COOLDOWN: number;
declare const LAB_REACTION_AMOUNT: number;
declare const GCL_POW: number;
declare const GCL_MULTIPLY: number;
declare const GCL_NOVICE: number;
declare const MODE_SIMULATION: null;
declare const MODE_WORLD: null;
declare const TERRAIN_MASK_WALL: TERRAIN_MASK_WALL;
declare const TERRAIN_MASK_SWAMP: TERRAIN_MASK_SWAMP;
declare const TERRAIN_MASK_LAVA: TERRAIN_MASK_LAVA;
declare const MAX_CONSTRUCTION_SITES: number;
declare const MAX_CREEP_SIZE: number;
declare const MINERAL_REGEN_TIME: number;
declare const MINERAL_MIN_AMOUNT: Record<MineralConstant, number>;
declare const MINERAL_RANDOM_FACTOR: number;
declare const MINERAL_DENSITY: {
[level: number]: number;
1: number;
2: number;
3: number;
4: number;
};
declare const MINERAL_DENSITY_PROBABILITY: {
[level: number]: number;
1: number;
2: number;
3: number;
4: number;
};
declare const MINERAL_DENSITY_CHANGE: number;
declare const DENSITY_LOW: DENSITY_LOW;
declare const DENSITY_MODERATE: DENSITY_MODERATE;
declare const DENSITY_HIGH: DENSITY_HIGH;
declare const DENSITY_ULTRA: DENSITY_ULTRA;
declare const DEPOSIT_EXHAUST_MULTIPLY: number;
declare const DEPOSIT_EXHAUST_POW: number;
declare const DEPOSIT_DECAY_TIME: number;
declare const TERMINAL_CAPACITY: number;
declare const TERMINAL_COOLDOWN: number;
declare const TERMINAL_HITS: number;
declare const TERMINAL_SEND_COST: number;
declare const TERMINAL_MIN_SEND: number;
declare const CONTAINER_HITS: number;
declare const CONTAINER_CAPACITY: number;
declare const CONTAINER_DECAY: number;
declare const CONTAINER_DECAY_TIME: number;
declare const CONTAINER_DECAY_TIME_OWNED: number;
declare const NUKER_HITS: number;
declare const NUKER_COOLDOWN: number;
declare const NUKER_ENERGY_CAPACITY: number;
declare const NUKER_GHODIUM_CAPACITY: number;
declare const NUKE_LAND_TIME: number;
declare const NUKE_RANGE: number;
declare const NUKE_DAMAGE: {
[range: number]: number;
0: number;
1: number;
4: number;
};
declare const REACTIONS: {
[resource: string]: { [resource: string]: string };
H: {
O: "OH";
L: "LH";
K: "KH";
U: "UH";
Z: "ZH";
G: "GH";
};
O: {
H: "OH";
L: "LO";
K: "KO";
U: "UO";
Z: "ZO";
G: "GO";
};
Z: {
K: "ZK";
H: "ZH";
O: "ZO";
};
L: {
U: "UL";
H: "LH";
O: "LO";
};
K: {
Z: "ZK";
H: "KH";
O: "KO";
};
G: {
H: "GH";
O: "GO";
};
U: {
L: "UL";
H: "UH";
O: "UO";
};
OH: {
UH: "UH2O";
UO: "UHO2";
ZH: "ZH2O";
ZO: "ZHO2";
KH: "KH2O";
KO: "KHO2";
LH: "LH2O";
LO: "LHO2";
GH: "GH2O";
GO: "GHO2";
};
X: {
UH2O: "XUH2O";
UHO2: "XUHO2";
LH2O: "XLH2O";
LHO2: "XLHO2";
KH2O: "XKH2O";
KHO2: "XKHO2";
ZH2O: "XZH2O";
ZHO2: "XZHO2";
GH2O: "XGH2O";
GHO2: "XGHO2";
};
ZK: {
UL: "G";
};
UL: {
ZK: "G";
};
LH: {
OH: "LH2O";
};
ZH: {
OH: "ZH2O";
};
GH: {
OH: "GH2O";
};
KH: {
OH: "KH2O";
};
UH: {
OH: "UH2O";
};
LO: {
OH: "LHO2";
};
ZO: {
OH: "ZHO2";
};
KO: {
OH: "KHO2";
};
UO: {
OH: "UHO2";
};
GO: {
OH: "GHO2";
};
LH2O: {
X: "XLH2O";
};
KH2O: {
X: "XKH2O";
};
ZH2O: {
X: "XZH2O";
};
UH2O: {
X: "XUH2O";
};
GH2O: {
X: "XGH2O";
};
LHO2: {
X: "XLHO2";
};
UHO2: {
X: "XUHO2";
};
KHO2: {
X: "XKHO2";
};
ZHO2: {
X: "XZHO2";
};
GHO2: {
X: "XGHO2";
};
};
declare const REACTION_TIME: {
OH: 20;
ZK: 5;
UL: 5;
G: 5;
UH: 10;
UH2O: 5;
XUH2O: 60;
UO: 10;
UHO2: 5;
XUHO2: 60;
KH: 10;
KH2O: 5;
XKH2O: 60;
KO: 10;
KHO2: 5;
XKHO2: 60;
LH: 15;
LH2O: 10;
XLH2O: 65;
LO: 10;
LHO2: 5;
XLHO2: 60;
ZH: 20;
ZH2O: 40;
XZH2O: 160;
ZO: 10;
ZHO2: 5;
XZHO2: 60;
GH: 10;
GH2O: 15;
XGH2O: 80;
GO: 10;
GHO2: 30;
XGHO2: 150;
};
declare const BOOSTS: {
[part: string]: { [boost: string]: { [action: string]: number } };
work: {
UO: {
harvest: 3;
};
UHO2: {
harvest: 5;
};
XUHO2: {
harvest: 7;
};
LH: {
build: 1.5;
repair: 1.5;
};
LH2O: {
build: 1.8;
repair: 1.8;
};
XLH2O: {
build: 2;
repair: 2;
};
ZH: {
dismantle: 2;
};
ZH2O: {
dismantle: 3;
};
XZH2O: {
dismantle: 4;
};
GH: {
upgradeController: 1.5;
};
GH2O: {
upgradeController: 1.8;
};
XGH2O: {
upgradeController: 2;
};
};
attack: {
UH: {
attack: 2;
};
UH2O: {
attack: 3;
};
XUH2O: {
attack: 4;
};
};
ranged_attack: {
KO: {
rangedAttack: 2;
rangedMassAttack: 2;
};
KHO2: {
rangedAttack: 3;
rangedMassAttack: 3;
};
XKHO2: {
rangedAttack: 4;
rangedMassAttack: 4;
};
};
heal: {
LO: {
heal: 2;
rangedHeal: 2;
};
LHO2: {
heal: 3;
rangedHeal: 3;
};
XLHO2: {
heal: 4;
rangedHeal: 4;
};
};
carry: {
KH: {
capacity: 2;
};
KH2O: {
capacity: 3;
};
XKH2O: {
capacity: 4;
};
};
move: {
ZO: {
fatigue: 2;
};
ZHO2: {
fatigue: 3;
};
XZHO2: {
fatigue: 4;
};
};
tough: {
GO: {
damage: 0.7;
};
GHO2: {
damage: 0.5;
};
XGHO2: {
damage: 0.3;
};
};
};
declare const INTERSHARD_RESOURCES: InterShardResourceConstant[];
type CommoditiesTypes = CommodityConstant | MineralConstant | RESOURCE_GHODIUM | RESOURCE_ENERGY;
interface CommodityEntry {
level?: number;
amount: number;
cooldown: number;
components: Record<DepositConstant | CommoditiesTypes, number>;
}
declare const COMMODITIES: Record<CommoditiesTypes, CommodityEntry>;
declare const LOOK_CREEPS: LOOK_CREEPS;
declare const LOOK_ENERGY: LOOK_ENERGY;
declare const LOOK_RESOURCES: LOOK_RESOURCES;
declare const LOOK_SOURCES: LOOK_SOURCES;
declare const LOOK_MINERALS: LOOK_MINERALS;
declare const LOOK_DEPOSITS: LOOK_DEPOSITS;
declare const LOOK_STRUCTURES: LOOK_STRUCTURES;
declare const LOOK_FLAGS: LOOK_FLAGS;
declare const LOOK_CONSTRUCTION_SITES: LOOK_CONSTRUCTION_SITES;
declare const LOOK_NUKES: LOOK_NUKES;
declare const LOOK_TERRAIN: LOOK_TERRAIN;
declare const LOOK_TOMBSTONES: LOOK_TOMBSTONES;
declare const LOOK_POWER_CREEPS: LOOK_POWER_CREEPS;
declare const LOOK_RUINS: LOOK_RUINS;
declare const ORDER_SELL: ORDER_SELL;
declare const ORDER_BUY: ORDER_BUY;
declare const MARKET_FEE: 0.05;
declare const MARKET_MAX_ORDERS: 300;
declare const MARKET_ORDER_LIFE_TIME: 2592000000; // 1000*60*60*24*30
declare const INVADERS_ENERGY_GOAL: number;
declare const SYSTEM_USERNAME: string;
declare const TOMBSTONE_DECAY_PER_PART: 5;
declare const TOMBSTONE_DECAY_POWER_CREEP: 500;
declare const RUIN_DECAY: 500;
declare const RUIN_DECAY_STRUCTURES: {
powerBank: 10;
};
declare const EVENT_ATTACK: EVENT_ATTACK;
declare const EVENT_OBJECT_DESTROYED: EVENT_OBJECT_DESTROYED;
declare const EVENT_ATTACK_CONTROLLER: EVENT_ATTACK_CONTROLLER;
declare const EVENT_BUILD: EVENT_BUILD;
declare const EVENT_HARVEST: EVENT_HARVEST;
declare const EVENT_HEAL: EVENT_HEAL;
declare const EVENT_REPAIR: EVENT_REPAIR;
declare const EVENT_RESERVE_CONTROLLER: EVENT_RESERVE_CONTROLLER;
declare const EVENT_UPGRADE_CONTROLLER: EVENT_UPGRADE_CONTROLLER;
declare const EVENT_EXIT: EVENT_EXIT;
declare const EVENT_POWER: EVENT_POWER;
declare const EVENT_TRANSFER: EVENT_TRANSFER;
declare const EVENT_ATTACK_TYPE_MELEE: EVENT_ATTACK_TYPE_MELEE;
declare const EVENT_ATTACK_TYPE_RANGED: EVENT_ATTACK_TYPE_RANGED;
declare const EVENT_ATTACK_TYPE_RANGED_MASS: EVENT_ATTACK_TYPE_RANGED_MASS;
declare const EVENT_ATTACK_TYPE_DISMANTLE: EVENT_ATTACK_TYPE_DISMANTLE;
declare const EVENT_ATTACK_TYPE_HIT_BACK: EVENT_ATTACK_TYPE_HIT_BACK;
declare const EVENT_ATTACK_TYPE_NUKE: EVENT_ATTACK_TYPE_NUKE;
declare const EVENT_HEAL_TYPE_MELEE: EVENT_HEAL_TYPE_MELEE;
declare const EVENT_HEAL_TYPE_RANGED: EVENT_HEAL_TYPE_RANGED;
declare const POWER_LEVEL_MULTIPLY: 1000;
declare const POWER_LEVEL_POW: 2;
declare const POWER_CREEP_SPAWN_COOLDOWN: 28800000; // 8 * 3600 * 1000
declare const POWER_CREEP_DELETE_COOLDOWN: 86400000; // 24 * 3600 * 1000
declare const POWER_CREEP_MAX_LEVEL: 25;
declare const POWER_CREEP_LIFE_TIME: 5000;
declare const POWER_CLASS: {
OPERATOR: "operator";
};
declare const PWR_GENERATE_OPS: PWR_GENERATE_OPS;
declare const PWR_OPERATE_SPAWN: PWR_OPERATE_SPAWN;
declare const PWR_OPERATE_TOWER: PWR_OPERATE_TOWER;
declare const PWR_OPERATE_STORAGE: PWR_OPERATE_STORAGE;
declare const PWR_OPERATE_LAB: PWR_OPERATE_LAB;
declare const PWR_OPERATE_EXTENSION: PWR_OPERATE_EXTENSION;
declare const PWR_OPERATE_OBSERVER: PWR_OPERATE_OBSERVER;
declare const PWR_OPERATE_TERMINAL: PWR_OPERATE_TERMINAL;
declare const PWR_DISRUPT_SPAWN: PWR_DISRUPT_SPAWN;
declare const PWR_DISRUPT_TOWER: PWR_DISRUPT_TOWER;
declare const PWR_DISRUPT_SOURCE: PWR_DISRUPT_SOURCE;
declare const PWR_SHIELD: PWR_SHIELD;
declare const PWR_REGEN_SOURCE: PWR_REGEN_SOURCE;
declare const PWR_REGEN_MINERAL: PWR_REGEN_MINERAL;
declare const PWR_DISRUPT_TERMINAL: PWR_DISRUPT_TERMINAL;
declare const PWR_OPERATE_POWER: PWR_OPERATE_POWER;
declare const PWR_FORTIFY: PWR_FORTIFY;
declare const PWR_OPERATE_CONTROLLER: PWR_OPERATE_CONTROLLER;
declare const PWR_OPERATE_FACTORY: PWR_OPERATE_FACTORY;
declare const EFFECT_INVULNERABILITY: EFFECT_INVULNERABILITY;
declare const EFFECT_COLLAPSE_TIMER: EFFECT_COLLAPSE_TIMER;
declare const INVADER_CORE_HITS: 100000;
declare const INVADER_CORE_CREEP_SPAWN_TIME: {
0: 0;
1: 0;
2: 6;
3: 3;
4: 2;
5: 1;
};
declare const INVADER_CORE_EXPAND_TIME: {
1: 4000;
2: 3500;
3: 3000;
4: 2500;
5: 2000;
};
declare const INVADER_CORE_CONTROLLER_POWER: 2;
declare const INVADER_CORE_CONTROLLER_DOWNGRADE: 5000;
declare const STRONGHOLD_RAMPART_HITS: {
0: 0;
1: 100000;
2: 200000;
3: 500000;
4: 1000000;
5: 2000000;
};
declare const STRONGHOLD_DECAY_TICKS: 75000;
declare const POWER_INFO: {
[powerID: number]: {
className: PowerClassConstant;
level: number[];
cooldown: number;
effect?: number[];
range?: number;
ops?: number | number[];
duration?: number | number[];
};
[PWR_GENERATE_OPS]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 50;
effect: [1, 2, 4, 6, 8];
};
[PWR_OPERATE_SPAWN]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 300;
duration: 1000;
range: 3;
ops: 100;
effect: [0.9, 0.7, 0.5, 0.35, 0.2];
};
[PWR_OPERATE_TOWER]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 10;
duration: 100;
range: 3;
ops: 10;
effect: [1.1, 1.2, 1.3, 1.4, 1.5];
};
[PWR_OPERATE_STORAGE]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 800;
duration: 1000;
range: 3;
ops: 100;
effect: [500000, 1000000, 2000000, 4000000, 7000000];
};
[PWR_OPERATE_LAB]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 50;
duration: 1000;
range: 3;
ops: 10;
effect: [2, 4, 6, 8, 10];
};
[PWR_OPERATE_EXTENSION]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 50;
range: 3;
ops: 2;
effect: [0.2, 0.4, 0.6, 0.8, 1.0];
};
[PWR_OPERATE_OBSERVER]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 400;
duration: [200, 400, 600, 800, 1000];
range: 3;
ops: 10;
};
[PWR_OPERATE_TERMINAL]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 500;
duration: 1000;
range: 3;
ops: 100;
effect: [0.9, 0.8, 0.7, 0.6, 0.5];
};
[PWR_DISRUPT_SPAWN]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 5;
range: 20;
ops: 10;
duration: [1, 2, 3, 4, 5];
};
[PWR_DISRUPT_TOWER]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 0;
duration: 5;
range: 50;
ops: 10;
effect: [0.9, 0.8, 0.7, 0.6, 0.5];
};
[PWR_DISRUPT_SOURCE]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 100;
range: 3;
ops: 100;
duration: [100, 200, 300, 400, 500];
};
[PWR_SHIELD]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
effect: [5000, 10000, 15000, 20000, 25000];
duration: 50;
cooldown: 20;
energy: 100;
};
[PWR_REGEN_SOURCE]: {
className: POWER_CLASS["OPERATOR"];
level: [10, 11, 12, 14, 22];
cooldown: 100;
duration: 300;
range: 3;
effect: [50, 100, 150, 200, 250];
period: 15;
};
[PWR_REGEN_MINERAL]: {
className: POWER_CLASS["OPERATOR"];
level: [10, 11, 12, 14, 22];
cooldown: 100;
duration: 100;
range: 3;
effect: [2, 4, 6, 8, 10];
period: 10;
};
[PWR_DISRUPT_TERMINAL]: {
className: POWER_CLASS["OPERATOR"];
level: [20, 21, 22, 23, 24];
cooldown: 8;
duration: 10;
range: 50;
ops: [50, 40, 30, 20, 10];
};
[PWR_FORTIFY]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 5;
range: 3;
ops: 5;
duration: [1, 2, 3, 4, 5];
};
[PWR_OPERATE_POWER]: {
className: POWER_CLASS["OPERATOR"];
level: [10, 11, 12, 14, 22];
cooldown: 800;
range: 3;
duration: 1000;
ops: 200;
effect: [1, 2, 3, 4, 5];
};
[PWR_OPERATE_CONTROLLER]: {
className: POWER_CLASS["OPERATOR"];
level: [20, 21, 22, 23, 24];
cooldown: 800;
range: 3;
duration: 1000;
ops: 200;
effect: [10, 20, 30, 40, 50];
};
[PWR_OPERATE_FACTORY]: {
className: POWER_CLASS["OPERATOR"];
level: [0, 2, 7, 14, 22];
cooldown: 1000;
range: 3;
duration: 1000;
ops: 100;
};
};
/**
* A site of a structure which is currently under construction.
*
* A construction site can be created using the 'Construct' button at the left of the game field or the {@link Room.createConstructionSite} method.
*
* To build a structure on the construction site, give a worker creep some amount of energy and perform {@link Creep.build} action.
*
* You can remove enemy construction sites by moving a creep on it.
*/
interface ConstructionSite<T extends BuildableStructureConstant = BuildableStructureConstant> extends RoomObject {
readonly prototype: ConstructionSite;
/**
* A unique object identifier.
*
* You can use {@link Game.getObjectById} to retrieve an object instance by its `id`.
*/
id: Id<this>;
/**
* Whether this is your own construction site.
*/
my: boolean;
/**
* An object with the structure’s owner info.
*/
owner: Owner;
/**
* The current construction progress.
*/
progress: number;
/**
* The total construction progress needed for the structure to be built.
*/
progressTotal: number;
/**
* One of the {@link StructureConstant STRUCTURE_*} constants.
*/
structureType: T;
/**
* Remove the construction site.
* @returns Result Code: OK, ERR_NOT_OWNER
*/
remove(): number;
}
interface ConstructionSiteConstructor extends _Constructor<ConstructionSite>, _ConstructorById<ConstructionSite> {}
declare const ConstructionSite: ConstructionSiteConstructor;
/**
* Creeps are your units.
*
* Creeps can move, harvest energy, construct structures, attack another creeps, and perform other actions.
* Each creep consists of up to 50 body parts represented by {@link BodyPartConstant}:.
*
* | Body part | Build cost | Effect per one body part
* | :-------------- | :--------: | :-----------------------
* | MOVE | 50 | Decreases fatigue by 2 points per tick.
* | WORK | 100 | Harvests 2 energy units from a source per tick.
* | | | Harvests 1 resource unit from a mineral or a deposit per tick.
* | | | Builds a structure for 5 energy units per tick.
* | | | Repairs a structure for 100 hits per tick consuming 1 energy unit per tick.
* | | | Dismantles a structure for 50 hits per tick returning 0.25 energy unit per tick.
* | | | Upgrades a controller for 1 energy unit per tick.
* | CARRY | 50 | Can contain up to 50 resource units.
* | ATTACK | 80 | Attacks another creep/structure with 30 hits per tick in a short-ranged attack.
* | RANGED_ATTACK | 150 | Attacks another single creep/structure with 10 hits per tick in a long-range attack up to 3 squares long.
* | | | Attacks all hostile creeps/structures within 3 squares range with 1-4-10 hits (depending on the range).
* | HEAL | 250 | Heals self or another creep restoring 12 hits per tick in short range or 4 hits per tick at a distance.
* | CLAIM | 600 | Claims a neutral room controller.
* | | | Reserves a neutral room controller for 1 tick per body part.
* | | | Attacks a hostile room controller downgrading its timer by 300 ticks per body parts.
* | | | Attacks a neutral room controller reservation timer by 1 tick per body parts.
* | | | A creep with this body part will have a reduced life time of 600 ticks and cannot be renewed.
* | TOUGH | 10 | No effect, just additional hit points to the creep's body. Can be boosted to resist damage.
*/
interface Creep extends RoomObject {
readonly prototype: Creep;
/**
* An array describing the creep's body.
*/
body: BodyPartDefinition[];
/**
* An object with the creep's cargo contents.
* @deprecated Is an alias for Creep.store
*/
carry: StoreDefinition;
/**
* The total amount of resources the creep can carry.
* @deprecated alias for {@link Creep.store.getCapacity}
*/
carryCapacity: number;
/**
* The movement fatigue indicator.
*
* If it is greater than zero, the creep cannot move.
*/
fatigue: number;
/**
* The current amount of hit points of the creep.
*/
hits: number;
/**
* The maximum amount of hit points of the creep.
*/
hitsMax: number;
/**
* A unique object identifier.
*
* You can use {@link Game.getObjectById} to retrieve an object instance by its `id`.
*/
id: Id<this>;
/**
* A shorthand to `Memory.creeps[creep.name]`.
*
* You can use it for quick access the creep’s specific memory data object.
*/
memory: CreepMemory;
/**
* Whether it is your creep or foe.
*/
my: boolean;
/**
* The creep’s name.
*
* You can choose the name while creating a new creep, and it cannot be changed later.
* This name is a hash key to access the creep via the {@link Game.creeps} object.
*/
name: string;
/**
* An object with the creep’s owner info.
*/
owner: Owner;
/**
* The {@link Room} the creep is in.
*
* Always defined because creeps give visibility into the room they're in.
*/
room: Room;
/**
* Whether this creep is still being spawned.
*/
spawning: boolean;
/**
* The text message that the creep was saying at the last tick.
*/
saying: string;
/**
* A Store object that contains cargo of this creep.
*/
store: StoreDefinition;
/**
* The remaining amount of game ticks after which the creep will die.
*
* Will be `undefined` if the creep is still spawning.
*/
ticksToLive: number | undefined;
/**
* Attack another creep or structure in a short-ranged attack.
*
* Needs the ATTACK body part.
* If the target is inside a rampart, then the rampart is attacked instead.
*
* The target has to be at adjacent square to the creep.
* If the target is a creep with ATTACK body parts and is not inside a rampart, it will
* automatically hit back at the attacker.
*
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_TARGET: The target is not a valid attackable object.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no ATTACK body parts in this creep’s body.
*/
attack(target: AnyCreep | Structure): CreepActionReturnCode;
/**
* Attack a controller.
*
* Decreases the controller's downgrade or reservation timer for 1 tick per every 5 `CLAIM` body parts (so the creep must have at least 5x`CLAIM`).
*
* The controller under attack cannot be upgraded for the next 1,000 ticks.
* The target has to be at adjacent square to the creep.
*
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_TARGET: The target is not a valid owned or reserved controller object.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_TIRED: You have to wait until the next attack is possible.
* - ERR_NO_BODYPART: There are not enough CLAIM body parts in this creep’s body.
*/
attackController(target: StructureController): CreepActionReturnCode;
/**
* Build a structure at the target construction site using carried energy.
*
* Needs WORK and CARRY body parts.
* The target has to be within 3 squares range of the creep.
*
* @param target The target construction site to be built.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_NOT_ENOUGH_RESOURCES: The creep does not have any carried energy.
* - ERR_INVALID_TARGET: The target is not a valid construction site object or the structure cannot be built here (probably because of a creep at the same square).
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no WORK body parts in this creep’s body.
*/
build(target: ConstructionSite): CreepActionReturnCode | ERR_NOT_ENOUGH_RESOURCES | ERR_RCL_NOT_ENOUGH;
/**
* Cancel the order given during the current game tick.
* @param methodName The name of a creep's method to be cancelled.
* @returns One of the following codes:
* - OK: The operation has been cancelled successfully.
* - ERR_NOT_FOUND: The order with the specified name is not found.
*/
cancelOrder(methodName: string): OK | ERR_NOT_FOUND;
/**
* Claim a controller.
*
* Requires the CLAIM body part.
* If applied to a neutral controller, claims it under your control.
* If applied to a hostile controller, decreases its downgrade or reservation timer depending on the CLAIM body parts count.
*
* The target has to be at adjacent square to the creep.
* @param target The target controller object.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_TARGET: The target is not a valid neutral controller object.
* - ERR_FULL: You cannot claim more than 3 rooms in the Novice Area.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no CLAIM body parts in this creep’s body.
* - ERR_GCL_NOT_ENOUGH: Your Global Control Level is not enough.
* - ERR_ACCESS_DENIED: The shard access is restricted.
*/
claimController(target: StructureController): CreepActionReturnCode | ERR_FULL | ERR_GCL_NOT_ENOUGH | ERR_ACCESS_DENIED;
/**
* Dismantles any structure that can be constructed (even hostile) returning 50% of the energy spent on its repair.
*
* Requires the WORK body part.
* If the creep has an empty CARRY body part, the energy is put into it; otherwise it is dropped on the ground.
* The target has to be at adjacent square to the creep.
* @param target The target structure.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_TARGET: The target is not a valid structure object.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no WORK body parts in this creep’s body.
*/
dismantle(target: Structure): CreepActionReturnCode;
/**
* Drop this resource on the ground.
*
* @param resourceType One of the {@link ResourceConstant RESOURCE_*} constants.
* @param amount The amount of resource units to be dropped. If omitted, all the available carried amount is used.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_NOT_ENOUGH_RESOURCES: The creep does not have the given amount of resources.
* - ERR_INVALID_ARGS: The resourceType is not a valid RESOURCE_* constants.
*/
drop(resourceType: ResourceConstant, amount?: number): OK | ERR_NOT_OWNER | ERR_BUSY | ERR_NOT_ENOUGH_RESOURCES;
/**
* Add one more available safe mode activation to a room controller.
*
* The creep has to be at adjacent square to the target room controller and have 1000 ghodium resource.
* @param target The target room controller.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_NOT_ENOUGH_RESOURCES: The creep does not have enough ghodium.
* - ERR_INVALID_TARGET: The target is not a valid controller object.
* - ERR_NOT_IN_RANGE: The target is too far away.
*/
generateSafeMode(target: StructureController): CreepActionReturnCode;
/**
* Get the quantity of live body parts of the given type.
*
* Fully damaged parts do not count.
* @param type A body part type, one of the {@link BodyPartConstant} constants.
*/
getActiveBodyparts(type: BodyPartConstant): number;
/**
* Harvest energy from the source or resource from minerals or deposits.
*
* Needs the WORK body part.
*
* If the creep has an empty CARRY body part, the harvested resource is put into it; otherwise it is dropped on the ground.
*
* The target has to be at an adjacent square to the creep.
* @param target The source object to be harvested.
* @return One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep, or the room controller is owned or reserved by another player.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_NOT_FOUND: Extractor not found. You must build an extractor structure to harvest minerals. Learn more
* - ERR_NOT_ENOUGH_RESOURCES: The target does not contain any harvestable energy or mineral.
* - ERR_INVALID_TARGET: The target is not a valid source or mineral object.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_TIRED: The extractor or the deposit is still cooling down.
* - ERR_NO_BODYPART: There are no WORK body parts in this creep’s body.
*/
harvest(target: Source | Mineral | Deposit): CreepActionReturnCode | ERR_NOT_FOUND | ERR_NOT_ENOUGH_RESOURCES;
/**
* Heal self or another creep.
*
* It will restore the target creep’s damaged body parts function and increase the hits counter.
*
* Needs the HEAL body part.
*
* The target has to be at adjacent square to the creep.
* @param target The target creep object.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_TARGET: The target is not a valid creep object.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no HEAL body parts in this creep’s body.
*/
heal(target: AnyCreep): CreepActionReturnCode;
/**
* Move the creep one square in the specified direction or towards a creep that is pulling it.
*
* Requires the MOVE body part if not being pulled.
* @param direction The direction to move in ({@link DirectionConstant `TOP`, `TOP_LEFT`...}).
* @param creep A creep nearby.
* @return One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_NOT_IN_RANGE: The target creep is too far away
* - ERR_INVALID_ARGS: The provided direction is incorrect.
* - ERR_TIRED: The fatigue indicator of the creep is non-zero.
* - ERR_NO_BODYPART: There are no MOVE body parts in this creep’s body.
*/
move(direction: DirectionConstant): CreepMoveReturnCode;
move(target: Creep): OK | ERR_NOT_OWNER | ERR_BUSY | ERR_NOT_IN_RANGE | ERR_INVALID_ARGS;
/**
* Move the creep using the specified predefined path.
*
* Needs the MOVE body part.
* @param path A path value as returned from {@link Room.findPath} or {@link RoomPosition.findPathTo} methods. Both array form and serialized string form are accepted.
*/
moveByPath(path: PathStep[] | RoomPosition[] | string): CreepMoveReturnCode | ERR_NOT_FOUND | ERR_INVALID_ARGS;
/**
* Find the optimal path to the target within the same room and move to it.
* A shorthand to consequent calls of pos.findPathTo() and move() methods.
* If the target is in another room, then the corresponding exit will be used as a target.
*
* Needs the MOVE body part.
* @param x X position of the target in the room.
* @param y Y position of the target in the room.
* @param opts An object containing pathfinding options flags (see Room.findPath for more info) or one of the following: reusePath, serializeMemory, noPathFinding
*/
moveTo(x: number, y: number, opts?: MoveToOpts): CreepMoveReturnCode | ERR_NO_PATH | ERR_INVALID_TARGET;
/**
* Find the optimal path to the target within the same room and move to it.
* A shorthand to consequent calls of pos.findPathTo() and move() methods.
* If the target is in another room, then the corresponding exit will be used as a target.
*
* Needs the MOVE body part.
* @param target Can be a RoomPosition object or any object containing RoomPosition.
* @param opts An object containing pathfinding options flags (see Room.findPath for more info) or one of the following: reusePath, serializeMemory, noPathFinding
*/
moveTo(
target: RoomPosition | { pos: RoomPosition },
opts?: MoveToOpts,
): CreepMoveReturnCode | ERR_NO_PATH | ERR_INVALID_TARGET | ERR_NOT_FOUND;
/**
* Toggle auto notification when the creep is under attack.
*
* The notification will be sent to your account email. Turned on by default.
* @param enabled Whether to enable notification or disable.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_ARGS: enable argument is not a boolean value.
*/
notifyWhenAttacked(enabled: boolean): OK | ERR_NOT_OWNER | ERR_BUSY | ERR_INVALID_ARGS;
/**
* Pick up an item (a dropped piece of energy).
*
* Needs the CARRY body part.
* The target has to be at adjacent square to the creep or at the same square.
* @param target The target object to be picked up.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_TARGET: The target is not a valid object to pick up.
* - ERR_FULL: The creep cannot receive any more resource.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no CARRY body parts in this creep’s body.
*/
pickup(target: Resource): CreepActionReturnCode | ERR_FULL;
/**
* Allow another creep to follow this creep.
*
* Requires the MOVE body part.
*
* The fatigue generated for the target's move will be added to the creep instead of the target.
* The target must be adjacent to the creep. The creep must move elsewhere, and the target must move towards the creep.
* @param target The target creep to be pulled.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_TARGET: The target provided is invalid.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no MOVE body parts in this creep’s body.
*/
pull(target: Creep): OK | ERR_NOT_OWNER | ERR_BUSY | ERR_INVALID_TARGET | ERR_NOT_IN_RANGE | ERR_NO_BODYPART;
/**
* A ranged attack against another creep or structure.
*
* Needs the RANGED_ATTACK body part.
*
* If the target is inside a rampart, the rampart is attacked instead.
* The target has to be within 3 squares range of the creep.
* @param target The target object to be attacked.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_TARGET: The target is not a valid attackable object.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no RANGED_ATTACK body parts in this creep’s body.
*/
rangedAttack(target: AnyCreep | Structure): CreepActionReturnCode;
/**
* Heal another creep at a distance.
*
* It will restore the target creep’s damaged body parts function and increase the hits counter.
*
* Needs the HEAL body part. The target has to be within 3 squares range of the creep.
* @param target The target creep object.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_TARGET: The target is not a valid creep object.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no HEAL body parts in this creep’s body.
*/
rangedHeal(target: AnyCreep): CreepActionReturnCode;
/**
* A ranged attack against all hostile creeps or structures within 3 squares range.
*
* Needs the RANGED_ATTACK body part.
*
* The attack power depends on the range to each target. Friendly units are not affected.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_NO_BODYPART: There are no RANGED_ATTACK body parts in this creep’s body.
*/
rangedMassAttack(): OK | ERR_NOT_OWNER | ERR_BUSY | ERR_NO_BODYPART;
/**
* Repair a damaged structure using carried energy. Needs the WORK and CARRY body parts. The target has to be within 3 squares range of the creep.
* @param target The target structure to be repaired.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_NOT_ENOUGH_RESOURCES: The creep does not carry any energy.
* - ERR_INVALID_TARGET: The target is not a valid structure object.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no WORK body parts in this creep’s body.
*/
repair(target: Structure): CreepActionReturnCode | ERR_NOT_ENOUGH_RESOURCES;
/**
* Temporarily block a neutral controller from claiming by other players.
*
* Each tick, this command increases the counter of the period during which the controller is unavailable by 1 tick per each CLAIM body part.
*
* The maximum reservation period to maintain is 5,000 ticks.
*
* The target has to be at adjacent square to the creep....
* @param target The target controller object to be reserved.
* @return One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_TARGET: The target is not a valid neutral controller object.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no CLAIM body parts in this creep’s body.
* - ERR_ACCESS_DENIED: The shard access is restricted.
*/
reserveController(target: StructureController): CreepActionReturnCode | ERR_ACCESS_DENIED;
/**
* Display a visual speech balloon above the creep with the specified message.
*
* The message will disappear after a few seconds. Useful for debugging purposes.
*
* Only the creep's owner can see the speech message unless toPublic is true.
* @param message The message to be displayed. Maximum length is 10 characters.
* @param set to 'true' to allow other players to see this message. Default is 'false'.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
*/
say(message: string, toPublic?: boolean): OK | ERR_NOT_OWNER | ERR_BUSY;
/**
* Sign a controller with a random text visible to all players.
*
* This text will appear in the room UI, in the world map, and can be accessed via the API.
* You can sign unowned and hostile controllers.
*
* The target has to be at adjacent square to the creep. Pass an empty string to remove the sign.
* @param target The target controller object to be signed.
* @param text The sign text. The maximum text length is 100 characters.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_INVALID_TARGET: The target is not a valid controller object.
* - ERR_NOT_IN_RANGE: The target is too far away.
*/
signController(target: StructureController, text: string): OK | ERR_BUSY | ERR_INVALID_TARGET | ERR_NOT_IN_RANGE;
/**
* Kill the creep immediately.
*
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
*/
suicide(): OK | ERR_NOT_OWNER | ERR_BUSY;
/**
* Transfer resource from the creep to another object.
*
* The target has to be at adjacent square to the creep.
* @param target The target object.
* @param resourceType One of the {@link ResourceConstant RESOURCE_*} constants
* @param amount The amount of resources to be transferred. If omitted, all the available carried amount is used.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_NOT_ENOUGH_RESOURCES: The creep does not have the given amount of resources.
* - ERR_INVALID_TARGET: The target is not a valid object which can contain the specified resource.
* - ERR_FULL: The target cannot receive any more resources.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_INVALID_ARGS: The resourceType is not one of the {@link ResourceConstant RESOURCE_*} constants, or the amount is incorrect.
*/
transfer(target: AnyCreep | Structure, resourceType: ResourceConstant, amount?: number): ScreepsReturnCode;
/**
* Upgrade your controller to the next level using carried energy.
*
* Upgrading controllers raises your Global Control Level in parallel.
* Requires WORK and CARRY body parts. The target has to be within 3 squares range of the creep.
*
* A fully upgraded level 8 controller can't be upgraded over 15 energy units per tick regardless of creeps abilities.
* The cumulative effect of all the creeps performing upgradeController in the current tick is taken into account.
* This limit can be increased by using ghodium mineral boost.
*
* Upgrading the controller raises its ticksToDowngrade timer by 100. The timer must be full in order for controller to be levelled up.
* @param target The target controller object to be upgraded.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep or the target controller.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_NOT_ENOUGH_RESOURCES: The creep does not have any carried energy.
* - ERR_INVALID_TARGET: The target is not a valid controller object, or the controller upgrading is blocked.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_NO_BODYPART: There are no WORK body parts in this creep’s body.
* - ERR_ACCESS_DENIED: The shard access is restricted.
*/
upgradeController(target: StructureController): ScreepsReturnCode | ERR_ACCESS_DENIED;
/**
* Withdraw resources from a structure, a tombstone or a ruin.
*
* The target has to be at adjacent square to the creep. Multiple creeps can withdraw from the same object in the same tick.
* Your creeps can withdraw resources from hostile structures/tombstones as well, in case if there is no hostile rampart on top of it.
*
* This method should not be used to transfer resources between creeps.
* To transfer between creeps, use the {@link Creep.transfer} method on the original creep.
*
* @param target The target object.
* @param resourceType One of the {@link ResourceConstant RESOURCE_*} constants.
* @param amount The amount of resources to be transferred. If omitted, all the available amount is used.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep, or there is a hostile rampart on top of the target.
* - ERR_BUSY: The creep is still being spawned.
* - ERR_NOT_ENOUGH_RESOURCES: The target does not have the given amount of resources.
* - ERR_INVALID_TARGET: The target is not a valid object which can contain the specified resource.
* - ERR_FULL: The creep's carry is full.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_INVALID_ARGS: The resourceType is not one of the {@link ResourceConstant RESOURCE_*} constants, or the amount is incorrect.
*/
withdraw(target: Structure | Tombstone | Ruin, resourceType: ResourceConstant, amount?: number): ScreepsReturnCode;
}
interface CreepConstructor extends _Constructor<Creep>, _ConstructorById<Creep> {}
declare const Creep: CreepConstructor;
/**
* A rare resource deposit needed for producing commodities.
*
* Can be harvested by creeps with a WORK body part. Each harvest operation triggers a cooldown period, which becomes longer and longer over time.
*
* Learn more about deposits from [this article](https://docs.screeps.com/resources.html).
*
* | | |
* | ------------ | ----------- |
* | **Cooldown** | 0.001 * totalHarvested ^ 1.2
* | **Decay** | 50,000 ticks after appearing or last harvest operation
*/
interface Deposit extends RoomObject {
/**
* A unique object identifier.
*
* You can use {@link Game.getObjectById} to retrieve an object instance by its id.
*/
id: Id<this>;
/**
* The deposit type, one of the {@link DepositConstant}:
* - `RESOURCE_MIST`
* - `RESOURCE_BIOMASS`
* - `RESOURCE_METAL`
* - `RESOURCE_SILICON`
*/
depositType: DepositConstant;
/**
* The amount of game ticks until the next harvest action is possible.
*/
cooldown: number;
/**
* The cooldown of the last harvest operation on this deposit.
*/
lastCooldown: number;
/**
* The amount of game ticks when this deposit will disappear.
*/
ticksToDecay: number;
}
interface DepositConstructor extends _Constructor<Deposit>, _ConstructorById<Deposit> {}
declare const Deposit: DepositConstructor;
/**
* A flag.
*
* Flags can be used to mark particular spots in a room. Flags are visible to their owners only. You cannot have more than 10,000 flags.
*/
interface Flag extends RoomObject {
readonly prototype: Flag;
/**
* Flag color. One of the {@link ColorConstant COLOR_*} constants.
*/
color: ColorConstant;
/**
* The flag's memory.
*
* A shorthand to Memory.flags[flag.name]. You can use it for quick access the flag's specific memory data object.
*/
memory: FlagMemory;
/**
* The flag’s name.
*
* You can choose the name while creating a new flag, and it cannot be changed later.
*
* This name is a hash key to access the flag via the {@link Game.flags} object. The maximum name length is 60 characters.
*/
name: string;
/**
* Flag secondary color. One of the {@link ColorConstant COLOR_*} constants.
*/
secondaryColor: ColorConstant;
/**
* Remove the flag.
* @returns Result Code: OK
*/
remove(): OK;
/**
* Set new color of the flag.
* @param color One of the {@link ColorConstant COLOR_*} constants.
* @param secondaryColor Secondary color of the flag. One of the {@link ColorConstant COLOR_*} constants.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_INVALID_ARGS: color or secondaryColor is not a valid color constant.
*/
setColor(color: ColorConstant, secondaryColor?: ColorConstant): OK | ERR_INVALID_ARGS;
/**
* Set new position of the flag.
* @param x The X position in the room.
* @param y The Y position in the room.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_INVALID_TARGET: The target provided is invalid.
*/
setPosition(x: number, y: number): OK | ERR_INVALID_ARGS;
/**
* Set new position of the flag.
* @param pos Can be a {@link RoomPosition} object or any object containing RoomPosition.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_INVALID_TARGET: The target provided is invalid.
*/
setPosition(pos: RoomPosition | { pos: RoomPosition }): OK | ERR_INVALID_ARGS;
}
interface FlagConstructor extends _Constructor<Flag> {
new (name: string, color: ColorConstant, secondaryColor: ColorConstant, roomName: string, x: number, y: number): Flag;
(name: string, color: ColorConstant, secondaryColor: ColorConstant, roomName: string, x: number, y: number): Flag;
}
declare const Flag: FlagConstructor;
/**
* The main global game object containing all the gameplay information.
*/
interface Game {
/**
* An object containing information about your CPU usage.
*/
cpu: CPU;
/**
* A hash containing all your creeps with creep names as hash keys.
*/
creeps: { [creepName: string]: Creep };
/**
* A hash containing all your flags with flag names as hash keys.
*/
flags: { [flagName: string]: Flag };
/**
* Your Global Control Level.
*/
gcl: GlobalControlLevel;
/**
* Your clobal Power Level
*/
gpl: GlobalPowerLevel;
/**
* A global object representing world GameMap.
*/
map: GameMap;
/**
* A global object representing the in-game market.
*/
market: Market;
/**
* A hash containing all your power creeps with their names as hash keys.
*
* Even power creeps not spawned in the world can be accessed here.
*/
powerCreeps: { [creepName: string]: PowerCreep };
/**
* An object with your global resources that are bound to the account, like pixels or cpu unlocks.
*
* Each object key is a resource constant, values are resources amounts.
*/
resources: { [key: string]: any };
/**
* A hash containing all the rooms available to you with room names as hash keys.
*
* A room is visible if you have a creep or an owned structure in it.
*/
rooms: { [roomName: string]: Room };
/**
* A hash containing all your spawns with spawn names as hash keys.
*/
spawns: { [spawnName: string]: StructureSpawn };
/**
* A hash containing all your structures with structure id as hash keys.
*/
structures: { [structureId: string]: OwnedStructure };
/**
* A hash containing all your construction sites with their id as hash keys.
*/
constructionSites: { [constructionSiteId: string]: ConstructionSite };
/**
* An object describing the world shard where your script is currently being executed in.
*/
shard: Shard;
/**
* System game tick counter.
*
* It is automatically incremented on every tick.
*/
time: number;
/**
* Get an object with the specified unique ID.
*
* It may be a game object of any type. Only objects from the rooms which are visible to you can be accessed.
* @param id The unique identifier.
* @returns an object instance or null if it cannot be found.
*/
getObjectById<T extends Id<_HasId>>(id: T): fromId<T> | null;
getObjectById<T extends _HasId>(id: Id<T>): T | null;
/**
* Get an object with the specified unique ID.
*
* It may be a game object of any type. Only objects from the rooms which are visible to you can be accessed.
* @param id The unique identifier.
* @returns an object instance or null if it cannot be found.
* @deprecated Use Id<T>, instead of strings, to increase type safety.
*
* If you are using JavaScript, just ignore this deprecation warning.
*
* If you are using TypeScript, and you are using strings as IDs, you should change your code to use Id<T> instead.
*
* see [this section of README](https://github.com/screepers/typed-screeps?tab=readme-ov-file#Game.getObjectById()) for more information.
*/
getObjectById<T extends _HasId>(id: string): T | null;
/**
* Send a custom message at your profile email.
*
* This way, you can set up notifications to yourself on any occasion within the game.
*
* You can schedule up to 20 notifications during one game tick. Not available in the Simulator.
* @param message Custom text which will be sent in the message. Maximum length is 1000 characters.
* @param groupInterval If set to 0 (default), the notification will be scheduled immediately.
* Otherwise, it will be grouped with other notifications and mailed out later using the specified time in minutes.
* @returns One of the following codes:
* - OK: The message has been sent successfully.
* - ERR_FULL: More than 20 notifications sent this tick.
*/
notify(message: string, groupInterval?: number): OK | ERR_FULL;
}
declare var Game: Game;
interface _HasId {
id: Id<this>;
}
interface _HasRoomPosition {
pos: RoomPosition;
}
interface GlobalControlLevel {
/**
* The current level.
*/
level: number;
/**
* The current progress to the next level.
*/
progress: number;
/**
* The progress required to reach the next level.
*/
progressTotal: number;
}
interface GlobalPowerLevel {
/**
* The current level.
*/
level: number;
/**
* The current progress to the next level.
*/
progress: number;
/**
* The progress required to reach the next level.
*/
progressTotal: number;
}
interface Shard {
/**
* The name of the shard.
*/
name: string;
/**
* Currently always equals to normal.
*/
type: "normal";
/**
* Whether this shard belongs to the PTR.
*/
ptr: boolean;
/**
* Whether you currently have access to this shard.
*
* Always true on non-restricted shards. On restricted shards, requires either an active ACCESS_KEY resource or an unlimited access subscription.
* Use {@link Game.shard.activateAccess} to activate access.
*/
access?: boolean;
/**
* The time in milliseconds since UNIX epoch time until access to this restricted shard is active.
* This property is not defined when access is unlimited or when access is not currently active.
*/
accessTime?: number;
/**
* Activate access to the current restricted shard for additional 30 days.
*
* This method will consume 1 ACCESS_KEY resource bound to your account (See Game.resources).
* This method is only available on restricted shards (when {@link Game.shard.access} is defined).
*
* @returns One of the following codes:
* - OK:The operation has been scheduled successfully.
* - ERR_NOT_ENOUGH_RESOURCES: Your account does not have enough ACCESS_KEY resources.
* - ERR_INVALID_TARGET: This shard is not restricted.
* - ERR_FULL: Your access is unlimited.
*/
activateAccess?(): OK | ERR_INVALID_TARGET | ERR_FULL | ERR_NOT_ENOUGH_RESOURCES;
}
interface CPU {
/**
* Your assigned CPU limit for the current shard.
*/
limit: number;
/**
* An amount of available CPU time at the current game tick.
*
* Usually it is higher than {@link Game.cpu.limit}.
*/
tickLimit: number;
/**
* An amount of unused CPU accumulated in your bucket.
*
* @see http://docs.screeps.com/cpu-limit.html#Bucket
*/
bucket: number;
/**
* An object with limits for each shard with shard names as keys.
*
* You can use {@link Game.cpu.setShardLimits} method to re-assign them.
*/
shardLimits: CPUShardLimits;
/**
* Whether full CPU is currently unlocked for your account.
*/
unlocked: boolean;
/**
* The time in milliseconds since UNIX epoch time until full CPU is unlocked for your account.
*
* This property is not defined when full CPU is not unlocked for your account or it's unlocked with a subscription.
*/
unlockedTime: number | undefined;
/**
* Get amount of CPU time used from the beginning of the current game tick.
*
* Always returns 0 in the simulator.
*/
getUsed(): number;
/**
* Allocate CPU limits to different shards.
*
* Total amount of CPU should remain equal to {@link Game.cpu.shardLimits}.
* This method can be used only once per 12 hours.
*
* @param limits An object with CPU values for each shard in the same format as {@link Game.cpu.shardLimits}.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_BUSY: 12-hours cooldown period is not over yet.
* - ERR_INVALID_ARGS: The argument is not a valid shard limits object.
*/
setShardLimits(limits: CPUShardLimits): OK | ERR_BUSY | ERR_INVALID_ARGS;
/**
* Use this method to get heap statistics for your virtual machine.
*
* This method will be undefined if you are not using IVM.
*
* The return value is almost identical to Node's [v8.getHeapStatistics()](https://nodejs.org/docs/latest-v10.x/api/v8.html#v8_v8_getheapstatistics).
*
* This function returns one additional property: externally_allocated_size which is the total amount of currently
* allocated memory which is not included in the v8 heap but counts against this isolate's memory limit.
* ArrayBuffer instances over a certain size are externally allocated and will be counted here.
*/
getHeapStatistics?(): HeapStatistics;
/**
* This method will be undefined if you are not using IVM.
*
* Reset your runtime environment and wipe all data in heap memory.
* Player code execution stops immediately.
*/
halt?(): never;
/**
* Generate 1 pixel resource unit for 10000 CPU from your bucket.
*
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_ENOUGH_RESOURCES: Your bucket does not have enough CPU.
*/
generatePixel(): OK | ERR_NOT_ENOUGH_RESOURCES;
/**
* Unlock full CPU for your account for additional 24 hours.
*
* This method will consume 1 CPU unlock bound to your account (See {@link Game.resources}).
* If full CPU is not currently unlocked for your account, it may take some time (up to 5 minutes) before unlock is applied to your account.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_ENOUGH_RESOURCES: Your account does not have enough cpuUnlock resource.
* - ERR_FULL: Your CPU is unlocked with a subscription.
*/
unlock(): OK | ERR_NOT_ENOUGH_RESOURCES | ERR_FULL;
}
interface HeapStatistics {
total_heap_size: number;
total_heap_size_executable: number;
total_physical_size: number;
total_available_size: number;
used_heap_size: number;
heap_size_limit: number;
malloced_memory: number;
peak_malloced_memory: number;
does_zap_garbage: 0 | 1;
externally_allocated_size: number;
}
/**
* Describes one part of a creep’s body.
*/
type BodyPartDefinition<T extends BodyPartConstant = BodyPartConstant> = T extends any
? {
/**
* One of the {@link ResourceConstant RESOURCE_*} constants.
*
* If the body part is boosted, this property specifies the mineral type which is used for boosting.
*/
boost?: keyof (typeof BOOSTS)[T];
/**
* One of the body part types constants.
*/
type: T;
/**
* The remaining amount of hit points of this body part.
*/
hits: number;
}
: never;
interface Owner {
/**
* The name of the owner user.
*/
username: string;
}
interface ReservationDefinition {
username: string;
ticksToEnd: number;
}
interface SignDefinition {
username: string;
text: string;
time: number;
datetime: Date;
}
interface CPUShardLimits {
[shard: string]: number;
}
/** A general purpose Store, which has a limited capacity */
type StoreDefinition = Store<ResourceConstant, false>;
/** A general purpose Store, which has an unlimited capacity */
type StoreDefinitionUnlimited = Store<ResourceConstant, true>;
/**
* @example
* {
* "1": "W8N4", // TOP
* "3": "W7N3", // RIGHT
* // "5": "W8N2", // BOTTOM
* "7": "W9N3" // LEFT
* }
*/
type ExitsInformation = Partial<Record<ExitKey, string>>;
interface AllLookAtTypes {
[LOOK_CONSTRUCTION_SITES]: ConstructionSite;
[LOOK_CREEPS]: Creep;
[LOOK_ENERGY]: Resource<RESOURCE_ENERGY>;
[LOOK_FLAGS]: Flag;
[LOOK_MINERALS]: Mineral;
[LOOK_DEPOSITS]: Deposit;
[LOOK_NUKES]: Nuke;
[LOOK_RESOURCES]: Resource;
[LOOK_SOURCES]: Source;
[LOOK_STRUCTURES]: AnyStructure;
[LOOK_TERRAIN]: Terrain;
[LOOK_TOMBSTONES]: Tombstone;
[LOOK_POWER_CREEPS]: PowerCreep;
[LOOK_RUINS]: Ruin;
}
type LookAtTypes = Partial<AllLookAtTypes>;
type LookAtResult<K extends LookConstant = LookConstant> = Pick<LookAtTypes, K> & { type: K };
type LookAtResultWithPos<K extends LookConstant = LookConstant> = LookAtResult<K> & {
x: number;
y: number;
};
interface LookAtResultMatrix<K extends LookConstant = LookConstant> {
[y: number]: {
[x: number]: Array<LookAtResult<K>>;
};
}
interface LookForAtAreaResultMatrix<T> {
[y: number]: {
[x: number]: T[];
};
}
type LookForAtAreaResult<T, K extends keyof LookAtTypes = keyof LookAtTypes> = { type: K } & { [P in K]: T };
type LookForAtAreaResultWithPos<T, K extends keyof LookAtTypes = keyof LookAtTypes> = LookForAtAreaResult<T, K> & { x: number; y: number };
type LookForAtAreaResultArray<T, K extends keyof LookAtTypes = keyof LookAtTypes> = Array<LookForAtAreaResultWithPos<T, K>>;
interface FindTypes {
[key: number]:
| RoomPosition
| AnyCreep
| Source
| Resource
| Structure
| Flag
| ConstructionSite
| Mineral
| Nuke
| Tombstone
| Deposit
| Ruin;
[FIND_EXIT_TOP]: RoomPosition;
[FIND_EXIT_RIGHT]: RoomPosition;
[FIND_EXIT_BOTTOM]: RoomPosition;
[FIND_EXIT_LEFT]: RoomPosition;
[FIND_EXIT]: RoomPosition;
[FIND_CREEPS]: Creep;
[FIND_MY_CREEPS]: Creep;
[FIND_HOSTILE_CREEPS]: Creep;
[FIND_SOURCES_ACTIVE]: Source;
[FIND_SOURCES]: Source;
[FIND_DROPPED_RESOURCES]: Resource;
[FIND_STRUCTURES]: AnyStructure;
[FIND_MY_STRUCTURES]: AnyOwnedStructure;
[FIND_HOSTILE_STRUCTURES]: AnyOwnedStructure;
[FIND_FLAGS]: Flag;
[FIND_CONSTRUCTION_SITES]: ConstructionSite;
[FIND_MY_SPAWNS]: StructureSpawn;
[FIND_HOSTILE_SPAWNS]: StructureSpawn;
[FIND_MY_CONSTRUCTION_SITES]: ConstructionSite;
[FIND_HOSTILE_CONSTRUCTION_SITES]: ConstructionSite;
[FIND_MINERALS]: Mineral;
[FIND_NUKES]: Nuke;
[FIND_TOMBSTONES]: Tombstone;
[FIND_POWER_CREEPS]: PowerCreep;
[FIND_MY_POWER_CREEPS]: PowerCreep;
[FIND_HOSTILE_POWER_CREEPS]: PowerCreep;
[FIND_DEPOSITS]: Deposit;
[FIND_RUINS]: Ruin;
}
interface FindPathOpts {
/**
* Treat squares with creeps as walkable.
*
* Can be useful with too many moving creeps around or in some other cases.
* @default false
*/
ignoreCreeps?: boolean;
/**
* Treat squares with destructible structures (constructed walls, ramparts, spawns, extensions) as walkable.
*
* Use this flag when you need to move through a territory blocked by hostile structures.
* If a creep with an ATTACK body part steps on such a square, it automatically attacks the structure.
* @default false
*/
ignoreDestructibleStructures?: boolean;
/**
* Ignore road structures.
*
* Enabling this option can speed up the search. This is only used when the new PathFinder is enabled.
*
* @default false
*/
ignoreRoads?: boolean;
/**
* You can use this callback to modify a CostMatrix for any room during the search.
*
* The callback accepts two arguments, roomName and costMatrix. Use the costMatrix instance to make changes to the positions costs.
* If you return a new matrix from this callback, it will be used instead of the built-in cached one.
* This option is only used when the new PathFinder is enabled.
*
* @param roomName The name of the room.
* @param costMatrix The current CostMatrix
* @returns The new CostMatrix to use
*/
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
costCallback?: (roomName: string, costMatrix: CostMatrix) => void | CostMatrix;
/**
* An array of the room's objects or RoomPosition objects which should be treated as walkable tiles during the search.
*
* This option cannot be used when the new PathFinder is enabled (use costCallback option instead).
*/
ignore?: any[] | RoomPosition[];
/**
* An array of the room's objects or RoomPosition objects which should be treated as obstacles during the search.
*
* This option cannot be used when the new PathFinder is enabled (use costCallback option instead).
*/
avoid?: any[] | RoomPosition[];
/**
* The maximum limit of possible pathfinding operations.
*
* You can limit CPU time used for the search based on ratio 1 op ~ 0.001 CPU.
* @default 2000
*/
maxOps?: number;
/**
* Weight to apply to the heuristic in the A* formula `F = G + weight * H`.
*
* Use this option only if you understand the underlying A* algorithm mechanics!
* @default 1.2
*/
heuristicWeight?: number;
/**
* If true, the result path will be serialized using {@link Room.serializePath}.
* @default false
*/
serialize?: boolean;
/**
* The maximum allowed rooms to search.
*
* This is only used when the new PathFinder is enabled.
* @default 16 (also maximum)
*/
maxRooms?: number;
/**
* Path to within (range) tiles of target tile.
*
* The default is to path to the tile that the target is on.
*
* @default 0
*/
range?: number;
/**
* Cost for walking on plain positions.
* @default 1
*/
plainCost?: number;
/**
* Cost for walking on swamp positions.
* @default 5
*/
swampCost?: number;
}
interface MoveToOpts extends FindPathOpts {
/**
* This option enables reusing the path found along multiple game ticks.
*
* It allows to save CPU time, but can result in a slightly slower creep reaction behavior.
* The path is stored into the creep's memory to the `_move` property.
* The `reusePath` value defines the amount of ticks which the path should be reused for.
* Increase the amount to save more CPU, decrease to make the movement more consistent.
* Set to 0 if you want to disable path reusing.
* @default 5
*/
reusePath?: number;
/**
* If `reusePath` is enabled and this option is set to true, the path will be stored in memory in the short serialized form using {@link Room.serializePath}.
* @default true
*/
serializeMemory?: boolean;
/**
* Force the use of a cached path.
*
* If this option is set to true, `moveTo` method will return `ERR_NOT_FOUND` if there is no memorized path to reuse.
* This can significantly save CPU time in some cases.
* @default false
*/
noPathFinding?: boolean;
/**
* Draw a line along the creep’s path using {@link RoomVisual.poly}.
*
* You can provide either an empty object or custom style parameters.
*/
visualizePathStyle?: PolyStyle;
}
interface PathStep {
x: number;
dx: number;
y: number;
dy: number;
direction: DirectionConstant;
}
interface _Constructor<T> {
readonly prototype: T;
}
interface _ConstructorById<T extends _HasId> extends _Constructor<T> {
new (id: Id<T>): T;
(id: Id<T>): T;
}
declare namespace Tag {
const OpaqueTagSymbol: unique symbol;
class OpaqueTag<T> {
private [OpaqueTagSymbol]: T;
}
}
type Id<T extends _HasId> = string & Tag.OpaqueTag<T>;
type fromId<T> = T extends Id<infer R> ? R : never;
/**
* `InterShardMemory` object provides an interface for communicating between shards.
*
* Your script is executed separatedly on each shard, and their {@link Memory} objects are isolated from each other.
* In order to pass messages and data between shards, you need to use {@link InterShardMemory} instead.
*
* Every shard can have its own data string that can be accessed by all other shards.
* A shard can write only to its own data, other shards' data is read-only.
*
* This data has nothing to do with `Memory` contents, it's a separate data container.
*/
interface InterShardMemory {
/**
* Returns the string contents of the current shard's data.
*/
getLocal(): string;
/**
* Replace the current shard's data with the new value.
*
* @param value New data value in string format.
* @throws if `value` isn't a string or contains more than `100 * 2014` characters.
*/
setLocal(value: string): void;
/**
* Returns the string contents of another shard's data, null if shard exists but data is not set.
*
* @param shard Shard name.
* @throws if shard name is invalid
*/
getRemote(shard: string): string | null;
}
declare const InterShardMemory: InterShardMemory;
/*
* This file creates literal versions of many of the constants
* It should be kept in sync with constants.ts
*/
// Extras
type Terrain = "plain" | "swamp" | "wall";
type ExitKey = "1" | "3" | "5" | "7";
type AnyCreep = Creep | PowerCreep;
type FindClosestByPathAlgorithm = "astar" | "dijkstra";
// Return Codes
type ScreepsReturnCode =
| OK
| ERR_NOT_OWNER
| ERR_NO_PATH
| ERR_BUSY
| ERR_NAME_EXISTS
| ERR_NOT_FOUND
| ERR_NOT_ENOUGH_RESOURCES
| ERR_NOT_ENOUGH_ENERGY
| ERR_INVALID_TARGET
| ERR_FULL
| ERR_NOT_IN_RANGE
| ERR_INVALID_ARGS
| ERR_TIRED
| ERR_NO_BODYPART
| ERR_NOT_ENOUGH_EXTENSIONS
| ERR_RCL_NOT_ENOUGH
| ERR_GCL_NOT_ENOUGH;
type OK = 0;
type ERR_NOT_OWNER = -1;
type ERR_NO_PATH = -2;
type ERR_NAME_EXISTS = -3;
type ERR_BUSY = -4;
type ERR_NOT_FOUND = -5;
type ERR_NOT_ENOUGH_RESOURCES = -6;
type ERR_NOT_ENOUGH_ENERGY = -6;
type ERR_INVALID_TARGET = -7;
type ERR_FULL = -8;
type ERR_NOT_IN_RANGE = -9;
type ERR_INVALID_ARGS = -10;
type ERR_TIRED = -11;
type ERR_NO_BODYPART = -12;
type ERR_NOT_ENOUGH_EXTENSIONS = -6;
type ERR_RCL_NOT_ENOUGH = -14;
type ERR_GCL_NOT_ENOUGH = -15;
type ERR_ACCESS_DENIED = -16;
type CreepActionReturnCode = OK | ERR_NOT_OWNER | ERR_BUSY | ERR_INVALID_TARGET | ERR_NOT_IN_RANGE | ERR_NO_BODYPART | ERR_TIRED;
type CreepMoveReturnCode = OK | ERR_NOT_OWNER | ERR_BUSY | ERR_TIRED | ERR_NO_BODYPART;
// Find Constants
type ExitConstant = FIND_EXIT_TOP | FIND_EXIT_RIGHT | FIND_EXIT_BOTTOM | FIND_EXIT_LEFT;
type FindConstant =
| FIND_EXIT_TOP
| FIND_EXIT_RIGHT
| FIND_EXIT_BOTTOM
| FIND_EXIT_LEFT
| FIND_EXIT
| FIND_CREEPS
| FIND_MY_CREEPS
| FIND_HOSTILE_CREEPS
| FIND_SOURCES_ACTIVE
| FIND_SOURCES
| FIND_DROPPED_RESOURCES
| FIND_STRUCTURES
| FIND_MY_STRUCTURES
| FIND_HOSTILE_STRUCTURES
| FIND_FLAGS
| FIND_CONSTRUCTION_SITES
| FIND_MY_SPAWNS
| FIND_HOSTILE_SPAWNS
| FIND_MY_CONSTRUCTION_SITES
| FIND_HOSTILE_CONSTRUCTION_SITES
| FIND_MINERALS
| FIND_NUKES
| FIND_TOMBSTONES
| FIND_POWER_CREEPS
| FIND_MY_POWER_CREEPS
| FIND_HOSTILE_POWER_CREEPS
| FIND_DEPOSITS
| FIND_RUINS;
type FIND_EXIT_TOP = 1;
type FIND_EXIT_RIGHT = 3;
type FIND_EXIT_BOTTOM = 5;
type FIND_EXIT_LEFT = 7;
type FIND_EXIT = 10;
type FIND_CREEPS = 101;
type FIND_MY_CREEPS = 102;
type FIND_HOSTILE_CREEPS = 103;
type FIND_SOURCES_ACTIVE = 104;
type FIND_SOURCES = 105;
type FIND_DROPPED_RESOURCES = 106;
type FIND_STRUCTURES = 107;
type FIND_MY_STRUCTURES = 108;
type FIND_HOSTILE_STRUCTURES = 109;
type FIND_FLAGS = 110;
type FIND_CONSTRUCTION_SITES = 111;
type FIND_MY_SPAWNS = 112;
type FIND_HOSTILE_SPAWNS = 113;
type FIND_MY_CONSTRUCTION_SITES = 114;
type FIND_HOSTILE_CONSTRUCTION_SITES = 115;
type FIND_MINERALS = 116;
type FIND_NUKES = 117;
type FIND_TOMBSTONES = 118;
type FIND_POWER_CREEPS = 119;
type FIND_MY_POWER_CREEPS = 120;
type FIND_HOSTILE_POWER_CREEPS = 121;
type FIND_DEPOSITS = 122;
type FIND_RUINS = 123;
// Filter Options
interface FilterOptions<T, S extends T> {
filter?: PredicateFilterFunction<T, S> | FilterFunction<T> | FilterObject<T> | string;
}
type PredicateFilterFunction<T, S extends T> = (object: T, index: number, collection: T[]) => object is S;
type FilterFunction<T> = (object: T, index: number, collection: T[]) => unknown;
type FilterObject<T> = DeepPartial<T>;
type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T;
// Body Part Constants
type BodyPartConstant = MOVE | WORK | CARRY | ATTACK | RANGED_ATTACK | TOUGH | HEAL | CLAIM;
type MOVE = "move";
type WORK = "work";
type CARRY = "carry";
type ATTACK = "attack";
type RANGED_ATTACK = "ranged_attack";
type TOUGH = "tough";
type HEAL = "heal";
type CLAIM = "claim";
// Look Constants
type LookConstant =
| LOOK_CREEPS
| LOOK_ENERGY
| LOOK_RESOURCES
| LOOK_SOURCES
| LOOK_MINERALS
| LOOK_DEPOSITS
| LOOK_STRUCTURES
| LOOK_FLAGS
| LOOK_CONSTRUCTION_SITES
| LOOK_NUKES
| LOOK_TERRAIN
| LOOK_TOMBSTONES
| LOOK_POWER_CREEPS
| LOOK_RUINS;
type LOOK_CONSTRUCTION_SITES = "constructionSite";
type LOOK_CREEPS = "creep";
type LOOK_ENERGY = "energy";
type LOOK_FLAGS = "flag";
type LOOK_MINERALS = "mineral";
type LOOK_DEPOSITS = "deposit";
type LOOK_NUKES = "nuke";
type LOOK_RESOURCES = "resource";
type LOOK_SOURCES = "source";
type LOOK_STRUCTURES = "structure";
type LOOK_TERRAIN = "terrain";
type LOOK_TOMBSTONES = "tombstone";
type LOOK_POWER_CREEPS = "powerCreep";
type LOOK_RUINS = "ruin";
type ORDER_SELL = "sell";
type ORDER_BUY = "buy";
// Direction Constants
type DirectionConstant = TOP | TOP_RIGHT | RIGHT | BOTTOM_RIGHT | BOTTOM | BOTTOM_LEFT | LEFT | TOP_LEFT;
type TOP = 1;
type TOP_RIGHT = 2;
type RIGHT = 3;
type BOTTOM_RIGHT = 4;
type BOTTOM = 5;
type BOTTOM_LEFT = 6;
type LEFT = 7;
type TOP_LEFT = 8;
// Color Constants
type ColorConstant =
| COLOR_RED
| COLOR_PURPLE
| COLOR_BLUE
| COLOR_CYAN
| COLOR_GREEN
| COLOR_YELLOW
| COLOR_ORANGE
| COLOR_BROWN
| COLOR_GREY
| COLOR_WHITE;
type COLOR_RED = 1;
type COLOR_PURPLE = 2;
type COLOR_BLUE = 3;
type COLOR_CYAN = 4;
type COLOR_GREEN = 5;
type COLOR_YELLOW = 6;
type COLOR_ORANGE = 7;
type COLOR_BROWN = 8;
type COLOR_GREY = 9;
type COLOR_WHITE = 10;
// Structure Constants
type BuildableStructureConstant =
| STRUCTURE_EXTENSION
| STRUCTURE_RAMPART
| STRUCTURE_ROAD
| STRUCTURE_SPAWN
| STRUCTURE_LINK
| STRUCTURE_WALL
| STRUCTURE_STORAGE
| STRUCTURE_TOWER
| STRUCTURE_OBSERVER
| STRUCTURE_POWER_SPAWN
| STRUCTURE_EXTRACTOR
| STRUCTURE_LAB
| STRUCTURE_TERMINAL
| STRUCTURE_CONTAINER
| STRUCTURE_NUKER
| STRUCTURE_FACTORY;
type StructureConstant =
| BuildableStructureConstant
| STRUCTURE_KEEPER_LAIR
| STRUCTURE_CONTROLLER
| STRUCTURE_POWER_BANK
| STRUCTURE_PORTAL
| STRUCTURE_INVADER_CORE;
type STRUCTURE_EXTENSION = "extension";
type STRUCTURE_RAMPART = "rampart";
type STRUCTURE_ROAD = "road";
type STRUCTURE_SPAWN = "spawn";
type STRUCTURE_LINK = "link";
type STRUCTURE_WALL = "constructedWall";
type STRUCTURE_KEEPER_LAIR = "keeperLair";
type STRUCTURE_CONTROLLER = "controller";
type STRUCTURE_STORAGE = "storage";
type STRUCTURE_TOWER = "tower";
type STRUCTURE_OBSERVER = "observer";
type STRUCTURE_POWER_BANK = "powerBank";
type STRUCTURE_POWER_SPAWN = "powerSpawn";
type STRUCTURE_EXTRACTOR = "extractor";
type STRUCTURE_LAB = "lab";
type STRUCTURE_TERMINAL = "terminal";
type STRUCTURE_CONTAINER = "container";
type STRUCTURE_NUKER = "nuker";
type STRUCTURE_FACTORY = "factory";
type STRUCTURE_INVADER_CORE = "invaderCore";
type STRUCTURE_PORTAL = "portal";
// Terrain mask constants
type TERRAIN_MASK_WALL = 1;
type TERRAIN_MASK_SWAMP = 2;
type TERRAIN_MASK_LAVA = 4;
// Resource Constants
type ResourceConstant =
| RESOURCE_ENERGY
| RESOURCE_POWER
| RESOURCE_OPS
| MineralConstant
| MineralCompoundConstant
| DepositConstant
| CommodityConstant;
type _ResourceConstantSansEnergy = Exclude<ResourceConstant, RESOURCE_ENERGY>;
/** The raw harvestable minerals */
type MineralConstant =
| RESOURCE_UTRIUM
| RESOURCE_LEMERGIUM
| RESOURCE_KEANIUM
| RESOURCE_ZYNTHIUM
| RESOURCE_OXYGEN
| RESOURCE_HYDROGEN
| RESOURCE_CATALYST;
/** The compounds which can't boost */
type MineralBaseCompoundsConstant = RESOURCE_HYDROXIDE | RESOURCE_ZYNTHIUM_KEANITE | RESOURCE_UTRIUM_LEMERGITE | RESOURCE_GHODIUM;
/** The boosts (from tier 1 to tier 3) */
type MineralBoostConstant =
| RESOURCE_UTRIUM_HYDRIDE
| RESOURCE_UTRIUM_OXIDE
| RESOURCE_KEANIUM_HYDRIDE
| RESOURCE_KEANIUM_OXIDE
| RESOURCE_LEMERGIUM_HYDRIDE
| RESOURCE_LEMERGIUM_OXIDE
| RESOURCE_ZYNTHIUM_HYDRIDE
| RESOURCE_ZYNTHIUM_OXIDE
| RESOURCE_GHODIUM_HYDRIDE
| RESOURCE_GHODIUM_OXIDE
| RESOURCE_UTRIUM_ACID
| RESOURCE_UTRIUM_ALKALIDE
| RESOURCE_KEANIUM_ACID
| RESOURCE_KEANIUM_ALKALIDE
| RESOURCE_LEMERGIUM_ACID
| RESOURCE_LEMERGIUM_ALKALIDE
| RESOURCE_ZYNTHIUM_ACID
| RESOURCE_ZYNTHIUM_ALKALIDE
| RESOURCE_GHODIUM_ACID
| RESOURCE_GHODIUM_ALKALIDE
| RESOURCE_CATALYZED_UTRIUM_ACID
| RESOURCE_CATALYZED_UTRIUM_ALKALIDE
| RESOURCE_CATALYZED_KEANIUM_ACID
| RESOURCE_CATALYZED_KEANIUM_ALKALIDE
| RESOURCE_CATALYZED_LEMERGIUM_ACID
| RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE
| RESOURCE_CATALYZED_ZYNTHIUM_ACID
| RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE
| RESOURCE_CATALYZED_GHODIUM_ACID
| RESOURCE_CATALYZED_GHODIUM_ALKALIDE;
/** All the mineral compounds */
type MineralCompoundConstant = MineralBaseCompoundsConstant | MineralBoostConstant;
/** The raw deposits */
type DepositConstant = RESOURCE_MIST | RESOURCE_BIOMASS | RESOURCE_METAL | RESOURCE_SILICON;
/** The commodities, produced by the Factory */
type CommodityConstant =
| RESOURCE_UTRIUM_BAR
| RESOURCE_LEMERGIUM_BAR
| RESOURCE_ZYNTHIUM_BAR
| RESOURCE_KEANIUM_BAR
| RESOURCE_GHODIUM_MELT
| RESOURCE_OXIDANT
| RESOURCE_REDUCTANT
| RESOURCE_PURIFIER
| RESOURCE_BATTERY
| RESOURCE_COMPOSITE
| RESOURCE_CRYSTAL
| RESOURCE_LIQUID
| RESOURCE_WIRE
| RESOURCE_SWITCH
| RESOURCE_TRANSISTOR
| RESOURCE_MICROCHIP
| RESOURCE_CIRCUIT
| RESOURCE_DEVICE
| RESOURCE_CELL
| RESOURCE_PHLEGM
| RESOURCE_TISSUE
| RESOURCE_MUSCLE
| RESOURCE_ORGANOID
| RESOURCE_ORGANISM
| RESOURCE_ALLOY
| RESOURCE_TUBE
| RESOURCE_FIXTURES
| RESOURCE_FRAME
| RESOURCE_HYDRAULICS
| RESOURCE_MACHINE
| RESOURCE_CONDENSATE
| RESOURCE_CONCENTRATE
| RESOURCE_EXTRACT
| RESOURCE_SPIRIT
| RESOURCE_EMANATION
| RESOURCE_ESSENCE;
type InterShardResourceConstant = SUBSCRIPTION_TOKEN | CPU_UNLOCK | PIXEL | ACCESS_KEY;
type MarketResourceConstant = ResourceConstant | InterShardResourceConstant;
type RESOURCE_ENERGY = "energy";
type RESOURCE_POWER = "power";
type RESOURCE_OPS = "ops";
type RESOURCE_BIOMASS = "biomass";
type RESOURCE_METAL = "metal";
type RESOURCE_MIST = "mist";
type RESOURCE_SILICON = "silicon";
type RESOURCE_UTRIUM = "U";
type RESOURCE_LEMERGIUM = "L";
type RESOURCE_KEANIUM = "K";
type RESOURCE_ZYNTHIUM = "Z";
type RESOURCE_OXYGEN = "O";
type RESOURCE_HYDROGEN = "H";
type RESOURCE_CATALYST = "X";
type RESOURCE_HYDROXIDE = "OH";
type RESOURCE_ZYNTHIUM_KEANITE = "ZK";
type RESOURCE_UTRIUM_LEMERGITE = "UL";
type RESOURCE_GHODIUM = "G";
type RESOURCE_UTRIUM_HYDRIDE = "UH";
type RESOURCE_UTRIUM_OXIDE = "UO";
type RESOURCE_KEANIUM_HYDRIDE = "KH";
type RESOURCE_KEANIUM_OXIDE = "KO";
type RESOURCE_LEMERGIUM_HYDRIDE = "LH";
type RESOURCE_LEMERGIUM_OXIDE = "LO";
type RESOURCE_ZYNTHIUM_HYDRIDE = "ZH";
type RESOURCE_ZYNTHIUM_OXIDE = "ZO";
type RESOURCE_GHODIUM_HYDRIDE = "GH";
type RESOURCE_GHODIUM_OXIDE = "GO";
type RESOURCE_UTRIUM_ACID = "UH2O";
type RESOURCE_UTRIUM_ALKALIDE = "UHO2";
type RESOURCE_KEANIUM_ACID = "KH2O";
type RESOURCE_KEANIUM_ALKALIDE = "KHO2";
type RESOURCE_LEMERGIUM_ACID = "LH2O";
type RESOURCE_LEMERGIUM_ALKALIDE = "LHO2";
type RESOURCE_ZYNTHIUM_ACID = "ZH2O";
type RESOURCE_ZYNTHIUM_ALKALIDE = "ZHO2";
type RESOURCE_GHODIUM_ACID = "GH2O";
type RESOURCE_GHODIUM_ALKALIDE = "GHO2";
type RESOURCE_CATALYZED_UTRIUM_ACID = "XUH2O";
type RESOURCE_CATALYZED_UTRIUM_ALKALIDE = "XUHO2";
type RESOURCE_CATALYZED_KEANIUM_ACID = "XKH2O";
type RESOURCE_CATALYZED_KEANIUM_ALKALIDE = "XKHO2";
type RESOURCE_CATALYZED_LEMERGIUM_ACID = "XLH2O";
type RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE = "XLHO2";
type RESOURCE_CATALYZED_ZYNTHIUM_ACID = "XZH2O";
type RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE = "XZHO2";
type RESOURCE_CATALYZED_GHODIUM_ACID = "XGH2O";
type RESOURCE_CATALYZED_GHODIUM_ALKALIDE = "XGHO2";
type RESOURCE_UTRIUM_BAR = "utrium_bar";
type RESOURCE_LEMERGIUM_BAR = "lemergium_bar";
type RESOURCE_ZYNTHIUM_BAR = "zynthium_bar";
type RESOURCE_KEANIUM_BAR = "keanium_bar";
type RESOURCE_GHODIUM_MELT = "ghodium_melt";
type RESOURCE_OXIDANT = "oxidant";
type RESOURCE_REDUCTANT = "reductant";
type RESOURCE_PURIFIER = "purifier";
type RESOURCE_BATTERY = "battery";
type RESOURCE_COMPOSITE = "composite";
type RESOURCE_CRYSTAL = "crystal";
type RESOURCE_LIQUID = "liquid";
type RESOURCE_WIRE = "wire";
type RESOURCE_SWITCH = "switch";
type RESOURCE_TRANSISTOR = "transistor";
type RESOURCE_MICROCHIP = "microchip";
type RESOURCE_CIRCUIT = "circuit";
type RESOURCE_DEVICE = "device";
type RESOURCE_CELL = "cell";
type RESOURCE_PHLEGM = "phlegm";
type RESOURCE_TISSUE = "tissue";
type RESOURCE_MUSCLE = "muscle";
type RESOURCE_ORGANOID = "organoid";
type RESOURCE_ORGANISM = "organism";
type RESOURCE_ALLOY = "alloy";
type RESOURCE_TUBE = "tube";
type RESOURCE_FIXTURES = "fixtures";
type RESOURCE_FRAME = "frame";
type RESOURCE_HYDRAULICS = "hydraulics";
type RESOURCE_MACHINE = "machine";
type RESOURCE_CONDENSATE = "condensate";
type RESOURCE_CONCENTRATE = "concentrate";
type RESOURCE_EXTRACT = "extract";
type RESOURCE_SPIRIT = "spirit";
type RESOURCE_EMANATION = "emanation";
type RESOURCE_ESSENCE = "essence";
type SUBSCRIPTION_TOKEN = "token";
type CPU_UNLOCK = "cpuUnlock";
type PIXEL = "pixel";
type ACCESS_KEY = "accessKey";
type TOMBSTONE_DECAY_PER_PART = 5;
type EventConstant =
| EVENT_ATTACK
| EVENT_OBJECT_DESTROYED
| EVENT_ATTACK_CONTROLLER
| EVENT_BUILD
| EVENT_HARVEST
| EVENT_HEAL
| EVENT_REPAIR
| EVENT_RESERVE_CONTROLLER
| EVENT_UPGRADE_CONTROLLER
| EVENT_EXIT
| EVENT_POWER
| EVENT_TRANSFER;
type EVENT_ATTACK = 1;
type EVENT_OBJECT_DESTROYED = 2;
type EVENT_ATTACK_CONTROLLER = 3;
type EVENT_BUILD = 4;
type EVENT_HARVEST = 5;
type EVENT_HEAL = 6;
type EVENT_REPAIR = 7;
type EVENT_RESERVE_CONTROLLER = 8;
type EVENT_UPGRADE_CONTROLLER = 9;
type EVENT_EXIT = 10;
type EVENT_POWER = 11;
type EVENT_TRANSFER = 12;
type EventAttackType =
| EVENT_ATTACK_TYPE_MELEE
| EVENT_ATTACK_TYPE_RANGED
| EVENT_ATTACK_TYPE_RANGED_MASS
| EVENT_ATTACK_TYPE_DISMANTLE
| EVENT_ATTACK_TYPE_HIT_BACK
| EVENT_ATTACK_TYPE_NUKE;
type EVENT_ATTACK_TYPE_MELEE = 1;
type EVENT_ATTACK_TYPE_RANGED = 2;
type EVENT_ATTACK_TYPE_RANGED_MASS = 3;
type EVENT_ATTACK_TYPE_DISMANTLE = 4;
type EVENT_ATTACK_TYPE_HIT_BACK = 5;
type EVENT_ATTACK_TYPE_NUKE = 6;
type EventHealType = EVENT_HEAL_TYPE_MELEE | EVENT_HEAL_TYPE_RANGED;
type EVENT_HEAL_TYPE_MELEE = 1;
type EVENT_HEAL_TYPE_RANGED = 2;
type EventDestroyType = "creep" | StructureConstant;
type EventItem =
| {
event: EVENT_ATTACK;
objectId: string;
data: EventData[EVENT_ATTACK];
}
| {
event: EVENT_OBJECT_DESTROYED;
objectId: string;
data: EventData[EVENT_OBJECT_DESTROYED];
}
| {
event: EVENT_ATTACK_CONTROLLER;
objectId: string;
data: EventData[EVENT_ATTACK_CONTROLLER];
}
| {
event: EVENT_BUILD;
objectId: string;
data: EventData[EVENT_BUILD];
}
| {
event: EVENT_HARVEST;
objectId: string;
data: EventData[EVENT_HARVEST];
}
| {
event: EVENT_HEAL;
objectId: string;
data: EventData[EVENT_HEAL];
}
| {
event: EVENT_REPAIR;
objectId: string;
data: EventData[EVENT_REPAIR];
}
| {
event: EVENT_RESERVE_CONTROLLER;
objectId: string;
data: EventData[EVENT_RESERVE_CONTROLLER];
}
| {
event: EVENT_UPGRADE_CONTROLLER;
objectId: string;
data: EventData[EVENT_UPGRADE_CONTROLLER];
}
| {
event: EVENT_EXIT;
objectId: string;
data: EventData[EVENT_EXIT];
}
| {
event: EVENT_POWER;
objectId: string;
data: EventData[EVENT_POWER];
}
| {
event: EVENT_TRANSFER;
objectId: string;
data: EventData[EVENT_TRANSFER];
};
interface EventData {
[EVENT_ATTACK]: {
targetId: string;
damage: number;
attackType: EventAttackType;
};
[EVENT_OBJECT_DESTROYED]: {
type: EventDestroyType;
};
[EVENT_ATTACK_CONTROLLER]: null;
[EVENT_BUILD]: {
targetId: string;
amount: number;
structureType: BuildableStructureConstant;
x: number;
y: number;
incomplete: boolean;
};
[EVENT_HARVEST]: {
targetId: string;
amount: number;
};
[EVENT_HEAL]: {
targetId: string;
amount: number;
healType: EventHealType;
};
[EVENT_REPAIR]: {
targetId: string;
amount: number;
energySpent: number;
};
[EVENT_RESERVE_CONTROLLER]: {
amount: number;
};
[EVENT_UPGRADE_CONTROLLER]: {
amount: number;
energySpent: number;
};
[EVENT_EXIT]: {
room: string;
x: number;
y: number;
};
[EVENT_POWER]: {
targetId: string;
power: PowerConstant;
};
[EVENT_TRANSFER]: {
targetId: string;
resourceType: ResourceConstant;
amount: number;
};
}
type PowerClassConstant = POWER_CLASS["OPERATOR"];
interface POWER_CLASS {
OPERATOR: "operator";
}
type PowerConstant =
| PWR_GENERATE_OPS
| PWR_OPERATE_SPAWN
| PWR_OPERATE_TOWER
| PWR_OPERATE_STORAGE
| PWR_OPERATE_LAB
| PWR_OPERATE_EXTENSION
| PWR_OPERATE_OBSERVER
| PWR_OPERATE_TERMINAL
| PWR_DISRUPT_SPAWN
| PWR_DISRUPT_TOWER
| PWR_DISRUPT_SOURCE
| PWR_SHIELD
| PWR_REGEN_SOURCE
| PWR_REGEN_MINERAL
| PWR_DISRUPT_TERMINAL
| PWR_OPERATE_POWER
| PWR_FORTIFY
| PWR_OPERATE_CONTROLLER
| PWR_OPERATE_FACTORY;
type PWR_GENERATE_OPS = 1;
type PWR_OPERATE_SPAWN = 2;
type PWR_OPERATE_TOWER = 3;
type PWR_OPERATE_STORAGE = 4;
type PWR_OPERATE_LAB = 5;
type PWR_OPERATE_EXTENSION = 6;
type PWR_OPERATE_OBSERVER = 7;
type PWR_OPERATE_TERMINAL = 8;
type PWR_DISRUPT_SPAWN = 9;
type PWR_DISRUPT_TOWER = 10;
type PWR_DISRUPT_SOURCE = 11;
type PWR_SHIELD = 12;
type PWR_REGEN_SOURCE = 13;
type PWR_REGEN_MINERAL = 14;
type PWR_DISRUPT_TERMINAL = 15;
type PWR_OPERATE_POWER = 16;
type PWR_FORTIFY = 17;
type PWR_OPERATE_CONTROLLER = 18;
type PWR_OPERATE_FACTORY = 19;
type EffectConstant = EFFECT_INVULNERABILITY | EFFECT_COLLAPSE_TIMER;
type EFFECT_INVULNERABILITY = 1001;
type EFFECT_COLLAPSE_TIMER = 1002;
type DENSITY_LOW = 1;
type DENSITY_MODERATE = 2;
type DENSITY_HIGH = 3;
type DENSITY_ULTRA = 4;
type DensityConstant = DENSITY_LOW | DENSITY_MODERATE | DENSITY_HIGH | DENSITY_ULTRA;
/**
* The options that can be accepted by `findRoute()` and friends.
*/
interface RouteOptions {
/**
* This callback can be used to calculate the cost of entering that room.
* You can use this to do things like prioritize your own rooms, or avoid some rooms.
* @param roomName The room being considered
* @param fromRoomName The room we're coming from
* @returns a floating point to steer the route toward a given room, or Infinity to block it entirely.
*/
routeCallback: (roomName: string, fromRoomName: string) => number;
}
interface RoomStatusPermanent {
status: "normal" | "closed";
timestamp: null;
}
interface RoomStatusTemporary {
status: "novice" | "respawn";
timestamp: number;
}
type RoomStatus = RoomStatusPermanent | RoomStatusTemporary;
/**
* A global object representing world map.
*
* Use it to navigate between rooms. The object is accessible via the {@link Game.map} property.
*/
interface GameMap {
/**
* List all exits available from the room with the given name.
* @param roomName The room name.
* @returns The exits information or null if the room not found.
*/
describeExits(roomName: string): ExitsInformation | null;
/**
* Find the exit direction from the given room en route to another room.
* @param fromRoom Start room name or room object.
* @param toRoom Finish room name or room object.
* @param opts (optional) An object with the pathfinding options.
* @returns The room direction constant, one of the following:
* FIND_EXIT_TOP, FIND_EXIT_RIGHT, FIND_EXIT_BOTTOM, FIND_EXIT_LEFT
* Or one of the following Result codes:
* ERR_NO_PATH, ERR_INVALID_ARGS
*/
findExit(fromRoom: string | Room, toRoom: string | Room, opts?: RouteOptions): ExitConstant | ERR_NO_PATH | ERR_INVALID_ARGS;
/**
* Find route from the given room to another room.
* @param fromRoom Start room name or room object.
* @param toRoom Finish room name or room object.
* @param opts (optional) An object with the pathfinding options.
* @returns either an array of room exits / room name, or ERR_NO_PATH if the destination room cannot be reached.
*/
findRoute(fromRoom: string | Room, toRoom: string | Room, opts?: RouteOptions): { exit: ExitConstant; room: string }[] | ERR_NO_PATH;
/**
* Get the linear distance (in rooms) between two rooms.
*
* You can use this function to estimate the energy cost of sending resources through terminals, or using observers and nukes.
* @param roomName1 The name of the first room.
* @param roomName2 The name of the second room.
* @param continuous Whether to treat the world map continuous on borders. Set to true if you
* want to calculate the trade or terminal send cost. Default is false.
*/
getRoomLinearDistance(roomName1: string, roomName2: string, continuous?: boolean): number;
/**
* Get terrain type at the specified room position.
*
* This method works for any room in the world even if you have no access to it.
* @param x X position in the room.
* @param y Y position in the room.
* @param roomName The room name.
* @deprecated use {@link Game.map.getRoomTerrain} instead
*/
getTerrainAt(x: number, y: number, roomName: string): Terrain;
/**
* Get terrain type at the specified room position.
*
* This method works for any room in the world even if you have no access to it.
* @param pos The position object.
* @deprecated use {@link Game.map.getRoomTerrain} instead
*/
getTerrainAt(pos: RoomPosition): Terrain;
/**
* Get room terrain for the specified room.
*
* This method works for any room in the world even if you have no access to it.
* @param roomName String name of the room.
*/
getRoomTerrain(roomName: string): RoomTerrain;
/**
* Returns the world size as a number of rooms between world corners.
*
* For example, for a world with rooms from W50N50 to E50S50 this method will return 102.
*/
getWorldSize(): number;
/**
* Check if the room is available to move into.
* @param roomName The room name.
* @returns A boolean value.
* @deprecated Use `Game.map.getRoomStatus` instead
*/
isRoomAvailable(roomName: string): boolean;
/**
* Get the room status to determine if it's available, or in a reserved area.
* @param roomName The room name.
* @returns A {@link RoomStatus} object.
*/
getRoomStatus(roomName: string): RoomStatus;
/**
* Map visuals provide a way to show various visual debug info on the game map.
* You can use the {@link Game.map.visual} object to draw simple shapes that are visible only to you.
*
* Map visuals are not stored in the database, their only purpose is to display something in your browser.
* All drawings will persist for one tick and will disappear if not updated.
* All `Game.map.visual` calls have no added CPU cost (their cost is natural and mostly related to simple JSON.serialize calls).
* However, there is a usage limit: you cannot post more than 1000 KB of serialized data.
*
* All draw coordinates are measured in global game coordinates (`RoomPosition`).
*/
visual: MapVisual;
}
/**
* Map visuals provide a way to show various visual debug info on the game map.
*
* You can use the {@link Game.map.visual} object to draw simple shapes that are visible only to you.
*
* Map visuals are not stored in the database, their only purpose is to display something in your browser.
* All drawings will persist for one tick and will disappear if not updated.
* All `Game.map.visual` calls have no added CPU cost (their cost is natural and mostly related to simple `JSON.serialize` calls).
* However, there is a usage limit: you cannot post more than 1000 KB of serialized data.
*
* All draw coordinates are measured in global game coordinates ({@link RoomPosition}).
*/
interface MapVisual {
/**
* Draw a line.
* @param pos1 The start position object.
* @param pos2 The finish position object.
* @param style The optional style
* @returns The MapVisual object, for chaining.
*/
line(pos1: RoomPosition, pos2: RoomPosition, style?: MapLineStyle): MapVisual;
/**
* Draw a circle.
* @param pos The position object of the center.
* @param style The optional style
* @returns The MapVisual object, for chaining.
*/
circle(pos: RoomPosition, style?: MapCircleStyle): MapVisual;
/**
* Draw a rectangle.
* @param topLeftPos The position object of the top-left corner.
* @param width The width of the rectangle.
* @param height The height of the rectangle.
* @param style The optional style
* @returns The MapVisual object, for chaining.
*/
rect(topLeftPos: RoomPosition, width: number, height: number, style?: MapPolyStyle): MapVisual;
/**
* Draw a polyline.
* @param points An array of points. Every item should be a `RoomPosition` object.
* @param style The optional style
* @returns The MapVisual object, for chaining.
*/
poly(points: RoomPosition[], style?: MapPolyStyle): MapVisual;
/**
* Draw a text label. You can use any valid Unicode characters, including emoji.
* @param text The text message.
* @param pos The position object of the label baseline.
* @param style The optional style
* @returns The MapVisual object, for chaining
*/
text(text: string, pos: RoomPosition, style?: MapTextStyle): MapVisual;
/**
* Remove all visuals from the map.
* @returns The MapVisual object, for chaining
*/
clear(): MapVisual;
/**
* Get the stored size of all visuals added on the map in the current tick.
*
* It must not exceed 1024,000 (1000 KB).
* @returns The size of the visuals in bytes.
*/
getSize(): number;
/**
* Returns a compact representation of all visuals added on the map in the current tick.
* @returns A string with visuals data. There's not much you can do with the string besides store them for later.
*/
export(): string;
/**
* Add previously exported (with {@link Game.map.visual.export}) map visuals to the map visual data of the current tick.
* @param data The string returned from `Game.map.visual.export`.
* @returns The MapVisual object itself, so that you can chain calls.
*/
import(data: string): MapVisual;
}
interface MapLineStyle {
/**
* Line width.
* @default 0.1
*/
width?: number;
/**
* Line color in the following format: #ffffff (hex triplet).
* @default #ffffff
*/
color?: string;
/**
* Opacity value
* @default 0.5
*/
opacity?: number;
/**
* Either undefined (solid line), dashed, or dotted.
* @default undefined.
*/
lineStyle?: "dashed" | "dotted" | "solid" | undefined;
}
interface MapPolyStyle {
/**
* Fill color in the following format: #ffffff (hex triplet).
* @default undefined (no fill).
*/
fill?: string | undefined;
/**
* Opacity value
* @default 0.5
*/
opacity?: number;
/**
* Stroke color in the following format: #ffffff (hex triplet).
* @default #ffffff
*/
stroke?: string;
/**
* Stroke line width.
* @default 0.5
*/
strokeWidth?: number;
/**
* Either undefined (solid line), dashed, or dotted.
* @default is undefined
*/
lineStyle?: "dashed" | "dotted" | "solid" | undefined;
}
interface MapCircleStyle extends MapPolyStyle {
/**
* Circle radius.
* @default 10
*/
radius?: number;
}
interface MapTextStyle {
/**
* Font color in the following format: #ffffff (hex triplet).
* @default #ffffff
*/
color?: string;
/**
* The font family.
* @default sans-serif
*/
fontFamily?: string;
/**
* The font size in game coordinates.
* @default 10
*/
fontSize?: number;
/**
* The font style ('normal', 'italic' or 'oblique')
*/
fontStyle?: string;
/**
* The font variant ('normal' or 'small-caps')
*/
fontVariant?: string;
/**
* Stroke color in the following format: #ffffff (hex triplet)
* @default undefined (no stroke).
*/
stroke?: string | undefined;
/**
* Stroke width.
* @default 0.15
*/
strokeWidth?: number;
/**
* Background color in the following format: #ffffff (hex triplet).
*
* When background is enabled, text vertical align is set to middle (default is baseline).
* @default undefined (no background).
*/
backgroundColor?: string | undefined;
/**
* Background rectangle padding.
* @default 2
*/
backgroundPadding?: number;
/**
* Text align, either center, left, or right.
* @default center
*/
align?: "center" | "left" | "right";
/**
* Opacity value.
* @default 0.5
*/
opacity?: number;
}
/**
* A global object representing the in-game market.
*
* You can use this object to track resource transactions to/from your terminals, and your buy/sell orders.
* The object is accessible via the singleton {@link Game.market} property.
*
* Learn more about the market system from [this article](https://docs.screeps.com/market.html).
*/
interface Market {
/**
* Your current credits balance.
*/
credits: number;
/**
* An array of the last 100 incoming transactions to your terminals
*/
incomingTransactions: Transaction[];
/**
* An object with your active and inactive buy/sell orders on the market.
*/
orders: { [key: string]: Order };
/**
* An array of the last 100 outgoing transactions from your terminals
*/
outgoingTransactions: Transaction[];
/**
* Estimate the energy transaction cost of {@link StructureTerminal.send} and {@link Market.deal} methods.
*
* The formula:
*
* ```
* Math.ceil(amount * (1 - Math.exp(-linearDistanceBetweenRooms / 30)))
* ```
*
* @param amount Amount of resources to be sent.
* @param roomName1 The name of the first room.
* @param roomName2 The name of the second room.
* @returns The amount of energy required to perform the transaction.
*/
calcTransactionCost(amount: number, roomName1: string, roomName2: string): number;
/**
* Cancel a previously created order.
*
* The 5% fee is not returned.
* @param orderId The order ID as provided in Game.market.orders
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_INVALID_ARGS: The order ID is not valid.
*/
cancelOrder(orderId: string): ScreepsReturnCode;
/**
* Change the price of an existing order.
*
* If `newPrice` is greater than old price, you will be charged `(newPrice-oldPrice)*remainingAmount*0.05` credits.
* @param orderId The order ID as provided in Game.market.orders
* @param newPrice The new order price.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of the room's terminal or there is no terminal.
* - ERR_NOT_ENOUGH_RESOURCES: You don't have enough credits to pay a fee.
* - ERR_INVALID_ARGS: The arguments provided are invalid.
*/
changeOrderPrice(orderId: string, newPrice: number): ScreepsReturnCode;
/**
* Create a market order in your terminal.
*
* You will be charged `price*amount*0.05` credits when the order is placed.
*
* The maximum orders count is 300 per player. You can create an order at any time with any amount,
* it will be automatically activated and deactivated depending on the resource/credits availability.
*
* An order expires in 30 days after its creation, and the remaining market fee is returned.
*
* @param params A object describing the order.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of the room's terminal or there is no terminal.
* - ERR_NOT_ENOUGH_RESOURCES: You don't have enough credits to pay a fee.
* - ERR_FULL: You cannot create more than 50 orders.
* - ERR_INVALID_ARGS: The arguments provided are invalid.
*/
createOrder(params: CreateOrderParam): ScreepsReturnCode;
/**
* Execute a trade deal from your Terminal to another player's Terminal using the specified buy/sell order.
*
* Your Terminal will be charged energy units of transfer cost regardless of the order resource type.
* You can use {@link Game.market.calcTransactionCost} method to estimate it.
*
* When multiple players try to execute the same deal, the one with the shortest distance takes precedence.
*
* You cannot execute more than 10 deals during one tick.
*
* @param orderId The order ID as provided in Game.market.orders
* @param amount The amount of resources to transfer.
* @param yourRoomName The name of your room which has to contain an active Terminal with enough amount of energy.
* This argument is not used when the order resource type is one of account-bound resources (@see {@link InterShardResourceConstant}).
*
* @returns One of the following error codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You don't have a terminal in the target room.
* - ERR_NOT_ENOUGH_RESOURCES: You don't have enough credits or resource units.
* - ERR_FULL: You cannot execute more than 10 deals during one tick.
* - ERR_INVALID_ARGS: The arguments provided are invalid.
* - ERR_TIRED: The target terminal is still cooling down.
*/
deal(orderId: string, amount: number, yourRoomName?: string): ScreepsReturnCode;
/**
* Add more capacity to an existing order.
*
* It will affect `remainingAmount` and `totalAmount` properties. You will be charged `price*addAmount*0.05` credits.
* Extending the order doesn't update its expiration time.
*
* @param orderId The order ID as provided in Game.market.orders
* @param addAmount How much capacity to add. Cannot be a negative value.
* @returns One of the following error codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_ENOUGH_RESOURCES: You don't have enough credits to pay a fee.
* - ERR_INVALID_ARGS: The arguments provided are invalid.
*/
extendOrder(orderId: string, addAmount: number): ScreepsReturnCode;
/**
* Get other players' orders currently active on the market.
* @param filter (optional) An object or function that will filter the resulting list using the lodash.filter method.
* @returns An array of objects containing order information.
*/
getAllOrders(filter?: OrderFilter | ((o: Order) => boolean)): Order[];
/**
* Get daily price history of the specified resource on the market for the last 14 days.
* @param resource One of the {@link MarketResourceConstant RESOURCE_*} constants. If undefined, returns history data for all resources. Optional
* @returns An array of objects with resource info.
*/
getHistory(resource?: MarketResourceConstant): PriceHistory[];
/**
* Retrieve info for specific market order.
* @param orderId The order ID.
* @returns An object with the order info. See {@link Order}.
*/
getOrderById(id: string): Order | null;
}
// No static is available
interface Transaction {
transactionId: string;
time: number;
sender?: { username: string };
recipient?: { username: string };
resourceType: MarketResourceConstant;
amount: number;
from: string;
to: string;
description: string;
order?: TransactionOrder;
}
interface Order {
/** The unique order ID. */
id: string;
/**
* The order creation time in milliseconds since UNIX epoch time.
*
* This property is absent for old orders.
*/
created: number;
/** Whether the order is active or not.
*
* Only exists for your own orders. */
active?: boolean;
/** The order type. */
type: ORDER_BUY | ORDER_SELL;
/**
* The type of resource requested by the order. See {@link MarketResourceConstant}.
*/
resourceType: MarketResourceConstant;
/** The room where this order is placed. */
roomName?: string;
/** Currently available quantity of resource to trade. */
amount: number;
/** Remaining quantity of resources to trade. */
remainingAmount: number;
/** Total quantity of resources traded */
totalAmount?: number;
/** The current price per unit. */
price: number;
}
interface TransactionOrder {
id: string;
type: string;
price: number;
}
interface OrderFilter {
id?: string;
created?: number;
type?: string;
resourceType?: MarketResourceConstant;
roomName?: string;
amount?: number;
remainingAmount?: number;
price?: number;
}
interface PriceHistory {
resourceType: MarketResourceConstant;
date: string;
transactions: number;
volume: number;
avgPrice: number;
stddevPrice: number;
}
/** Parameters to {@link Game.market.createOrder} */
interface CreateOrderParam {
/**
* The order type.
*/
type: ORDER_BUY | ORDER_SELL;
/**
* The resource type to trade.
*
* If your Terminal doesn't have the specified resource, the order will be temporary inactive.
*/
resourceType: MarketResourceConstant;
/**
* The price for one resource unit in credits.
*
* Can be a decimal number.
*/
price: number;
/**
* The amount of resources to be traded in total.
*/
totalAmount: number;
/**
* The room where your order will be created.
*
* You must have your own Terminal structure in this room, otherwise the created order will be temporary inactive.
* This argument is not used when `resourceType` is one of the {@link InterShardResourceConstant} resources.
*/
roomName?: string;
}
interface Memory {
creeps: { [name: string]: CreepMemory };
powerCreeps: { [name: string]: PowerCreepMemory };
flags: { [name: string]: FlagMemory };
rooms: { [name: string]: RoomMemory };
spawns: { [name: string]: SpawnMemory };
}
interface CreepMemory {}
interface FlagMemory {}
interface PowerCreepMemory {}
interface RoomMemory {}
interface SpawnMemory {}
declare const Memory: Memory;
/**
* A mineral deposit.
*
* Can be harvested by creeps with a WORK body part using the extractor structure.
* Learn more about minerals from [this article](http://docs.screeps.com/api/#Mineral).
*
*
* | | |
* | ---------------------------| ---------------------------- |
* | Regeneration amount | DENSITY_LOW: 15,000
* | | DENSITY_MODERATE: 35,000
* | | DENSITY_HIGH: 70,000
* | | DENSITY_ULTRA: 100,000
* | Regeneration time | 50,000 ticks
* | Density change probability | DENSITY_LOW: 100% chance
* | | DENSITY_MODERATE: 5% chance
* | | DENSITY_HIGH: 5% chance
* | | DENSITY_ULTRA: 100% chance*
*/
interface Mineral<T extends MineralConstant = MineralConstant> extends RoomObject {
/**
* The prototype is stored in the Mineral.prototype global object. You can use it to extend game objects behaviour globally.
*/
readonly prototype: Mineral;
/**
* The density of this mineral deposit, one of the {@link DensityConstant DENSITY_*} constants.
*/
density: DensityConstant;
/**
* The remaining amount of resources.
*/
mineralAmount: number;
/**
* The resource type, one of the {@link MineralConstant RESOURCE_*} constants.
*/
mineralType: T;
/**
* A unique object identifier.
*
* You can use {@link Game.getObjectById} to retrieve an object instance by its `id`.
*/
id: Id<this>;
/**
* The remaining time after which the deposit will be refilled if is recharging, otherwise undefined.
*/
ticksToRegeneration?: number;
}
interface MineralConstructor extends _Constructor<Mineral>, _ConstructorById<Mineral> {}
declare const Mineral: MineralConstructor;
/**
* A nuke landing position.
*
* This object cannot be removed or modified. You can find incoming nukes in the room using the {@link FIND_NUKES} constant.
*
* Landing time: 50,000 ticks
* All creeps, construction sites and dropped resources in the room are removed immediately, even inside ramparts.
*
* Damage to structures:
* - 10,000,000 hits at the landing position;
* - 5,000,000 hits to all structures in 5x5 area.
*
* Note that you can stack multiple nukes from different rooms at the same target position to increase damage.
*
* Nuke landing does not generate tombstones and ruins, and destroys all existing tombstones and ruins in the room.
*
* If the room is in safe mode, then the safe mode is cancelled immediately, and the safe mode cooldown is reset to 0.
*
* The room controller is hit by triggering {@link StructureController.upgradeBlocked} period, which means it is unavailable to activate safe mode again within the next 200 ticks.
*/
interface Nuke extends RoomObject {
readonly prototype: Nuke;
/**
* A unique object identifier.
*
* You can use {@link Game.getObjectById} to retrieve an object instance by its id.
*/
id: Id<this>;
/**
* The name of the room where this nuke has been launched from.
*/
launchRoomName: string;
/**
* The remaining landing time.
*/
timeToLand: number;
}
interface NukeConstructor extends _Constructor<Nuke>, _ConstructorById<Nuke> {}
declare const Nuke: NukeConstructor;
/**
* Contains powerful methods for pathfinding in the game world.
*
* This module is written in fast native C++ code and supports custom navigation costs and paths which span multiple rooms.
*
* Additionally PathFinder can search for paths through rooms you can't see, although you won't be able to detect any dynamic obstacles like creeps or buildings.
*/
interface PathFinder {
/**
* Creates a new {@link CostMatrix} containing 0's for all positions.
*/
CostMatrix: CostMatrixConstructor;
/**
* Find an optimal path between origin and goal.
*
* @param origin The start position.
* @param goal goal A RoomPosition, an object containing a RoomPosition and range or an array of either.
* @param opts An object containing additional pathfinding flags.
*/
search(
origin: RoomPosition,
goal: RoomPosition | { pos: RoomPosition; range: number } | Array<RoomPosition | { pos: RoomPosition; range: number }>,
opts?: PathFinderOpts,
): PathFinderPath;
/**
* Specify whether to use this new experimental pathfinder in game objects methods.
* This method should be invoked every tick. It affects the following methods behavior:
* - {@link Room.findPath}
* - {@link RoomPosition.findPathTo}
* - {@link RoomPosition.findClosestByPath}
* - {@link Creep.moveTo}
*
* @deprecated This method is deprecated and will be removed soon.
* @param isEnabled Whether to activate the new pathfinder or deactivate.
*/
use(isEnabled: boolean): undefined;
}
/**
* An object containing:
* path - An array of RoomPosition objects.
* ops - Total number of operations performed before this path was calculated.
* cost - The total cost of the path as derived from `plainCost`, `swampCost` and any given CostMatrix instances.
* incomplete - If the pathfinder fails to find a complete path, this will be true.
* Note that `path` will still be populated with a partial path which represents the closest path it could find given the search parameters.
*/
interface PathFinderPath {
/**
* An array of {@link RoomPosition} objects.
*/
path: RoomPosition[];
/**
* Total number of operations performed before this path was calculated.
*/
ops: number;
/**
* The total cost of the path as derived from `plainCost`, `swampCost` and any given {@link CostMatrix} instances.
*/
cost: number;
/**
* If the pathfinder fails to find a complete path, this will be true.
*
* Note that `path` will still be populated with a partial path which represents the closest path it could find given the search parameters.
*/
incomplete: boolean;
}
/**
* An object containing additional pathfinding flags.
*/
interface PathFinderOpts {
/**
* Cost for walking on plain positions.
* @default 1
*/
plainCost?: number;
/**
* Cost for walking on swamp positions.
* @default 5
*/
swampCost?: number;
/**
* Instead of searching for a path to the goals this will search for a path away from the goals.
*
* The cheapest path that is out of range of every goal will be returned.
* @default false
*/
flee?: boolean;
/**
* The maximum allowed pathfinding operations.
*
* You can limit CPU time used for the search based on ratio 1 op ~ 0.001 CPU.
* @default 2000
*/
maxOps?: number;
/**
* The maximum allowed rooms to search.
* @default 16 (also maximum)
*/
maxRooms?: number;
/**
* The maximum allowed cost of the path returned.
*
* If at any point the pathfinder detects that it is impossible to find a path with a cost less than or equal to maxCost it will immediately halt the search.
* @default Infinity
*/
maxCost?: number;
/**
* Weight to apply to the heuristic in the A* formula `F = G + weight * H`.
*
* Use this option only if you understand the underlying A* algorithm mechanics!
* @default 1.2
*/
heuristicWeight?: number;
/**
* Request from the pathfinder to generate a CostMatrix for a certain room.
*
* The callback accepts one argument, roomName.
* This callback will only be called once per room per search. If you are running multiple pathfinding operations in a
* single room and in a single tick you may consider caching your {@link CostMatrix} to speed up your code.
* Please read the {@link CostMatrix} documentation below for more information on CostMatrix.
*
* @param roomName The name of the room the pathfinder needs a cost matrix for.
*/
roomCallback?(roomName: string): boolean | CostMatrix;
}
interface CostMatrixConstructor extends _Constructor<CostMatrix> {
new (): CostMatrix;
/**
* Static method which deserializes a new CostMatrix using the return value of serialize.
* @param val Whatever serialize returned
*/
deserialize(val: number[]): CostMatrix;
}
/**
* Container for custom navigation cost data.
*
* By default PathFinder will only consider terrain data (plain, swamp, wall) — if you need to route around obstacles such as buildings or creeps you must put them into a CostMatrix.
*
* Generally you will create your CostMatrix from within {@link PathFinderOpts.roomCallback}.
* If a non-0 value is found in a room's CostMatrix then that value will be used instead of the default terrain cost.
*
* You should avoid using large values in your CostMatrix and terrain cost flags.
* For example, running {@link PathFinder.search} with `{ plainCost: 1, swampCost: 5 }` is faster than running it with `{plainCost: 2, swampCost: 10 }` even though your paths will be the same.
*/
interface CostMatrix {
/**
* Set the cost of a position in this CostMatrix.
* @param x X position in the room.
* @param y Y position in the room.
* @param cost Cost of this position. Must be a whole number. A cost of 0 will use the terrain cost for that tile. A cost greater than or equal to 255 will be treated as unwalkable.
*/
set(x: number, y: number, cost: number): undefined;
/**
* Get the cost of a position in this CostMatrix.
* @param x X position in the room.
* @param y Y position in the room.
*/
get(x: number, y: number): number;
/**
* Copy this CostMatrix into a new CostMatrix with the same data.
*/
clone(): CostMatrix;
/**
* Returns a compact representation of this CostMatrix which can be stored via JSON.stringify.
*/
serialize(): number[];
}
declare const PathFinder: PathFinder;
/**
* Power Creeps are immortal "heroes" that are tied to your account and can be respawned in any PowerSpawn after death.
*
* You can upgrade their abilities ("powers") up to your account Global Power Level (see {@link Game.gpl}).
*
* | | |
* | ----------------- | ---------------- |
* | **Time to live** | 5,000
* | **Hits** | 1,000 per level
* | **Capacity** | 100 per level
*
* [Full list of available powers](https://docs.screeps.com/power.html#Powers)
*/
interface PowerCreep extends RoomObject {
/**
* An object with the creep's cargo contents.
* @deprecated An alias for Creep.store.
*/
carry: StoreDefinition;
/**
* The total amount of resources the creep can carry.
* @deprecated An alias for Creep.store.getCapacity().
*/
carryCapacity: number;
/**
* The power creep's class, one of the {@link PowerClassConstant POWER_CLASS} constants.
*/
className: PowerClassConstant;
/**
* A timestamp when this creeep is marked to be permanently deleted from the account, or undefined otherwise.
*/
deleteTime: number | undefined;
/**
* The current amount of hit points of the creep.
*/
hits: number;
/**
* The maximum amount of hit points of the creep.
*/
hitsMax: number;
/**
* A unique identifier.
*
* You can use the {@link Game.getObjectById} to retrieve an object instance by its id.
*/
id: Id<this>;
/**
* The power creep's level.
*/
level: number;
/**
* The power creep's memory.
*
* A shorthand to `Memory.powerCreeps[creep.name]`.
*
* You can use it for quick access to the creep's specific memory data object.
*/
memory: PowerCreepMemory;
/**
* Whether it is your creep or foe.
*/
my: boolean;
/**
* The power creep name.
*
* You can choose the name while creating a new power creep, and `rename` it while unspawned.
* This name is a hash key to access the creep via the {@link Game.powerCreeps} object.
*/
name: string;
/**
* An object with the creep's owner information.
*/
owner: Owner;
/**
* A Store object that contains cargo of this creep.
*/
store: StoreDefinition;
/**
* An object with the creep's available powers.
*/
powers: PowerCreepPowers;
/**
* The text message that the creep was saying at the last tick.
*/
saying: string;
/**
* The name of the shard where the power creeps is spawned, or undefined.
*/
shard: string | undefined;
/**
* The timestamp when spawning or deleting this creep will become available.
*
* Undefined if the power creep is spawned in the world.
*
* Note: This is a timestamp, not ticks as powerCreeps are not shard dependent.
*/
spawnCooldownTime: number | undefined;
/**
* The remaining amount of game ticks after which the creep will die and become unspawned.
*
* Undefined if the creep is not spawned in the world.
*/
ticksToLive: number | undefined;
/**
* Cancel the order given during the current game tick.
* @param methodName Cancel the order given during the current game tick.
* @returns One of the following codes:
* - OK: The operation has been cancelled successfully.
* - ERR_NOT_OWNER: You are not the owner of the creep.
* - ERR_BUSY: The power creep is not spawned in the world.
* - ERR_NOT_FOUND: The order with the specified name is not found.
*/
cancelOrder(methodName: string): OK | ERR_NOT_OWNER | ERR_BUSY | ERR_NOT_FOUND;
/**
* Delete the power creep permanently from your account.
*
* It should NOT be spawned in the world.
* The creep is not deleted immediately, but a 24-hour delete time is started (see {@link PowerCreep.deleteTime}).
* You can cancel deletion by calling `delete(true)`.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of the creep.
* - ERR_BUSY: The power creep is spawned in the world.
*/
delete(cancel?: boolean): OK | ERR_NOT_OWNER | ERR_BUSY;
/**
* Drop this resource on the ground.
* @param resourceType One of the {@link ResourceConstant RESOURCE_*} constants.
* @param amount The amount of resource units to be dropped. If omitted, all the available carried amount is used.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The power creep is not spawned in the world.
* - ERR_NOT_ENOUGH_RESOURCES: The creep does not have the given amount of energy.
* - ERR_INVALID_ARGS: The resourceType is not a valid {@link ResourceConstant RESOURCE_*} constants.
*/
drop(resourceType: ResourceConstant, amount?: number): OK | ERR_NOT_OWNER | ERR_BUSY | ERR_NOT_ENOUGH_RESOURCES;
/**
* Enable power usage in this room.
*
* The room controller should be at adjacent tile.
* @param controller The room controller
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_INVALID_TARGET: The target is not a controller structure.
* - ERR_NOT_IN_RANGE: The target is too far away.
*/
enableRoom(controller: StructureController): OK | ERR_NOT_OWNER | ERR_INVALID_TARGET | ERR_NOT_IN_RANGE;
/**
* Move the creep one square in the specified direction or towards a creep that is pulling it.
*
* Requires the MOVE body part if not being pulled.
* @param direction The direction to move in ({@link DirectionConstant `TOP`, `TOP_LEFT`...})
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The power creep is not spawned in the world.
* - ERR_NOT_IN_RANGE: The target creep is too far away
* - ERR_INVALID_ARGS: The provided direction is incorrect.
*/
move(direction: DirectionConstant): CreepMoveReturnCode;
move(target: Creep): OK | ERR_NOT_OWNER | ERR_BUSY | ERR_NOT_IN_RANGE | ERR_INVALID_ARGS;
/**
* Move the creep using the specified predefined path.
*
* @param path A path value as returned from {@link Room.findPath} or {@link RoomPosition.findPathTo} methods.
* Both array form and serialized string form are accepted.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The power creep is not spawned in the world.
* - ERR_NOT_FOUND: The specified path doesn't match the creep's location.
* - ERR_INVALID_ARGS: path is not a valid path array.
*/
moveByPath(path: PathStep[] | RoomPosition[] | string): CreepMoveReturnCode | ERR_NOT_FOUND | ERR_INVALID_ARGS;
/**
* Find the optimal path to the target within the same room and move to it.
*
* A shorthand to consequent calls of {@link RoomPosition.findPathTo()} and {@link Creep.move()} methods.
* If the target is in another room, then the corresponding exit will be used as a target.
*
* @param x X position of the target in the room.
* @param y Y position of the target in the room.
* @param target Can be a RoomPosition object or any object containing RoomPosition.
* @param opts An object containing pathfinding options flags (see {@link Room.findPath} for more info) or one of the following: reusePath, serializeMemory, noPathFinding
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_NO_PATH: No path to the target could be found.
* - ERR_BUSY: The power creep is not spawned in the world.
* - ERR_NOT_FOUND: The creep has no memorized path to reuse.
* - ERR_INVALID_TARGET: The target provided is invalid.
*/
moveTo(x: number, y: number, opts?: MoveToOpts): OK | ERR_NOT_OWNER | ERR_NO_PATH | ERR_BUSY | ERR_NOT_FOUND | ERR_INVALID_TARGET;
moveTo(
target: RoomPosition | { pos: RoomPosition },
opts?: MoveToOpts,
): CreepMoveReturnCode | ERR_NO_PATH | ERR_INVALID_TARGET | ERR_NOT_FOUND;
/**
* Toggle auto notification when the creep is under attack.
*
* The notification will be sent to your account email. Turned on by default.
* @param enabled Whether to enable notification or disable.
* * @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The power creep is not spawned in the world.
* - ERR_INVALID_ARGS: enable argument is not a boolean value.
*/
notifyWhenAttacked(enabled: boolean): OK | ERR_NOT_OWNER | ERR_BUSY | ERR_INVALID_ARGS;
/**
* Pick up an item (a dropped piece of energy).
*
* The target has to be at adjacent square to the creep or at the same square.
* @param target The target object to be picked up.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The power creep is not spawned in the world.
* - ERR_INVALID_TARGET: The target is not a valid object to pick up.
* - ERR_FULL: The creep cannot receive any more resource.
* - ERR_NOT_IN_RANGE: The target is too far away.
*/
pickup(target: Resource): CreepActionReturnCode | ERR_FULL;
/**
* Rename the power creep.
*
* It must not be spawned in the world.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of the creep.
* - ERR_NAME_EXISTS: A power creep with the specified name already exists.
* - ERR_BUSY: The power creep is spawned in the world.
*/
rename(name: string): OK | ERR_NOT_OWNER | ERR_NAME_EXISTS | ERR_BUSY;
/**
* Instantly restore time to live to the maximum using a Power Spawn or a Power Bank nearby.
*
* It has to be at adjacent tile.
* @param target The target structure
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The power creep is not spawned in the world.
* - ERR_INVALID_TARGET: The target is not a valid power bank or power spawn.
* - ERR_NOT_IN_RANGE: The target is too far away.
*/
renew(target: StructurePowerBank | StructurePowerSpawn): OK | ERR_NOT_OWNER | ERR_BUSY | ERR_INVALID_TARGET | ERR_NOT_IN_RANGE;
/**
* Display a visual speech balloon above the creep with the specified message.
*
* The message will disappear after a few seconds. Useful for debugging purposes.
*
* Only the creep's owner can see the speech message unless toPublic is true.
* @param message The message to be displayed. Maximum length is 10 characters.
* @param set to 'true' to allow other players to see this message. Default is 'false'.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The power creep is not spawned in the world.
*/
say(message: string, toPublic?: boolean): OK | ERR_NOT_OWNER | ERR_BUSY;
/**
* Spawn this power creep in the specified Power Spawn.
* @param powerSpawn Your Power Spawn structure
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of the creep or the spawn.
* - ERR_BUSY: The power creep is already spawned in the world.
* - ERR_INVALID_TARGET: The specified object is not a Power Spawn.
* - ERR_TIRED: The power creep cannot be spawned because of the cooldown.
* - ERR_RCL_NOT_ENOUGH: Room Controller Level insufficient to use the spawn.
*/
spawn(powerSpawn: StructurePowerSpawn): OK | ERR_NOT_OWNER | ERR_BUSY | ERR_INVALID_TARGET | ERR_TIRED | ERR_RCL_NOT_ENOUGH;
/**
* Kill the power creep immediately.
*
* It will not be destroyed permanently, but will become unspawned, so that you can `spawn` it again.
* @returns One of the following codes:
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The power creep is not spawned in the world.
*/
suicide(): OK | ERR_NOT_OWNER | ERR_BUSY;
/**
* Transfer resource from the creep to another object.
*
* The target has to be at adjacent square to the creep.
* @param target The target object.
* @param resourceType One of the {@link ResourceConstant RESOURCE_*} constants
* @param amount The amount of resources to be transferred. If omitted, all the available carried amount is used.
* @returns
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep.
* - ERR_BUSY: The power creep is not spawned in the world.
* - ERR_NOT_ENOUGH_RESOURCES: The creep does not have the given amount of resources.
* - ERR_INVALID_TARGET: The target is not a valid object which can contain the specified resource.
* - ERR_FULL: The target cannot receive any more resources.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_INVALID_ARGS: The resourceType is not one of the {@link ResourceConstant RESOURCE_*} constants, or the amount is incorrect.
*/
transfer(target: AnyCreep | Structure, resourceType: ResourceConstant, amount?: number): ScreepsReturnCode;
/**
* Upgrade the creep, adding a new power ability to it or increasing the level of the existing power.
*
* You need one free Power Level in your account to perform this action.
* @param power The power ability to upgrade, one of the {@link PowerConstant PWR_*} constants.
* @returns
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of the creep.
* - ERR_NOT_ENOUGH_RESOURCES: You account Power Level is not enough.
* - ERR_FULL: The specified power cannot be upgraded on this creep's level, or the creep reached the maximum level.
* - ERR_INVALID_ARGS: The specified power ID is not valid.
*/
upgrade(power: PowerConstant): OK | ERR_NOT_OWNER | ERR_NOT_ENOUGH_RESOURCES | ERR_FULL | ERR_INVALID_ARGS;
/**
* Apply one of the creep's powers on the specified target.
*
* @param power The power ability to use, one of the {@link PowerConstant PWR_*} constants.
* @param target A target object in the room.
* @returns
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of the creep.
* - ERR_BUSY: The creep is not spawned in the world.
* - ERR_NOT_ENOUGH_RESOURCES: The creep doesn't have enough resources to use the power.
* - ERR_INVALID_TARGET: The specified target is not valid.
* - ERR_FULL: The target has the same active effect of a higher level.
* - ERR_NOT_IN_RANGE: The specified target is too far away.
* - ERR_INVALID_ARGS: Using powers is not enabled on the Room Controller.
* - ERR_TIRED: The power ability is still on cooldown.
* - ERR_NO_BODYPART: The creep doesn't have the specified power ability.
*/
usePower(power: PowerConstant, target?: RoomObject): ScreepsReturnCode;
/**
* Withdraw resources from a structure, tombstone, or ruin.
*
* The target has to be at adjacent square to the creep.
*
* Multiple creeps can withdraw from the same structure in the same tick.
*
* Your creeps can withdraw resources from hostile structures as well, in case if there is no hostile rampart on top of it.
* @param target The target object.
* @param resourceType The target One of the {@link ResourceConstant RESOURCE_*} constants.
* @param amount The amount of resources to be transferred. If omitted, all the available amount is used.
* @returns
* - OK: The operation has been scheduled successfully.
* - ERR_NOT_OWNER: You are not the owner of this creep, or there is a hostile rampart on top of the target.
* - ERR_BUSY: The power creep is not spawned in the world.
* - ERR_NOT_ENOUGH_RESOURCES: The target does not have the given amount of resources.
* - ERR_INVALID_TARGET: The target is not a valid object which can contain the specified resource.
* - ERR_FULL: The creep's carry is full.
* - ERR_NOT_IN_RANGE: The target is too far away.
* - ERR_INVALID_ARGS: The resourceType is not one of the {@link ResourceConstant RESOURCE_*} constants, or the amount is incorrect.
*/
withdraw(target: Structure | Tombstone | Ruin, resourceType: ResourceConstant, amount?: number): ScreepsReturnCode;
}
interface PowerCreepConstructor extends _Constructor<PowerCreep>, _ConstructorById<PowerCreep> {
/**
* A static method to create new Power Creep instance in your account.
*
* It will be added in an unspawned state, use the {@link PowerCreep.spawn} method to spawn it in the world.
*
* You need one free Power Level in your account to perform this action.
*
* @param name The name of the power creep.
* @param className The class of the new power creep, one of the {@link PowerClassConstant POWER_CLASS} constants
*/
create(name: string, className: PowerClassConstant): OK | ERR_NAME_EXISTS | ERR_NOT_ENOUGH_RESOURCES;
}
declare const PowerCreep: PowerCreepConstructor;
/**
* Available powers, an object with power ID as a key, and the following properties
*/
interface PowerCreepPowers {
[powerID: number]: {
/**
* Current level of the power
*/
level: number;
/**
* Cooldown ticks remaining
*
* Will be undefined if the power creep is not spawned in the world.
*/
cooldown: number | undefined;
};
}
/**
* RawMemory object allows to implement your own memory stringifier instead of built-in serializer based on JSON.stringify.
*
* It also allows to request up to 10 MB of additional memory using asynchronous memory segments feature.
*
* You can also access memory segments of other players using methods below.
*/
interface RawMemory {
/**
* An object with asynchronous memory segments available on this tick.
*
* Each object key is the segment ID with data in string values.
* Use {@link RawMemory.setActiveSegments} to fetch segments on the next tick. Segments data is saved automatically in the end of the tick.
*/
segments: { [segmentId: number]: string };
/**
* An object with a memory segment of another player available on this tick. Use {@link RawMemory.setActiveForeignSegment} to fetch segments on the next tick.
*/
foreignSegment: {
username: string;
id: number;
data: string;
};
/**
* @deprecated Use `InterShardMemory` instead.
*
* A string with a shared memory segment available on every world shard. Maximum string length is 100 KB.
*
* **Warning:** this segment is not safe for concurrent usage! All shards have shared access to the same instance of
* data. When the segment contents is changed by two shards simultaneously, you may lose some data, since the segment
* string value is written all at once atomically. You must implement your own system to determine when each shard is
* allowed to rewrite the inter-shard memory, e.g. based on mutual exclusions.
*
*/
interShardSegment: string;
/**
* Get a raw string representation of the Memory object.
*/
get(): string;
/**
* Set new memory value.
* @param value New memory value as a string.
* @throws if the new value is not a string or contains more than `2 * 1024 * 1024` characters.
*/
set(value: string): undefined;
/**
* Request memory segments using the list of their IDs.
*
* Memory segments will become available on the next tick in {@link RawMemory.segments} object.
* Segment IDs are a number from 0 to 99. A maximum of 10 segments can be active at the same time.
* Subsequent calls to {@link RawMemory.setActiveSegments} overrides previous ones.
*
* @param ids An array of segment IDs.
* @throws if `ids` isn't an array, more than 10 segments are active, or the ids aren't all integers.
*/
setActiveSegments(ids: number[]): undefined;
/**
* Request a memory segment of another user.
*
* The segment should be marked by its owner as public using {@link RawMemory.setPublicSegments}.
*
* The segment data will become available on the next tick in {@link foreignSegment} object.
*
* You can only have access to one foreign segment at the same time.
*
* @param username The name of another user. Pass `null` to clear the foreign segment.
* @param id The ID of the requested segment from 0 to 99. If undefined, the user's default public segment is requested as set by {@link RawMemory.setDefaultPublicSegment}.
* @throws if `id` is passed and isn't an integer.
*/
setActiveForeignSegment(username: string | null, id?: number): undefined;
/**
* Set the specified segment as your default public segment.
*
* It will be returned if no id parameter is passed to {@link RawMemory.setActiveForeignSegment} by another user.
*
* @param id The ID of the requested segment from 0 to 99. Pass `null` to clear the foreign segment.
* @throws if `id` is passed and isn't an integer.
*/
setDefaultPublicSegment(id: number | null): undefined;
/**
* Set specified segments as public.
*
* Other users will be able to request access to them using {@link setActiveForeignSegment}.
*
* @param ids An array of segment IDs. Each ID should be a number from 0 to 99. Subsequent calls of {@link RawMemory.setPublicSegments} override previous ones.
* @throws if `ids` isn't an array or the ids aren't all integers.
*/
setPublicSegments(ids: number[]): undefined;
}
declare const RawMemory: RawMemory;
/**
* A dropped piece of resource.
*
* It will decay after a while if not picked up.
* Dropped resource pile decays for `ceil(amount/1000)` units per tick.
*/
interface Resource<T extends ResourceConstant = ResourceConstant> extends RoomObject {
readonly prototype: Resource;
/**
* The amount of resource units containing.
*/
amount: number;
/**
* A unique object identifier.
*
* You
gitextract_o_a42e6b/ ├── .editorconfig ├── .gitattributes ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug-report.md │ │ └── definition-changes.md │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows/ │ └── CI.yml ├── .gitignore ├── .husky/ │ └── pre-commit ├── .npmignore ├── .prettierrc ├── .vscode/ │ ├── extensions.json │ └── settings.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── build/ │ └── concat.js ├── dist/ │ ├── .eslintrc.json │ ├── .npmignore │ ├── index.d.ts │ ├── package.json │ ├── screeps-tests.ts │ └── tsconfig.json ├── eslint.config.mjs ├── eslint.config.test.mjs ├── package.json ├── src/ │ ├── constants.ts │ ├── construction-site.ts │ ├── creep.ts │ ├── deposit.ts │ ├── flag.ts │ ├── game.ts │ ├── helpers.ts │ ├── inter-shard-memory.ts │ ├── literals.ts │ ├── map.ts │ ├── market.ts │ ├── memory.ts │ ├── mineral.ts │ ├── nuke.ts │ ├── path-finder.ts │ ├── power-creep.ts │ ├── raw-memory.ts │ ├── resource.ts │ ├── room-object.ts │ ├── room-position.ts │ ├── room-terrain.ts │ ├── room-visual.ts │ ├── room.ts │ ├── ruin.ts │ ├── source.ts │ ├── spawn.ts │ ├── store.ts │ ├── structure.ts │ └── tombstone.ts └── tsconfig.json
SYMBOL INDEX (910 symbols across 32 files)
FILE: build/concat.js
constant HEADER (line 4) | const HEADER = `// Please contribute types to https://github.com/screepe...
FILE: dist/index.d.ts
type CommoditiesTypes (line 732) | type CommoditiesTypes = CommodityConstant | MineralConstant | RESOURCE_G...
type CommodityEntry (line 733) | interface CommodityEntry {
type ConstructionSite (line 1040) | interface ConstructionSite<T extends BuildableStructureConstant = Builda...
type ConstructionSiteConstructor (line 1075) | interface ConstructionSiteConstructor extends _Constructor<ConstructionS...
type Creep (line 1105) | interface Creep extends RoomObject {
type CreepConstructor (line 1635) | interface CreepConstructor extends _Constructor<Creep>, _ConstructorById...
type Deposit (line 1650) | interface Deposit extends RoomObject {
type DepositConstructor (line 1679) | interface DepositConstructor extends _Constructor<Deposit>, _Constructor...
type Flag (line 1687) | interface Flag extends RoomObject {
type FlagConstructor (line 1745) | interface FlagConstructor extends _Constructor<Flag> {
type Game (line 1754) | interface Game {
type _HasId (line 1868) | interface _HasId {
type _HasRoomPosition (line 1872) | interface _HasRoomPosition {
type GlobalControlLevel (line 1876) | interface GlobalControlLevel {
type GlobalPowerLevel (line 1891) | interface GlobalPowerLevel {
type Shard (line 1906) | interface Shard {
type CPU (line 1946) | interface CPU {
type HeapStatistics (line 2042) | interface HeapStatistics {
type BodyPartDefinition (line 2058) | type BodyPartDefinition<T extends BodyPartConstant = BodyPartConstant> =...
type Owner (line 2077) | interface Owner {
type ReservationDefinition (line 2083) | interface ReservationDefinition {
type SignDefinition (line 2087) | interface SignDefinition {
type CPUShardLimits (line 2094) | interface CPUShardLimits {
type StoreDefinition (line 2099) | type StoreDefinition = Store<ResourceConstant, false>;
type StoreDefinitionUnlimited (line 2102) | type StoreDefinitionUnlimited = Store<ResourceConstant, true>;
type ExitsInformation (line 2113) | type ExitsInformation = Partial<Record<ExitKey, string>>;
type AllLookAtTypes (line 2115) | interface AllLookAtTypes {
type LookAtTypes (line 2132) | type LookAtTypes = Partial<AllLookAtTypes>;
type LookAtResult (line 2134) | type LookAtResult<K extends LookConstant = LookConstant> = Pick<LookAtTy...
type LookAtResultWithPos (line 2136) | type LookAtResultWithPos<K extends LookConstant = LookConstant> = LookAt...
type LookAtResultMatrix (line 2141) | interface LookAtResultMatrix<K extends LookConstant = LookConstant> {
type LookForAtAreaResultMatrix (line 2147) | interface LookForAtAreaResultMatrix<T> {
type LookForAtAreaResult (line 2153) | type LookForAtAreaResult<T, K extends keyof LookAtTypes = keyof LookAtTy...
type LookForAtAreaResultWithPos (line 2155) | type LookForAtAreaResultWithPos<T, K extends keyof LookAtTypes = keyof L...
type LookForAtAreaResultArray (line 2157) | type LookForAtAreaResultArray<T, K extends keyof LookAtTypes = keyof Loo...
type FindTypes (line 2159) | interface FindTypes {
type FindPathOpts (line 2203) | interface FindPathOpts {
type MoveToOpts (line 2310) | interface MoveToOpts extends FindPathOpts {
type PathStep (line 2346) | interface PathStep {
type _Constructor (line 2354) | interface _Constructor<T> {
type _ConstructorById (line 2358) | interface _ConstructorById<T extends _HasId> extends _Constructor<T> {
class OpaqueTag (line 2366) | class OpaqueTag<T> {
type Id (line 2371) | type Id<T extends _HasId> = string & Tag.OpaqueTag<T>;
type fromId (line 2373) | type fromId<T> = T extends Id<infer R> ? R : never;
type InterShardMemory (line 2385) | interface InterShardMemory {
type Terrain (line 2414) | type Terrain = "plain" | "swamp" | "wall";
type ExitKey (line 2416) | type ExitKey = "1" | "3" | "5" | "7";
type AnyCreep (line 2418) | type AnyCreep = Creep | PowerCreep;
type FindClosestByPathAlgorithm (line 2420) | type FindClosestByPathAlgorithm = "astar" | "dijkstra";
type ScreepsReturnCode (line 2424) | type ScreepsReturnCode =
type OK (line 2443) | type OK = 0;
type ERR_NOT_OWNER (line 2444) | type ERR_NOT_OWNER = -1;
type ERR_NO_PATH (line 2445) | type ERR_NO_PATH = -2;
type ERR_NAME_EXISTS (line 2446) | type ERR_NAME_EXISTS = -3;
type ERR_BUSY (line 2447) | type ERR_BUSY = -4;
type ERR_NOT_FOUND (line 2448) | type ERR_NOT_FOUND = -5;
type ERR_NOT_ENOUGH_RESOURCES (line 2449) | type ERR_NOT_ENOUGH_RESOURCES = -6;
type ERR_NOT_ENOUGH_ENERGY (line 2450) | type ERR_NOT_ENOUGH_ENERGY = -6;
type ERR_INVALID_TARGET (line 2451) | type ERR_INVALID_TARGET = -7;
type ERR_FULL (line 2452) | type ERR_FULL = -8;
type ERR_NOT_IN_RANGE (line 2453) | type ERR_NOT_IN_RANGE = -9;
type ERR_INVALID_ARGS (line 2454) | type ERR_INVALID_ARGS = -10;
type ERR_TIRED (line 2455) | type ERR_TIRED = -11;
type ERR_NO_BODYPART (line 2456) | type ERR_NO_BODYPART = -12;
type ERR_NOT_ENOUGH_EXTENSIONS (line 2457) | type ERR_NOT_ENOUGH_EXTENSIONS = -6;
type ERR_RCL_NOT_ENOUGH (line 2458) | type ERR_RCL_NOT_ENOUGH = -14;
type ERR_GCL_NOT_ENOUGH (line 2459) | type ERR_GCL_NOT_ENOUGH = -15;
type ERR_ACCESS_DENIED (line 2460) | type ERR_ACCESS_DENIED = -16;
type CreepActionReturnCode (line 2462) | type CreepActionReturnCode = OK | ERR_NOT_OWNER | ERR_BUSY | ERR_INVALID...
type CreepMoveReturnCode (line 2464) | type CreepMoveReturnCode = OK | ERR_NOT_OWNER | ERR_BUSY | ERR_TIRED | E...
type ExitConstant (line 2468) | type ExitConstant = FIND_EXIT_TOP | FIND_EXIT_RIGHT | FIND_EXIT_BOTTOM |...
type FindConstant (line 2470) | type FindConstant =
type FIND_EXIT_TOP (line 2500) | type FIND_EXIT_TOP = 1;
type FIND_EXIT_RIGHT (line 2501) | type FIND_EXIT_RIGHT = 3;
type FIND_EXIT_BOTTOM (line 2502) | type FIND_EXIT_BOTTOM = 5;
type FIND_EXIT_LEFT (line 2503) | type FIND_EXIT_LEFT = 7;
type FIND_EXIT (line 2504) | type FIND_EXIT = 10;
type FIND_CREEPS (line 2505) | type FIND_CREEPS = 101;
type FIND_MY_CREEPS (line 2506) | type FIND_MY_CREEPS = 102;
type FIND_HOSTILE_CREEPS (line 2507) | type FIND_HOSTILE_CREEPS = 103;
type FIND_SOURCES_ACTIVE (line 2508) | type FIND_SOURCES_ACTIVE = 104;
type FIND_SOURCES (line 2509) | type FIND_SOURCES = 105;
type FIND_DROPPED_RESOURCES (line 2510) | type FIND_DROPPED_RESOURCES = 106;
type FIND_STRUCTURES (line 2511) | type FIND_STRUCTURES = 107;
type FIND_MY_STRUCTURES (line 2512) | type FIND_MY_STRUCTURES = 108;
type FIND_HOSTILE_STRUCTURES (line 2513) | type FIND_HOSTILE_STRUCTURES = 109;
type FIND_FLAGS (line 2514) | type FIND_FLAGS = 110;
type FIND_CONSTRUCTION_SITES (line 2515) | type FIND_CONSTRUCTION_SITES = 111;
type FIND_MY_SPAWNS (line 2516) | type FIND_MY_SPAWNS = 112;
type FIND_HOSTILE_SPAWNS (line 2517) | type FIND_HOSTILE_SPAWNS = 113;
type FIND_MY_CONSTRUCTION_SITES (line 2518) | type FIND_MY_CONSTRUCTION_SITES = 114;
type FIND_HOSTILE_CONSTRUCTION_SITES (line 2519) | type FIND_HOSTILE_CONSTRUCTION_SITES = 115;
type FIND_MINERALS (line 2520) | type FIND_MINERALS = 116;
type FIND_NUKES (line 2521) | type FIND_NUKES = 117;
type FIND_TOMBSTONES (line 2522) | type FIND_TOMBSTONES = 118;
type FIND_POWER_CREEPS (line 2523) | type FIND_POWER_CREEPS = 119;
type FIND_MY_POWER_CREEPS (line 2524) | type FIND_MY_POWER_CREEPS = 120;
type FIND_HOSTILE_POWER_CREEPS (line 2525) | type FIND_HOSTILE_POWER_CREEPS = 121;
type FIND_DEPOSITS (line 2526) | type FIND_DEPOSITS = 122;
type FIND_RUINS (line 2527) | type FIND_RUINS = 123;
type FilterOptions (line 2531) | interface FilterOptions<T, S extends T> {
type PredicateFilterFunction (line 2535) | type PredicateFilterFunction<T, S extends T> = (object: T, index: number...
type FilterFunction (line 2536) | type FilterFunction<T> = (object: T, index: number, collection: T[]) => ...
type FilterObject (line 2537) | type FilterObject<T> = DeepPartial<T>;
type DeepPartial (line 2539) | type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<...
type BodyPartConstant (line 2543) | type BodyPartConstant = MOVE | WORK | CARRY | ATTACK | RANGED_ATTACK | T...
type MOVE (line 2545) | type MOVE = "move";
type WORK (line 2546) | type WORK = "work";
type CARRY (line 2547) | type CARRY = "carry";
type ATTACK (line 2548) | type ATTACK = "attack";
type RANGED_ATTACK (line 2549) | type RANGED_ATTACK = "ranged_attack";
type TOUGH (line 2550) | type TOUGH = "tough";
type HEAL (line 2551) | type HEAL = "heal";
type CLAIM (line 2552) | type CLAIM = "claim";
type LookConstant (line 2556) | type LookConstant =
type LOOK_CONSTRUCTION_SITES (line 2572) | type LOOK_CONSTRUCTION_SITES = "constructionSite";
type LOOK_CREEPS (line 2573) | type LOOK_CREEPS = "creep";
type LOOK_ENERGY (line 2574) | type LOOK_ENERGY = "energy";
type LOOK_FLAGS (line 2575) | type LOOK_FLAGS = "flag";
type LOOK_MINERALS (line 2576) | type LOOK_MINERALS = "mineral";
type LOOK_DEPOSITS (line 2577) | type LOOK_DEPOSITS = "deposit";
type LOOK_NUKES (line 2578) | type LOOK_NUKES = "nuke";
type LOOK_RESOURCES (line 2579) | type LOOK_RESOURCES = "resource";
type LOOK_SOURCES (line 2580) | type LOOK_SOURCES = "source";
type LOOK_STRUCTURES (line 2581) | type LOOK_STRUCTURES = "structure";
type LOOK_TERRAIN (line 2582) | type LOOK_TERRAIN = "terrain";
type LOOK_TOMBSTONES (line 2583) | type LOOK_TOMBSTONES = "tombstone";
type LOOK_POWER_CREEPS (line 2584) | type LOOK_POWER_CREEPS = "powerCreep";
type LOOK_RUINS (line 2585) | type LOOK_RUINS = "ruin";
type ORDER_SELL (line 2587) | type ORDER_SELL = "sell";
type ORDER_BUY (line 2588) | type ORDER_BUY = "buy";
type DirectionConstant (line 2592) | type DirectionConstant = TOP | TOP_RIGHT | RIGHT | BOTTOM_RIGHT | BOTTOM...
type TOP (line 2594) | type TOP = 1;
type TOP_RIGHT (line 2595) | type TOP_RIGHT = 2;
type RIGHT (line 2596) | type RIGHT = 3;
type BOTTOM_RIGHT (line 2597) | type BOTTOM_RIGHT = 4;
type BOTTOM (line 2598) | type BOTTOM = 5;
type BOTTOM_LEFT (line 2599) | type BOTTOM_LEFT = 6;
type LEFT (line 2600) | type LEFT = 7;
type TOP_LEFT (line 2601) | type TOP_LEFT = 8;
type ColorConstant (line 2605) | type ColorConstant =
type COLOR_RED (line 2617) | type COLOR_RED = 1;
type COLOR_PURPLE (line 2618) | type COLOR_PURPLE = 2;
type COLOR_BLUE (line 2619) | type COLOR_BLUE = 3;
type COLOR_CYAN (line 2620) | type COLOR_CYAN = 4;
type COLOR_GREEN (line 2621) | type COLOR_GREEN = 5;
type COLOR_YELLOW (line 2622) | type COLOR_YELLOW = 6;
type COLOR_ORANGE (line 2623) | type COLOR_ORANGE = 7;
type COLOR_BROWN (line 2624) | type COLOR_BROWN = 8;
type COLOR_GREY (line 2625) | type COLOR_GREY = 9;
type COLOR_WHITE (line 2626) | type COLOR_WHITE = 10;
type BuildableStructureConstant (line 2630) | type BuildableStructureConstant =
type StructureConstant (line 2648) | type StructureConstant =
type STRUCTURE_EXTENSION (line 2656) | type STRUCTURE_EXTENSION = "extension";
type STRUCTURE_RAMPART (line 2657) | type STRUCTURE_RAMPART = "rampart";
type STRUCTURE_ROAD (line 2658) | type STRUCTURE_ROAD = "road";
type STRUCTURE_SPAWN (line 2659) | type STRUCTURE_SPAWN = "spawn";
type STRUCTURE_LINK (line 2660) | type STRUCTURE_LINK = "link";
type STRUCTURE_WALL (line 2661) | type STRUCTURE_WALL = "constructedWall";
type STRUCTURE_KEEPER_LAIR (line 2662) | type STRUCTURE_KEEPER_LAIR = "keeperLair";
type STRUCTURE_CONTROLLER (line 2663) | type STRUCTURE_CONTROLLER = "controller";
type STRUCTURE_STORAGE (line 2664) | type STRUCTURE_STORAGE = "storage";
type STRUCTURE_TOWER (line 2665) | type STRUCTURE_TOWER = "tower";
type STRUCTURE_OBSERVER (line 2666) | type STRUCTURE_OBSERVER = "observer";
type STRUCTURE_POWER_BANK (line 2667) | type STRUCTURE_POWER_BANK = "powerBank";
type STRUCTURE_POWER_SPAWN (line 2668) | type STRUCTURE_POWER_SPAWN = "powerSpawn";
type STRUCTURE_EXTRACTOR (line 2669) | type STRUCTURE_EXTRACTOR = "extractor";
type STRUCTURE_LAB (line 2670) | type STRUCTURE_LAB = "lab";
type STRUCTURE_TERMINAL (line 2671) | type STRUCTURE_TERMINAL = "terminal";
type STRUCTURE_CONTAINER (line 2672) | type STRUCTURE_CONTAINER = "container";
type STRUCTURE_NUKER (line 2673) | type STRUCTURE_NUKER = "nuker";
type STRUCTURE_FACTORY (line 2674) | type STRUCTURE_FACTORY = "factory";
type STRUCTURE_INVADER_CORE (line 2675) | type STRUCTURE_INVADER_CORE = "invaderCore";
type STRUCTURE_PORTAL (line 2676) | type STRUCTURE_PORTAL = "portal";
type TERRAIN_MASK_WALL (line 2679) | type TERRAIN_MASK_WALL = 1;
type TERRAIN_MASK_SWAMP (line 2680) | type TERRAIN_MASK_SWAMP = 2;
type TERRAIN_MASK_LAVA (line 2681) | type TERRAIN_MASK_LAVA = 4;
type ResourceConstant (line 2685) | type ResourceConstant =
type _ResourceConstantSansEnergy (line 2694) | type _ResourceConstantSansEnergy = Exclude<ResourceConstant, RESOURCE_EN...
type MineralConstant (line 2697) | type MineralConstant =
type MineralBaseCompoundsConstant (line 2707) | type MineralBaseCompoundsConstant = RESOURCE_HYDROXIDE | RESOURCE_ZYNTHI...
type MineralBoostConstant (line 2710) | type MineralBoostConstant =
type MineralCompoundConstant (line 2743) | type MineralCompoundConstant = MineralBaseCompoundsConstant | MineralBoo...
type DepositConstant (line 2746) | type DepositConstant = RESOURCE_MIST | RESOURCE_BIOMASS | RESOURCE_METAL...
type CommodityConstant (line 2749) | type CommodityConstant =
type InterShardResourceConstant (line 2787) | type InterShardResourceConstant = SUBSCRIPTION_TOKEN | CPU_UNLOCK | PIXE...
type MarketResourceConstant (line 2788) | type MarketResourceConstant = ResourceConstant | InterShardResourceConst...
type RESOURCE_ENERGY (line 2790) | type RESOURCE_ENERGY = "energy";
type RESOURCE_POWER (line 2791) | type RESOURCE_POWER = "power";
type RESOURCE_OPS (line 2792) | type RESOURCE_OPS = "ops";
type RESOURCE_BIOMASS (line 2794) | type RESOURCE_BIOMASS = "biomass";
type RESOURCE_METAL (line 2795) | type RESOURCE_METAL = "metal";
type RESOURCE_MIST (line 2796) | type RESOURCE_MIST = "mist";
type RESOURCE_SILICON (line 2797) | type RESOURCE_SILICON = "silicon";
type RESOURCE_UTRIUM (line 2799) | type RESOURCE_UTRIUM = "U";
type RESOURCE_LEMERGIUM (line 2800) | type RESOURCE_LEMERGIUM = "L";
type RESOURCE_KEANIUM (line 2801) | type RESOURCE_KEANIUM = "K";
type RESOURCE_ZYNTHIUM (line 2802) | type RESOURCE_ZYNTHIUM = "Z";
type RESOURCE_OXYGEN (line 2803) | type RESOURCE_OXYGEN = "O";
type RESOURCE_HYDROGEN (line 2804) | type RESOURCE_HYDROGEN = "H";
type RESOURCE_CATALYST (line 2805) | type RESOURCE_CATALYST = "X";
type RESOURCE_HYDROXIDE (line 2807) | type RESOURCE_HYDROXIDE = "OH";
type RESOURCE_ZYNTHIUM_KEANITE (line 2808) | type RESOURCE_ZYNTHIUM_KEANITE = "ZK";
type RESOURCE_UTRIUM_LEMERGITE (line 2809) | type RESOURCE_UTRIUM_LEMERGITE = "UL";
type RESOURCE_GHODIUM (line 2810) | type RESOURCE_GHODIUM = "G";
type RESOURCE_UTRIUM_HYDRIDE (line 2812) | type RESOURCE_UTRIUM_HYDRIDE = "UH";
type RESOURCE_UTRIUM_OXIDE (line 2813) | type RESOURCE_UTRIUM_OXIDE = "UO";
type RESOURCE_KEANIUM_HYDRIDE (line 2814) | type RESOURCE_KEANIUM_HYDRIDE = "KH";
type RESOURCE_KEANIUM_OXIDE (line 2815) | type RESOURCE_KEANIUM_OXIDE = "KO";
type RESOURCE_LEMERGIUM_HYDRIDE (line 2816) | type RESOURCE_LEMERGIUM_HYDRIDE = "LH";
type RESOURCE_LEMERGIUM_OXIDE (line 2817) | type RESOURCE_LEMERGIUM_OXIDE = "LO";
type RESOURCE_ZYNTHIUM_HYDRIDE (line 2818) | type RESOURCE_ZYNTHIUM_HYDRIDE = "ZH";
type RESOURCE_ZYNTHIUM_OXIDE (line 2819) | type RESOURCE_ZYNTHIUM_OXIDE = "ZO";
type RESOURCE_GHODIUM_HYDRIDE (line 2820) | type RESOURCE_GHODIUM_HYDRIDE = "GH";
type RESOURCE_GHODIUM_OXIDE (line 2821) | type RESOURCE_GHODIUM_OXIDE = "GO";
type RESOURCE_UTRIUM_ACID (line 2823) | type RESOURCE_UTRIUM_ACID = "UH2O";
type RESOURCE_UTRIUM_ALKALIDE (line 2824) | type RESOURCE_UTRIUM_ALKALIDE = "UHO2";
type RESOURCE_KEANIUM_ACID (line 2825) | type RESOURCE_KEANIUM_ACID = "KH2O";
type RESOURCE_KEANIUM_ALKALIDE (line 2826) | type RESOURCE_KEANIUM_ALKALIDE = "KHO2";
type RESOURCE_LEMERGIUM_ACID (line 2827) | type RESOURCE_LEMERGIUM_ACID = "LH2O";
type RESOURCE_LEMERGIUM_ALKALIDE (line 2828) | type RESOURCE_LEMERGIUM_ALKALIDE = "LHO2";
type RESOURCE_ZYNTHIUM_ACID (line 2829) | type RESOURCE_ZYNTHIUM_ACID = "ZH2O";
type RESOURCE_ZYNTHIUM_ALKALIDE (line 2830) | type RESOURCE_ZYNTHIUM_ALKALIDE = "ZHO2";
type RESOURCE_GHODIUM_ACID (line 2831) | type RESOURCE_GHODIUM_ACID = "GH2O";
type RESOURCE_GHODIUM_ALKALIDE (line 2832) | type RESOURCE_GHODIUM_ALKALIDE = "GHO2";
type RESOURCE_CATALYZED_UTRIUM_ACID (line 2834) | type RESOURCE_CATALYZED_UTRIUM_ACID = "XUH2O";
type RESOURCE_CATALYZED_UTRIUM_ALKALIDE (line 2835) | type RESOURCE_CATALYZED_UTRIUM_ALKALIDE = "XUHO2";
type RESOURCE_CATALYZED_KEANIUM_ACID (line 2836) | type RESOURCE_CATALYZED_KEANIUM_ACID = "XKH2O";
type RESOURCE_CATALYZED_KEANIUM_ALKALIDE (line 2837) | type RESOURCE_CATALYZED_KEANIUM_ALKALIDE = "XKHO2";
type RESOURCE_CATALYZED_LEMERGIUM_ACID (line 2838) | type RESOURCE_CATALYZED_LEMERGIUM_ACID = "XLH2O";
type RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE (line 2839) | type RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE = "XLHO2";
type RESOURCE_CATALYZED_ZYNTHIUM_ACID (line 2840) | type RESOURCE_CATALYZED_ZYNTHIUM_ACID = "XZH2O";
type RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE (line 2841) | type RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE = "XZHO2";
type RESOURCE_CATALYZED_GHODIUM_ACID (line 2842) | type RESOURCE_CATALYZED_GHODIUM_ACID = "XGH2O";
type RESOURCE_CATALYZED_GHODIUM_ALKALIDE (line 2843) | type RESOURCE_CATALYZED_GHODIUM_ALKALIDE = "XGHO2";
type RESOURCE_UTRIUM_BAR (line 2845) | type RESOURCE_UTRIUM_BAR = "utrium_bar";
type RESOURCE_LEMERGIUM_BAR (line 2846) | type RESOURCE_LEMERGIUM_BAR = "lemergium_bar";
type RESOURCE_ZYNTHIUM_BAR (line 2847) | type RESOURCE_ZYNTHIUM_BAR = "zynthium_bar";
type RESOURCE_KEANIUM_BAR (line 2848) | type RESOURCE_KEANIUM_BAR = "keanium_bar";
type RESOURCE_GHODIUM_MELT (line 2849) | type RESOURCE_GHODIUM_MELT = "ghodium_melt";
type RESOURCE_OXIDANT (line 2850) | type RESOURCE_OXIDANT = "oxidant";
type RESOURCE_REDUCTANT (line 2851) | type RESOURCE_REDUCTANT = "reductant";
type RESOURCE_PURIFIER (line 2852) | type RESOURCE_PURIFIER = "purifier";
type RESOURCE_BATTERY (line 2853) | type RESOURCE_BATTERY = "battery";
type RESOURCE_COMPOSITE (line 2855) | type RESOURCE_COMPOSITE = "composite";
type RESOURCE_CRYSTAL (line 2856) | type RESOURCE_CRYSTAL = "crystal";
type RESOURCE_LIQUID (line 2857) | type RESOURCE_LIQUID = "liquid";
type RESOURCE_WIRE (line 2859) | type RESOURCE_WIRE = "wire";
type RESOURCE_SWITCH (line 2860) | type RESOURCE_SWITCH = "switch";
type RESOURCE_TRANSISTOR (line 2861) | type RESOURCE_TRANSISTOR = "transistor";
type RESOURCE_MICROCHIP (line 2862) | type RESOURCE_MICROCHIP = "microchip";
type RESOURCE_CIRCUIT (line 2863) | type RESOURCE_CIRCUIT = "circuit";
type RESOURCE_DEVICE (line 2864) | type RESOURCE_DEVICE = "device";
type RESOURCE_CELL (line 2866) | type RESOURCE_CELL = "cell";
type RESOURCE_PHLEGM (line 2867) | type RESOURCE_PHLEGM = "phlegm";
type RESOURCE_TISSUE (line 2868) | type RESOURCE_TISSUE = "tissue";
type RESOURCE_MUSCLE (line 2869) | type RESOURCE_MUSCLE = "muscle";
type RESOURCE_ORGANOID (line 2870) | type RESOURCE_ORGANOID = "organoid";
type RESOURCE_ORGANISM (line 2871) | type RESOURCE_ORGANISM = "organism";
type RESOURCE_ALLOY (line 2873) | type RESOURCE_ALLOY = "alloy";
type RESOURCE_TUBE (line 2874) | type RESOURCE_TUBE = "tube";
type RESOURCE_FIXTURES (line 2875) | type RESOURCE_FIXTURES = "fixtures";
type RESOURCE_FRAME (line 2876) | type RESOURCE_FRAME = "frame";
type RESOURCE_HYDRAULICS (line 2877) | type RESOURCE_HYDRAULICS = "hydraulics";
type RESOURCE_MACHINE (line 2878) | type RESOURCE_MACHINE = "machine";
type RESOURCE_CONDENSATE (line 2880) | type RESOURCE_CONDENSATE = "condensate";
type RESOURCE_CONCENTRATE (line 2881) | type RESOURCE_CONCENTRATE = "concentrate";
type RESOURCE_EXTRACT (line 2882) | type RESOURCE_EXTRACT = "extract";
type RESOURCE_SPIRIT (line 2883) | type RESOURCE_SPIRIT = "spirit";
type RESOURCE_EMANATION (line 2884) | type RESOURCE_EMANATION = "emanation";
type RESOURCE_ESSENCE (line 2885) | type RESOURCE_ESSENCE = "essence";
type SUBSCRIPTION_TOKEN (line 2887) | type SUBSCRIPTION_TOKEN = "token";
type CPU_UNLOCK (line 2888) | type CPU_UNLOCK = "cpuUnlock";
type PIXEL (line 2889) | type PIXEL = "pixel";
type ACCESS_KEY (line 2890) | type ACCESS_KEY = "accessKey";
type TOMBSTONE_DECAY_PER_PART (line 2892) | type TOMBSTONE_DECAY_PER_PART = 5;
type EventConstant (line 2894) | type EventConstant =
type EVENT_ATTACK (line 2908) | type EVENT_ATTACK = 1;
type EVENT_OBJECT_DESTROYED (line 2909) | type EVENT_OBJECT_DESTROYED = 2;
type EVENT_ATTACK_CONTROLLER (line 2910) | type EVENT_ATTACK_CONTROLLER = 3;
type EVENT_BUILD (line 2911) | type EVENT_BUILD = 4;
type EVENT_HARVEST (line 2912) | type EVENT_HARVEST = 5;
type EVENT_HEAL (line 2913) | type EVENT_HEAL = 6;
type EVENT_REPAIR (line 2914) | type EVENT_REPAIR = 7;
type EVENT_RESERVE_CONTROLLER (line 2915) | type EVENT_RESERVE_CONTROLLER = 8;
type EVENT_UPGRADE_CONTROLLER (line 2916) | type EVENT_UPGRADE_CONTROLLER = 9;
type EVENT_EXIT (line 2917) | type EVENT_EXIT = 10;
type EVENT_POWER (line 2918) | type EVENT_POWER = 11;
type EVENT_TRANSFER (line 2919) | type EVENT_TRANSFER = 12;
type EventAttackType (line 2921) | type EventAttackType =
type EVENT_ATTACK_TYPE_MELEE (line 2929) | type EVENT_ATTACK_TYPE_MELEE = 1;
type EVENT_ATTACK_TYPE_RANGED (line 2930) | type EVENT_ATTACK_TYPE_RANGED = 2;
type EVENT_ATTACK_TYPE_RANGED_MASS (line 2931) | type EVENT_ATTACK_TYPE_RANGED_MASS = 3;
type EVENT_ATTACK_TYPE_DISMANTLE (line 2932) | type EVENT_ATTACK_TYPE_DISMANTLE = 4;
type EVENT_ATTACK_TYPE_HIT_BACK (line 2933) | type EVENT_ATTACK_TYPE_HIT_BACK = 5;
type EVENT_ATTACK_TYPE_NUKE (line 2934) | type EVENT_ATTACK_TYPE_NUKE = 6;
type EventHealType (line 2936) | type EventHealType = EVENT_HEAL_TYPE_MELEE | EVENT_HEAL_TYPE_RANGED;
type EVENT_HEAL_TYPE_MELEE (line 2938) | type EVENT_HEAL_TYPE_MELEE = 1;
type EVENT_HEAL_TYPE_RANGED (line 2939) | type EVENT_HEAL_TYPE_RANGED = 2;
type EventDestroyType (line 2941) | type EventDestroyType = "creep" | StructureConstant;
type EventItem (line 2943) | type EventItem =
type EventData (line 3005) | interface EventData {
type PowerClassConstant (line 3060) | type PowerClassConstant = POWER_CLASS["OPERATOR"];
type POWER_CLASS (line 3062) | interface POWER_CLASS {
type PowerConstant (line 3066) | type PowerConstant =
type PWR_GENERATE_OPS (line 3087) | type PWR_GENERATE_OPS = 1;
type PWR_OPERATE_SPAWN (line 3088) | type PWR_OPERATE_SPAWN = 2;
type PWR_OPERATE_TOWER (line 3089) | type PWR_OPERATE_TOWER = 3;
type PWR_OPERATE_STORAGE (line 3090) | type PWR_OPERATE_STORAGE = 4;
type PWR_OPERATE_LAB (line 3091) | type PWR_OPERATE_LAB = 5;
type PWR_OPERATE_EXTENSION (line 3092) | type PWR_OPERATE_EXTENSION = 6;
type PWR_OPERATE_OBSERVER (line 3093) | type PWR_OPERATE_OBSERVER = 7;
type PWR_OPERATE_TERMINAL (line 3094) | type PWR_OPERATE_TERMINAL = 8;
type PWR_DISRUPT_SPAWN (line 3095) | type PWR_DISRUPT_SPAWN = 9;
type PWR_DISRUPT_TOWER (line 3096) | type PWR_DISRUPT_TOWER = 10;
type PWR_DISRUPT_SOURCE (line 3097) | type PWR_DISRUPT_SOURCE = 11;
type PWR_SHIELD (line 3098) | type PWR_SHIELD = 12;
type PWR_REGEN_SOURCE (line 3099) | type PWR_REGEN_SOURCE = 13;
type PWR_REGEN_MINERAL (line 3100) | type PWR_REGEN_MINERAL = 14;
type PWR_DISRUPT_TERMINAL (line 3101) | type PWR_DISRUPT_TERMINAL = 15;
type PWR_OPERATE_POWER (line 3102) | type PWR_OPERATE_POWER = 16;
type PWR_FORTIFY (line 3103) | type PWR_FORTIFY = 17;
type PWR_OPERATE_CONTROLLER (line 3104) | type PWR_OPERATE_CONTROLLER = 18;
type PWR_OPERATE_FACTORY (line 3105) | type PWR_OPERATE_FACTORY = 19;
type EffectConstant (line 3107) | type EffectConstant = EFFECT_INVULNERABILITY | EFFECT_COLLAPSE_TIMER;
type EFFECT_INVULNERABILITY (line 3109) | type EFFECT_INVULNERABILITY = 1001;
type EFFECT_COLLAPSE_TIMER (line 3110) | type EFFECT_COLLAPSE_TIMER = 1002;
type DENSITY_LOW (line 3112) | type DENSITY_LOW = 1;
type DENSITY_MODERATE (line 3113) | type DENSITY_MODERATE = 2;
type DENSITY_HIGH (line 3114) | type DENSITY_HIGH = 3;
type DENSITY_ULTRA (line 3115) | type DENSITY_ULTRA = 4;
type DensityConstant (line 3117) | type DensityConstant = DENSITY_LOW | DENSITY_MODERATE | DENSITY_HIGH | D...
type RouteOptions (line 3121) | interface RouteOptions {
type RoomStatusPermanent (line 3132) | interface RoomStatusPermanent {
type RoomStatusTemporary (line 3137) | interface RoomStatusTemporary {
type RoomStatus (line 3142) | type RoomStatus = RoomStatusPermanent | RoomStatusTemporary;
type GameMap (line 3149) | interface GameMap {
type MapVisual (line 3258) | interface MapVisual {
type MapLineStyle (line 3331) | interface MapLineStyle {
type MapPolyStyle (line 3354) | interface MapPolyStyle {
type MapCircleStyle (line 3382) | interface MapCircleStyle extends MapPolyStyle {
type MapTextStyle (line 3390) | interface MapTextStyle {
type Market (line 3455) | interface Market {
type Transaction (line 3589) | interface Transaction {
type Order (line 3602) | interface Order {
type TransactionOrder (line 3633) | interface TransactionOrder {
type OrderFilter (line 3639) | interface OrderFilter {
type PriceHistory (line 3650) | interface PriceHistory {
type CreateOrderParam (line 3660) | interface CreateOrderParam {
type Memory (line 3689) | interface Memory {
type CreepMemory (line 3697) | interface CreepMemory {}
type FlagMemory (line 3698) | interface FlagMemory {}
type PowerCreepMemory (line 3699) | interface PowerCreepMemory {}
type RoomMemory (line 3700) | interface RoomMemory {}
type SpawnMemory (line 3701) | interface SpawnMemory {}
type Mineral (line 3723) | interface Mineral<T extends MineralConstant = MineralConstant> extends R...
type MineralConstructor (line 3752) | interface MineralConstructor extends _Constructor<Mineral>, _Constructor...
type Nuke (line 3775) | interface Nuke extends RoomObject {
type NukeConstructor (line 3794) | interface NukeConstructor extends _Constructor<Nuke>, _ConstructorById<N...
type PathFinder (line 3804) | interface PathFinder {
type PathFinderPath (line 3844) | interface PathFinderPath {
type PathFinderOpts (line 3868) | interface PathFinderOpts {
type CostMatrixConstructor (line 3926) | interface CostMatrixConstructor extends _Constructor<CostMatrix> {
type CostMatrix (line 3947) | interface CostMatrix {
type PowerCreep (line 3985) | interface PowerCreep extends RoomObject {
type PowerCreepConstructor (line 4330) | interface PowerCreepConstructor extends _Constructor<PowerCreep>, _Const...
type PowerCreepPowers (line 4349) | interface PowerCreepPowers {
type RawMemory (line 4370) | interface RawMemory {
type Resource (line 4464) | interface Resource<T extends ResourceConstant = ResourceConstant> extend...
type ResourceConstructor (line 4483) | interface ResourceConstructor extends _Constructor<Resource>, _Construct...
type RoomObject (line 4492) | interface RoomObject {
type RoomObjectConstructor (line 4511) | interface RoomObjectConstructor extends _Constructor<RoomObject> {
type RoomObjectEffect (line 4521) | type RoomObjectEffect = NaturalEffect | PowerEffect;
type NaturalEffect (line 4526) | interface NaturalEffect {
type PowerEffect (line 4542) | interface PowerEffect {
type RoomPosition (line 4573) | interface RoomPosition {
type RoomPositionConstructor (line 4778) | interface RoomPositionConstructor extends _Constructor<RoomPosition> {
type RoomTerrain (line 4798) | interface RoomTerrain {
type RoomTerrainConstructor (line 4831) | interface RoomTerrainConstructor extends _Constructor<RoomTerrain> {
class RoomVisual (line 4853) | class RoomVisual {
type LineStyle (line 4978) | interface LineStyle {
type PolyStyle (line 5001) | interface PolyStyle {
type CircleStyle (line 5028) | interface CircleStyle extends PolyStyle {
type TextStyle (line 5036) | interface TextStyle {
type Room (line 5086) | interface Room {
type RoomConstructor (line 5346) | interface RoomConstructor extends _Constructor<Room> {
type Ruin (line 5373) | interface Ruin extends RoomObject {
type RuinConstructor (line 5397) | interface RuinConstructor extends _Constructor<Ruin>, _ConstructorById<R...
type Source (line 5412) | interface Source extends RoomObject {
type SourceConstructor (line 5443) | interface SourceConstructor extends _Constructor<Source>, _ConstructorBy...
type StructureSpawn (line 5467) | interface StructureSpawn extends OwnedStructure<STRUCTURE_SPAWN> {
type StructureSpawnConstructor (line 5620) | interface StructureSpawnConstructor extends _Constructor<StructureSpawn>...
type Spawning (line 5628) | interface Spawning {
type SpawnOptions (line 5683) | interface SpawnOptions {
type SpawningConstructor (line 5706) | interface SpawningConstructor extends _Constructor<Spawning> {
type StoreBase (line 5710) | interface StoreBase<POSSIBLE_RESOURCES extends ResourceConstant, UNLIMIT...
type Store (line 5757) | type Store<POSSIBLE_RESOURCES extends ResourceConstant, UNLIMITED_STORE ...
type GenericStoreBase (line 5778) | interface GenericStoreBase {
type GenericStore (line 5803) | type GenericStore = GenericStoreBase & { [P in ResourceConstant]: number };
type Structure (line 5807) | interface Structure<T extends StructureConstant = StructureConstant> ext...
type StructureConstructor (line 5858) | interface StructureConstructor extends _Constructor<Structure>, _Constru...
type OwnedStructure (line 5867) | interface OwnedStructure<T extends StructureConstant = StructureConstant...
type OwnedStructureConstructor (line 5888) | interface OwnedStructureConstructor extends _Constructor<OwnedStructure>...
type StructureController (line 5898) | interface StructureController extends OwnedStructure<STRUCTURE_CONTROLLE...
type StructureControllerConstructor (line 5970) | interface StructureControllerConstructor extends _Constructor<StructureC...
type StructureExtension (line 5979) | interface StructureExtension extends OwnedStructure<STRUCTURE_EXTENSION> {
type StructureExtensionConstructor (line 6001) | interface StructureExtensionConstructor extends _Constructor<StructureEx...
type StructureLink (line 6008) | interface StructureLink extends OwnedStructure<STRUCTURE_LINK> {
type StructureLinkConstructor (line 6051) | interface StructureLinkConstructor extends _Constructor<StructureLink>, ...
type StructureKeeperLair (line 6061) | interface StructureKeeperLair extends OwnedStructure<STRUCTURE_KEEPER_LA...
type StructureKeeperLairConstructor (line 6070) | interface StructureKeeperLairConstructor extends _Constructor<StructureK...
type StructureObserver (line 6077) | interface StructureObserver extends OwnedStructure<STRUCTURE_OBSERVER> {
type StructureObserverConstructor (line 6095) | interface StructureObserverConstructor extends _Constructor<StructureObs...
type StructurePowerBank (line 6105) | interface StructurePowerBank extends OwnedStructure<STRUCTURE_POWER_BANK> {
type StructurePowerBankConstructor (line 6118) | interface StructurePowerBankConstructor extends _Constructor<StructurePo...
type StructurePowerSpawn (line 6128) | interface StructurePowerSpawn extends OwnedStructure<STRUCTURE_POWER_SPA...
type StructurePowerSpawnConstructor (line 6168) | interface StructurePowerSpawnConstructor extends _Constructor<StructureP...
type StructureRampart (line 6178) | interface StructureRampart extends OwnedStructure<STRUCTURE_RAMPART> {
type StructureRampartConstructor (line 6204) | interface StructureRampartConstructor extends _Constructor<StructureRamp...
type StructureRoad (line 6213) | interface StructureRoad extends Structure<STRUCTURE_ROAD> {
type StructureRoadConstructor (line 6222) | interface StructureRoadConstructor extends _Constructor<StructureRoad>, ...
type StructureStorage (line 6231) | interface StructureStorage extends OwnedStructure<STRUCTURE_STORAGE> {
type StructureStorageConstructor (line 6245) | interface StructureStorageConstructor extends _Constructor<StructureStor...
type StructureTower (line 6255) | interface StructureTower extends OwnedStructure<STRUCTURE_TOWER> {
type StructureTowerConstructor (line 6314) | interface StructureTowerConstructor extends _Constructor<StructureTower>...
type StructureWall (line 6321) | interface StructureWall extends Structure<STRUCTURE_WALL> {
type StructureWallConstructor (line 6329) | interface StructureWallConstructor extends _Constructor<StructureWall>, ...
type StructureExtractor (line 6336) | interface StructureExtractor extends OwnedStructure<STRUCTURE_EXTRACTOR> {
type StructureExtractorConstructor (line 6344) | interface StructureExtractorConstructor extends _Constructor<StructureEx...
type StructureLab (line 6351) | interface StructureLab extends OwnedStructure<STRUCTURE_LAB> {
type StructureLabConstructor (line 6461) | interface StructureLabConstructor extends _Constructor<StructureLab>, _C...
type StructureTerminal (line 6468) | interface StructureTerminal extends OwnedStructure<STRUCTURE_TERMINAL> {
type StructureTerminalConstructor (line 6499) | interface StructureTerminalConstructor extends _Constructor<StructureTer...
type StructureContainer (line 6508) | interface StructureContainer extends Structure<STRUCTURE_CONTAINER> {
type StructureContainerConstructor (line 6528) | interface StructureContainerConstructor extends _Constructor<StructureCo...
type StructureNuker (line 6540) | interface StructureNuker extends OwnedStructure<STRUCTURE_NUKER> {
type StructureNukerConstructor (line 6586) | interface StructureNukerConstructor extends _Constructor<StructureNuker>...
type StructurePortal (line 6596) | interface StructurePortal extends Structure<STRUCTURE_PORTAL> {
type StructurePortalConstructor (line 6612) | interface StructurePortalConstructor extends _Constructor<StructurePorta...
type StructureFactory (line 6619) | interface StructureFactory extends OwnedStructure<STRUCTURE_FACTORY> {
type StructureFactoryConstructor (line 6655) | interface StructureFactoryConstructor extends _Constructor<StructureFact...
type StructureInvaderCore (line 6662) | interface StructureInvaderCore extends OwnedStructure<STRUCTURE_INVADER_...
type StructureInvaderCoreConstructor (line 6680) | interface StructureInvaderCoreConstructor extends _Constructor<Structure...
type AnyOwnedStructure (line 6687) | type AnyOwnedStructure =
type AnyStoreStructure (line 6706) | type AnyStoreStructure =
type AnyStructure (line 6722) | type AnyStructure = AnyOwnedStructure | StructureContainer | StructurePo...
type ConcreteStructureMap (line 6727) | interface ConcreteStructureMap {
type ConcreteStructure (line 6756) | type ConcreteStructure<T extends StructureConstant> = ConcreteStructureM...
type Tombstone (line 6763) | interface Tombstone extends RoomObject {
type TombstoneConstructor (line 6792) | interface TombstoneConstructor extends _Constructor<Tombstone>, _Constru...
FILE: dist/screeps-tests.ts
type CreepMemory (line 26) | interface CreepMemory {
function keys (line 36) | function keys<T extends Record<string, any>>(o: T): Array<keyof T> {
function resources (line 40) | function resources(o: GenericStore): ResourceConstant[] {
type StoreStructure (line 55) | type StoreStructure = StructureContainer | StructureStorage | StructureL...
method routeCallback (line 287) | routeCallback(roomName, fromRoomName) {
method routeCallback (line 305) | routeCallback(roomName) {
method roomCallback (line 468) | roomCallback(roomName) {
method costCallback (line 503) | costCallback(roomName, costMatrix) {
function atackPower (line 1182) | function atackPower(creep: Creep) {
FILE: src/constants.ts
type CommoditiesTypes (line 730) | type CommoditiesTypes = CommodityConstant | MineralConstant | RESOURCE_G...
type CommodityEntry (line 731) | interface CommodityEntry {
FILE: src/construction-site.ts
type ConstructionSite (line 10) | interface ConstructionSite<T extends BuildableStructureConstant = Builda...
type ConstructionSiteConstructor (line 45) | interface ConstructionSiteConstructor extends _Constructor<ConstructionS...
FILE: src/creep.ts
type Creep (line 28) | interface Creep extends RoomObject {
type CreepConstructor (line 558) | interface CreepConstructor extends _Constructor<Creep>, _ConstructorById...
FILE: src/deposit.ts
type Deposit (line 13) | interface Deposit extends RoomObject {
type DepositConstructor (line 42) | interface DepositConstructor extends _Constructor<Deposit>, _Constructor...
FILE: src/flag.ts
type Flag (line 6) | interface Flag extends RoomObject {
type FlagConstructor (line 64) | interface FlagConstructor extends _Constructor<Flag> {
FILE: src/game.ts
type Game (line 4) | interface Game {
FILE: src/helpers.ts
type _HasId (line 1) | interface _HasId {
type _HasRoomPosition (line 5) | interface _HasRoomPosition {
type GlobalControlLevel (line 9) | interface GlobalControlLevel {
type GlobalPowerLevel (line 24) | interface GlobalPowerLevel {
type Shard (line 39) | interface Shard {
type CPU (line 79) | interface CPU {
type HeapStatistics (line 175) | interface HeapStatistics {
type BodyPartDefinition (line 191) | type BodyPartDefinition<T extends BodyPartConstant = BodyPartConstant> =...
type Owner (line 210) | interface Owner {
type ReservationDefinition (line 216) | interface ReservationDefinition {
type SignDefinition (line 220) | interface SignDefinition {
type CPUShardLimits (line 227) | interface CPUShardLimits {
type StoreDefinition (line 232) | type StoreDefinition = Store<ResourceConstant, false>;
type StoreDefinitionUnlimited (line 235) | type StoreDefinitionUnlimited = Store<ResourceConstant, true>;
type ExitsInformation (line 246) | type ExitsInformation = Partial<Record<ExitKey, string>>;
type AllLookAtTypes (line 248) | interface AllLookAtTypes {
type LookAtTypes (line 265) | type LookAtTypes = Partial<AllLookAtTypes>;
type LookAtResult (line 267) | type LookAtResult<K extends LookConstant = LookConstant> = Pick<LookAtTy...
type LookAtResultWithPos (line 269) | type LookAtResultWithPos<K extends LookConstant = LookConstant> = LookAt...
type LookAtResultMatrix (line 274) | interface LookAtResultMatrix<K extends LookConstant = LookConstant> {
type LookForAtAreaResultMatrix (line 280) | interface LookForAtAreaResultMatrix<T> {
type LookForAtAreaResult (line 286) | type LookForAtAreaResult<T, K extends keyof LookAtTypes = keyof LookAtTy...
type LookForAtAreaResultWithPos (line 288) | type LookForAtAreaResultWithPos<T, K extends keyof LookAtTypes = keyof L...
type LookForAtAreaResultArray (line 290) | type LookForAtAreaResultArray<T, K extends keyof LookAtTypes = keyof Loo...
type FindTypes (line 292) | interface FindTypes {
type FindPathOpts (line 336) | interface FindPathOpts {
type MoveToOpts (line 443) | interface MoveToOpts extends FindPathOpts {
type PathStep (line 479) | interface PathStep {
type _Constructor (line 487) | interface _Constructor<T> {
type _ConstructorById (line 491) | interface _ConstructorById<T extends _HasId> extends _Constructor<T> {
class OpaqueTag (line 499) | class OpaqueTag<T> {
type Id (line 504) | type Id<T extends _HasId> = string & Tag.OpaqueTag<T>;
type fromId (line 506) | type fromId<T> = T extends Id<infer R> ? R : never;
FILE: src/inter-shard-memory.ts
type InterShardMemory (line 12) | interface InterShardMemory {
FILE: src/literals.ts
type Terrain (line 8) | type Terrain = "plain" | "swamp" | "wall";
type ExitKey (line 10) | type ExitKey = "1" | "3" | "5" | "7";
type AnyCreep (line 12) | type AnyCreep = Creep | PowerCreep;
type FindClosestByPathAlgorithm (line 14) | type FindClosestByPathAlgorithm = "astar" | "dijkstra";
type ScreepsReturnCode (line 18) | type ScreepsReturnCode =
type OK (line 37) | type OK = 0;
type ERR_NOT_OWNER (line 38) | type ERR_NOT_OWNER = -1;
type ERR_NO_PATH (line 39) | type ERR_NO_PATH = -2;
type ERR_NAME_EXISTS (line 40) | type ERR_NAME_EXISTS = -3;
type ERR_BUSY (line 41) | type ERR_BUSY = -4;
type ERR_NOT_FOUND (line 42) | type ERR_NOT_FOUND = -5;
type ERR_NOT_ENOUGH_RESOURCES (line 43) | type ERR_NOT_ENOUGH_RESOURCES = -6;
type ERR_NOT_ENOUGH_ENERGY (line 44) | type ERR_NOT_ENOUGH_ENERGY = -6;
type ERR_INVALID_TARGET (line 45) | type ERR_INVALID_TARGET = -7;
type ERR_FULL (line 46) | type ERR_FULL = -8;
type ERR_NOT_IN_RANGE (line 47) | type ERR_NOT_IN_RANGE = -9;
type ERR_INVALID_ARGS (line 48) | type ERR_INVALID_ARGS = -10;
type ERR_TIRED (line 49) | type ERR_TIRED = -11;
type ERR_NO_BODYPART (line 50) | type ERR_NO_BODYPART = -12;
type ERR_NOT_ENOUGH_EXTENSIONS (line 51) | type ERR_NOT_ENOUGH_EXTENSIONS = -6;
type ERR_RCL_NOT_ENOUGH (line 52) | type ERR_RCL_NOT_ENOUGH = -14;
type ERR_GCL_NOT_ENOUGH (line 53) | type ERR_GCL_NOT_ENOUGH = -15;
type ERR_ACCESS_DENIED (line 54) | type ERR_ACCESS_DENIED = -16;
type CreepActionReturnCode (line 56) | type CreepActionReturnCode = OK | ERR_NOT_OWNER | ERR_BUSY | ERR_INVALID...
type CreepMoveReturnCode (line 58) | type CreepMoveReturnCode = OK | ERR_NOT_OWNER | ERR_BUSY | ERR_TIRED | E...
type ExitConstant (line 62) | type ExitConstant = FIND_EXIT_TOP | FIND_EXIT_RIGHT | FIND_EXIT_BOTTOM |...
type FindConstant (line 64) | type FindConstant =
type FIND_EXIT_TOP (line 94) | type FIND_EXIT_TOP = 1;
type FIND_EXIT_RIGHT (line 95) | type FIND_EXIT_RIGHT = 3;
type FIND_EXIT_BOTTOM (line 96) | type FIND_EXIT_BOTTOM = 5;
type FIND_EXIT_LEFT (line 97) | type FIND_EXIT_LEFT = 7;
type FIND_EXIT (line 98) | type FIND_EXIT = 10;
type FIND_CREEPS (line 99) | type FIND_CREEPS = 101;
type FIND_MY_CREEPS (line 100) | type FIND_MY_CREEPS = 102;
type FIND_HOSTILE_CREEPS (line 101) | type FIND_HOSTILE_CREEPS = 103;
type FIND_SOURCES_ACTIVE (line 102) | type FIND_SOURCES_ACTIVE = 104;
type FIND_SOURCES (line 103) | type FIND_SOURCES = 105;
type FIND_DROPPED_RESOURCES (line 104) | type FIND_DROPPED_RESOURCES = 106;
type FIND_STRUCTURES (line 105) | type FIND_STRUCTURES = 107;
type FIND_MY_STRUCTURES (line 106) | type FIND_MY_STRUCTURES = 108;
type FIND_HOSTILE_STRUCTURES (line 107) | type FIND_HOSTILE_STRUCTURES = 109;
type FIND_FLAGS (line 108) | type FIND_FLAGS = 110;
type FIND_CONSTRUCTION_SITES (line 109) | type FIND_CONSTRUCTION_SITES = 111;
type FIND_MY_SPAWNS (line 110) | type FIND_MY_SPAWNS = 112;
type FIND_HOSTILE_SPAWNS (line 111) | type FIND_HOSTILE_SPAWNS = 113;
type FIND_MY_CONSTRUCTION_SITES (line 112) | type FIND_MY_CONSTRUCTION_SITES = 114;
type FIND_HOSTILE_CONSTRUCTION_SITES (line 113) | type FIND_HOSTILE_CONSTRUCTION_SITES = 115;
type FIND_MINERALS (line 114) | type FIND_MINERALS = 116;
type FIND_NUKES (line 115) | type FIND_NUKES = 117;
type FIND_TOMBSTONES (line 116) | type FIND_TOMBSTONES = 118;
type FIND_POWER_CREEPS (line 117) | type FIND_POWER_CREEPS = 119;
type FIND_MY_POWER_CREEPS (line 118) | type FIND_MY_POWER_CREEPS = 120;
type FIND_HOSTILE_POWER_CREEPS (line 119) | type FIND_HOSTILE_POWER_CREEPS = 121;
type FIND_DEPOSITS (line 120) | type FIND_DEPOSITS = 122;
type FIND_RUINS (line 121) | type FIND_RUINS = 123;
type FilterOptions (line 125) | interface FilterOptions<T, S extends T> {
type PredicateFilterFunction (line 129) | type PredicateFilterFunction<T, S extends T> = (object: T, index: number...
type FilterFunction (line 130) | type FilterFunction<T> = (object: T, index: number, collection: T[]) => ...
type FilterObject (line 131) | type FilterObject<T> = DeepPartial<T>;
type DeepPartial (line 133) | type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<...
type BodyPartConstant (line 137) | type BodyPartConstant = MOVE | WORK | CARRY | ATTACK | RANGED_ATTACK | T...
type MOVE (line 139) | type MOVE = "move";
type WORK (line 140) | type WORK = "work";
type CARRY (line 141) | type CARRY = "carry";
type ATTACK (line 142) | type ATTACK = "attack";
type RANGED_ATTACK (line 143) | type RANGED_ATTACK = "ranged_attack";
type TOUGH (line 144) | type TOUGH = "tough";
type HEAL (line 145) | type HEAL = "heal";
type CLAIM (line 146) | type CLAIM = "claim";
type LookConstant (line 150) | type LookConstant =
type LOOK_CONSTRUCTION_SITES (line 166) | type LOOK_CONSTRUCTION_SITES = "constructionSite";
type LOOK_CREEPS (line 167) | type LOOK_CREEPS = "creep";
type LOOK_ENERGY (line 168) | type LOOK_ENERGY = "energy";
type LOOK_FLAGS (line 169) | type LOOK_FLAGS = "flag";
type LOOK_MINERALS (line 170) | type LOOK_MINERALS = "mineral";
type LOOK_DEPOSITS (line 171) | type LOOK_DEPOSITS = "deposit";
type LOOK_NUKES (line 172) | type LOOK_NUKES = "nuke";
type LOOK_RESOURCES (line 173) | type LOOK_RESOURCES = "resource";
type LOOK_SOURCES (line 174) | type LOOK_SOURCES = "source";
type LOOK_STRUCTURES (line 175) | type LOOK_STRUCTURES = "structure";
type LOOK_TERRAIN (line 176) | type LOOK_TERRAIN = "terrain";
type LOOK_TOMBSTONES (line 177) | type LOOK_TOMBSTONES = "tombstone";
type LOOK_POWER_CREEPS (line 178) | type LOOK_POWER_CREEPS = "powerCreep";
type LOOK_RUINS (line 179) | type LOOK_RUINS = "ruin";
type ORDER_SELL (line 181) | type ORDER_SELL = "sell";
type ORDER_BUY (line 182) | type ORDER_BUY = "buy";
type DirectionConstant (line 186) | type DirectionConstant = TOP | TOP_RIGHT | RIGHT | BOTTOM_RIGHT | BOTTOM...
type TOP (line 188) | type TOP = 1;
type TOP_RIGHT (line 189) | type TOP_RIGHT = 2;
type RIGHT (line 190) | type RIGHT = 3;
type BOTTOM_RIGHT (line 191) | type BOTTOM_RIGHT = 4;
type BOTTOM (line 192) | type BOTTOM = 5;
type BOTTOM_LEFT (line 193) | type BOTTOM_LEFT = 6;
type LEFT (line 194) | type LEFT = 7;
type TOP_LEFT (line 195) | type TOP_LEFT = 8;
type ColorConstant (line 199) | type ColorConstant =
type COLOR_RED (line 211) | type COLOR_RED = 1;
type COLOR_PURPLE (line 212) | type COLOR_PURPLE = 2;
type COLOR_BLUE (line 213) | type COLOR_BLUE = 3;
type COLOR_CYAN (line 214) | type COLOR_CYAN = 4;
type COLOR_GREEN (line 215) | type COLOR_GREEN = 5;
type COLOR_YELLOW (line 216) | type COLOR_YELLOW = 6;
type COLOR_ORANGE (line 217) | type COLOR_ORANGE = 7;
type COLOR_BROWN (line 218) | type COLOR_BROWN = 8;
type COLOR_GREY (line 219) | type COLOR_GREY = 9;
type COLOR_WHITE (line 220) | type COLOR_WHITE = 10;
type BuildableStructureConstant (line 224) | type BuildableStructureConstant =
type StructureConstant (line 242) | type StructureConstant =
type STRUCTURE_EXTENSION (line 250) | type STRUCTURE_EXTENSION = "extension";
type STRUCTURE_RAMPART (line 251) | type STRUCTURE_RAMPART = "rampart";
type STRUCTURE_ROAD (line 252) | type STRUCTURE_ROAD = "road";
type STRUCTURE_SPAWN (line 253) | type STRUCTURE_SPAWN = "spawn";
type STRUCTURE_LINK (line 254) | type STRUCTURE_LINK = "link";
type STRUCTURE_WALL (line 255) | type STRUCTURE_WALL = "constructedWall";
type STRUCTURE_KEEPER_LAIR (line 256) | type STRUCTURE_KEEPER_LAIR = "keeperLair";
type STRUCTURE_CONTROLLER (line 257) | type STRUCTURE_CONTROLLER = "controller";
type STRUCTURE_STORAGE (line 258) | type STRUCTURE_STORAGE = "storage";
type STRUCTURE_TOWER (line 259) | type STRUCTURE_TOWER = "tower";
type STRUCTURE_OBSERVER (line 260) | type STRUCTURE_OBSERVER = "observer";
type STRUCTURE_POWER_BANK (line 261) | type STRUCTURE_POWER_BANK = "powerBank";
type STRUCTURE_POWER_SPAWN (line 262) | type STRUCTURE_POWER_SPAWN = "powerSpawn";
type STRUCTURE_EXTRACTOR (line 263) | type STRUCTURE_EXTRACTOR = "extractor";
type STRUCTURE_LAB (line 264) | type STRUCTURE_LAB = "lab";
type STRUCTURE_TERMINAL (line 265) | type STRUCTURE_TERMINAL = "terminal";
type STRUCTURE_CONTAINER (line 266) | type STRUCTURE_CONTAINER = "container";
type STRUCTURE_NUKER (line 267) | type STRUCTURE_NUKER = "nuker";
type STRUCTURE_FACTORY (line 268) | type STRUCTURE_FACTORY = "factory";
type STRUCTURE_INVADER_CORE (line 269) | type STRUCTURE_INVADER_CORE = "invaderCore";
type STRUCTURE_PORTAL (line 270) | type STRUCTURE_PORTAL = "portal";
type TERRAIN_MASK_WALL (line 273) | type TERRAIN_MASK_WALL = 1;
type TERRAIN_MASK_SWAMP (line 274) | type TERRAIN_MASK_SWAMP = 2;
type TERRAIN_MASK_LAVA (line 275) | type TERRAIN_MASK_LAVA = 4;
type ResourceConstant (line 279) | type ResourceConstant =
type _ResourceConstantSansEnergy (line 288) | type _ResourceConstantSansEnergy = Exclude<ResourceConstant, RESOURCE_EN...
type MineralConstant (line 291) | type MineralConstant =
type MineralBaseCompoundsConstant (line 301) | type MineralBaseCompoundsConstant = RESOURCE_HYDROXIDE | RESOURCE_ZYNTHI...
type MineralBoostConstant (line 304) | type MineralBoostConstant =
type MineralCompoundConstant (line 337) | type MineralCompoundConstant = MineralBaseCompoundsConstant | MineralBoo...
type DepositConstant (line 340) | type DepositConstant = RESOURCE_MIST | RESOURCE_BIOMASS | RESOURCE_METAL...
type CommodityConstant (line 343) | type CommodityConstant =
type InterShardResourceConstant (line 381) | type InterShardResourceConstant = SUBSCRIPTION_TOKEN | CPU_UNLOCK | PIXE...
type MarketResourceConstant (line 382) | type MarketResourceConstant = ResourceConstant | InterShardResourceConst...
type RESOURCE_ENERGY (line 384) | type RESOURCE_ENERGY = "energy";
type RESOURCE_POWER (line 385) | type RESOURCE_POWER = "power";
type RESOURCE_OPS (line 386) | type RESOURCE_OPS = "ops";
type RESOURCE_BIOMASS (line 388) | type RESOURCE_BIOMASS = "biomass";
type RESOURCE_METAL (line 389) | type RESOURCE_METAL = "metal";
type RESOURCE_MIST (line 390) | type RESOURCE_MIST = "mist";
type RESOURCE_SILICON (line 391) | type RESOURCE_SILICON = "silicon";
type RESOURCE_UTRIUM (line 393) | type RESOURCE_UTRIUM = "U";
type RESOURCE_LEMERGIUM (line 394) | type RESOURCE_LEMERGIUM = "L";
type RESOURCE_KEANIUM (line 395) | type RESOURCE_KEANIUM = "K";
type RESOURCE_ZYNTHIUM (line 396) | type RESOURCE_ZYNTHIUM = "Z";
type RESOURCE_OXYGEN (line 397) | type RESOURCE_OXYGEN = "O";
type RESOURCE_HYDROGEN (line 398) | type RESOURCE_HYDROGEN = "H";
type RESOURCE_CATALYST (line 399) | type RESOURCE_CATALYST = "X";
type RESOURCE_HYDROXIDE (line 401) | type RESOURCE_HYDROXIDE = "OH";
type RESOURCE_ZYNTHIUM_KEANITE (line 402) | type RESOURCE_ZYNTHIUM_KEANITE = "ZK";
type RESOURCE_UTRIUM_LEMERGITE (line 403) | type RESOURCE_UTRIUM_LEMERGITE = "UL";
type RESOURCE_GHODIUM (line 404) | type RESOURCE_GHODIUM = "G";
type RESOURCE_UTRIUM_HYDRIDE (line 406) | type RESOURCE_UTRIUM_HYDRIDE = "UH";
type RESOURCE_UTRIUM_OXIDE (line 407) | type RESOURCE_UTRIUM_OXIDE = "UO";
type RESOURCE_KEANIUM_HYDRIDE (line 408) | type RESOURCE_KEANIUM_HYDRIDE = "KH";
type RESOURCE_KEANIUM_OXIDE (line 409) | type RESOURCE_KEANIUM_OXIDE = "KO";
type RESOURCE_LEMERGIUM_HYDRIDE (line 410) | type RESOURCE_LEMERGIUM_HYDRIDE = "LH";
type RESOURCE_LEMERGIUM_OXIDE (line 411) | type RESOURCE_LEMERGIUM_OXIDE = "LO";
type RESOURCE_ZYNTHIUM_HYDRIDE (line 412) | type RESOURCE_ZYNTHIUM_HYDRIDE = "ZH";
type RESOURCE_ZYNTHIUM_OXIDE (line 413) | type RESOURCE_ZYNTHIUM_OXIDE = "ZO";
type RESOURCE_GHODIUM_HYDRIDE (line 414) | type RESOURCE_GHODIUM_HYDRIDE = "GH";
type RESOURCE_GHODIUM_OXIDE (line 415) | type RESOURCE_GHODIUM_OXIDE = "GO";
type RESOURCE_UTRIUM_ACID (line 417) | type RESOURCE_UTRIUM_ACID = "UH2O";
type RESOURCE_UTRIUM_ALKALIDE (line 418) | type RESOURCE_UTRIUM_ALKALIDE = "UHO2";
type RESOURCE_KEANIUM_ACID (line 419) | type RESOURCE_KEANIUM_ACID = "KH2O";
type RESOURCE_KEANIUM_ALKALIDE (line 420) | type RESOURCE_KEANIUM_ALKALIDE = "KHO2";
type RESOURCE_LEMERGIUM_ACID (line 421) | type RESOURCE_LEMERGIUM_ACID = "LH2O";
type RESOURCE_LEMERGIUM_ALKALIDE (line 422) | type RESOURCE_LEMERGIUM_ALKALIDE = "LHO2";
type RESOURCE_ZYNTHIUM_ACID (line 423) | type RESOURCE_ZYNTHIUM_ACID = "ZH2O";
type RESOURCE_ZYNTHIUM_ALKALIDE (line 424) | type RESOURCE_ZYNTHIUM_ALKALIDE = "ZHO2";
type RESOURCE_GHODIUM_ACID (line 425) | type RESOURCE_GHODIUM_ACID = "GH2O";
type RESOURCE_GHODIUM_ALKALIDE (line 426) | type RESOURCE_GHODIUM_ALKALIDE = "GHO2";
type RESOURCE_CATALYZED_UTRIUM_ACID (line 428) | type RESOURCE_CATALYZED_UTRIUM_ACID = "XUH2O";
type RESOURCE_CATALYZED_UTRIUM_ALKALIDE (line 429) | type RESOURCE_CATALYZED_UTRIUM_ALKALIDE = "XUHO2";
type RESOURCE_CATALYZED_KEANIUM_ACID (line 430) | type RESOURCE_CATALYZED_KEANIUM_ACID = "XKH2O";
type RESOURCE_CATALYZED_KEANIUM_ALKALIDE (line 431) | type RESOURCE_CATALYZED_KEANIUM_ALKALIDE = "XKHO2";
type RESOURCE_CATALYZED_LEMERGIUM_ACID (line 432) | type RESOURCE_CATALYZED_LEMERGIUM_ACID = "XLH2O";
type RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE (line 433) | type RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE = "XLHO2";
type RESOURCE_CATALYZED_ZYNTHIUM_ACID (line 434) | type RESOURCE_CATALYZED_ZYNTHIUM_ACID = "XZH2O";
type RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE (line 435) | type RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE = "XZHO2";
type RESOURCE_CATALYZED_GHODIUM_ACID (line 436) | type RESOURCE_CATALYZED_GHODIUM_ACID = "XGH2O";
type RESOURCE_CATALYZED_GHODIUM_ALKALIDE (line 437) | type RESOURCE_CATALYZED_GHODIUM_ALKALIDE = "XGHO2";
type RESOURCE_UTRIUM_BAR (line 439) | type RESOURCE_UTRIUM_BAR = "utrium_bar";
type RESOURCE_LEMERGIUM_BAR (line 440) | type RESOURCE_LEMERGIUM_BAR = "lemergium_bar";
type RESOURCE_ZYNTHIUM_BAR (line 441) | type RESOURCE_ZYNTHIUM_BAR = "zynthium_bar";
type RESOURCE_KEANIUM_BAR (line 442) | type RESOURCE_KEANIUM_BAR = "keanium_bar";
type RESOURCE_GHODIUM_MELT (line 443) | type RESOURCE_GHODIUM_MELT = "ghodium_melt";
type RESOURCE_OXIDANT (line 444) | type RESOURCE_OXIDANT = "oxidant";
type RESOURCE_REDUCTANT (line 445) | type RESOURCE_REDUCTANT = "reductant";
type RESOURCE_PURIFIER (line 446) | type RESOURCE_PURIFIER = "purifier";
type RESOURCE_BATTERY (line 447) | type RESOURCE_BATTERY = "battery";
type RESOURCE_COMPOSITE (line 449) | type RESOURCE_COMPOSITE = "composite";
type RESOURCE_CRYSTAL (line 450) | type RESOURCE_CRYSTAL = "crystal";
type RESOURCE_LIQUID (line 451) | type RESOURCE_LIQUID = "liquid";
type RESOURCE_WIRE (line 453) | type RESOURCE_WIRE = "wire";
type RESOURCE_SWITCH (line 454) | type RESOURCE_SWITCH = "switch";
type RESOURCE_TRANSISTOR (line 455) | type RESOURCE_TRANSISTOR = "transistor";
type RESOURCE_MICROCHIP (line 456) | type RESOURCE_MICROCHIP = "microchip";
type RESOURCE_CIRCUIT (line 457) | type RESOURCE_CIRCUIT = "circuit";
type RESOURCE_DEVICE (line 458) | type RESOURCE_DEVICE = "device";
type RESOURCE_CELL (line 460) | type RESOURCE_CELL = "cell";
type RESOURCE_PHLEGM (line 461) | type RESOURCE_PHLEGM = "phlegm";
type RESOURCE_TISSUE (line 462) | type RESOURCE_TISSUE = "tissue";
type RESOURCE_MUSCLE (line 463) | type RESOURCE_MUSCLE = "muscle";
type RESOURCE_ORGANOID (line 464) | type RESOURCE_ORGANOID = "organoid";
type RESOURCE_ORGANISM (line 465) | type RESOURCE_ORGANISM = "organism";
type RESOURCE_ALLOY (line 467) | type RESOURCE_ALLOY = "alloy";
type RESOURCE_TUBE (line 468) | type RESOURCE_TUBE = "tube";
type RESOURCE_FIXTURES (line 469) | type RESOURCE_FIXTURES = "fixtures";
type RESOURCE_FRAME (line 470) | type RESOURCE_FRAME = "frame";
type RESOURCE_HYDRAULICS (line 471) | type RESOURCE_HYDRAULICS = "hydraulics";
type RESOURCE_MACHINE (line 472) | type RESOURCE_MACHINE = "machine";
type RESOURCE_CONDENSATE (line 474) | type RESOURCE_CONDENSATE = "condensate";
type RESOURCE_CONCENTRATE (line 475) | type RESOURCE_CONCENTRATE = "concentrate";
type RESOURCE_EXTRACT (line 476) | type RESOURCE_EXTRACT = "extract";
type RESOURCE_SPIRIT (line 477) | type RESOURCE_SPIRIT = "spirit";
type RESOURCE_EMANATION (line 478) | type RESOURCE_EMANATION = "emanation";
type RESOURCE_ESSENCE (line 479) | type RESOURCE_ESSENCE = "essence";
type SUBSCRIPTION_TOKEN (line 481) | type SUBSCRIPTION_TOKEN = "token";
type CPU_UNLOCK (line 482) | type CPU_UNLOCK = "cpuUnlock";
type PIXEL (line 483) | type PIXEL = "pixel";
type ACCESS_KEY (line 484) | type ACCESS_KEY = "accessKey";
type TOMBSTONE_DECAY_PER_PART (line 486) | type TOMBSTONE_DECAY_PER_PART = 5;
type EventConstant (line 488) | type EventConstant =
type EVENT_ATTACK (line 502) | type EVENT_ATTACK = 1;
type EVENT_OBJECT_DESTROYED (line 503) | type EVENT_OBJECT_DESTROYED = 2;
type EVENT_ATTACK_CONTROLLER (line 504) | type EVENT_ATTACK_CONTROLLER = 3;
type EVENT_BUILD (line 505) | type EVENT_BUILD = 4;
type EVENT_HARVEST (line 506) | type EVENT_HARVEST = 5;
type EVENT_HEAL (line 507) | type EVENT_HEAL = 6;
type EVENT_REPAIR (line 508) | type EVENT_REPAIR = 7;
type EVENT_RESERVE_CONTROLLER (line 509) | type EVENT_RESERVE_CONTROLLER = 8;
type EVENT_UPGRADE_CONTROLLER (line 510) | type EVENT_UPGRADE_CONTROLLER = 9;
type EVENT_EXIT (line 511) | type EVENT_EXIT = 10;
type EVENT_POWER (line 512) | type EVENT_POWER = 11;
type EVENT_TRANSFER (line 513) | type EVENT_TRANSFER = 12;
type EventAttackType (line 515) | type EventAttackType =
type EVENT_ATTACK_TYPE_MELEE (line 523) | type EVENT_ATTACK_TYPE_MELEE = 1;
type EVENT_ATTACK_TYPE_RANGED (line 524) | type EVENT_ATTACK_TYPE_RANGED = 2;
type EVENT_ATTACK_TYPE_RANGED_MASS (line 525) | type EVENT_ATTACK_TYPE_RANGED_MASS = 3;
type EVENT_ATTACK_TYPE_DISMANTLE (line 526) | type EVENT_ATTACK_TYPE_DISMANTLE = 4;
type EVENT_ATTACK_TYPE_HIT_BACK (line 527) | type EVENT_ATTACK_TYPE_HIT_BACK = 5;
type EVENT_ATTACK_TYPE_NUKE (line 528) | type EVENT_ATTACK_TYPE_NUKE = 6;
type EventHealType (line 530) | type EventHealType = EVENT_HEAL_TYPE_MELEE | EVENT_HEAL_TYPE_RANGED;
type EVENT_HEAL_TYPE_MELEE (line 532) | type EVENT_HEAL_TYPE_MELEE = 1;
type EVENT_HEAL_TYPE_RANGED (line 533) | type EVENT_HEAL_TYPE_RANGED = 2;
type EventDestroyType (line 535) | type EventDestroyType = "creep" | StructureConstant;
type EventItem (line 537) | type EventItem =
type EventData (line 599) | interface EventData {
type PowerClassConstant (line 654) | type PowerClassConstant = POWER_CLASS["OPERATOR"];
type POWER_CLASS (line 656) | interface POWER_CLASS {
type PowerConstant (line 660) | type PowerConstant =
type PWR_GENERATE_OPS (line 681) | type PWR_GENERATE_OPS = 1;
type PWR_OPERATE_SPAWN (line 682) | type PWR_OPERATE_SPAWN = 2;
type PWR_OPERATE_TOWER (line 683) | type PWR_OPERATE_TOWER = 3;
type PWR_OPERATE_STORAGE (line 684) | type PWR_OPERATE_STORAGE = 4;
type PWR_OPERATE_LAB (line 685) | type PWR_OPERATE_LAB = 5;
type PWR_OPERATE_EXTENSION (line 686) | type PWR_OPERATE_EXTENSION = 6;
type PWR_OPERATE_OBSERVER (line 687) | type PWR_OPERATE_OBSERVER = 7;
type PWR_OPERATE_TERMINAL (line 688) | type PWR_OPERATE_TERMINAL = 8;
type PWR_DISRUPT_SPAWN (line 689) | type PWR_DISRUPT_SPAWN = 9;
type PWR_DISRUPT_TOWER (line 690) | type PWR_DISRUPT_TOWER = 10;
type PWR_DISRUPT_SOURCE (line 691) | type PWR_DISRUPT_SOURCE = 11;
type PWR_SHIELD (line 692) | type PWR_SHIELD = 12;
type PWR_REGEN_SOURCE (line 693) | type PWR_REGEN_SOURCE = 13;
type PWR_REGEN_MINERAL (line 694) | type PWR_REGEN_MINERAL = 14;
type PWR_DISRUPT_TERMINAL (line 695) | type PWR_DISRUPT_TERMINAL = 15;
type PWR_OPERATE_POWER (line 696) | type PWR_OPERATE_POWER = 16;
type PWR_FORTIFY (line 697) | type PWR_FORTIFY = 17;
type PWR_OPERATE_CONTROLLER (line 698) | type PWR_OPERATE_CONTROLLER = 18;
type PWR_OPERATE_FACTORY (line 699) | type PWR_OPERATE_FACTORY = 19;
type EffectConstant (line 701) | type EffectConstant = EFFECT_INVULNERABILITY | EFFECT_COLLAPSE_TIMER;
type EFFECT_INVULNERABILITY (line 703) | type EFFECT_INVULNERABILITY = 1001;
type EFFECT_COLLAPSE_TIMER (line 704) | type EFFECT_COLLAPSE_TIMER = 1002;
type DENSITY_LOW (line 706) | type DENSITY_LOW = 1;
type DENSITY_MODERATE (line 707) | type DENSITY_MODERATE = 2;
type DENSITY_HIGH (line 708) | type DENSITY_HIGH = 3;
type DENSITY_ULTRA (line 709) | type DENSITY_ULTRA = 4;
type DensityConstant (line 711) | type DensityConstant = DENSITY_LOW | DENSITY_MODERATE | DENSITY_HIGH | D...
FILE: src/map.ts
type RouteOptions (line 4) | interface RouteOptions {
type RoomStatusPermanent (line 15) | interface RoomStatusPermanent {
type RoomStatusTemporary (line 20) | interface RoomStatusTemporary {
type RoomStatus (line 25) | type RoomStatus = RoomStatusPermanent | RoomStatusTemporary;
type GameMap (line 32) | interface GameMap {
type MapVisual (line 141) | interface MapVisual {
type MapLineStyle (line 214) | interface MapLineStyle {
type MapPolyStyle (line 237) | interface MapPolyStyle {
type MapCircleStyle (line 265) | interface MapCircleStyle extends MapPolyStyle {
type MapTextStyle (line 273) | interface MapTextStyle {
FILE: src/market.ts
type Market (line 9) | interface Market {
type Transaction (line 143) | interface Transaction {
type Order (line 156) | interface Order {
type TransactionOrder (line 187) | interface TransactionOrder {
type OrderFilter (line 193) | interface OrderFilter {
type PriceHistory (line 204) | interface PriceHistory {
type CreateOrderParam (line 214) | interface CreateOrderParam {
FILE: src/memory.ts
type Memory (line 1) | interface Memory {
type CreepMemory (line 9) | interface CreepMemory {}
type FlagMemory (line 10) | interface FlagMemory {}
type PowerCreepMemory (line 11) | interface PowerCreepMemory {}
type RoomMemory (line 12) | interface RoomMemory {}
type SpawnMemory (line 13) | interface SpawnMemory {}
FILE: src/mineral.ts
type Mineral (line 20) | interface Mineral<T extends MineralConstant = MineralConstant> extends R...
type MineralConstructor (line 49) | interface MineralConstructor extends _Constructor<Mineral>, _Constructor...
FILE: src/nuke.ts
type Nuke (line 21) | interface Nuke extends RoomObject {
type NukeConstructor (line 40) | interface NukeConstructor extends _Constructor<Nuke>, _ConstructorById<N...
FILE: src/path-finder.ts
type PathFinder (line 8) | interface PathFinder {
type PathFinderPath (line 48) | interface PathFinderPath {
type PathFinderOpts (line 72) | interface PathFinderOpts {
type CostMatrixConstructor (line 130) | interface CostMatrixConstructor extends _Constructor<CostMatrix> {
type CostMatrix (line 151) | interface CostMatrix {
FILE: src/power-creep.ts
type PowerCreep (line 14) | interface PowerCreep extends RoomObject {
type PowerCreepConstructor (line 359) | interface PowerCreepConstructor extends _Constructor<PowerCreep>, _Const...
type PowerCreepPowers (line 378) | interface PowerCreepPowers {
FILE: src/raw-memory.ts
type RawMemory (line 8) | interface RawMemory {
FILE: src/resource.ts
type Resource (line 8) | interface Resource<T extends ResourceConstant = ResourceConstant> extend...
type ResourceConstructor (line 27) | interface ResourceConstructor extends _Constructor<Resource>, _Construct...
FILE: src/room-object.ts
type RoomObject (line 7) | interface RoomObject {
type RoomObjectConstructor (line 26) | interface RoomObjectConstructor extends _Constructor<RoomObject> {
type RoomObjectEffect (line 36) | type RoomObjectEffect = NaturalEffect | PowerEffect;
type NaturalEffect (line 41) | interface NaturalEffect {
type PowerEffect (line 57) | interface PowerEffect {
FILE: src/room-position.ts
type RoomPosition (line 8) | interface RoomPosition {
type RoomPositionConstructor (line 213) | interface RoomPositionConstructor extends _Constructor<RoomPosition> {
FILE: src/room-terrain.ts
type RoomTerrain (line 8) | interface RoomTerrain {
type RoomTerrainConstructor (line 41) | interface RoomTerrainConstructor extends _Constructor<RoomTerrain> {
FILE: src/room-visual.ts
class RoomVisual (line 14) | class RoomVisual {
type LineStyle (line 139) | interface LineStyle {
type PolyStyle (line 162) | interface PolyStyle {
type CircleStyle (line 189) | interface CircleStyle extends PolyStyle {
type TextStyle (line 197) | interface TextStyle {
FILE: src/room.ts
type Room (line 8) | interface Room {
type RoomConstructor (line 268) | interface RoomConstructor extends _Constructor<Room> {
FILE: src/ruin.ts
type Ruin (line 8) | interface Ruin extends RoomObject {
type RuinConstructor (line 32) | interface RuinConstructor extends _Constructor<Ruin>, _ConstructorById<R...
FILE: src/source.ts
type Source (line 13) | interface Source extends RoomObject {
type SourceConstructor (line 44) | interface SourceConstructor extends _Constructor<Source>, _ConstructorBy...
FILE: src/spawn.ts
type StructureSpawn (line 22) | interface StructureSpawn extends OwnedStructure<STRUCTURE_SPAWN> {
type StructureSpawnConstructor (line 175) | interface StructureSpawnConstructor extends _Constructor<StructureSpawn>...
type Spawning (line 183) | interface Spawning {
type SpawnOptions (line 238) | interface SpawnOptions {
type SpawningConstructor (line 261) | interface SpawningConstructor extends _Constructor<Spawning> {
FILE: src/store.ts
type StoreBase (line 1) | interface StoreBase<POSSIBLE_RESOURCES extends ResourceConstant, UNLIMIT...
type Store (line 48) | type Store<POSSIBLE_RESOURCES extends ResourceConstant, UNLIMITED_STORE ...
type GenericStoreBase (line 69) | interface GenericStoreBase {
type GenericStore (line 94) | type GenericStore = GenericStoreBase & { [P in ResourceConstant]: number };
FILE: src/structure.ts
type Structure (line 4) | interface Structure<T extends StructureConstant = StructureConstant> ext...
type StructureConstructor (line 55) | interface StructureConstructor extends _Constructor<Structure>, _Constru...
type OwnedStructure (line 64) | interface OwnedStructure<T extends StructureConstant = StructureConstant...
type OwnedStructureConstructor (line 85) | interface OwnedStructureConstructor extends _Constructor<OwnedStructure>...
type StructureController (line 95) | interface StructureController extends OwnedStructure<STRUCTURE_CONTROLLE...
type StructureControllerConstructor (line 167) | interface StructureControllerConstructor extends _Constructor<StructureC...
type StructureExtension (line 176) | interface StructureExtension extends OwnedStructure<STRUCTURE_EXTENSION> {
type StructureExtensionConstructor (line 198) | interface StructureExtensionConstructor extends _Constructor<StructureEx...
type StructureLink (line 205) | interface StructureLink extends OwnedStructure<STRUCTURE_LINK> {
type StructureLinkConstructor (line 248) | interface StructureLinkConstructor extends _Constructor<StructureLink>, ...
type StructureKeeperLair (line 258) | interface StructureKeeperLair extends OwnedStructure<STRUCTURE_KEEPER_LA...
type StructureKeeperLairConstructor (line 267) | interface StructureKeeperLairConstructor extends _Constructor<StructureK...
type StructureObserver (line 274) | interface StructureObserver extends OwnedStructure<STRUCTURE_OBSERVER> {
type StructureObserverConstructor (line 292) | interface StructureObserverConstructor extends _Constructor<StructureObs...
type StructurePowerBank (line 302) | interface StructurePowerBank extends OwnedStructure<STRUCTURE_POWER_BANK> {
type StructurePowerBankConstructor (line 315) | interface StructurePowerBankConstructor extends _Constructor<StructurePo...
type StructurePowerSpawn (line 325) | interface StructurePowerSpawn extends OwnedStructure<STRUCTURE_POWER_SPA...
type StructurePowerSpawnConstructor (line 365) | interface StructurePowerSpawnConstructor extends _Constructor<StructureP...
type StructureRampart (line 375) | interface StructureRampart extends OwnedStructure<STRUCTURE_RAMPART> {
type StructureRampartConstructor (line 401) | interface StructureRampartConstructor extends _Constructor<StructureRamp...
type StructureRoad (line 410) | interface StructureRoad extends Structure<STRUCTURE_ROAD> {
type StructureRoadConstructor (line 419) | interface StructureRoadConstructor extends _Constructor<StructureRoad>, ...
type StructureStorage (line 428) | interface StructureStorage extends OwnedStructure<STRUCTURE_STORAGE> {
type StructureStorageConstructor (line 442) | interface StructureStorageConstructor extends _Constructor<StructureStor...
type StructureTower (line 452) | interface StructureTower extends OwnedStructure<STRUCTURE_TOWER> {
type StructureTowerConstructor (line 511) | interface StructureTowerConstructor extends _Constructor<StructureTower>...
type StructureWall (line 518) | interface StructureWall extends Structure<STRUCTURE_WALL> {
type StructureWallConstructor (line 526) | interface StructureWallConstructor extends _Constructor<StructureWall>, ...
type StructureExtractor (line 533) | interface StructureExtractor extends OwnedStructure<STRUCTURE_EXTRACTOR> {
type StructureExtractorConstructor (line 541) | interface StructureExtractorConstructor extends _Constructor<StructureEx...
type StructureLab (line 548) | interface StructureLab extends OwnedStructure<STRUCTURE_LAB> {
type StructureLabConstructor (line 658) | interface StructureLabConstructor extends _Constructor<StructureLab>, _C...
type StructureTerminal (line 665) | interface StructureTerminal extends OwnedStructure<STRUCTURE_TERMINAL> {
type StructureTerminalConstructor (line 696) | interface StructureTerminalConstructor extends _Constructor<StructureTer...
type StructureContainer (line 705) | interface StructureContainer extends Structure<STRUCTURE_CONTAINER> {
type StructureContainerConstructor (line 725) | interface StructureContainerConstructor extends _Constructor<StructureCo...
type StructureNuker (line 737) | interface StructureNuker extends OwnedStructure<STRUCTURE_NUKER> {
type StructureNukerConstructor (line 783) | interface StructureNukerConstructor extends _Constructor<StructureNuker>...
type StructurePortal (line 793) | interface StructurePortal extends Structure<STRUCTURE_PORTAL> {
type StructurePortalConstructor (line 809) | interface StructurePortalConstructor extends _Constructor<StructurePorta...
type StructureFactory (line 816) | interface StructureFactory extends OwnedStructure<STRUCTURE_FACTORY> {
type StructureFactoryConstructor (line 852) | interface StructureFactoryConstructor extends _Constructor<StructureFact...
type StructureInvaderCore (line 859) | interface StructureInvaderCore extends OwnedStructure<STRUCTURE_INVADER_...
type StructureInvaderCoreConstructor (line 877) | interface StructureInvaderCoreConstructor extends _Constructor<Structure...
type AnyOwnedStructure (line 884) | type AnyOwnedStructure =
type AnyStoreStructure (line 903) | type AnyStoreStructure =
type AnyStructure (line 919) | type AnyStructure = AnyOwnedStructure | StructureContainer | StructurePo...
type ConcreteStructureMap (line 924) | interface ConcreteStructureMap {
type ConcreteStructure (line 953) | type ConcreteStructure<T extends StructureConstant> = ConcreteStructureM...
FILE: src/tombstone.ts
type Tombstone (line 7) | interface Tombstone extends RoomObject {
type TombstoneConstructor (line 36) | interface TombstoneConstructor extends _Constructor<Tombstone>, _Constru...
Condensed preview — 57 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (610K chars).
[
{
"path": ".editorconfig",
"chars": 228,
"preview": "# editorconfig.org\n\nroot = true\n\n[*]\nindent_style = space\nindent_size = 4\nend_of_line = lf\ncharset = utf-8\ntrim_trailing"
},
{
"path": ".gitattributes",
"chars": 38,
"preview": "# Set end-of-line to LF\n* text eol=lf\n"
},
{
"path": ".github/ISSUE_TEMPLATE/bug-report.md",
"chars": 538,
"preview": "---\nname: \"Bug Report 🐛\"\nabout: For reporting bugs/problems with the definition.\nlabels: \"bug\"\n---\n\n<!-- Please replace "
},
{
"path": ".github/ISSUE_TEMPLATE/definition-changes.md",
"chars": 391,
"preview": "---\nname: \"Declaration Changes 👨💻\"\nabout: For changes/additions to the declaration files.\nlabels: \"enhancement\"\n---\n\n<!"
},
{
"path": ".github/PULL_REQUEST_TEMPLATE.md",
"chars": 412,
"preview": "<!-- Thank you for your contribution to typed-screeps! Please replace {Please write here} with your description. -->\n\n##"
},
{
"path": ".github/workflows/CI.yml",
"chars": 598,
"preview": "name: CI\n\non:\n pull_request:\n push:\n branches: [\"master\"]\n\njobs:\n build:\n runs-on: ubuntu-latest\n\n strategy:"
},
{
"path": ".gitignore",
"chars": 149,
"preview": ".idea\nnode_modules\nnpm-debug.log\n*.*~\n.DS_Store\ntest/typed-screeps-tests.js\ndist/screeps.ts\ndist/screeps.js\ndist/screeps"
},
{
"path": ".husky/pre-commit",
"chars": 91,
"preview": "#!/bin/sh\n. \"$(dirname \"$0\")/_/husky.sh\"\n\nnpx --no-install lint-staged\nnpm run pre-commit\n\n"
},
{
"path": ".npmignore",
"chars": 134,
"preview": "node_modules/\n*.d.ts\n*.log\n*.tgz\n\n.editorconfig\n.gitattributes\ntsconfig.json\neslint.config.*\n\nsrc/\ndist/screeps.ts\n!dist"
},
{
"path": ".prettierrc",
"chars": 426,
"preview": "{\n \"semi\": true,\n \"tabWidth\": 4,\n \"printWidth\": 140,\n \"useTabs\": false,\n \"trailingComma\": \"all\",\n \"ove"
},
{
"path": ".vscode/extensions.json",
"chars": 139,
"preview": "{\n \"recommendations\": [\n \"EditorConfig.EditorConfig\",\n \"esbenp.prettier-vscode\",\n \"dbaeumer.vsco"
},
{
"path": ".vscode/settings.json",
"chars": 315,
"preview": "{\n \"editor.insertSpaces\": true,\n \"editor.tabSize\": 4,\n \"editor.rulers\": [140],\n \"files.encoding\": \"utf8\",\n "
},
{
"path": "CHANGELOG.md",
"chars": 20696,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 3204,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
},
{
"path": "CONTRIBUTING.md",
"chars": 3183,
"preview": "# Thank you for contributing to `typed-screeps`!\n\nThis document contains guides on getting started with developing `type"
},
{
"path": "LICENSE",
"chars": 1088,
"preview": "MIT License\n\nCopyright (c) 2016-2017 typed-screeps contributors\n\nPermission is hereby granted, free of charge, to any pe"
},
{
"path": "README.md",
"chars": 6065,
"preview": "# typed-screeps\n\n> Strong TypeScript declarations for the game Screeps: World.\n\n[;\nconst path = require(\"path\");\n\nconst HEADER = `// Please contribute types to https://github.co"
},
{
"path": "dist/.eslintrc.json",
"chars": 239,
"preview": "{\n \"rules\": {\n \"@definitelytyped/no-any-union\": \"off\",\n \"@definitelytyped/no-unnecessary-generics\": \"of"
},
{
"path": "dist/.npmignore",
"chars": 50,
"preview": "*\n!**/*.d.ts\n!**/*.d.cts\n!**/*.d.mts\n!**/*.d.*.ts\n"
},
{
"path": "dist/index.d.ts",
"chars": 249915,
"preview": "// Please contribute types to https://github.com/screepers/typed-screeps\n\n// Game Constants\n\ndeclare const OK: OK;\ndecla"
},
{
"path": "dist/package.json",
"chars": 1021,
"preview": "{\n \"private\": true,\n \"name\": \"@types/screeps\",\n \"version\": \"3.4.9999\",\n \"projects\": [\n \"https://githu"
},
{
"path": "dist/screeps-tests.ts",
"chars": 46716,
"preview": "// This file exists solely to test whether or not the typings actually work.\n// After working on your changes, make sure"
},
{
"path": "dist/tsconfig.json",
"chars": 443,
"preview": "{\n \"compilerOptions\": {\n \"module\": \"commonjs\",\n \"lib\": [\n \"es6\"\n ],\n \"noImplic"
},
{
"path": "eslint.config.mjs",
"chars": 777,
"preview": "// @ts-check\nimport tseslint, { parser } from 'typescript-eslint';\nimport expectType from \"eslint-plugin-expect-type/con"
},
{
"path": "eslint.config.test.mjs",
"chars": 498,
"preview": "// @ts-check\n// only used for 'dist/screeps-tests.ts'\nimport tseslint, { parser } from 'typescript-eslint';\nimport { sha"
},
{
"path": "package.json",
"chars": 1219,
"preview": "{\n \"name\": \"typed-screeps\",\n \"version\": \"3.4.0\",\n \"description\": \"Strong TypeScript declarations for the game Screeps"
},
{
"path": "src/constants.ts",
"chars": 29870,
"preview": "// Game Constants\n\ndeclare const OK: OK;\ndeclare const ERR_NOT_OWNER: ERR_NOT_OWNER;\ndeclare const ERR_NO_PATH: ERR_NO_P"
},
{
"path": "src/construction-site.ts",
"chars": 1528,
"preview": "/**\n * A site of a structure which is currently under construction.\n *\n * A construction site can be created using the '"
},
{
"path": "src/creep.ts",
"chars": 29184,
"preview": "/**\n * Creeps are your units.\n *\n * Creeps can move, harvest energy, construct structures, attack another creeps, and pe"
},
{
"path": "src/deposit.ts",
"chars": 1395,
"preview": "/**\n * A rare resource deposit needed for producing commodities.\n *\n * Can be harvested by creeps with a WORK body part."
},
{
"path": "src/flag.ts",
"chars": 2654,
"preview": "/**\n * A flag.\n *\n * Flags can be used to mark particular spots in a room. Flags are visible to their owners only. You c"
},
{
"path": "src/game.ts",
"chars": 4250,
"preview": "/**\n * The main global game object containing all the gameplay information.\n */\ninterface Game {\n /**\n * An objec"
},
{
"path": "src/helpers.ts",
"chars": 15528,
"preview": "interface _HasId {\n id: Id<this>;\n}\n\ninterface _HasRoomPosition {\n pos: RoomPosition;\n}\n\ninterface GlobalControlLe"
},
{
"path": "src/inter-shard-memory.ts",
"chars": 1259,
"preview": "/**\n * `InterShardMemory` object provides an interface for communicating between shards.\n *\n * Your script is executed s"
},
{
"path": "src/literals.ts",
"chars": 18712,
"preview": "/*\n * This file creates literal versions of many of the constants\n * It should be kept in sync with constants.ts\n */\n\n//"
},
{
"path": "src/map.ts",
"chars": 11235,
"preview": "/**\n * The options that can be accepted by `findRoute()` and friends.\n */\ninterface RouteOptions {\n /**\n * This c"
},
{
"path": "src/market.ts",
"chars": 9271,
"preview": "/**\n * A global object representing the in-game market.\n *\n * You can use this object to track resource transactions to/"
},
{
"path": "src/memory.ts",
"chars": 412,
"preview": "interface Memory {\n creeps: { [name: string]: CreepMemory };\n powerCreeps: { [name: string]: PowerCreepMemory };\n "
},
{
"path": "src/mineral.ts",
"chars": 1923,
"preview": "/**\n * A mineral deposit.\n *\n * Can be harvested by creeps with a WORK body part using the extractor structure.\n * Learn"
},
{
"path": "src/nuke.ts",
"chars": 1514,
"preview": "/**\n * A nuke landing position.\n *\n * This object cannot be removed or modified. You can find incoming nukes in the room"
},
{
"path": "src/path-finder.ts",
"chars": 6676,
"preview": "/**\n * Contains powerful methods for pathfinding in the game world.\n *\n * This module is written in fast native C++ code"
},
{
"path": "src/power-creep.ts",
"chars": 18599,
"preview": "/**\n * Power Creeps are immortal \"heroes\" that are tied to your account and can be respawned in any PowerSpawn after dea"
},
{
"path": "src/raw-memory.ts",
"chars": 4253,
"preview": "/**\n * RawMemory object allows to implement your own memory stringifier instead of built-in serializer based on JSON.str"
},
{
"path": "src/resource.ts",
"chars": 780,
"preview": "/**\n * A dropped piece of resource.\n *\n * It will decay after a while if not picked up.\n * Dropped resource pile decays "
},
{
"path": "src/room-object.ts",
"chars": 1947,
"preview": "/**\n * Any object with a position in a room.\n *\n * Almost all game objects prototypes are derived from RoomObject.\n */\n\n"
},
{
"path": "src/room-position.ts",
"chars": 11045,
"preview": "/**\n * An object representing the specified position in the room.\n *\n * Every object in the room contains one of these a"
},
{
"path": "src/room-terrain.ts",
"chars": 1782,
"preview": "/**\n * An object which provides fast access to room terrain data.\n *\n * These objects can be constructed for any room in"
},
{
"path": "src/room-visual.ts",
"chars": 7754,
"preview": "/**\n * Room visuals provide a way to show various visual debug info in game rooms.\n *\n * You can use the RoomVisual obje"
},
{
"path": "src/room.ts",
"chars": 13348,
"preview": "/**\n * An object representing the room in which your units and structures are in.\n *\n * It can be used to look around, f"
},
{
"path": "src/ruin.ts",
"chars": 802,
"preview": "/**\n * A destroyed structure.\n *\n * This is a walkable object.\n *\n * Usually decays in 500 ticks except some special cas"
},
{
"path": "src/source.ts",
"chars": 1337,
"preview": "/**\n * An energy source object.\n *\n * Can be harvested by creeps with a WORK body part.\n *\n * | | "
},
{
"path": "src/spawn.ts",
"chars": 10920,
"preview": "/**\n * Spawns are your colony centers.\n *\n * This structure can create, renew, and recycle creeps.\n * All your spawns ar"
},
{
"path": "src/store.ts",
"chars": 4319,
"preview": "interface StoreBase<POSSIBLE_RESOURCES extends ResourceConstant, UNLIMITED_STORE extends boolean> {\n /**\n * Retur"
},
{
"path": "src/structure.ts",
"chars": 36386,
"preview": "/**\n * The base prototype object of all structures.\n */\ninterface Structure<T extends StructureConstant = StructureConst"
},
{
"path": "src/tombstone.ts",
"chars": 1158,
"preview": "/**\n * A creep's final resting place.\n *\n * This is a walkable structure.\n * Will decay 5 ticks per body part of the dec"
},
{
"path": "tsconfig.json",
"chars": 366,
"preview": "{\n \"compilerOptions\": {\n \"module\": \"esnext\",\n \"target\": \"es2017\",\n \"sourceMap\": false,\n \""
}
]
About this extraction
This page contains the full source code of the screepers/typed-screeps GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 57 files (575.6 KB), approximately 146.1k tokens, and a symbol index with 910 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.