`;
70 | });
71 |
--------------------------------------------------------------------------------
/api/scripts/tag-api_method.js:
--------------------------------------------------------------------------------
1 | var util = require('hexo-util');
2 |
3 | hexo.extend.tag.register('api_method', function(args) {
4 | if(args[2] === undefined) {
5 | args[2] = args[1];
6 | args[1] = '';
7 | }
8 |
9 | var signatures = args[1].split('|').map(i => `(${i})`).join(' ');
10 | var inherited = '';
11 | var cpuDescription = {
12 | 0: 'This method has insignificant CPU cost.',
13 | 1: 'This method has low CPU cost.',
14 | 2: 'This method has medium CPU cost.',
15 | 3: 'This method has high CPU cost.',
16 | A: 'This method is an action that changes game state. It has additional 0.2 CPU cost added to its natural cost in case if OK code is returned.',
17 | };
18 |
19 | var name = args[0];
20 | var m = name.match(/^(.*?):(.*)$/);
21 | if(m) {
22 | name = m[2];
23 | inherited = `
${inherited}${name}${args[1]}`;
34 | if (opts.deprecated) {
35 | var text = 'This property is deprecated and will be removed soon.';
36 | if (opts.deprecated !== true) {
37 | text += ' ' + opts.deprecated;
38 | }
39 | text = hexo.render.renderSync({text, engine: 'markdown'});
40 | result += `
{
24 | return data.content;
25 | });
26 | }, {async: true});
27 |
28 |
29 |
--------------------------------------------------------------------------------
/api/source/ConstructionSite.md:
--------------------------------------------------------------------------------
1 | # ConstructionSite
2 |
3 | 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 [`Room.createConstructionSite`](#Room.createConstructionSite) method.
4 |
5 | To build a structure on the construction site, give a worker creep some amount of energy and perform [`Creep.build`](#Creep.build) action.
6 |
7 | You can remove enemy construction sites by moving a creep on it.
8 |
9 | {% page inherited/RoomObject.md %}
10 |
11 | {% api_property id string %}
12 |
13 |
14 |
15 | A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id.
16 |
17 |
18 |
19 | {% api_property my boolean %}
20 |
21 |
22 |
23 | Whether this is your own construction site.
24 |
25 |
26 |
27 | {% api_property owner object %}
28 |
29 |
30 |
31 | An object with the structure’s owner info containing the following properties:
32 |
33 | {% api_method_params %}
34 | username : string
35 | The name of the owner user.
36 | {% endapi_method_params %}
37 |
38 |
39 | {% api_property progress number %}
40 |
41 |
42 |
43 | The current construction progress.
44 |
45 |
46 |
47 | {% api_property progressTotal number %}
48 |
49 |
50 |
51 | The total construction progress needed for the structure to be built.
52 |
53 |
54 |
55 | {% api_property structureType string %}
56 |
57 |
58 |
59 | One of the STRUCTURE_* constants.
60 |
61 |
62 |
63 | {% api_method remove '' A %}
64 |
65 |
66 |
67 | Remove the construction site.
68 |
69 |
70 |
71 | ### Return value
72 |
73 | One of the following codes:
74 | {% api_return_codes %}
75 | OK | The operation has been scheduled successfully.
76 | ERR_NOT_OWNER | You are not the owner of this construction site, and it's not in your room.
77 | {% endapi_return_codes %}
78 |
79 |
80 |
--------------------------------------------------------------------------------
/api/source/Deposit.md:
--------------------------------------------------------------------------------
1 | # Deposit
2 |
3 |
4 |
5 | A rare resource deposit needed for producing commodities. Can be harvested by creeps with a `WORK` body part.
6 | Each harvest operation triggers a cooldown period, which becomes longer and longer over time.
7 |
8 | Learn more about deposits from [this article](/resources.html).
9 |
10 |
11 |
12 |
13 |
Cooldown
14 |
`0.001 * totalHarvested ^ 1.2`
15 |
16 |
17 |
Decay
18 |
50,000 ticks after appearing or last harvest operation
19 |
20 |
21 |
22 |
23 | {% page inherited/RoomObject.md %}
24 |
25 | {% api_property cooldown 'number' %}
26 |
27 |
28 | The amount of game ticks until the next harvest action is possible.
29 |
30 |
31 | {% api_property depositType 'string' %}
32 |
33 |
34 | The deposit type, one of the following constants:
35 |
36 | ```javascript-content
37 | RESOURCE_MIST
38 | RESOURCE_BIOMASS
39 | RESOURCE_METAL
40 | RESOURCE_SILICON
41 | ```
42 |
43 | {% api_property id 'string' %}
44 |
45 | A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id.
46 |
47 |
48 |
49 | {% api_property lastCooldown 'number' %}
50 |
51 |
52 | The cooldown of the last harvest operation on this deposit.
53 |
54 |
55 | {% api_property ticksToDecay 'number' %}
56 |
57 |
58 | The amount of game ticks when this deposit will disappear.
59 |
--------------------------------------------------------------------------------
/api/source/Flag.md:
--------------------------------------------------------------------------------
1 | # Flag
2 |
3 | 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.
4 |
5 | {% page inherited/RoomObject.md %}
6 |
7 | {% api_property color number %}
8 |
9 | Flag primary color. One of the COLOR_* constants.
10 |
11 |
12 |
13 | {% api_property memory any %}
14 |
15 |
16 |
17 | A shorthand to Memory.flags[flag.name]. You can use it for quick access the flag's specific memory data object.
18 |
19 |
20 |
21 | {% api_property name string %}
22 |
23 |
24 |
25 | 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 Game.flags object. The maximum name length is 100 charactes.
26 |
27 |
28 |
29 | {% api_property secondaryColor number %}
30 |
31 |
32 |
33 | Flag secondary color. One of the COLOR_* constants.
34 |
35 |
36 |
37 | {% api_method remove '' A %}
38 |
39 |
40 |
41 | Remove the flag.
42 |
43 |
44 |
45 | ### Return value
46 |
47 | Always returns
48 | OK
49 | .
50 |
51 | {% api_method setColor 'color, [secondaryColor]' A %}
52 |
53 | ```javascript
54 | Game.flags.Flag1.setColor(COLOR_GREEN, COLOR_WHITE);
55 | ```
56 |
57 | Set new color of the flag.
58 |
59 | {% api_method_params %}
60 | color : number
61 | Primary color of the flag. One of the COLOR_* constants.
62 | ===
63 | secondaryColor (optional) : number
64 | Secondary color of the flag. One of the COLOR_* constants.
65 | {% endapi_method_params %}
66 |
67 |
68 | ### Return value
69 |
70 | One of the following codes:
71 | {% api_return_codes %}
72 | OK | The operation has been scheduled successfully.
73 | ERR_INVALID_ARGS | color or secondaryColor is not a valid color constant.
74 | {% endapi_return_codes %}
75 |
76 |
77 |
78 | {% api_method setPosition 'x,y|pos' A %}
79 |
80 | ```javascript
81 | Game.flags.Flag1.setPosition(10,20);
82 | ```
83 |
84 | ```javascript
85 | Game.flags.Flag1.setPosition( new RoomPosition(10, 20, 'W3S5') );
86 | ```
87 |
88 | Set new position of the flag.
89 |
90 | {% api_method_params %}
91 | x : number
92 | The X position in the room.
93 | ===
94 | y : number
95 | The Y position in the room.
96 | ===
97 | pos : object
98 | Can be a RoomPosition object or any object containing RoomPosition.
99 | {% endapi_method_params %}
100 |
101 |
102 | ### Return value
103 |
104 | One of the following codes:
105 | {% api_return_codes %}
106 | OK | The operation has been scheduled successfully.
107 | ERR_INVALID_TARGET | The target provided is invalid.
108 | {% endapi_return_codes %}
109 |
110 |
111 |
--------------------------------------------------------------------------------
/api/source/InterShardMemory.md:
--------------------------------------------------------------------------------
1 | # InterShardMemory
2 |
3 | `InterShardMemory` object provides an interface for communicating between shards. Your script is executed separatedly
4 | on each shard, and their [`Memory`](#Memory) objects are isolated from each other. In order to pass messages and
5 | data between shards, you need to use `InterShardMemory` instead.
6 |
7 | Every shard can have its own 100 KB of data in string format that can be accessed by all other shards.
8 | A shard can write only to its own data, other shards' data is read-only.
9 |
10 | This data has nothing to do with `Memory` contents, it's a separate data container.
11 |
12 | {% api_method InterShardMemory.getLocal '' 0 %}
13 |
14 | Returns the string contents of the current shard's data.
15 |
16 | {% api_method InterShardMemory.setLocal 'value' 0 %}
17 |
18 | ```javascript
19 | var data = JSON.parse(InterShardMemory.getLocal() || "{}");
20 | data.message = "hello from another shard!";
21 | InterShardMemory.setLocal(JSON.stringify(data));
22 | ```
23 |
24 | Replace the current shard's data with the new value.
25 |
26 | {% api_method_params %}
27 | value : string
28 | New data value in string format.
29 | {% endapi_method_params %}
30 |
31 |
32 | {% api_method InterShardMemory.getRemote 'shard' 0 %}
33 |
34 | ```javascript
35 | var data = JSON.parse(InterShardMemory.getRemote('shard0') || "{}");
36 | console.log(data.message);
37 | ```
38 |
39 | Returns the string contents of another shard's data.
40 |
41 | {% api_method_params %}
42 | shard : string
43 | Shard name.
44 | {% endapi_method_params %}
45 |
--------------------------------------------------------------------------------
/api/source/Memory.md:
--------------------------------------------------------------------------------
1 | # Memory
2 |
3 | A global plain object which can contain arbitrary data. You can access it both using the API and the Memory UI in the game editor.
4 | Learn how to work with memory from [this article](http://docs.screeps.com/global-objects.html#Memory-object).
--------------------------------------------------------------------------------
/api/source/Mineral.md:
--------------------------------------------------------------------------------
1 | # Mineral
2 |
3 | A mineral deposit. Can be harvested by creeps with a `WORK` body part using the extractor structure.
4 | Learn more about minerals from [this article](/resources.html).
5 |
6 |
22 |
23 | {% page inherited/RoomObject.md %}
24 |
25 | {% api_property density 'number' %}
26 |
27 |
28 |
29 | The density that this mineral deposit will be refilled to once ticksToRegeneration reaches 0. This is one of the DENSITY_* constants.
30 |
31 |
32 |
33 | {% api_property mineralAmount 'number' %}
34 |
35 |
36 |
37 | The remaining amount of resources.
38 |
39 |
40 |
41 | {% api_property mineralType 'string' %}
42 |
43 |
44 |
45 | The resource type, one of the RESOURCE_* constants.
46 |
47 |
48 |
49 | {% api_property id 'string' %}
50 |
51 |
52 |
53 | A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id.
54 |
55 |
56 |
57 | {% api_property ticksToRegeneration 'number' %}
58 |
59 |
60 |
61 | The remaining time after which the deposit will be refilled.
62 |
63 |
64 |
--------------------------------------------------------------------------------
/api/source/Nuke.md:
--------------------------------------------------------------------------------
1 | # Nuke
2 |
3 | A nuke landing position. This object cannot be removed or modified. You can find incoming nukes in the room using the `FIND_NUKES` constant.
4 |
5 |
6 |
7 |
8 |
Landing time
9 |
50,000 ticks
10 |
11 |
12 |
Effect
13 |
All creeps, construction sites and dropped resources in the room are removed immediately, even inside ramparts. Damage to structures:
14 |
15 |
10,000,000 hits at the landing position;
16 |
5,000,000 hits to all structures in 5x5 area.
17 |
18 |
Note that you can stack multiple nukes from different rooms at the same target position to increase damage.
19 |
Nuke landing does not generate tombstones and ruins, and destroys all existing tombstones and ruins in the room
20 |
If the room is in safe mode, then the safe mode is cancelled immediately, and the safe mode cooldown is reset to 0.
21 |
The room controller is hit by triggering upgradeBlocked period, which means it is unavailable to activate safe mode again within the next 200 ticks.
22 |
23 |
24 |
25 |
26 |
27 | {% page inherited/RoomObject.md %}
28 |
29 | {% api_property id 'string' %}
30 |
31 |
32 |
33 | A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id.
34 |
35 |
36 |
37 | {% api_property launchRoomName 'string' %}
38 |
39 |
40 |
41 | The name of the room where this nuke has been launched from.
42 |
43 |
44 |
45 | {% api_property timeToLand 'number' %}
46 |
47 |
48 |
49 | The remaining landing time.
50 |
51 |
52 |
--------------------------------------------------------------------------------
/api/source/OwnedStructure.md:
--------------------------------------------------------------------------------
1 | # OwnedStructure
2 |
3 | The base prototype for a structure that has an owner.
4 | Such structures can be found using `FIND_MY_STRUCTURES` and `FIND_HOSTILE_STRUCTURES` constants.
5 |
6 | {% page inherited/Structure.md %}
7 |
8 | {% api_property my 'boolean' %}
9 |
10 |
11 |
12 | Whether this is your own structure.
13 |
14 |
15 |
16 | {% api_property owner 'object' %}
17 |
18 |
19 |
20 | An object with the structure’s owner info containing the following properties:
21 |
22 | {% api_method_params %}
23 | username : string
24 | The name of the owner user.
25 | {% endapi_method_params %}
26 |
27 |
--------------------------------------------------------------------------------
/api/source/PathFinder.CostMatrix.md:
--------------------------------------------------------------------------------
1 | # PathFinder.CostMatrix
2 |
3 | Container for custom navigation cost data. By default `PathFinder` will only consider
4 | terrain data (plain, swamp, wall) — if you need to route around obstacles such as buildings
5 | or creeps you must put them into a `CostMatrix`. Generally you will create your `CostMatrix`
6 | from within `roomCallback`. If a non-0 value is found in a room's CostMatrix then that value
7 | will be used instead of the default terrain cost. You should avoid using large values in your
8 | CostMatrix and terrain cost flags. For example, running `PathFinder.search` with
9 | `{ plainCost: 1, swampCost: 5 }` is faster than running it with `{plainCost: 2, swampCost: 10 }`
10 | even though your paths will be the same.
11 |
12 |
13 |
14 | {% api_method constructor %}
15 |
16 | ```javascript
17 | let costs = new PathFinder.CostMatrix;
18 | ```
19 |
20 | Creates a new CostMatrix containing 0's for all positions.
21 |
22 |
23 |
24 |
25 |
26 | {% api_method set 'x, y, cost' 0 %}
27 |
28 | ```javascript
29 | let costs = new PathFinder.CostMatrix;
30 | let pos = Game.spawns['Spawn1'].pos;
31 | costs.set(pos.x, pos.y, 255); // Can't walk over a building
32 | ```
33 |
34 | Set the cost of a position in this CostMatrix.
35 |
36 | {% api_method_params %}
37 | x : number
38 | X position in the room.
39 | ===
40 | y : number
41 | Y position in the room.
42 | ===
43 | cost : number
44 | 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.
45 | {% endapi_method_params %}
46 |
47 |
48 |
49 |
50 | {% api_method get 'x, y' 0 %}
51 |
52 |
53 |
54 | Get the cost of a position in this CostMatrix.
55 |
56 | {% api_method_params %}
57 | x : number
58 | X position in the room.
59 | ===
60 | y : number
61 | Y position in the room.
62 | {% endapi_method_params %}
63 |
64 |
65 |
66 |
67 | {% api_method clone '' 1 %}
68 |
69 |
70 |
71 | Copy this CostMatrix into a new CostMatrix with the same data.
72 |
73 |
74 |
75 | ### Return value
76 |
77 | A new CostMatrix instance.
78 |
79 | {% api_method serialize '' 1 %}
80 |
81 | ```javascript
82 | let costs = new PathFinder.CostMatrix;
83 | Memory.savedMatrix = costs.serialize();
84 | ```
85 |
86 | Returns a compact representation of this CostMatrix which can be stored via JSON.stringify.
87 |
88 |
89 |
90 | ### Return value
91 |
92 | An array of numbers. There's not much you can do with the numbers besides store them for later.
93 |
94 | {% api_method PathFinder.CostMatrix.deserialize 'val' 1 %}
95 |
96 | ```javascript
97 | let costs = PathFinder.CostMatrix.deserialize(Memory.savedMatrix)
98 | ```
99 |
100 | Static method which deserializes a new CostMatrix using the return value of serialize.
101 |
102 | {% api_method_params %}
103 | val : object
104 | Whatever serialize returned
105 | {% endapi_method_params %}
106 |
107 |
108 | ### Return value
109 |
110 | Returns new
111 | CostMatrix
112 | instance.
113 |
--------------------------------------------------------------------------------
/api/source/Resource.md:
--------------------------------------------------------------------------------
1 | # Resource
2 |
3 | A dropped piece of resource. It will decay after a while if not picked up.
4 | Dropped resource pile decays for `ceil(amount/1000)` units per tick.
5 |
6 | {% page inherited/RoomObject.md %}
7 |
8 | {% api_property amount 'number' %}
9 |
10 |
11 |
12 | The amount of resource units containing.
13 |
14 |
15 |
16 | {% api_property id 'string' %}
17 |
18 |
19 |
20 | A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id.
21 |
22 |
23 |
24 | {% api_property resourceType 'string' %}
25 |
26 |
27 |
28 | One of the RESOURCE_* constants.
29 |
30 |
31 |
--------------------------------------------------------------------------------
/api/source/RoomObject.md:
--------------------------------------------------------------------------------
1 | # RoomObject
2 |
3 | Any object with a position in a room. Almost all game objects prototypes are derived from `RoomObject`.
4 |
5 | {% api_property effects array %}
6 | Applied effects, an array of objects with the following properties:
7 |
8 | {% api_method_params %}
9 | effect : number
10 | Effect ID of the applied effect. Can be either natural effect ID or Power ID.
11 | ===
12 | level (optional) : number
13 | Power level of the applied effect. Absent if the effect is not a Power effect.
14 | ===
15 | ticksRemaining : number
16 | How many ticks will the effect last.
17 | {% endapi_method_params %}
18 |
19 | {% api_property pos 'RoomPosition' %}
20 |
21 |
22 |
23 | An object representing the position of this object in the room.
24 |
25 |
26 |
27 | {% api_property room 'Room' %}
28 |
29 |
30 |
31 | The link to the Room object. May be undefined in case if an object is a flag or a construction site and is placed in a room that is not visible to you.
32 |
33 |
34 |
--------------------------------------------------------------------------------
/api/source/Ruin.md:
--------------------------------------------------------------------------------
1 | # Ruin
2 |
3 |
4 |
5 | A destroyed structure. This is a walkable object.
6 |
7 |
8 |
9 |
10 |
Decay
11 |
500 ticks except some special cases
12 |
13 |
14 |
15 |
16 | {% page inherited/RoomObject.md %}
17 |
18 |
19 | {% api_property destroyTime 'number' %}
20 |
21 | The time when the structure has been destroyed.
22 |
23 | {% api_property id string %}
24 |
25 | A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id.
26 |
27 | {% api_property store 'Store' %}
28 |
29 | A [`Store`](#Store) object that contains resources of this structure.
30 |
31 | {% api_property structure 'Structure | OwnedStructure' %}
32 |
33 | An object containing basic data of the destroyed structure.
34 |
35 |
36 | {% api_property ticksToDecay 'number' %}
37 |
38 | The amount of game ticks before this ruin decays.
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/api/source/Source.md:
--------------------------------------------------------------------------------
1 | # Source
2 |
3 | An energy source object. Can be harvested by creeps with a `WORK` body part.
4 |
5 |
6 |
7 |
8 |
Energy amount
9 |
4000 in center rooms 3000 in an owned or reserved room 1500 in an unreserved room
10 |
11 |
12 |
Energy regeneration
13 |
Every 300 game ticks
14 |
15 |
16 |
17 |
18 | {% page inherited/RoomObject.md %}
19 |
20 | {% api_property energy 'number' %}
21 |
22 |
23 |
24 | The remaining amount of energy.
25 |
26 |
27 |
28 | {% api_property energyCapacity 'number' %}
29 |
30 |
31 |
32 | The total amount of energy in the source.
33 |
34 |
35 |
36 | {% api_property id 'string' %}
37 |
38 |
39 |
40 | A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id.
41 |
42 |
43 |
44 | {% api_property ticksToRegeneration 'number' %}
45 |
46 |
47 |
48 | The remaining time after which the source will be refilled.
49 |
50 |
51 |
--------------------------------------------------------------------------------
/api/source/Store.md:
--------------------------------------------------------------------------------
1 | # Store
2 |
3 | An object that can contain resources in its cargo.
4 |
5 | There are two types of stores in the game: general purpose stores and limited stores.
6 |
7 | * General purpose stores can contain any resource within its capacity (e.g. creeps, containers, storages, terminals).
8 |
9 | * Limited stores can contain only a few types of resources needed for that particular object (e.g. spawns, extensions, labs, nukers).
10 |
11 | The `Store` prototype is the same for both types of stores, but they have different behavior depending on the `resource` argument in its methods.
12 |
13 | You can get specific resources from the store by addressing them as object properties:
14 |
15 | ```javascript-content
16 | console.log(creep.store[RESOURCE_ENERGY]);
17 | ```
18 |
19 |
20 |
21 | {% api_method getCapacity '[resource]' 0 %}
22 |
23 | ```javascript
24 | if(creep.store[RESOURCE_ENERGY] < creep.store.getCapacity()) {
25 | goHarvest(creep);
26 | }
27 | ```
28 |
29 | Returns capacity of this store for the specified resource. For a general purpose store, it returns total capacity if `resource` is undefined.
30 |
31 | {% api_method_params %}
32 | resource (optional) : string
33 | The type of the resource.
34 | {% endapi_method_params %}
35 |
36 |
37 | ### Return value
38 |
39 | Returns capacity number, or `null` in case of an invalid `resource` for this store type.
40 |
41 | {% api_method getFreeCapacity '[resource]' 0 %}
42 |
43 | ```javascript
44 | if(structure.store.getFreeCapacity(RESOURCE_ENERGY) > 0) {
45 | creep.transfer(structure, RESOURCE_ENERGY);
46 | }
47 | ```
48 | Returns free capacity for the store. For a limited store, it returns the capacity available for the specified resource if `resource` is defined and valid for this store.
49 |
50 | {% api_method_params %}
51 | resource (optional) : string
52 | The type of the resource.
53 | {% endapi_method_params %}
54 |
55 |
56 | ### Return value
57 |
58 | Returns available capacity number, or `null` in case of an invalid `resource` for this store type.
59 |
60 |
61 |
62 | {% api_method getUsedCapacity '[resource]' 0 %}
63 |
64 | ```javascript
65 | if(Game.rooms['W1N1'].terminal.store.getUsedCapacity() == 0) {
66 | // terminal is empty
67 | }
68 | ```
69 |
70 | Returns the capacity used by the specified resource. For a general purpose store, it returns total used capacity if `resource` is undefined.
71 |
72 | {% api_method_params %}
73 | resource (optional) : string
74 | The type of the resource.
75 | {% endapi_method_params %}
76 |
77 |
78 | ### Return value
79 |
80 | Returns used capacity number, or `null` in case of a not valid `resource` for this store type.
81 |
--------------------------------------------------------------------------------
/api/source/Structure.md:
--------------------------------------------------------------------------------
1 | # Structure
2 |
3 | The base prototype object of all structures.
4 |
5 | {% page inherited/RoomObject.md %}
6 |
7 | {% api_property hits 'number' %}
8 |
9 |
10 |
11 | The current amount of hit points of the structure.
12 |
13 |
14 |
15 | {% api_property hitsMax 'number' %}
16 |
17 |
18 |
19 | The total amount of hit points of the structure.
20 |
21 |
22 |
23 | {% api_property id 'string' %}
24 |
25 |
26 |
27 | A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id.
28 |
29 |
30 |
31 | {% api_property structureType 'string' %}
32 |
33 |
34 |
35 | One of the STRUCTURE_* constants.
36 |
37 |
38 |
39 | {% api_method destroy '' A %}
40 |
41 |
42 |
43 | Destroy this structure immediately.
44 |
45 |
46 |
47 | ### Return value
48 |
49 | One of the following codes:
50 | {% api_return_codes %}
51 | OK | The operation has been scheduled successfully.
52 | ERR_NOT_OWNER | You are not the owner of this structure, and it's not in your room.
53 | ERR_BUSY | Hostile creeps are in the room.
54 | {% endapi_return_codes %}
55 |
56 |
57 |
58 | {% api_method isActive '' 2 %}
59 |
60 |
61 |
62 | Check whether this structure can be used. If room controller level is insufficient, then this method will return false, and the structure will be highlighted with red in the game.
63 |
64 |
65 |
66 | ### Return value
67 |
68 | A boolean value.
69 |
70 | {% api_method notifyWhenAttacked 'enabled' A %}
71 |
72 |
73 |
74 | Toggle auto notification when the structure is under attack. The notification will be sent to your account email. Turned on by default.
75 |
76 | {% api_method_params %}
77 | enabled : boolean
78 | Whether to enable notification or disable.
79 | {% endapi_method_params %}
80 |
81 |
82 | ### Return value
83 |
84 | One of the following codes:
85 | {% api_return_codes %}
86 | OK | The operation has been scheduled successfully.
87 | ERR_NOT_OWNER | You are not the owner of this structure.
88 | ERR_INVALID_ARGS | enable argument is not a boolean value.
89 | {% endapi_return_codes %}
90 |
91 |
92 |
--------------------------------------------------------------------------------
/api/source/StructureContainer.md:
--------------------------------------------------------------------------------
1 | # StructureContainer
2 |
3 |
4 |
5 | A small container that can be used to store resources. This is a walkable structure. All dropped resources automatically goes to the container at the same tile.
6 |
7 |
8 |
9 |
10 |
Controller level
11 |
Any (including neutral rooms)
12 |
13 |
14 |
Available per room
15 |
5
16 |
17 |
18 |
Capacity
19 |
2,000
20 |
21 |
22 |
Cost
23 |
5,000
24 |
25 |
26 |
Hits
27 |
250,000
28 |
29 |
30 |
Decay
31 |
Loses 5,000 hits every 500 ticks in an owned room, and every 100 ticks in an unowned room.
32 |
33 |
34 |
35 |
36 | {% page inherited/Structure.md %}
37 |
38 | {% api_property store 'Store' %}
39 |
40 | ```javascript
41 | const containersWithEnergy = room.find(FIND_STRUCTURES, {
42 | filter: (i) => i.structureType == STRUCTURE_CONTAINER &&
43 | i.store[RESOURCE_ENERGY] > 0
44 | });
45 | ```
46 |
47 |
48 | A [`Store`](#Store) object that contains cargo of this structure.
49 |
50 | {% api_property storeCapacity 'number' '{"deprecated": true}' %}
51 |
52 | An alias for [`.store.getCapacity()`](#Store.getCapacity).
53 |
54 |
55 |
56 | {% api_property ticksToDecay 'number' %}
57 |
58 |
59 |
60 | The amount of game ticks when this container will lose some hit points.
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/api/source/StructureExtension.md:
--------------------------------------------------------------------------------
1 | # StructureExtension
2 |
3 |
4 |
5 | Contains energy which can be spent on spawning bigger creeps. Extensions can be placed anywhere in the room, any spawns will be able to use them regardless of distance.
6 |
7 |
8 |
9 |
10 |
Controller level
11 |
12 |
13 |
1
14 |
—
15 |
16 |
17 |
2
18 |
5 extensions (50 capacity)
19 |
20 |
21 |
3
22 |
10 extensions (50 capacity)
23 |
24 |
25 |
4
26 |
20 extensions (50 capacity)
27 |
28 |
29 |
5
30 |
30 extensions (50 capacity)
31 |
32 |
33 |
6
34 |
40 extensions (50 capacity)
35 |
36 |
37 |
7
38 |
50 extensions (100 capacity)
39 |
40 |
41 |
8
42 |
60 extensions (200 capacity)
43 |
44 |
45 |
Cost
46 |
3,000
47 |
48 |
49 |
Hits
50 |
1,000
51 |
52 |
53 |
54 |
55 | {% page inherited/OwnedStructure.md %}
56 |
57 | {% api_property energy 'number' '{"deprecated": true}' %}
58 |
59 | An alias for [`.store[RESOURCE_ENERGY]`](#StructureExtension.store).
60 |
61 |
62 | {% api_property energyCapacity 'number' '{"deprecated": true}' %}
63 |
64 | An alias for [`.store.getCapacity(RESOURCE_ENERGY)`](#Store.getCapacity).
65 |
66 |
67 |
68 | The total amount of energy the extension can contain.
69 |
70 | {% api_property store 'Store' %}
71 |
72 | ```javascript
73 | if(structure.store.getFreeCapacity(RESOURCE_ENERGY) > 0) {
74 | creep.transfer(structure, RESOURCE_ENERGY);
75 | }
76 | ```
77 |
78 |
79 | A [`Store`](#Store) object that contains cargo of this structure.
80 |
81 |
--------------------------------------------------------------------------------
/api/source/StructureExtractor.md:
--------------------------------------------------------------------------------
1 | # StructureExtractor
2 |
3 |
4 |
5 | Allows to harvest a mineral deposit. Learn more about minerals from [this article](/resources.html).
6 |
7 |
8 |
9 |
10 |
Controller level
11 |
6
12 |
13 |
14 |
Cost
15 |
5,000
16 |
17 |
18 |
Hits
19 |
500
20 |
21 |
22 |
Cooldown
23 |
5 ticks on each harvest action
24 |
25 |
26 |
27 |
28 | {% page inherited/OwnedStructure.md %}
29 |
30 | {% api_property cooldown 'number' %}
31 |
32 | The amount of game ticks until the next harvest action is possible.
33 |
34 |
35 |
--------------------------------------------------------------------------------
/api/source/StructureFactory.md:
--------------------------------------------------------------------------------
1 | # StructureFactory
2 |
3 |
4 |
5 | Produces trade commodities from base minerals and other commodities. Learn more about commodities from [this article](/resources.html#Commodities).
6 |
7 |
8 |
9 |
10 |
Controller level
11 |
12 |
13 |
1-6
14 |
—
15 |
16 |
17 |
7-8
18 |
1 factory
19 |
20 |
21 |
Cost
22 |
100,000
23 |
24 |
25 |
Hits
26 |
1000
27 |
28 |
29 |
Capacity
30 |
50,000
31 |
32 |
33 |
Production cooldown
34 |
Depends on the resource
35 |
36 |
37 |
38 |
39 | {% page inherited/OwnedStructure.md %}
40 |
41 | {% api_property cooldown 'number' %}
42 |
43 |
44 |
45 | The amount of game ticks the factory has to wait until the next production is possible.
46 |
47 | {% api_property level number %}
48 |
49 | ```javascript
50 | if(!factory.level) {
51 | Game.powerCreeps['MyOperator1'].usePower(PWR_OPERATE_FACTORY, factory);
52 | }
53 | ```
54 |
55 | The factory's level. Can be set by applying the `PWR_OPERATE_FACTORY` power to a newly built factory.
56 | Once set, the level cannot be changed.
57 |
58 | {% api_property store 'Store' %}
59 |
60 | A [`Store`](#Store) object that contains cargo of this structure.
61 |
62 |
63 |
64 | {% api_property storeCapacity 'number' '{"deprecated": true}' %}
65 |
66 | An alias for [`.store.getCapacity()`](#Store.getCapacity).
67 |
68 | {% api_method produce 'resourceType' A %}
69 |
70 | ```javascript
71 | factory.produce(RESOURCE_UTRIUM_BAR);
72 | ```
73 |
74 | Produces the specified commodity. All ingredients should be available in the factory store.
75 |
76 | {% api_method_params %}
77 | resourceType : string
78 | One of the RESOURCE_* constants.
79 | {% endapi_method_params %}
80 |
81 |
82 | ### Return value
83 |
84 | One of the following codes:
85 | {% api_return_codes %}
86 | OK | The operation has been scheduled successfully.
87 | ERR_NOT_OWNER | You are not the owner of this structure.
88 | ERR_RCL_NOT_ENOUGH | Your Room Controller level is insufficient to use the factory.
89 | ERR_NOT_ENOUGH_RESOURCES | The structure does not have the required amount of resources.
90 | ERR_INVALID_ARGS | The arguments provided are incorrect.
91 | ERR_INVALID_TARGET | The factory cannot produce the commodity of this level.
92 | ERR_TIRED | The factory is still cooling down.
93 | ERR_BUSY | The factory is not operated by the `PWR_OPERATE_FACTORY` power.
94 | ERR_FULL | The factory cannot contain the produce.
95 | {% endapi_return_codes %}
96 |
--------------------------------------------------------------------------------
/api/source/StructureInvaderCore.md:
--------------------------------------------------------------------------------
1 | # StructureInvaderCore
2 |
3 |
4 |
5 | This NPC structure is a control center of NPC Strongholds, and also rules all invaders in the sector. It spawns NPC defenders of the stronghold, refill towers, repairs structures.
6 | While it's alive, it will spawn invaders in all rooms in the same sector. It also contains some valuable resources inside, which you can loot from its ruin if you destroy the structure.
7 |
8 | An Invader Core has two lifetime stages: deploy stage and active stage. When it appears in a random room in the sector, it has `ticksToDeploy` property,
9 | public ramparts around it, and doesn't perform any actions. While in this stage it's invulnerable to attacks (has `EFFECT_INVULNERABILITY` enabled). When the `ticksToDeploy` timer is over, it spawns structures around it and starts
10 | spawning creeps, becomes vulnerable, and receives `EFFECT_COLLAPSE_TIMER` which will remove the stronghold when this timer is over.
11 |
12 | An active Invader Core spawns level-0 Invader Cores in neutral neighbor rooms inside the sector. These lesser Invader Cores are spawned
13 | near the room controller and don't perform any activity except reserving/attacking the controller. One Invader Core can spawn up to 42 lesser Cores
14 | during its lifetime.
15 |
16 |
44 |
45 | {% page inherited/OwnedStructure.md %}
46 |
47 |
48 | {% api_property level 'number' %}
49 |
50 | The level of the stronghold. The amount and quality of the loot depends on the level.
51 |
52 | {% api_property ticksToDeploy 'number' %}
53 |
54 | Shows the timer for a not yet deployed stronghold, undefined otherwise.
55 |
56 | {% api_property spawning 'StructureSpawn.Spawning' %}
57 |
58 | If the core is in process of spawning a new creep, this object will contain a [`StructureSpawn.Spawning`](#StructureSpawn-Spawning) object, or null otherwise.
59 |
--------------------------------------------------------------------------------
/api/source/StructureKeeperLair.md:
--------------------------------------------------------------------------------
1 | # StructureKeeperLair
2 |
3 |
4 |
5 | Non-player structure. Spawns NPC Source Keepers that guards energy sources and minerals in some rooms. This structure cannot be destroyed.
6 |
7 |
8 |
9 |
10 |
Spawning time
11 |
300
12 |
13 |
14 |
15 |
16 | {% page inherited/OwnedStructure.md %}
17 |
18 | {% api_property ticksToSpawn 'number' %}
19 |
20 | Time to spawning of the next Source Keeper.
21 |
22 |
23 |
--------------------------------------------------------------------------------
/api/source/StructureLink.md:
--------------------------------------------------------------------------------
1 | # StructureLink
2 |
3 |
4 |
5 | Remotely transfers energy to another Link in the same room.
6 |
7 |
8 |
9 |
10 |
Controller level
11 |
12 |
13 |
1-4
14 |
—
15 |
16 |
17 |
5
18 |
2 links
19 |
20 |
21 |
6
22 |
3 links
23 |
24 |
25 |
7
26 |
4 links
27 |
28 |
29 |
8
30 |
6 links
31 |
32 |
33 |
Cost
34 |
5,000
35 |
36 |
37 |
Hits
38 |
1,000
39 |
40 |
41 |
Capacity
42 |
800
43 |
44 |
45 |
Cooldown time
46 |
1 tick per tile of the linear distance to the target
47 |
48 |
49 |
Energy loss
50 |
3%
51 |
52 |
53 |
54 |
55 | {% page inherited/OwnedStructure.md %}
56 |
57 |
58 | {% api_property cooldown 'number' %}
59 |
60 |
61 |
62 | The amount of game ticks the link has to wait until the next transfer is possible.
63 |
64 |
65 |
66 | {% api_property energy 'number' '{"deprecated": true}' %}
67 |
68 | An alias for [`.store[RESOURCE_ENERGY]`](#StructureExtension.store).
69 |
70 |
71 |
72 | {% api_property energyCapacity 'number' '{"deprecated": true}' %}
73 |
74 | An alias for [`.store.getCapacity(RESOURCE_ENERGY)`](#Store.getCapacity).
75 |
76 | {% api_property store 'Store' %}
77 |
78 | ```javascript
79 | if(structure.store.getFreeCapacity(RESOURCE_ENERGY) > 0) {
80 | creep.transfer(structure, RESOURCE_ENERGY);
81 | }
82 | ```
83 |
84 |
85 | A [`Store`](#Store) object that contains cargo of this structure.
86 |
87 |
88 |
89 | {% api_method transferEnergy 'target, [amount]' A %}
90 |
91 | ```javascript
92 | const linkFrom = Game.rooms['W1N1'].lookForAt('structure', 10, 25)[0];
93 |
94 | const linkTo = linkFrom.pos.findInRange(FIND_MY_STRUCTURES, 2,
95 | {filter: {structureType: STRUCTURE_LINK}})[0];
96 |
97 | linkFrom.transferEnergy(linkTo);
98 | ```
99 |
100 | Remotely transfer energy to another link at any location in the same room.
101 |
102 | {% api_method_params %}
103 | target : StructureLink
104 | The target object.
105 | ===
106 | amount (optional) : number
107 | The amount of energy to be transferred. If omitted, all the available energy is used.
108 | {% endapi_method_params %}
109 |
110 |
111 | ### Return value
112 |
113 | One of the following codes:
114 | {% api_return_codes %}
115 | OK | The operation has been scheduled successfully.
116 | ERR_NOT_OWNER | You are not the owner of this link.
117 | ERR_NOT_ENOUGH_RESOURCES | The structure does not have the given amount of energy.
118 | ERR_INVALID_TARGET | The target is not a valid StructureLink object.
119 | ERR_FULL | The target cannot receive any more energy.
120 | ERR_INVALID_ARGS | The energy amount is incorrect.
121 | ERR_TIRED | The link is still cooling down.
122 | ERR_RCL_NOT_ENOUGH | Room Controller Level insufficient to use this link.
123 | ERR_NOT_IN_RANGE | The target is too far away.
124 | {% endapi_return_codes %}
125 |
126 |
127 |
--------------------------------------------------------------------------------
/api/source/StructureObserver.md:
--------------------------------------------------------------------------------
1 | # StructureObserver
2 |
3 |
4 |
5 | Provides visibility into a distant room from your script.
6 |
7 |
8 |
9 |
10 |
Controller level
11 |
12 |
13 |
1-7
14 |
—
15 |
16 |
17 |
8
18 |
1 observer
19 |
20 |
21 |
Cost
22 |
8,000
23 |
24 |
25 |
Hits
26 |
500
27 |
28 |
29 |
Range
30 |
10 rooms
31 |
32 |
33 |
34 |
35 | {% page inherited/OwnedStructure.md %}
36 |
37 |
38 | {% api_method observeRoom 'roomName' A %}
39 |
40 |
41 |
42 | Provide visibility into a distant room from your script. The target room object will be available on the next tick.
43 |
44 | {% api_method_params %}
45 | roomName : string
46 | The name of the target room.
47 | {% endapi_method_params %}
48 |
49 |
50 | ### Return value
51 |
52 | One of the following codes:
53 | {% api_return_codes %}
54 | OK | The operation has been scheduled successfully.
55 | ERR_NOT_OWNER | You are not the owner of this structure.
56 | ERR_INVALID_ARGS | roomName argument is not a valid room name value.
57 | ERR_NOT_IN_RANGE | Room roomName is not in observing range.
58 | ERR_RCL_NOT_ENOUGH | Room Controller Level insufficient to use this structure.
59 | {% endapi_return_codes %}
60 |
61 |
62 |
--------------------------------------------------------------------------------
/api/source/StructurePortal.md:
--------------------------------------------------------------------------------
1 | # StructurePortal
2 |
3 |
4 |
5 | A non-player structure. Instantly teleports your creeps to a distant room acting as a room exit tile.
6 | Portals appear randomly in the central room of each sector.
7 |
8 |
9 |
10 |
11 |
Stable time
12 |
10 days
13 |
14 |
15 |
Decay time
16 |
30,000 ticks
17 |
18 |
19 |
20 |
21 | {% page inherited/Structure.md %}
22 |
23 |
24 | {% api_property destination 'RoomPosition | object' %}
25 |
26 | If this is an **inter-room** portal, then this property contains a `RoomPosition` object
27 | leading to the point in the destination room.
28 |
29 | If this is an **inter-shard** portal, then this property contains an object with `shard` and `room` string properties.
30 | Exact coordinates are undetermined, the creep will appear at any free spot in the destination room.
31 |
32 |
33 | {% api_property ticksToDecay 'number' %}
34 |
35 |
36 |
37 | The amount of game ticks when the portal disappears, or undefined when the portal is stable.
38 |
39 |
40 |
--------------------------------------------------------------------------------
/api/source/StructurePowerBank.md:
--------------------------------------------------------------------------------
1 | # StructurePowerBank
2 |
3 |
4 |
5 | Non-player structure. Contains power resource which can be obtained by destroying the structure.
6 | Hits the attacker creep back on each attack. Learn more about power
7 | from [this article](/power.html).
8 |
9 |
10 |
11 |
12 |
Hits
13 |
2,000,000
14 |
15 |
16 |
Return damage
17 |
50%
18 |
19 |
20 |
Capacity
21 |
500 — 10,000
22 |
23 |
24 |
Decay
25 |
5,000 ticks
26 |
27 |
28 |
29 |
30 | {% page inherited/OwnedStructure.md %}
31 |
32 |
33 | {% api_property power 'number' %}
34 |
35 |
36 |
37 | The amount of power containing.
38 |
39 |
40 |
41 | {% api_property ticksToDecay 'number' %}
42 |
43 |
44 |
45 | The amount of game ticks when this structure will disappear.
46 |
--------------------------------------------------------------------------------
/api/source/StructurePowerSpawn.md:
--------------------------------------------------------------------------------
1 | # StructurePowerSpawn
2 |
3 |
4 |
5 | Processes power into your account, and spawns power creeps with special unique powers (in development).
6 | Learn more about power from [this article](/power.html).
7 |
8 |
9 |
10 |
11 |
Controller level
12 |
13 |
14 |
1-7
15 |
—
16 |
17 |
18 |
8
19 |
1 power spawn
20 |
21 |
22 |
Cost
23 |
100,000
24 |
25 |
26 |
Hits
27 |
5,000
28 |
29 |
30 |
Capacity
31 |
5,000 energy units, 100 power units
32 |
33 |
34 |
Processing cost
35 |
50 energy units per 1 power unit
36 |
37 |
38 |
Processing speed
39 |
1 power unit per tick
40 |
41 |
42 |
43 |
44 | {% page inherited/OwnedStructure.md %}
45 |
46 |
47 | {% api_property energy 'number' '{"deprecated": true}' %}
48 |
49 | An alias for [`.store[RESOURCE_ENERGY]`](#StructureExtension.store).
50 |
51 |
52 |
53 | {% api_property energyCapacity 'number' '{"deprecated": true}' %}
54 |
55 | An alias for [`.store.getCapacity(RESOURCE_ENERGY)`](#Store.getCapacity).
56 |
57 |
58 |
59 | {% api_property power 'number' '{"deprecated": true}' %}
60 |
61 | An alias for [`.store[RESOURCE_POWER]`](#StructureExtension.store).
62 |
63 |
64 |
65 | {% api_property powerCapacity 'number' '{"deprecated": true}' %}
66 |
67 | An alias for [`.store.getCapacity(RESOURCE_POWER)`](#Store.getCapacity).
68 |
69 | {% api_property store 'Store' %}
70 |
71 | ```javascript
72 | if(structure.store.getFreeCapacity(RESOURCE_ENERGY) > 0) {
73 | creep.transfer(structure, RESOURCE_ENERGY);
74 | }
75 | ```
76 |
77 |
78 | A [`Store`](#Store) object that contains cargo of this structure.
79 |
80 |
81 | {% api_method processPower '' A %}
82 |
83 |
84 |
85 | Register power resource units into your account. Registered power allows to develop power creeps skills.
86 |
87 |
88 |
89 | ### Return value
90 |
91 | One of the following codes:
92 | {% api_return_codes %}
93 | OK | The operation has been scheduled successfully.
94 | ERR_NOT_OWNER | You are not the owner of this structure.
95 | ERR_NOT_ENOUGH_RESOURCES | The structure does not have enough energy or power resource units.
96 | ERR_RCL_NOT_ENOUGH | Room Controller Level insufficient to use this structure.
97 | {% endapi_return_codes %}
98 |
99 |
--------------------------------------------------------------------------------
/api/source/StructureRampart.md:
--------------------------------------------------------------------------------
1 | # StructureRampart
2 |
3 |
4 |
5 | Blocks movement of hostile creeps, and defends your creeps and structures on the same tile.
6 | Can be used as a controllable gate.
7 |
8 |
9 |
10 |
11 |
Controller level
12 |
13 |
14 |
1
15 |
—
16 |
17 |
18 |
2
19 |
300,000 max hits
20 |
21 |
22 |
3
23 |
1,000,000 max hits
24 |
25 |
26 |
4
27 |
3,000,000 max hits
28 |
29 |
30 |
5
31 |
10,000,000 max hits
32 |
33 |
34 |
6
35 |
30,000,000 max hits
36 |
37 |
38 |
7
39 |
100,000,000 max hits
40 |
41 |
42 |
8
43 |
300,000,000 max hits
44 |
45 |
46 |
Cost
47 |
1
48 |
49 |
50 |
Hits when constructed
51 |
1
52 |
53 |
54 |
Decay
55 |
Loses 300 hits every 100 ticks
56 |
57 |
58 |
59 |
60 | {% page inherited/OwnedStructure.md %}
61 |
62 |
63 | {% api_property isPublic 'boolean' %}
64 |
65 |
66 |
67 | If false (default), only your creeps can step on the same square. If true, any hostile creeps can pass through.
68 |
69 |
70 |
71 | {% api_property ticksToDecay 'number' %}
72 |
73 |
74 |
75 | The amount of game ticks when this rampart will lose some hit points.
76 |
77 |
78 |
79 | {% api_method setPublic 'isPublic' A %}
80 |
81 |
82 |
83 | Make this rampart public to allow other players' creeps to pass through.
84 |
85 | {% api_method_params %}
86 | isPublic : boolean
87 | Whether this rampart should be public or non-public.
88 | {% endapi_method_params %}
89 |
90 |
91 | ### Return value
92 |
93 | One of the following codes:
94 | {% api_return_codes %}
95 | OK | The operation has been scheduled successfully.
96 | ERR_NOT_OWNER | You are not the owner of this structure.
97 | {% endapi_return_codes %}
98 |
99 |
100 |
--------------------------------------------------------------------------------
/api/source/StructureRoad.md:
--------------------------------------------------------------------------------
1 | # StructureRoad
2 |
3 |
4 |
5 | Decreases movement cost to 1. Using roads allows creating creeps with less `MOVE` body parts. You can also build roads on top of natural terrain walls which are otherwise impassable.
6 |
7 |
8 |
9 |
10 |
Controller level
11 |
Any (including neutral rooms)
12 |
13 |
14 |
Cost
15 |
16 |
17 |
300 on plain land
18 |
1,500 on swamp
19 |
45,000 on walls
20 |
21 |
22 |
23 |
24 |
Hits
25 |
26 |
27 |
5,000 on plain land
28 |
25,000 on swamp
29 |
750,000 on walls
30 |
31 |
32 |
33 |
34 |
Decay
35 |
36 |
37 |
Loses 100 hits every 1,000 ticks on plain land
38 |
Loses 500 hits every 1,000 ticks on swamp
39 |
Loses 15,000 hits every 1,000 ticks on walls
40 |
41 | Note: every creep step decreases the decay timer for 1 tick per each creep body part
42 |
43 |
44 |
45 |
46 | {% page inherited/Structure.md %}
47 |
48 |
49 | {% api_property ticksToDecay 'number' %}
50 |
51 |
52 |
53 | The amount of game ticks when this road will lose some hit points.
54 |
55 |
56 |
--------------------------------------------------------------------------------
/api/source/StructureSpawnSpawning.md:
--------------------------------------------------------------------------------
1 | # StructureSpawn.Spawning
2 |
3 | Details of the creep being spawned currently that can be addressed by the [`StructureSpawn.spawning`](#StructureSpawn.spawning) property.
4 |
5 | {% api_property directions 'array' %}
6 |
7 | An array with the spawn directions, see [`StructureSpawn.Spawning.setDirections`](#StructureSpawn.Spawning.setDirections).
8 |
9 | {% api_property name 'string' %}
10 |
11 | The name of a new creep.
12 |
13 | {% api_property needTime 'number' %}
14 |
15 | Time needed in total to complete the spawning.
16 |
17 | {% api_property remainingTime 'number ' %}
18 |
19 | Remaining time to go.
20 |
21 | {% api_property spawn 'StructureSpawn' %}
22 |
23 | A link to the spawn.
24 |
25 |
26 | {% api_method cancel '' A %}
27 |
28 | ```javascript
29 | Game.spawns['Spawn1'].spawning.cancel();
30 | ```
31 |
32 | Cancel spawning immediately. Energy spent on spawning is not returned.
33 |
34 | ### Return value
35 |
36 | One of the following codes:
37 | {% api_return_codes %}
38 | OK | The operation has been scheduled successfully.
39 | ERR_NOT_OWNER | You are not the owner of this spawn.
40 | {% endapi_return_codes %}
41 |
42 | {% api_method setDirections 'directions' A %}
43 |
44 | ```javascript
45 | Game.spawns['Spawn1'].spawning.setDirections([RIGHT, TOP_RIGHT]);
46 | ```
47 |
48 | Set desired directions where the creep should move when spawned.
49 |
50 | {% api_method_params %}
51 | directions : array<number>
52 | An array with the direction constants:
53 |
54 |
TOP
55 |
TOP_RIGHT
56 |
RIGHT
57 |
BOTTOM_RIGHT
58 |
BOTTOM
59 |
BOTTOM_LEFT
60 |
LEFT
61 |
TOP_LEFT
62 |
63 | {% endapi_method_params %}
64 |
65 | ### Return value
66 |
67 | One of the following codes:
68 | {% api_return_codes %}
69 | OK | The operation has been scheduled successfully.
70 | ERR_NOT_OWNER | You are not the owner of this spawn.
71 | ERR_INVALID_ARGS | The directions is array is invalid.
72 | {% endapi_return_codes %}
73 |
--------------------------------------------------------------------------------
/api/source/StructureStorage.md:
--------------------------------------------------------------------------------
1 | # StructureStorage
2 |
3 |
4 |
5 | A structure that can store huge amount of resource units. Only one structure per room is allowed
6 | that can be addressed by [`Room.storage`](#Room.storage) property.
7 |
8 |
9 |
10 |
11 |
Controller level
12 |
13 |
14 |
1-3
15 |
—
16 |
17 |
18 |
4-8
19 |
1 storage
20 |
21 |
22 |
Cost
23 |
30,000
24 |
25 |
26 |
Hits
27 |
10,000
28 |
29 |
30 |
Capacity
31 |
1,000,000
32 |
33 |
34 |
35 |
36 | {% page inherited/OwnedStructure.md %}
37 |
38 |
39 | {% api_property store 'Store' %}
40 |
41 | A [`Store`](#Store) object that contains cargo of this structure.
42 |
43 |
44 | {% api_property storeCapacity 'number' '{"deprecated": true}' %}
45 |
46 | An alias for [`.store.getCapacity()`](#Store.getCapacity).
47 |
48 |
--------------------------------------------------------------------------------
/api/source/StructureTerminal.md:
--------------------------------------------------------------------------------
1 | # StructureTerminal
2 |
3 |
4 |
5 | Sends any resources to a Terminal in another room. The destination Terminal can belong to any player.
6 | Each transaction requires additional energy (regardless of the transfer resource type) that can be
7 | calculated using [`Game.market.calcTransactionCost`](#Game.market.calcTransactionCost) method.
8 | For example, sending 1000 mineral units from W0N0 to W10N5 will consume 742 energy units.
9 | You can track your incoming and outgoing transactions using the [`Game.market`](#Game.market) object.
10 | Only one Terminal per room is allowed that can be addressed by [`Room.terminal`](#Room.terminal) property.
11 |
12 | Terminals are used in the [Market system](/market.html).
13 |
14 |
15 |
16 |
17 |
Controller level
18 |
19 |
20 |
1-5
21 |
—
22 |
23 |
24 |
6-8
25 |
1 terminal
26 |
27 |
28 |
Cost
29 |
100,000
30 |
31 |
32 |
Hits
33 |
3,000
34 |
35 |
36 |
Capacity
37 |
300,000
38 |
39 |
40 |
Cooldown on send
41 |
10 ticks
42 |
43 |
44 |
45 |
46 | {% page inherited/OwnedStructure.md %}
47 |
48 | {% api_property cooldown 'number' %}
49 |
50 | The remaining amount of ticks while this terminal cannot be used to make [`StructureTerminal.send`](#StructureTerminal.send) or [`Game.market.deal`](#Game.market.deal) calls.
51 |
52 |
53 | {% api_property store 'Store' %}
54 |
55 | A [`Store`](#Store) object that contains cargo of this structure.
56 |
57 |
58 | {% api_property storeCapacity 'number' '{"deprecated": true}' %}
59 |
60 | An alias for [`.store.getCapacity()`](#Store.getCapacity).
61 |
62 | {% api_method send 'resourceType, amount, destination, [description]' A %}
63 |
64 | ```javascript
65 | Game.rooms['W1N1'].terminal.send(RESOURCE_UTRIUM, 100, 'W2N3',
66 | 'trade contract #1');
67 | ```
68 |
69 | Sends resource to a Terminal in another room with the specified name.
70 |
71 | {% api_method_params %}
72 | resourceType : string
73 | One of the RESOURCE_* constants.
74 | ===
75 | amount : number
76 | The amount of resources to be sent.
77 | ===
78 | destination : string
79 | The name of the target room. You don't have to gain visibility in this room.
80 | ===
81 | description (optional) : string
82 | The description of the transaction. It is visible to the recipient. The maximum length is 100 characters.
83 | {% endapi_method_params %}
84 |
85 |
86 | ### Return value
87 |
88 | One of the following codes:
89 | {% api_return_codes %}
90 | OK | The operation has been scheduled successfully.
91 | ERR_NOT_OWNER | You are not the owner of this structure.
92 | ERR_NOT_ENOUGH_RESOURCES | The structure does not have the required amount of resources.
93 | ERR_INVALID_ARGS | The arguments provided are incorrect.
94 | ERR_TIRED | The terminal is still cooling down.
95 | {% endapi_return_codes %}
96 |
97 |
--------------------------------------------------------------------------------
/api/source/StructureWall.md:
--------------------------------------------------------------------------------
1 | # StructureWall
2 |
3 |
4 |
5 | Blocks movement of all creeps.
6 | Players can build destructible walls in controlled rooms.
7 | Some rooms also contain indestructible walls separating novice and respawn areas from the rest of the world or dividing novice / respawn areas into smaller sections. Indestructible walls have no `hits` property.
8 |
9 |
10 |
11 |
12 |
Controller level
13 |
2
14 |
15 |
16 |
Cost
17 |
1
18 |
19 |
20 |
Hits when constructed
21 |
1
22 |
23 |
24 |
Max hits
25 |
300,000,000
26 |
27 |
28 |
29 |
30 | {% page inherited/Structure.md %}
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/api/source/Tombstone.md:
--------------------------------------------------------------------------------
1 | # Tombstone
2 |
3 |
4 |
5 | A remnant of dead creeps. This is a walkable object.
6 |
7 |
8 |
9 |
10 |
Decay
11 |
5 ticks per body part of the deceased creep
12 |
13 |
14 |
15 |
16 | {% page inherited/RoomObject.md %}
17 |
18 | {% api_property creep 'Creep | PowerCreep' %}
19 |
20 | ```javascript
21 | room.find(FIND_TOMBSTONES).forEach(tombstone => {
22 | if(tombstone.creep.my) {
23 | console.log(`My creep died with ID=${tombstone.creep.id} ` +
24 | `and role=${Memory.creeps[tombstone.creep.name].role}`);
25 | }
26 | });
27 | ```
28 | ```javascript
29 | room.find(FIND_TOMBSTONES).forEach(tombstone => {
30 | if(tombstone.creep instanceof PowerCreep) {
31 | console.log(`Power creep died here`);
32 | }
33 | });
34 | ````
35 |
36 | An object containing the deceased creep or power creep.
37 |
38 | {% api_property deathTime 'number' %}
39 |
40 | Time of death.
41 |
42 | {% api_property id string %}
43 |
44 | A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id.
45 |
46 |
47 | {% api_property store 'Store' %}
48 |
49 | A [`Store`](#Store) object that contains cargo of this structure.
50 |
51 |
52 | {% api_property ticksToDecay 'number' %}
53 |
54 | The amount of game ticks before this tombstone decays.
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/api/source/constants.md:
--------------------------------------------------------------------------------
1 | # Constants
2 |
3 | All the following constant names are available in the global scope:
4 |
5 | {% constants %}
--------------------------------------------------------------------------------
/api/source/inherited/OwnedStructure.md:
--------------------------------------------------------------------------------
1 | {% page inherited/Structure.md %}
2 |
3 | {% api_property OwnedStructure:my 'boolean' %}
4 |
5 | Whether this is your own structure.
6 |
7 | {% api_property OwnedStructure:owner 'object' %}
8 |
9 | An object with the structure’s owner info containing the following properties:
10 |
11 | {% api_method_params %}
12 | username : string
13 | The name of the owner user.
14 | {% endapi_method_params %}
15 |
16 |
--------------------------------------------------------------------------------
/api/source/inherited/RoomObject.md:
--------------------------------------------------------------------------------
1 | {% api_property RoomObject:effects array %}
2 | Applied effects, an array of objects with the following properties:
3 |
4 | {% api_method_params %}
5 | effect : number
6 | Effect ID of the applied effect. Can be either natural effect ID or Power ID.
7 | ===
8 | level (optional) : number
9 | Power level of the applied effect. Absent if the effect is not a Power effect.
10 | ===
11 | ticksRemaining : number
12 | How many ticks will the effect last.
13 | {% endapi_method_params %}
14 |
15 |
16 | {% api_property RoomObject:pos 'RoomPosition' %}
17 |
18 |
19 |
20 | An object representing the position of this object in the room.
21 |
22 |
23 |
24 | {% api_property RoomObject:room 'Room' %}
25 |
26 |
27 |
28 | The link to the Room object. May be undefined in case if an object is a flag or a construction site and is placed in a room that is not visible to you.
29 |
30 |
--------------------------------------------------------------------------------
/api/source/inherited/Structure.md:
--------------------------------------------------------------------------------
1 | {% page inherited/RoomObject.md %}
2 |
3 | {% api_property Structure:hits 'number' %}
4 |
5 |
6 |
7 | The current amount of hit points of the structure.
8 |
9 |
10 |
11 | {% api_property Structure:hitsMax 'number' %}
12 |
13 |
14 |
15 | The total amount of hit points of the structure.
16 |
17 |
18 |
19 | {% api_property Structure:id 'string' %}
20 |
21 |
22 |
23 | A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id.
24 |
25 |
26 |
27 | {% api_property Structure:structureType 'string' %}
28 |
29 |
30 |
31 | One of the STRUCTURE_* constants.
32 |
33 |
34 |
35 | {% api_method Structure:destroy '' A %}
36 |
37 |
38 |
39 | Destroy this structure immediately.
40 |
41 |
42 |
43 | ### Return value
44 |
45 | One of the following codes:
46 | {% api_return_codes %}
47 | OK | The operation has been scheduled successfully.
48 | ERR_NOT_OWNER | You are not the owner of this structure.
49 | ERR_BUSY | Hostile creeps are in the room.
50 | {% endapi_return_codes %}
51 |
52 |
53 |
54 | {% api_method Structure:isActive '' 2 %}
55 |
56 |
57 |
58 | Check whether this structure can be used. If room controller level is insufficient, then this method will return false, and the structure will be highlighted with red in the game.
59 |
60 |
61 |
62 | ### Return value
63 |
64 | A boolean value.
65 |
66 | {% api_method Structure:notifyWhenAttacked 'enabled' A %}
67 |
68 |
69 |
70 | Toggle auto notification when the structure is under attack. The notification will be sent to your account email. Turned on by default.
71 |
72 | {% api_method_params %}
73 | enabled : boolean
74 | Whether to enable notification or disable.
75 | {% endapi_method_params %}
76 |
77 |
78 | ### Return value
79 |
80 | One of the following codes:
81 | {% api_return_codes %}
82 | OK | The operation has been scheduled successfully.
83 | ERR_NOT_OWNER | You are not the owner of this structure.
84 | ERR_INVALID_ARGS | enable argument is not a boolean value.
85 | {% endapi_return_codes %}
86 |
87 |
88 |
--------------------------------------------------------------------------------
/api/themes/screeps-api/layout/index.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html(lang='en')
3 | head
4 | meta(charset='UTF-8')
5 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
6 | meta(name='viewport', content='width=device-width, initial-scale=1, maximum-scale=1')
7 | title Screeps Documentation
8 | link(rel='stylesheet' href='css/print.css' media="print")
9 | link(rel='stylesheet' href='css/screen.css' media="screen")
10 | link(rel='stylesheet' href='css/prism.css' media="screen")
11 | script(src="js/lib/energize.js")
12 | script(src="js/lib/jquery.js")
13 | script(src="js/lib/jquery_ui.js")
14 | script(src="js/lib/jquery.highlight.js")
15 | script(src="js/lib/jquery.tocify.js")
16 | script(src="js/lib/lunr.js")
17 | script(src="js/lib/prism.js")
18 | script(src="js/app/lang.js")
19 | script(src="js/app/search.js")
20 | script(src="js/app/toc.js")
21 | body(class="index")
22 | a#nav-button(href="#")
23 | span
24 | NAV
25 | img(src="img/navbar.png")
26 | .tocify-wrapper
27 | .logo
28 | a(href="https://screeps.com/a/")
29 | img(src="img/logotype_bw_animation.svg")
30 | a(href="/api/")
31 | | api
32 | if is_ptr()
33 | | [ptr]
34 | .search
35 | input.search#input-search(type="text" placeholder="Search")
36 | ul.search-results
37 | if !is_ptr()
38 | a.back(href="/index.html")
39 | | Back to docs
40 | img(src="img/link-external.svg")
41 | #toc
42 | ul.tocify-header
43 | li.tocify-item.divider(style='pointer-events: none;') Global Objects
44 | each name in config.GlobalObjects
45 | != tocify(page.pages[name])
46 | ul.tocify-header
47 | li.tocify-item.divider(style='pointer-events: none;') Prototypes
48 | each name in config.Prototypes
49 | != tocify(page.pages[name])
50 |
51 | .page-wrapper
52 | .dark-box
53 | .content.api-content
54 | //- h1.divider Global Objects
55 | each name in config.GlobalObjects
56 | != page.pages[name]
57 | //- h1.divider Prototypes
58 | each name in config.Prototypes
59 | != page.pages[name]
60 |
61 | .dark-box
62 | div
63 |
--------------------------------------------------------------------------------
/api/themes/screeps-api/layout/page.jade:
--------------------------------------------------------------------------------
1 | != page.content
--------------------------------------------------------------------------------
/api/themes/screeps-api/layout/post.jade:
--------------------------------------------------------------------------------
1 | != page.content
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/css/_icon-font.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'slate';
3 | src:url('../fonts/slate.eot?-syv14m');
4 | src:url('../fonts/slate.eot?#iefix-syv14m') format('embedded-opentype'),
5 | url('../fonts/slate.woff2?-syv14m') format('woff2'),
6 | url('../fonts/slate.woff?-syv14m') format('woff'),
7 | url('../fonts/slate.ttf?-syv14m') format('truetype'),
8 | url('../fonts/slate.svg?-syv14m#slate') format('svg');
9 | font-weight: normal;
10 | font-style: normal;
11 | }
12 |
13 | %icon {
14 | font-family: 'slate';
15 | speak: none;
16 | font-style: normal;
17 | font-weight: normal;
18 | font-variant: normal;
19 | text-transform: none;
20 | line-height: 1;
21 | }
22 |
23 | %icon-exclamation-sign {
24 | @extend %icon;
25 | content: "\e600";
26 | }
27 | %icon-info-sign {
28 | @extend %icon;
29 | content: "\e602";
30 | }
31 | %icon-ok-sign {
32 | @extend %icon;
33 | content: "\e606";
34 | }
35 | %icon-search {
36 | @extend %icon;
37 | content: "\e607";
38 | }
39 |
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/css/prism.css:
--------------------------------------------------------------------------------
1 | /* http://prismjs.com/download.html?themes=prism-okaidia&languages=markup+css+clike+javascript */
2 | /**
3 | * okaidia theme for JavaScript, CSS and HTML
4 | * Loosely based on Monokai textmate theme by http://www.monokai.nl/
5 | * @author ocodia
6 | */
7 |
8 | code[class*="language-"],
9 | pre[class*="language-"] {
10 | color: #f8f8f2;
11 | /*text-shadow: 0 1px rgba(0, 0, 0, 0.3);*/
12 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
13 | direction: ltr;
14 | text-align: left;
15 | white-space: pre;
16 | word-spacing: normal;
17 | word-break: normal;
18 | line-height: 1.5;
19 |
20 | -moz-tab-size: 4;
21 | -o-tab-size: 4;
22 | tab-size: 4;
23 |
24 | -webkit-hyphens: none;
25 | -moz-hyphens: none;
26 | -ms-hyphens: none;
27 | hyphens: none;
28 | }
29 |
30 | /* Code blocks */
31 | pre[class*="language-"] {
32 | padding: 1em;
33 | margin: .5em 0;
34 | overflow: auto;
35 | border-radius: 0.3em;
36 | }
37 |
38 | :not(pre) > code[class*="language-"],
39 | pre[class*="language-"] {
40 | background: #2A3B5F;
41 | }
42 |
43 | /* Inline code */
44 | :not(pre) > code[class*="language-"] {
45 | padding: .1em;
46 | border-radius: .3em;
47 | }
48 |
49 | .token.comment,
50 | .token.prolog,
51 | .token.doctype,
52 | .token.cdata {
53 | color: slategray;
54 | }
55 |
56 | .token.punctuation {
57 | color: #f8f8f2;
58 | }
59 |
60 | .namespace {
61 | opacity: .7;
62 | }
63 |
64 | .token.property,
65 | .token.tag,
66 | .token.constant,
67 | .token.symbol,
68 | .token.deleted {
69 | color: #f92672;
70 | }
71 |
72 | .token.boolean,
73 | .token.number {
74 | color: #ae81ff;
75 | }
76 |
77 | .token.selector,
78 | .token.attr-name,
79 | .token.string,
80 | .token.char,
81 | .token.builtin,
82 | .token.inserted {
83 | color: #a6e22e;
84 | }
85 |
86 | .token.operator,
87 | .token.entity,
88 | .token.url,
89 | .language-css .token.string,
90 | .style .token.string,
91 | .token.variable {
92 | color: #f8f8f2;
93 | }
94 |
95 | .token.atrule,
96 | .token.attr-value,
97 | .token.function {
98 | color: #e6db74;
99 | }
100 |
101 | .token.keyword {
102 | color: #66d9ef;
103 | }
104 |
105 | .token.regex,
106 | .token.important {
107 | color: #fd971f;
108 | }
109 |
110 | .token.important,
111 | .token.bold {
112 | font-weight: bold;
113 | }
114 | .token.italic {
115 | font-style: italic;
116 | }
117 |
118 | .token.entity {
119 | cursor: help;
120 | }
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/fonts/slate.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/fonts/slate.eot
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/fonts/slate.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/fonts/slate.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/fonts/slate.ttf
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/fonts/slate.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/fonts/slate.woff
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/fonts/slate.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/fonts/slate.woff2
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/bodyparts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/bodyparts.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/container.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/container.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/controller.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/controller.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/cpu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/cpu.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/deposit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/deposit.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/extractor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/extractor.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/factory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/factory.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/invaderCore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/invaderCore.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/keeperLair.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/keeperLair.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/lab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/lab.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/link-external.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/link.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/logo.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/logotype_bw_animation.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/navbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/navbar.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/nuke.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/nuke.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/observer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/observer.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/portal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/portal.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/powerBank.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/powerBank.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/powerSpawn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/powerSpawn.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/property_types.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/property_types.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/rampart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/rampart.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/road_plain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/road_plain.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/ruin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/ruin.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/spawn (1).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/spawn (1).png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/spawn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/spawn.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/storage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/storage.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/terminal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/terminal.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/tombstone.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/tombstone.gif
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/tower.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/tower.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/visual.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/visual.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/img/wall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/api/themes/screeps-api/source/img/wall.png
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/js/all.js:
--------------------------------------------------------------------------------
1 | //= require ./lib/_energize
2 | //= require ./app/_lang
3 | //= require ./app/_search
4 | //= require ./app/_toc
5 |
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/js/all_nosearch.js:
--------------------------------------------------------------------------------
1 | //= require ./lib/_energize
2 | //= require ./app/_lang
3 | //= require ./app/_toc
4 |
--------------------------------------------------------------------------------
/api/themes/screeps-api/source/js/app/search.js:
--------------------------------------------------------------------------------
1 | //= require ../lib/_lunr
2 | //= require ../lib/_jquery
3 | //= require ../lib/_jquery.highlight
4 | (function () {
5 | 'use strict';
6 |
7 | var content, searchResults;
8 | var highlightOpts = { element: 'span', className: 'search-highlight' };
9 |
10 | var index = new lunr.Index();
11 |
12 | index.ref('id');
13 | index.field('title', { boost: 10 });
14 | index.field('body');
15 | index.pipeline.add(lunr.trimmer, lunr.stopWordFilter);
16 |
17 | $(populate);
18 | $(bind);
19 |
20 | function populate() {
21 | $('h1, h2').each(function() {
22 | var title = $(this);
23 | var body = title.nextUntil('h1, h2');
24 | index.add({
25 | id: title.prop('id'),
26 | title: title.text(),
27 | body: body.text()
28 | });
29 | });
30 | }
31 |
32 | function bind() {
33 | content = $('.content');
34 | searchResults = $('.search-results');
35 |
36 | $('#input-search').on('keyup', search);
37 | }
38 |
39 | function search(event) {
40 | unhighlight();
41 | searchResults.addClass('visible');
42 |
43 | // ESC clears the field
44 | if (event.keyCode === 27) this.value = '';
45 |
46 | if (this.value) {
47 | var results = index.search(this.value).filter(function(r) {
48 | return r.score > 0.0001;
49 | });
50 |
51 | if (results.length) {
52 | searchResults.empty();
53 | $.each(results, function (index, result) {
54 | var elem = document.getElementById(result.ref);
55 | searchResults.append("
' + header;
13 | result += hexo.render.renderSync({text: content, engine: 'markdown'});
14 | result += '
';
15 |
16 | return result;
17 | }, true);
18 |
19 | hexo.extend.tag.register('index_block', function(args, content) {
20 | return `${args[0]}${content}`;
21 | }, {ends: true});
22 |
23 | hexo.extend.tag.register('twitter_feed', function() {
24 | return `
25 | Tweets by ScreepsGame
26 | `;
27 | });
28 |
29 | hexo.extend.tag.register('resource', function(args) {
30 | return `${args[0]}`;
31 | });
--------------------------------------------------------------------------------
/source/_data/languages.yml:
--------------------------------------------------------------------------------
1 | en: English
2 | zh-tw:
3 | name: 正體中文
4 | disqus_lang: zh_TW
5 | zh-cn:
6 | name: 简体中文
7 | disqus_lang: zh
8 | ru:
9 | name: Русский
10 | disqus_lang: ru
11 | ko:
12 | name: 한국어
13 | disqus_lang: ko
--------------------------------------------------------------------------------
/source/_data/sidebar.yml:
--------------------------------------------------------------------------------
1 | _:
2 | Overview: /index.html
3 | Gameplay:
4 | Introduction: /introduction.html
5 | Creeps: /creeps.html
6 | Control: /control.html
7 | Defense: /defense.html
8 | Respawning: /respawn.html
9 | Start Areas: /start-areas.html
10 | Resources: /resources.html
11 | Market: /market.html
12 | NPC Invaders: /invaders.html
13 | Power: /power.html
14 | Scripting:
15 | Scripting Basics: /scripting-basics.html
16 | Global Objects: /global-objects.html
17 | Modules: /modules.html
18 | Debugging: /debugging.html
19 | Game Loop: /game-loop.html
20 | External Commit: /commit.html
21 | Simultaneous Actions: /simultaneous-actions.html
22 | CPU Limit: /cpu-limit.html
23 |
24 | Other:
25 | Server-Side Architecture: /architecture.html
26 | Public Test Realm (PTR): /ptr.html
27 | Third Party Tools: /third-party.html
28 | Auth Tokens: /auth-tokens.html
29 | Community Servers: /community-servers.html
30 | Terms of Service: /tos.html
31 | Privacy Policy: /privacy-policy.html
32 |
33 | Resources:
34 | Blog: http://blog.screeps.com
35 | Changelogs: http://blog.screeps.com/categories/Changelogs/
36 | Chat: http://chat.screeps.com
37 | Forum: https://screeps.com/forum/
38 |
39 | Contributed Articles:
40 | Contribution Rules: /contributed/rules.html
41 | Advanced Grunt Usage: /contributed/advanced_grunt.html
42 | Modifying Prototypes: /contributed/modifying-prototypes.html
43 | Caching Overview: /contributed/caching-overview.html
44 | Private Server MongoDB: /contributed/ps_ubuntu.html
--------------------------------------------------------------------------------
/source/_posts/test.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/screeps/docs/f96f46242d431cd84ae06f6ac70cbba31190050f/source/_posts/test.md
--------------------------------------------------------------------------------
/source/changelog.md:
--------------------------------------------------------------------------------
1 | title: Changelog
2 | ---
3 |
4 | This page is still empty.
--------------------------------------------------------------------------------
/source/commit.md:
--------------------------------------------------------------------------------
1 | title: Committing scripts using external tools
2 | ---
3 |
4 | Screeps has a handy embedded code editor for writing game scripts. However, in some cases (for example, you want to use a language other than JavaScript or integrate with your IDE) you will have to commit game scripts to your Screeps account from outside.
5 |
6 | {% note info %}
7 | You have to create an auth token in the [account settings](https://screeps.com/a/#!/account/auth-tokens) in order to use external synchronization.
8 | {% endnote %}
9 |
10 | ## Using Grunt task
11 |
12 | If you haven't used [Grunt](http://gruntjs.com) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
13 |
14 | npm install grunt-screeps
15 |
16 | Configure your Gruntfile.js:
17 |
18 | module.exports = function(grunt) {
19 |
20 | grunt.loadNpmTasks('grunt-screeps');
21 |
22 | grunt.initConfig({
23 | screeps: {
24 | options: {
25 | email: '',
26 | token: '',
27 | branch: 'default',
28 | //server: 'season'
29 | },
30 | dist: {
31 | src: ['dist/*.js']
32 | }
33 | }
34 | });
35 | }
36 |
37 | Now you can run this command to commit your code from `dist` folder to your Screeps account:
38 |
39 | grunt screeps
40 |
41 | ## Using direct API access
42 |
43 | Screeps Web API has an endpoint `https://screeps.com/api/user/code` for working with scripts. The two supported methods are `POST` and `GET` for writing and retrieving respectively. Both methods accept [Basic access authentication](http://en.wikipedia.org/wiki/Basic_access_authentication). Endpoints get and return a JSON structure containing modules object with module names as keys and their content as values.
44 |
45 | An example of committing code using Node.js:
46 |
47 | var https = require('https');
48 |
49 | var email = '',
50 | password = '',
51 | data = {
52 | branch: 'default',
53 | modules: {
54 | main: 'require("hello");',
55 | hello: 'console.log("Hello World!");'
56 | }
57 | };
58 |
59 | var req = https.request({
60 | hostname: 'screeps.com',
61 | port: 443,
62 | path: '/api/user/code',
63 | method: 'POST',
64 | auth: email + ':' + password,
65 | headers: {
66 | 'Content-Type': 'application/json; charset=utf-8'
67 | }
68 | });
69 |
70 | req.write(JSON.stringify(data));
71 | req.end();
72 |
73 | Request:
74 |
75 | POST /api/user/code HTTP/1.1
76 | Content-Type: application/json; charset=utf-8
77 | Host: screeps.com:443
78 | Authorization: Basic PHlvdXIgZS1tYWlsPjo8eW91ciBwYXNzd29yZD4=
79 | Connection: close
80 | Transfer-Encoding: chunked
81 |
82 | {"branch":"default","modules":{"main":"require(\"hello\");","hello":"console.log(\"Hello World!\");"}}
83 |
84 | Response:
85 |
86 | X-Powered-By: Express
87 | Content-Type: application/json; charset=utf-8
88 | Content-Length: 8
89 | Date: Mon, 02 Feb 2015 18:46:11 GMT
90 | Connection: close
91 |
92 | {"ok":1}
93 |
--------------------------------------------------------------------------------
/source/community-servers.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Community Servers
3 | ---
4 |
5 | Screeps is not only a MMO game with the officially maintained open world, but also an open source project. We released [game server software](https://github.com/screeps/screeps) under open license so that everybody can create their own Screeps world and modify it via flexible mod system down to its core, including unique game mechanics and rules, game objects with custom graphics and behavior.
6 |
7 | We like such community activity, this is why we display public quality servers on the game login screen in the Community Servers list.
8 |
9 | 
10 |
11 | If you want your server to be included to this list, send an email to [contact@screeps.com](mailto:contact@screeps.com). Your server has to comply with the following rules:
12 |
13 | * Server version 4.0.0 or higher.
14 |
15 | * Server must have stable online during last 7 days. If it becomes inaccessible for a long time, we'll remove it from the list.
16 |
17 | * Use [`config.backend.welcomeText`](https://github.com/screeps/launcher/blob/master/init_dist/example-mods/welcome-text.js) to inform players about any specific features of your server: customizations you have made, installed mods, etc.
18 |
--------------------------------------------------------------------------------
/source/cpu-limit.md:
--------------------------------------------------------------------------------
1 | title: How does CPU limit work
2 | ---
3 |
4 | The Screeps game engine exists in two variants: browser-based (**Simulation** **mode**) and server-based (**online mode**). When you play in the Simulation mode, your scripts are executed by means of your browser only. The game API in the Simulation is the same as that on the server, but the server does not take part in game calculations.
5 |
6 | On the other hand, in the online mode calculations of your scripts do not affect your browser in any way and done on the servers only. In order to maintain them, we offer CPU time that allows you to use CPU resources of the game servers.
7 |
8 | As described in the article [Understanding game loop, time and ticks](/game-loop.html), the game process is divided into game iterations, or **ticks**. During each tick, the game engine calculates each player's scripts concurrently. Then all the planned activities are executed. The duration of one game tick is not fixed - a tick ends when all scripts of all players have been executed to the end.
9 |
10 | ## CPU Limit
11 |
12 | In order to avoid abuse of execution time (which would affect the duration of the game tick for all players), we have introduced a concept of **CPU time limit**. This is a duration of time in milliseconds during which your game script is allowed to run within one tick. The CPU limit 100 means that after 100 ms execution of your script will be terminated even if it has not accomplished some work yet. Your CPU time limit depends on your [Global Control Level](/control.html) if you have active [subscription](/subscription.html), or fixed at 20 otherwise.
13 |
14 | ## Bucket
15 |
16 | However, for your convenience, there may be a rollover of unused time limit for using in future ticks. This allows to carry out resource-hungry operations in bursts once per several ticks, thus exceeding the CPU limit set in your account provided your scripts have saved resources in the preceding ticks.
17 |
18 | 
19 |
20 | If a script during a tick worked less time than the account CPU baseline limit set, the resulting difference is added to a cumulative bucket. You may accumulate up to 10,000 CPU. If the bucket contains any accumulation, your script can overrun your CPU limit using up to 500 CPU per tick from the amount accumulated in the bucket.
21 |
22 | For example, if your account limit is set to 150 and you consume only 100 CPU per tick, then 50 CPU per tick will go to the bucket. You will be able to execute either a one-time burst exceeding the limit by 250 CPU every 5 ticks, or a series of 20 bursts for 500 CPU each once per 200 ticks.
23 |
24 | The property [`Game.cpu.tickLimit`](/api/#Game.cpu) reflects the amount of CPU that you can spend on a current tick given the accumulation. As soon as the [`Game.cpu.bucket`](/api/#Game.cpu) is full, [`Game.cpu.tickLimit`](/api/#Game.cpu) equals 500. It will start decreasing only after the accumulation is depleted. [`Game.cpu.tickLimit`](/api/#Game.cpu) can never be less than your account limit, i.e the [`Game.cpu.limit`](/api/#Game.cpu) property.
25 |
26 | Therefore, you can plan your limit usage by postponing some calculations (for example pathfinding operations) to the moment when you are able to do them in bursts by exceeding the limit.
27 |
--------------------------------------------------------------------------------
/source/debugging.md:
--------------------------------------------------------------------------------
1 | title: Debugging
2 | ---
3 |
4 | There is a standard `console.log()` method as everywhere in Javascript world.
5 |
6 | for(var i in Game.creeps) {
7 | console.log(Game.creeps[i]);
8 | }
9 |
10 | Each action command returns code `OK` if the execution was successful and one of the `ERR_*` codes in case of error.
11 |
12 | var result = creep.attack(target);
13 | if(result != OK) {
14 | console.log(creep + ' failed to attack the target ' + target +
15 | ' with the code: ' + result);
16 | }
17 |
18 |
19 | Note that a seemingly successful command may not always be executed (for example, your creep faces an obstacle it did not know about when the script started).
20 |
21 | In order to safely test your scripts in a parallel copy of the world, you can use our [Public Test Realm](/ptr.html) server.
22 |
23 | ## Debugging in the web version
24 |
25 | When playing using the web version of the game, all the console output is being forwarded to the browser console. When you are in the Simulation mode and your script is executed in your browser, that allows you to expand the objects, see and traverse their properties, etc.
26 |
27 | Also, in Chrome browser you can use `debugger` JavaScript keyword to put a breakpoint in the Simulation mode which allows you to pause your script execution for debugging:
28 |
29 | var result = creep.attack(target);
30 | if(result != OK) {
31 | debugger;
32 | }
33 |
34 | ## Memory inspector
35 |
36 | If you want to track some values in real-time, write them into Memory and add the corresponding watches in the Memory inspector panel. They will be updated automatically each tick.
37 |
38 | 
39 |
--------------------------------------------------------------------------------
/source/game-loop.md:
--------------------------------------------------------------------------------
1 | title: Understanding game loop, time and ticks
2 | ---
3 |
4 | Screeps is a real-time game. The game time is essentially a number of game "ticks" (or turns, cycles) that have passed since the start of the game servers. The number of the current tick is stored in the `Game.time` property. It is a global counter that increases during the entire game lifespan.
5 |
6 | Generally, ticks run in an infinite loop of your `main` module. It is important to understand that this loop is turn- and multiplayer-based: the next tick (next `Game.time` value) begins only after the full execution of all `main` modules of all players.
7 |
8 | We will now analyze the tick execution mechanism with conditional dividing it into beginning, middle, and end stages.
9 |
10 | 
11 |
12 | In the **beginning of the tick, **there is a certain game situation: different game objects with some property values. Take note that any changes in these properties, appearing of new objects, and dismantling of old ones will happen only at the start of the next tick.
13 |
14 | In the **middle part of the tick,** the `main` module is executed (along with the modules required from it). The `main` operates the unchangeable game condition in the beginning of the tick. For example, by executing `creep.move()` and then (in the same tick) `creep.attack()` the attack still runs from the old coordinates, since properties `creep.pos.x` / `creep.pos.y` will change only in the next tick.
15 |
16 | In the **end of the tick, **the commands specified in the `main` accumulate in order to change the game situation by the beginning of the next tick instantaneously and independently from each other. If any conflicts arise – for example, multiple creeps want to move to the same coordinates, or you have scheduled contradictory orders – these conflicts are solved according to [predefined priorities](/simultaneous-actions.html). Another example: a mutual attack does not result in a conflict, and creeps can die at the same time.
17 |
18 | ## Additional information
19 |
20 | * Physically, resource intensity of the `main` execution is limited by the available CPU (see [`Game.cpuLimit`](/api/#Game.cpuLimit)) .
21 | * The amount of CPU actually used in the current tick is shown by [`Game.getUsedCpu`](/api/#Game.getUsedCpu).
22 | * The correlation between the game tick counter ([`Game.time`](/api/#Game.time)) and real time depends on overall capacity of servers affected.
23 | * All runtime global scope with all the variables between ticks is erased. See more in [this article](/global-objects.html).
24 | * A console command is governed by the same rules: execution is made within one tick as though it is added to the end of `main`.
25 |
26 |
27 | ## See also
28 |
29 | * [How does CPU limit work](/cpu-limit.html)
30 | * [Server-side architecture overview](/architecture.html)
--------------------------------------------------------------------------------
/source/index.md:
--------------------------------------------------------------------------------
1 | title: Overview
2 | ---
3 | Welcome to the Screeps documentation. Get familiar with the game and explore our API:
4 |
5 | {% index_block "Tutorial" "https://screeps.com/a/#!/sim/tutorial" %}
6 | Learn game basics step by step in our interactive tutorial
7 | {% endindex_block %}
8 |
9 | {% index_block "API Reference" "/api" %}
10 | Reference of all game objects, methods and prototypes
11 | {% endindex_block %}
12 |
13 | {% index_block "Contributed articles" "/contributed/rules.html" %}
14 | Read articles written by other players, or contribute your own
15 | {% endindex_block %}
16 |
17 | {% index_block "Chat" "http://chat.screeps.com" %}
18 | Join the game community on our Discord server
19 | {% endindex_block %}
20 |
21 | {% index_block "Chinese version(中文)" "https://screeps-cn.github.io/" %}
22 | The unofficial Chinese version of this documentation translated and maintained by the community
23 | {% endindex_block %}
24 |
25 | ## Other resources
26 |
27 | * The quickest way to get an answer is asking a question on our [Discord server](http://chat.screeps.com).
28 | * You can find real working samples for various scenarios from other players at [GitHub](https://github.com/search?o=desc&p=1&q=screeps&s=updated&type=Repositories).
29 | * If you still have any questions or concerns, please feel free to [submit a request](http://support.screeps.com/hc/en-us/requests/new) or reach out to us by email at [contact@screeps.com](mailto:contact.screeps.com).
30 | * We also have [forum](http://support.screeps.com/hc/communities/public/topics), [Twitter](https://twitter.com/ScreepsGame), and [Facebook](https://facebook.com/ScreepsGame).
31 |
--------------------------------------------------------------------------------
/source/introduction.md:
--------------------------------------------------------------------------------
1 | title: Introduction
2 | ---
3 |
4 | ## What kind of game is Screeps
5 |
6 | Screeps is a massive multiplayer online real-time strategy game. Each player can create their own colony in a **single persistent world** shared by all the players. Such a colony can mine **resources**, build **units**, conquer **territory**. As you conquer more territory, your influence in the game world grows, as well as your abilities to expand your footprint. However, it requires a lot of effort on your part, since multiple players may aim at the same territory.
7 |
8 | Screeps is developed for people with **programming skills**. Unlike some other RTS games, your units in Screeps can react to events without your participation – provided that you have programmed them properly. And, unlike other MMO, you do not have to play Screeps constantly to play well. It is quite enough just to check once in a while to see if everything goes well.
9 |
10 | ## Game world
11 |
12 | The game world consists of interconnected **rooms**. A room is a closed space 50x50 cells in size. It may have from 1 to 4 exits to other rooms. The world is separated into **shards** which are connected by intershard portals. You can consider shards a Z-axis of the world.
13 |
14 | 
15 |
16 | Each room landscape is unique. The view of each room is generated procedurally and consists of three types of surface:
17 |
18 | * **Plain land** – simple ground with a movement cost of 2.
19 | * **Swamps** increase a movement cost to 10.
20 | * **Walls** block movement of all creeps.
21 |
22 | You can customize the room landscape with the help of the following facilities:
23 |
24 | * **Roads** decrease a movement cost to 1. Roads deteriorate due to movement and require repair.
25 | * **Constructed walls** can be created by players. Unlike natural walls, they may be attacked and destroyed by creeps.
26 | * **Ramparts** are your defenses. Only your creeps may move inside your ramparts. Besides, a creep inside a rampart cell cannot be attacked until the rampart is destroyed (though it can attack others). Ramparts deteriorate with each game cycle and require repair.
27 |
28 | In the beginning of the game, you are free to choose the place for your new colony in one of the free rooms inside the zone of the game world available for settlement. After your first spawn is set up, your room will be in **safe mode**. Use this time to create good defenses, or any player will be able to destroy your colony!
29 |
30 | ## Your colony
31 |
32 | ****
33 |
34 | **Energy sources** are the main game resource. They can be harvested by worker creeps. The amount of energy in a source is limited, but resumes once in 300 game ticks.
35 |
36 | **Spawns** are your colony centers. They can accumulate mined energy and use it to create your units. There may be no more than 3 spawns in a room. Hence, by building 3 spawns in a room you actually conquer it. You can have multiple spawns totally in all your rooms though.
37 |
38 | A spawn itself can build only basic units. In order to build more complex ones, you have to construct one or more spawn **extensions**. Read more about that in the next article.
39 |
--------------------------------------------------------------------------------
/source/privacy-policy.md:
--------------------------------------------------------------------------------
1 | title: Privacy Policy
2 | ---
3 |
4 | Screeps, LLC (hereinafter referred to as "We") through its online game Screeps collects personal and non-personal information about you that you provide in your account in order to provide and improve its services, but never hands this information to any third parties. We maintain all reasonable safeguards to protect the security, integrity and privacy of the personal information we collect.
5 |
6 | While the security of your information is very important to us, and we take all reasonable precautions against possible breaches of our websites, no website or Internet transmission is completely secure. So, we cannot guarantee that unauthorized access, hacking, data loss, or other breaches will never occur. We urge you to take steps to keep your personal information safe by memorizing your password or keeping it in a safe place.
7 |
8 | We do not store our users' passwords in any way. We store only their hashes.
9 |
10 | We do not collect any personal information from the payments you make on our websites. This is done solely by the third-party service provider Xsolla. You may read its Privacy Policy here: [http://xsolla.com/privacypolicy/](http://xsolla.com/privacypolicy/).
11 |
12 | As most websites, we collect information automatically, and it is stored in the form of log files. This information includes such data as Internet Protocol (IP) addresses, browser type and language, operating system, website activity, the number of "hits" a webpage is getting, and other relevant information which may be later combined with your personal and non-personal information.
13 |
14 | We may use cookies, scripts, and other technologies to improve the use of our websites, products and services. You can disable or delete cookies or set your browser to alert you when cookies are being sent to your computer. We may use local storage to store content information and preferences of our users. We may collect certain "device-identifying data" about your personal computer or mobile device to create a digital identifier of your device in order to optimize our services for it.
15 |
--------------------------------------------------------------------------------
/source/ptr.md:
--------------------------------------------------------------------------------
1 | title: Public Test Realm (PTR)
2 | ---
3 |
4 | The Public Test Realm is a stand-alone game server with its own world data, players' scripts, memory, and settings. It has been created for two purposes:
5 |
6 | 1) testing changes and new features upcoming to the main server,
7 | 2) providing players with a platform to safely test their scripts in a multi-room environment.
8 |
9 | ---
10 |
11 |
12 |
13 |
[ENTER](https://screeps.com/ptr/)
14 |
15 |
[API Reference](http://docs-ptr.screeps.com/api/)
16 |
17 |
18 | ---
19 |
20 | Both World Mode and Simulation Mode are available on PTR. All the game world data is copied from the main server to PTR every Monday at 0:00 UTC, and old PTR data is then wiped (including players’ scripts). **Don’t use PTR for prolonged storage of your code!**
21 |
22 | Registering new accounts on PTR is blocked. Each time after data is copied from the main server into PTR, existing players accounts are copied as well. Your account CPU subscription is deactivated by default. Click the Activate button on the [order page](https://screeps.com/ptr/#!/order) to enable your free PTR subscription until the next PTR reset.
23 |
24 | Please take note that construction of any structures on the PTR costs only 1 energy unit and the controller upgrade requires 1000 energy units. It allows quick creation of infrastructure you need for testing purposes.
25 |
26 | If you use [grunt-screeps](/commit.html) for committing your scripts from a local machine, you can provide ptr: true option in order to commit your code to the PTR.
27 |
28 | Engine code changes from the PTR are periodically deployed to the `ptr` branch of the private server package on npm, so you can use this command to run it locally:
29 |
30 | ```
31 | npm install screeps@ptr
32 | ```
33 |
--------------------------------------------------------------------------------
/source/respawn.md:
--------------------------------------------------------------------------------
1 | title: Respawning
2 | ---
3 |
4 | In Screeps, the game is never over, and a global win of any player is hardly ever possible. The game is devised in such a way that you can always continue playing, gain revenge, change landscape, save your achievements, etc.
5 |
6 | ## Initial spawn
7 |
8 | The game begins from your appearance on the map. You can choose any room with a neutral Controller and at least one energy source, although we recommend to choose a room with two sources and inside one of the [Start Areas](/start-areas.html). So, after analyzing the landscape, place your spawn on the map:
9 |
10 | 
11 |
12 | Now the room is in [Safe mode](/defense.html) during **20,000 game ticks** (approx. 15** **hours depending on the tick duration). Use this period to explore the room, develop, plan defenses, and prepare for capturing territory and resources.
13 |
14 | When the spawn is placed, it has 300 energy units first. For your safety, the spawn is constantly refilled with a small amount of 1 energy unit per tick, so that you won't stuck without energy.
15 |
16 | {% note info %}
17 | A spawn stops generating energy when there are 300 energy units in the spawn itself or any other spawns and extensions in the room.
18 | {% endnote %}
19 |
20 | ## Respawn
21 |
22 | If you have chosen hastily and now want to move to a more interesting room, or if another player forced you to do so, you can restart the game with the help of the **Respawn** feature. It has a 180 seconds timeout. You will also need to respawn if your rooms are captured by an enemy and you don't have an extra foothold with creeps to build a spawn.
23 |
24 | 
25 |
26 | 
27 |
28 | As you have already known from the article [Control](/control.html), a player's **Global Control Level** (GCL) remains the same after the Respawn. So, if you have a right to claim 3 rooms, you will never lose it.
29 |
30 | Always try to control as many rooms as your GCL allows. It will allow your colony develop at the maximum speed. Even after a respawn from scratch, a high GCL will let you find a place with many free rooms and instantly claim some into your domain for parallel development.
31 |
--------------------------------------------------------------------------------
/source/scripting-basics.md:
--------------------------------------------------------------------------------
1 | title: Scripting Basics
2 | ---
3 |
4 | Writing scripts for Screeps is similar to writing any other JavaScript application. You write your scripts in a special in-game editor, and they are executed continuously even while you are offline (with the exception of the Simulation Room).
5 |
6 | Your game script is executed each game tick in a loop. The game tick duration depends on the current load of servers. The goal of a script is to process the current situation within the game and pass orders to your creeps and spawns. Commands are not executed instantly. Rather, the game remembers your commands and executes them later, after all players' scripts have been executed. For more details on this topic, see the article [Understanding game loop, time and ticks](/game-loop.html).
7 |
8 | Please remember that the exact duration of the execution of your script is limited by the CPU time available in your account. In case of exceeding the limit, the script execution will be stopped. The exception is the Simulation Room where the script execution time is unlimited.
9 |
--------------------------------------------------------------------------------
/source/simultaneous-actions.md:
--------------------------------------------------------------------------------
1 | title: Simultaneous execution of creep actions
2 | ---
3 |
4 | The exact methods available to a creep are determined by its parts. You may opt to create an all-in-one creep out of all existing parts, but you won't be able to execute all methods simultaneously. Here are the dependencies:
5 |
6 | 
7 |
8 | If you try to execute all the dependent methods within one tick, **only the most right one will be executed**. Each attempt means a correct execution returning the `OK` result. For example:
9 |
10 | // tick 1
11 | creep.build(constructionSite); // ERR_NOT_ENOUGH_ENERGY
12 | creep.harvest(source); // OK – executed, creep gained energy
13 | // tick 2
14 | creep.build(constructionSite); // OK – executed
15 | creep.harvest(source); // OK, but execution failed since it was blocked by build
16 |
17 | However, you may execute multiple methods by combining methods from different pipelines (including those which are not involved in any dependency above). For example:
18 |
19 | creep.moveTo(target);
20 | creep.rangedMassAttack();
21 | creep.heal(target);
22 | creep.transfer(target, RESOURCE_ENERGY, amountTransfer);
23 | creep.drop(amountDrop, RESOURCE_ENERGY);
24 | creep.pickup(energy);
25 | creep.claimController(controller);
26 |
27 | All these methods may be successfully executed within one tick.
28 |
29 | Combining methods with energy usage may have two possible results:
30 |
31 | * with enough energy for executing all scheduled operations, all of them will be executed,
32 | * othwerwise, the conflict will arise and only the most right one will be executed.
33 |
34 | ## Methods call priority
35 |
36 | The sequence of calling commands for different methods in the code is irrelevant, only the aforementioned priorities matter. But if the same method is specified, the last call has the priority. For example:
37 |
38 | creep.moveTo(target); // will be ignored
39 | creep.move(RIGHT); // will be ignored
40 | creep.move(LEFT); // will be executed
41 |
42 | The creep will move to the left in this tick.
43 |
44 | ## Additionally
45 |
46 | 1. Though healing healthy creeps and repairing undamaged building may be senseless, it returns `OK` and blocks more left methods in its pipeline.
47 | 2. While `transfer` may work along with `drop`, you cannot execute `transfer` two and more times per tick (to transfer energy to multiple objects). The same is true for all similar methods.
48 | 3. Simultaneously executed methods using `CARRY` body part don't affect each other. Each of them has the amount of energy available in the beginning of the tick. See more about this in [Understanding game loop, time and ticks](/game-loop.html).
49 |
--------------------------------------------------------------------------------
/source/start-areas.md:
--------------------------------------------------------------------------------
1 | title: Start Areas
2 | ---
3 |
4 | ## Novice Areas
5 |
6 | To allow each player start out in the game and develop a colony without facing veterans of the Screeps world, we’ve devised a system of special temporary sectors for novice players. They are marked in green, and the “**Novice Area**” label pops up as you hover the mouse pointer over them.
7 |
8 | 
9 |
10 | The following rules are in force in these rooms:
11 |
12 | * The sector is completely separated from the outer world with a blind, indestructible wall preventing outside players from entering it. Getting inside a Novice Area is possible only by placing there your initial spawn directly.
13 | * Only players with GCL 3 or lower is allowed to start playing in these rooms.
14 | * Each player is allowed to [claim](/api/#Creep.claimController) not more than 3 rooms. But the room [reservation](/api/#Creep.reserveController) is unlimited.
15 | * No cooldown between [safe mode](/defense.html) activations.
16 | * It’s prohibited to use [Nukers](/api/#StructureNuker).
17 |
18 | Novice Areas have the day counter. After it runs out, the walls disappear, rooms lose the green mark, all the limitations are cancelled, and the sector becomes a regular part of the world. After zones are opened, residents can start outward expansion, but can also face invasion into their sectors.
19 |
20 | The majority of novice sectors are divided into 4x4 room size quarters. Apart from the common outer wall that encircles the entire 10x10 sector, there are also inside walls that intersect these “quarters.” The counters of those walls are lower than the total Novice Area counter. It means that each resident starts out in the game by facing other players only in their own “quarter” first, but after a few days they can meet all the residents of the sector.
21 |
22 | ## Respawn Areas
23 |
24 | Another similar kind of isolated world map zones is **Respawn Areas**. They are highlighted with blue color and have only the Nukers usage restriction. All players with any GCL can place their first spawn in this area and claim as many rooms as their GCL allows.
25 |
26 | 
27 |
28 | ## Areas generation in inner sectors
29 |
30 | We keep monitoring the Novice and Respawn Areas population progress and open new areas as it becomes necessary. Please mind that such areas can be allocated in previously opened sectors of the common world provided they are sufficiently big, not populated, and not in use by anyone.
31 |
32 | {% note info %}
33 | If you don’t want some rooms to get transformed into Novice or Respawn Areas, you should take care to [reserve](/api/#Creep.reserveController) them.
34 | {% endnote %}
35 |
36 | When a Novice or Respawn Area is being planned in an inner sector, all free rooms in this sector will be signed by the game with the following message:
37 |
38 | 
39 |
40 | You can use game constants `SYSTEM_USERNAME`, `SIGN_NOVICE_AREA`, and `SIGN_RESPAWN_AREA` to programmatically check the signs in the rooms that are important to you and reserve them if such a message detected.
41 |
--------------------------------------------------------------------------------
/themes/screeps-docs/languages/en.yml:
--------------------------------------------------------------------------------
1 | menu:
2 | docs: Docs
3 | api: API
4 | news: News
5 | plugins: Plugins
6 | themes: Themes
7 | search: Search
8 |
9 | index:
10 | get_started: Get started
11 |
12 | page:
13 | contents: Contents
14 | back_to_top: Back to Top
15 | improve: Improve this doc
16 | prev: Prev
17 | next: Next
18 | last_updated: "Last updated: %s"
19 |
20 | sidebar:
21 | docs:
22 | getting_started: Getting Started
23 | overview: Overview
24 | setup: Setup
25 | configuration: Configuration
26 | commands: Commands
27 | migration: Migration
28 | basic_usage: Basic Usage
29 | writing: Writing
30 | front_matter: Front-matter
31 | tag_plugins: Tag Plugins
32 | asset_folders: Asset Folders
33 | data_files: Data Files
34 | server: Server
35 | generating: Generating
36 | deployment: Deployment
37 | customization: Customization
38 | permalinks: Permalinks
39 | themes: Themes
40 | structure: Structure
41 | templates: Templates
42 | variables: Variables
43 | helpers: Helpers
44 | internationalization: Internationalization (i18n)
45 | plugins: Plugins
46 | miscellaneous: Miscellaneous
47 | troubleshooting: Troubleshooting
48 | contributing: Contributing
49 | api:
50 | core: Core
51 | overview: Overview
52 | events: Events
53 | locals: Locals
54 | router: Router
55 | box: Box
56 | rendering: Rendering
57 | posts: Posts
58 | scaffolds: Scaffolds
59 | themes: Themes
60 | extensions: Extensions
61 | console: Console
62 | deployer: Deployer
63 | filter: Filter
64 | generator: Generator
65 | helper: Helper
66 | migrator: Migrator
67 | processor: Processor
68 | renderer: Renderer
69 | tag: Tag
--------------------------------------------------------------------------------
/themes/screeps-docs/languages/ko.yml:
--------------------------------------------------------------------------------
1 | menu:
2 | docs: Docs
3 | api: API
4 | news: News
5 | plugins: Plugins
6 | themes: Themes
7 | search: Search
8 |
9 | index:
10 | get_started: Get started
11 |
12 | page:
13 | contents: Contents
14 | back_to_top: Back to Top
15 | improve: Improve this doc
16 | prev: Prev
17 | next: Next
18 | last_updated: "Last updated: %s"
19 |
20 | sidebar:
21 | docs:
22 | getting_started: Getting Started
23 | overview: Overview
24 | setup: Setup
25 | configuration: Configuration
26 | commands: Commands
27 | migration: Migration
28 | basic_usage: Basic Usage
29 | writing: Writing
30 | front_matter: Front-matter
31 | tag_plugins: Tag Plugins
32 | asset_folders: Asset Folders
33 | data_files: Data Files
34 | server: Server
35 | generating: Generating
36 | deployment: Deployment
37 | customization: Customization
38 | permalinks: Permalinks
39 | themes: Themes
40 | structure: Structure
41 | templates: Templates
42 | variables: Variables
43 | helpers: Helpers
44 | internationalization: Internationalization (i18n)
45 | plugins: Plugins
46 | miscellaneous: Miscellaneous
47 | troubleshooting: Troubleshooting
48 | contributing: Contributing
49 | api:
50 | core: Core
51 | overview: Overview
52 | events: Events
53 | locals: Locals
54 | router: Router
55 | box: Box
56 | rendering: Rendering
57 | posts: Posts
58 | scaffolds: Scaffolds
59 | themes: Themes
60 | extensions: Extensions
61 | console: Console
62 | deployer: Deployer
63 | filter: Filter
64 | generator: Generator
65 | helper: Helper
66 | migrator: Migrator
67 | processor: Processor
68 | renderer: Renderer
69 | tag: Tag
--------------------------------------------------------------------------------
/themes/screeps-docs/languages/ru.yml:
--------------------------------------------------------------------------------
1 | menu:
2 | docs: Docs
3 | api: API
4 | news: Новости
5 | plugins: Плагины
6 | themes: Темы
7 | search: Поиск
8 |
9 | index:
10 | get_started: Начнём
11 |
12 | page:
13 | contents: Содержание
14 | back_to_top: Наверх
15 | improve: Предложить улучшение
16 | prev: Пред
17 | next: След
18 | last_updated: "Последнее обновление: %s"
19 |
20 | sidebar:
21 | docs:
22 | getting_started: Начало работы
23 | overview: Обзор
24 | setup: Установка
25 | configuration: Конфигурация
26 | commands: Команды
27 | migration: Миграция
28 | basic_usage: Основы
29 | writing: Написание
30 | front_matter: Шапка файла
31 | tag_plugins: Плагины тэгов
32 | asset_folders: Папки с материалами
33 | data_files: Файлы с данными
34 | server: Сервер
35 | generating: Генерация
36 | deployment: Публикация
37 | customization: Кастомизация
38 | permalinks: Постоянные ссылки
39 | themes: Темы
40 | structure: Структура
41 | templates: Шаблоны
42 | variables: Переменные
43 | helpers: Помощники
44 | internationalization: Интернацинализация (i18n)
45 | plugins: Плагины
46 | miscellaneous: Разное
47 | troubleshooting: Решение проблем
48 | contributing: Содействие
49 | api:
50 | core: Ядро
51 | overview: Обзор
52 | events: События
53 | locals: Переменные
54 | router: Маршруты
55 | box: Модуль
56 | rendering: Рендеринг
57 | posts: Посты
58 | scaffolds: Заготовки
59 | themes: Темы
60 | extensions: Расширения
61 | console: Консоль
62 | deployer: Инструмент размещения
63 | filter: Фильтр
64 | generator: Генератор
65 | helper: Помошник
66 | migrator: Мигратор
67 | processor: Обработчик
68 | renderer: Рендер
69 | tag: Тэг
--------------------------------------------------------------------------------
/themes/screeps-docs/languages/zh-cn.yml:
--------------------------------------------------------------------------------
1 | menu:
2 | docs: 文档
3 | api: API
4 | news: 新闻
5 | plugins: 插件
6 | themes: 主题
7 | search: 搜索
8 |
9 | index:
10 | get_started: 开始使用
11 |
12 | page:
13 | contents: 目录
14 | back_to_top: 回到顶部
15 | improve: 改进本文
16 | prev: 上一页
17 | next: 下一页
18 | last_updated: 上次更新:%s
19 |
20 | sidebar:
21 | docs:
22 | getting_started: 开始使用
23 | overview: 概述
24 | setup: 建站
25 | configuration: 配置
26 | commands: 命令
27 | migration: 迁移
28 | basic_usage: 基本操作
29 | writing: 写作
30 | front_matter: Front-matter
31 | tag_plugins: 标签插件
32 | asset_folders: 资源文件夹
33 | data_files: 数据文件夹
34 | server: 服务器
35 | generating: 生成器
36 | deployment: 部署
37 | customization: 自定义
38 | permalinks: 永久链接
39 | themes: 主题
40 | structure: 结构
41 | templates: 模版
42 | variables: 变量
43 | helpers: 辅助函数
44 | internationalization: 国际化 (i18n)
45 | plugins: 插件
46 | miscellaneous: 其他
47 | troubleshooting: 问题解答
48 | contributing: 贡献
49 | api:
50 | core: 核心
51 | overview: 概述
52 | events: 事件
53 | locals: 本地变量
54 | router: 路由
55 | box: 盒(Box)
56 | rendering: 渲染
57 | posts: 文章
58 | scaffolds: 模版 (Scaffold)
59 | themes: 主题
60 | extensions: 扩展
61 | console: 控制台 (Console)
62 | deployer: 部署器 (Deployer)
63 | filter: 过滤器 (Filter)
64 | generator: 生成器 (Generator)
65 | helper: 辅助函数 (Helper)
66 | migrator: 迁移器 (Migrator)
67 | processor: 处理器 (Processor)
68 | renderer: 渲染引擎 (Renderer)
69 | tag: 标签 (Tag)
--------------------------------------------------------------------------------
/themes/screeps-docs/languages/zh-tw.yml:
--------------------------------------------------------------------------------
1 | menu:
2 | docs: 文件
3 | api: API
4 | news: 新聞
5 | plugins: 外掛
6 | themes: 主題
7 | search: 搜尋
8 |
9 | index:
10 | get_started: 開始使用
11 |
12 | page:
13 | contents: 目錄
14 | back_to_top: 回到頁首
15 | improve: 改善這篇文件
16 | prev: 上一頁
17 | next: 下一頁
18 | last_updated: 上次更新:%s
19 |
20 | sidebar:
21 | docs:
22 | getting_started: 開始使用
23 | overview: 概覽
24 | setup: 建立
25 | configuration: 配置
26 | commands: 指令
27 | migration: 轉移
28 | basic_usage: 基本操作
29 | writing: 寫作
30 | front_matter: Front-matter
31 | tag_plugins: 標籤外掛
32 | asset_folders: 資產資料夾
33 | data_files: 資料檔案
34 | server: 伺服器
35 | generating: 產生檔案
36 | deployment: 佈署
37 | customization: 自定
38 | permalinks: 永久連結
39 | themes: 主題
40 | structure: 結構
41 | templates: 模版
42 | variables: 變數
43 | helpers: 輔助函數
44 | internationalization: 國際化 (i18n)
45 | plugins: 外掛
46 | miscellaneous: 其他
47 | troubleshooting: 解決問題
48 | contributing: 貢獻
49 | api:
50 | core: 核心
51 | overview: 概覽
52 | events: 事件
53 | locals: 區域變數
54 | router: 路由
55 | box: 箱子 (Box)
56 | rendering: 渲染
57 | posts: 文章
58 | scaffolds: 鷹架 (Scaffold)
59 | themes: 主題
60 | extensions: 擴充
61 | console: 控制台 (Console)
62 | deployer: 佈署器 (Deployer)
63 | filter: 過濾器 (Filter)
64 | generator: 產生器 (Generator)
65 | helper: 輔助函數 (Helper)
66 | migrator: 轉移器 (Migrator)
67 | processor: 處理器 (Processor)
68 | renderer: 渲染引擎 (Renderer)
69 | tag: 標籤外掛 (Tag)
--------------------------------------------------------------------------------
/themes/screeps-docs/layout/archive.swig:
--------------------------------------------------------------------------------
1 | {% set page.title = 'News' %}
2 |