tern-screeps 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm.yml +33 -0
- package/README.md +11 -11
- package/build.js +2172 -2156
- package/defs/screeps.json +62 -8
- package/package.json +18 -18
- package/check.js +0 -49
package/build.js
CHANGED
|
@@ -1,2156 +1,2172 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
|
|
3
|
-
function _extend() {
|
|
4
|
-
var dst = arguments[0];
|
|
5
|
-
var srcs = Array.prototype.slice.call(arguments, 1);
|
|
6
|
-
srcs.forEach(function(src) {
|
|
7
|
-
for(var i in src) {
|
|
8
|
-
dst[i] = src[i];
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
return dst;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _docs = {
|
|
16
|
-
store: {
|
|
17
|
-
store: {
|
|
18
|
-
"!doc": "A Store object that contains cargo of this creep.",
|
|
19
|
-
"!type": "+Store"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
_extend(_docs, {
|
|
25
|
-
pathfindingOptions: {
|
|
26
|
-
roomCallback: {
|
|
27
|
-
"!doc": "Request from the pathfinder to generate a CostMatrix for a certain room. The callback accepts one argument, roomName. This callback will only be called once per room per search. If you are running multiple pathfinding operations in a single room and in a single tick you may consider caching your CostMatrix to speed up your code. Please read the CostMatrix documentation below for more information on CostMatrix. If you return false from the callback the requested room will not be searched, and it won't count against maxRooms",
|
|
28
|
-
"!type": "fn(roomName: string) -> +CostMatrix"
|
|
29
|
-
},
|
|
30
|
-
plainCost: {
|
|
31
|
-
"!doc": "Cost for walking on plain positions. The default is 1.",
|
|
32
|
-
"!type": "number"
|
|
33
|
-
},
|
|
34
|
-
swampCost: {
|
|
35
|
-
"!doc": "Cost for walking on swamp positions. The default is 5.",
|
|
36
|
-
"!type": "number"
|
|
37
|
-
},
|
|
38
|
-
flee: {
|
|
39
|
-
"!doc": "Instead of searching for a path to the goals this will search for a path away from the goals. The cheapest path that is out of range of every goal will be returned. The default is false.",
|
|
40
|
-
"!type": "bool"
|
|
41
|
-
},
|
|
42
|
-
maxOps: {
|
|
43
|
-
"!doc": "The maximum allowed pathfinding operations. You can limit CPU time used for the search based on ratio 1 op ~ 0.001 CPU. The default value is 2000.",
|
|
44
|
-
"!type": "number"
|
|
45
|
-
},
|
|
46
|
-
maxRooms: {
|
|
47
|
-
"!doc": "The maximum allowed rooms to search. The default is 16, maximum is 64.",
|
|
48
|
-
"!type": "number"
|
|
49
|
-
},
|
|
50
|
-
maxCost: {
|
|
51
|
-
"!doc": "The maximum allowed cost of the path returned. If at any point the pathfinder detects that it is impossible to find a path with a cost less than or equal to maxCost it will immediately halt the search. The default is Infinity.",
|
|
52
|
-
"!type": "number"
|
|
53
|
-
},
|
|
54
|
-
heuristicWeight: {
|
|
55
|
-
"!doc": "Weight to apply to the heuristic in the A* formula F = G + weight * H. Use this option only if you understand the underlying A* algorithm mechanics! The default value is 1.",
|
|
56
|
-
"!type": "number"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
_extend(_docs, {
|
|
62
|
-
roomFindPathOptions: _extend({}, _docs.pathfindingOptions, {
|
|
63
|
-
ignoreCreeps: {
|
|
64
|
-
"!doc": "Treat squares with creeps as walkable. Can be useful with too many moving creeps around or in some other cases. The default value is false.",
|
|
65
|
-
"!type": "boolean"
|
|
66
|
-
},
|
|
67
|
-
ignoreDestructibleStructures: {
|
|
68
|
-
"!doc": "Treat squares with destructible structures (constructed walls, ramparts, spawns, extensions) as walkable. The default value is false.",
|
|
69
|
-
"!type": "boolean"
|
|
70
|
-
},
|
|
71
|
-
ignoreRoads: {
|
|
72
|
-
"!doc": "Ignore road structures. Enabling this option can speed up the search. The default value is false. This is only used when the new PathFinder is enabled.",
|
|
73
|
-
"!type": "boolean"
|
|
74
|
-
},
|
|
75
|
-
ignore: {
|
|
76
|
-
"!doc": "An array of the room's objects or RoomPosition objects which should be treated as walkable tiles during the search. This option cannot be used when the new PathFinder is enabled (use costCallback option instead).",
|
|
77
|
-
"!type": "[+RoomObject]"
|
|
78
|
-
},
|
|
79
|
-
avoid: {
|
|
80
|
-
"!doc": "An array of the room's objects or RoomPosition objects which should be treated as obstacles during the search. This option cannot be used when the new PathFinder is enabled (use costCallback option instead).",
|
|
81
|
-
"!type": "[+RoomObject]"
|
|
82
|
-
},
|
|
83
|
-
serialize: {
|
|
84
|
-
"!doc": "If true, the result path will be serialized using Room.serializePath. The default is false.",
|
|
85
|
-
"!type": "boolean"
|
|
86
|
-
},
|
|
87
|
-
range: {
|
|
88
|
-
"!doc": "Find a path to a position in specified linear range of target. The default is 0.",
|
|
89
|
-
"!type": "number"
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
_extend(_docs, {
|
|
95
|
-
moveToOptions: _extend({}, _docs.roomFindPathOptions, {
|
|
96
|
-
reusePath: {
|
|
97
|
-
"!doc": "This option enables reusing the path found along multiple game ticks. It allows to save CPU time, but can result in a slightly slower creep reaction behavior. The path is stored into the creep's memory to the _move property. The reusePath value defines the amount of ticks which the path should be reused for. The default value is 5. Increase the amount to save more CPU, decrease to make the movement more consistent. Set to 0 if you want to disable path reusing.",
|
|
98
|
-
"!type": "boolean"
|
|
99
|
-
},
|
|
100
|
-
serializeMemory: {
|
|
101
|
-
"!doc": "If reusePath is enabled and this option is set to true, the path will be stored in memory in the short serialized form using Room.serializePath. The default value is true.",
|
|
102
|
-
"!type": "boolean"
|
|
103
|
-
},
|
|
104
|
-
noPathFinding: {
|
|
105
|
-
"!doc": "If this option is set to true, moveTo method will return ERR_NOT_FOUND if there is no memorized path to reuse. This can significantly save CPU time in some cases. The default value is false.",
|
|
106
|
-
"!type": "boolean"
|
|
107
|
-
},
|
|
108
|
-
visualizePathStyle: {
|
|
109
|
-
"!doc": "Draw a line along the creep’s path using RoomVisual.poly. You can provide either an empty object or custom style parameters.",
|
|
110
|
-
"!type": "object"
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
var def_screeps = {
|
|
116
|
-
"!name": "screeps",
|
|
117
|
-
"!define": {
|
|
118
|
-
object: {},
|
|
119
|
-
BodyPart: {
|
|
120
|
-
type: {
|
|
121
|
-
"!doc": "One of the body part types constants",
|
|
122
|
-
"!type": "string"
|
|
123
|
-
},
|
|
124
|
-
hits: {
|
|
125
|
-
"!doc": "The remaining amount of hit points of this body part.",
|
|
126
|
-
"!type": "number"
|
|
127
|
-
},
|
|
128
|
-
boost: {
|
|
129
|
-
"!doc": "If the body part is boosted, this property specifies the mineral type which is used for boosting. One of the RESOURCE_* constants.",
|
|
130
|
-
"!type": "string"
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
PathStep: {
|
|
134
|
-
x: "number",
|
|
135
|
-
y: "number",
|
|
136
|
-
dx: "number",
|
|
137
|
-
dy: "number",
|
|
138
|
-
direction: "number"
|
|
139
|
-
},
|
|
140
|
-
Path: {
|
|
141
|
-
"!type": "[PathStep]"
|
|
142
|
-
},
|
|
143
|
-
PathfindingResult: {
|
|
144
|
-
path: {
|
|
145
|
-
"!doc": "An array of RoomPosition objects.",
|
|
146
|
-
"!type": "[+RoomPosition]"
|
|
147
|
-
},
|
|
148
|
-
ops: {
|
|
149
|
-
"!doc": "Total number of operations performed before this path was calculated.",
|
|
150
|
-
"!type": "number"
|
|
151
|
-
},
|
|
152
|
-
cost: {
|
|
153
|
-
"!doc": "The total cost of the path as derived from plainCost, swampCost and any given CostMatrix instances.",
|
|
154
|
-
"!type": "number"
|
|
155
|
-
},
|
|
156
|
-
incomplete: {
|
|
157
|
-
"!doc": "If the pathfinder fails to find a complete path, this will be true. Note that path will still be populated with a partial path which represents the closest path it could find given the search parameters.",
|
|
158
|
-
"!type": "boolean"
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
PathfindingOptions: _docs.pathfindingOptions,
|
|
162
|
-
RoomFindPathOptions: _docs.roomFindPathOptions,
|
|
163
|
-
MoveToOptions: _docs.moveToOptions,
|
|
164
|
-
FindRouteOptions: {
|
|
165
|
-
routeCallback: {
|
|
166
|
-
"!doc": "This callback accepts two arguments: function(roomName, fromRoomName). It can be used to calculate the cost of entering that room. You can use this to do things like prioritize your own rooms, or avoid some rooms. You can return a floating point cost or Infinity to block the room.",
|
|
167
|
-
"!type": "fn(roomName: string, fromRoomName: string) -> number"
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
LookItem: {
|
|
171
|
-
type: "string",
|
|
172
|
-
creep: "+Creep",
|
|
173
|
-
structure: "+Structure",
|
|
174
|
-
energy: "+Resource",
|
|
175
|
-
resource: "+Resource",
|
|
176
|
-
flag: "+Flag",
|
|
177
|
-
source: "+Source",
|
|
178
|
-
constructionSite: "+ConstructionSite",
|
|
179
|
-
terrain: "string"
|
|
180
|
-
},
|
|
181
|
-
LookArray: {
|
|
182
|
-
"!type": "[LookItem]"
|
|
183
|
-
},
|
|
184
|
-
LookRowArray: {
|
|
185
|
-
"!type": "[LookArray]"
|
|
186
|
-
},
|
|
187
|
-
LookAreaArray: {
|
|
188
|
-
"!type": "[LookRowArray]"
|
|
189
|
-
},
|
|
190
|
-
MapRouteStep: {
|
|
191
|
-
exit: "number",
|
|
192
|
-
room: "string"
|
|
193
|
-
},
|
|
194
|
-
CostMatrix: {
|
|
195
|
-
"!type": "fn()",
|
|
196
|
-
"!doc": "Container for custom navigation cost data. By default PathFinder will only consider terrain data (plain, swamp, wall) — if you need to route around obstacles such as buildings or creeps you must put them into a CostMatrix. Generally you will create your CostMatrix from within roomCallback. If a non-0 value is found in a room's CostMatrix then that value will be used instead of the default terrain cost. You should avoid using large values in your CostMatrix and terrain cost flags. For example, running PathFinder.search with { plainCost: 1, swampCost: 5 } is faster than running it with {plainCost: 2, swampCost: 10 } even though your paths will be the same.",
|
|
197
|
-
prototype: {
|
|
198
|
-
"set": {
|
|
199
|
-
"!doc": "Set the cost of a position in this CostMatrix.",
|
|
200
|
-
"!type": "fn(x: number, y: number, cost: number)"
|
|
201
|
-
},
|
|
202
|
-
"get": {
|
|
203
|
-
"!doc": "Get the cost of a position in this CostMatrix.",
|
|
204
|
-
"!type": "fn(x: number, y: number)"
|
|
205
|
-
},
|
|
206
|
-
"clone": {
|
|
207
|
-
"!doc": "Copy this CostMatrix into a new CostMatrix with the same data.",
|
|
208
|
-
"!type": "fn() -> +CostMatrix"
|
|
209
|
-
},
|
|
210
|
-
serialize: {
|
|
211
|
-
"!doc": "Returns a compact representation of this CostMatrix which can be stored via JSON.stringify",
|
|
212
|
-
"!type": "fn() -> [number]"
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
deserialize: {
|
|
216
|
-
"!doc": "Static method which deserializes a new CostMatrix using the return value of `serialize`.",
|
|
217
|
-
"!type": "fn(val: [number]) -> +CostMatrix"
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
Transaction: {
|
|
221
|
-
transactionId: "string",
|
|
222
|
-
time: "number",
|
|
223
|
-
sender: {
|
|
224
|
-
username: "string"
|
|
225
|
-
},
|
|
226
|
-
recipient: {
|
|
227
|
-
username: "string"
|
|
228
|
-
},
|
|
229
|
-
resouceType: "string",
|
|
230
|
-
amount: "number",
|
|
231
|
-
from: "string",
|
|
232
|
-
to: "string",
|
|
233
|
-
description: "string",
|
|
234
|
-
order: {
|
|
235
|
-
id: "string",
|
|
236
|
-
type: "string",
|
|
237
|
-
price: "number"
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
MarketOrder: {
|
|
241
|
-
id: "string",
|
|
242
|
-
created: "number",
|
|
243
|
-
type: "string",
|
|
244
|
-
resourceType: "string",
|
|
245
|
-
roomName: "string",
|
|
246
|
-
amount: "number",
|
|
247
|
-
remainingAmount: "number",
|
|
248
|
-
price: "number",
|
|
249
|
-
active: "boolean",
|
|
250
|
-
totalAmount: "number"
|
|
251
|
-
},
|
|
252
|
-
MarketHistoryItem: {
|
|
253
|
-
"resourceType": "string",
|
|
254
|
-
"date": "string",
|
|
255
|
-
"transactions": "number",
|
|
256
|
-
"volume": "number",
|
|
257
|
-
"avgPrice": "number",
|
|
258
|
-
"stddevPrice": "number"
|
|
259
|
-
},
|
|
260
|
-
HeapStatistics: {
|
|
261
|
-
"total_heap_size": "number",
|
|
262
|
-
"total_heap_size_executable": "number",
|
|
263
|
-
"total_physical_size": "number",
|
|
264
|
-
"total_available_size": "number",
|
|
265
|
-
"used_heap_size": "number",
|
|
266
|
-
"heap_size_limit": "number",
|
|
267
|
-
"malloced_memory": "number",
|
|
268
|
-
"peak_malloced_memory": "number",
|
|
269
|
-
"does_zap_garbage": "number",
|
|
270
|
-
"externally_allocated_size": "number"
|
|
271
|
-
},
|
|
272
|
-
Effect: {
|
|
273
|
-
effect: {
|
|
274
|
-
"!doc": "Effect ID of the applied effect. Can be either natural effect ID or Power ID.",
|
|
275
|
-
"!type": "number"
|
|
276
|
-
},
|
|
277
|
-
level: {
|
|
278
|
-
"!doc": "Power level of the applied effect. Absent if the effect is not a Power effect.",
|
|
279
|
-
"!type": "number"
|
|
280
|
-
},
|
|
281
|
-
ticksRemaining: {
|
|
282
|
-
"!doc": "How many ticks will the effect last.",
|
|
283
|
-
"!type": "number"
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
RoomTerrain: {
|
|
287
|
-
"!type": "fn()",
|
|
288
|
-
"!doc": "An object which provides fast access to room terrain data. These objects can be constructed for any room in the world even if you have no access to it. Technically every Room.Terrain object is a very lightweight adapter to underlying static terrain buffers with corresponding minimal accessors.",
|
|
289
|
-
prototype: {
|
|
290
|
-
get: {
|
|
291
|
-
"!doc": "Get terrain type at the specified room position by (x,y) coordinates. Unlike the Game.map.getTerrainAt(...) method, this one doesn't perform any string operations and returns integer terrain type values (see below).\n\nArguments:\n* x - X position in the room.\n* y - Y position in the room.\n\nCPU Cost: LOW",
|
|
292
|
-
"!type": "fn(x: number, y: number) -> number",
|
|
293
|
-
},
|
|
294
|
-
getRawBuffer: {
|
|
295
|
-
"!doc": "Get copy of underlying static terrain buffer. Current underlying representation is Uint8Array.\n\nArguments:\n* destinationArray (optional) - A typed array view in which terrain will be copied to.\n\nCPU Cost: LOW",
|
|
296
|
-
"!type": "fn(destinationArray?: bool) -> +Uint8Array"
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
},
|
|
300
|
-
StructureSpawnSpawning: {
|
|
301
|
-
"!type": "fn()",
|
|
302
|
-
"!doc": "Details of the creep being spawned currently that can be addressed by the StructureSpawn.spawning property.",
|
|
303
|
-
prototype: {
|
|
304
|
-
name: {
|
|
305
|
-
"!doc": "The name of a new creep.",
|
|
306
|
-
"!type": "string"
|
|
307
|
-
},
|
|
308
|
-
needTime: {
|
|
309
|
-
"!doc": "Time needed in total to complete the spawning.",
|
|
310
|
-
"!type": "number"
|
|
311
|
-
},
|
|
312
|
-
remainingTime: {
|
|
313
|
-
"!doc": "Remaining time to go.",
|
|
314
|
-
"!type": "number"
|
|
315
|
-
},
|
|
316
|
-
directions: {
|
|
317
|
-
"!doc": "An array with the spawn directions, see StructureSpawn.Spawning.setDirections.",
|
|
318
|
-
"!type": "[number]"
|
|
319
|
-
},
|
|
320
|
-
spawn: {
|
|
321
|
-
"!doc": "A link to the spawn.",
|
|
322
|
-
"!type": "+StructureSpawn"
|
|
323
|
-
},
|
|
324
|
-
cancel: {
|
|
325
|
-
"!doc": "Cancel spawning immediately. Energy spent on spawning is not returned.",
|
|
326
|
-
"!type": "fn() -> number"
|
|
327
|
-
},
|
|
328
|
-
setDirections: {
|
|
329
|
-
"!doc": "Set desired directions where the creep should move when spawned.\n\nArguments:\n* directions - An array with the direction constants as items.\n\nCPU cost: CONST",
|
|
330
|
-
"!type": "fn(directions: [number]) -> number"
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
Power: {
|
|
335
|
-
level: {
|
|
336
|
-
"!doc": "Current level of the power.",
|
|
337
|
-
"!type": "number"
|
|
338
|
-
},
|
|
339
|
-
cooldown: {
|
|
340
|
-
"!doc": "Cooldown ticks remaining, or undefined if the power creep is not spawned in the world.",
|
|
341
|
-
"!type": "number"
|
|
342
|
-
}
|
|
343
|
-
},
|
|
344
|
-
RoomStatus: {
|
|
345
|
-
status: {
|
|
346
|
-
"!doc": "One of the following string values:\n* normal – the room has no restrictions\n* closed – the room is not available\n* novice – the room is part of a novice area\n* respawn – the room is part of a respawn area",
|
|
347
|
-
"!type": "string"
|
|
348
|
-
},
|
|
349
|
-
timestamp: {
|
|
350
|
-
"!doc": "Status expiration time in milliseconds since UNIX epoch time. This property is null if the status is permanent.",
|
|
351
|
-
"!type": "number"
|
|
352
|
-
},
|
|
353
|
-
},
|
|
354
|
-
LineStyle: {
|
|
355
|
-
width: {
|
|
356
|
-
"!doc": "Line width, default is 0.1.",
|
|
357
|
-
"!type": "number"
|
|
358
|
-
},
|
|
359
|
-
color: {
|
|
360
|
-
"!doc": "Line color in any web format, default is #ffffff (white).",
|
|
361
|
-
"!type": "string"
|
|
362
|
-
},
|
|
363
|
-
opacity: {
|
|
364
|
-
"!doc": "Opacity value, default is 0.5.",
|
|
365
|
-
"!type": "number"
|
|
366
|
-
},
|
|
367
|
-
lineStyle: {
|
|
368
|
-
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
369
|
-
"!type": "string"
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
MapLineStyle: {
|
|
373
|
-
width: {
|
|
374
|
-
"!doc": "Line width, default is 0.5.",
|
|
375
|
-
"!type": "number"
|
|
376
|
-
},
|
|
377
|
-
color: {
|
|
378
|
-
"!doc": "Line color in any web format, default is #ffffff (white).",
|
|
379
|
-
"!type": "string"
|
|
380
|
-
},
|
|
381
|
-
opacity: {
|
|
382
|
-
"!doc": "Opacity value, default is 0.5.",
|
|
383
|
-
"!type": "number"
|
|
384
|
-
},
|
|
385
|
-
lineStyle: {
|
|
386
|
-
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
387
|
-
"!type": "string"
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
CircleStyle: {
|
|
391
|
-
radius: {
|
|
392
|
-
"!doc": "Circle radius, default is 0.15.",
|
|
393
|
-
"!type": "number"
|
|
394
|
-
},
|
|
395
|
-
fill: {
|
|
396
|
-
"!doc": "Fill color in any web format, default is #ffffff (white).",
|
|
397
|
-
"!type": "string"
|
|
398
|
-
},
|
|
399
|
-
opacity: {
|
|
400
|
-
"!doc": "Opacity value, default is 0.5.",
|
|
401
|
-
"!type": "number"
|
|
402
|
-
},
|
|
403
|
-
stroke: {
|
|
404
|
-
"!doc": "Stroke color in any web format, default is undefined (no stroke).",
|
|
405
|
-
"!type": "string"
|
|
406
|
-
},
|
|
407
|
-
strokeWidth: {
|
|
408
|
-
"!doc": "Stroke line width, default is 0.1.",
|
|
409
|
-
"!type": "number"
|
|
410
|
-
},
|
|
411
|
-
lineStyle: {
|
|
412
|
-
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
413
|
-
"!type": "string"
|
|
414
|
-
}
|
|
415
|
-
},
|
|
416
|
-
MapCircleStyle: {
|
|
417
|
-
radius: {
|
|
418
|
-
"!doc": "Circle radius, default is 10.",
|
|
419
|
-
"!type": "number"
|
|
420
|
-
},
|
|
421
|
-
fill: {
|
|
422
|
-
"!doc": "Fill color in the following format: #ffffff (hex triplet). Default is #ffffff.",
|
|
423
|
-
"!type": "string"
|
|
424
|
-
},
|
|
425
|
-
opacity: {
|
|
426
|
-
"!doc": "Opacity value, default is 0.5.",
|
|
427
|
-
"!type": "number"
|
|
428
|
-
},
|
|
429
|
-
stroke: {
|
|
430
|
-
"!doc": "Stroke color in the following format: #ffffff (hex triplet). Default is undefined (no stroke).",
|
|
431
|
-
"!type": "string"
|
|
432
|
-
},
|
|
433
|
-
strokeWidth: {
|
|
434
|
-
"!doc": "Stroke line width, default is 0.5.",
|
|
435
|
-
"!type": "number"
|
|
436
|
-
},
|
|
437
|
-
lineStyle: {
|
|
438
|
-
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
439
|
-
"!type": "string"
|
|
440
|
-
}
|
|
441
|
-
},
|
|
442
|
-
PolyStyle: {
|
|
443
|
-
fill: {
|
|
444
|
-
"!doc": "Fill color in any web format, default is #ffffff (white).",
|
|
445
|
-
"!type": "string"
|
|
446
|
-
},
|
|
447
|
-
opacity: {
|
|
448
|
-
"!doc": "Opacity value, default is 0.5.",
|
|
449
|
-
"!type": "number"
|
|
450
|
-
},
|
|
451
|
-
stroke: {
|
|
452
|
-
"!doc": "Stroke color in any web format, default is undefined (no stroke).",
|
|
453
|
-
"!type": "string"
|
|
454
|
-
},
|
|
455
|
-
strokeWidth: {
|
|
456
|
-
"!doc": "Stroke line width, default is 0.1.",
|
|
457
|
-
"!type": "number"
|
|
458
|
-
},
|
|
459
|
-
lineStyle: {
|
|
460
|
-
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
461
|
-
"!type": "string"
|
|
462
|
-
}
|
|
463
|
-
},
|
|
464
|
-
MapRectStyle: {
|
|
465
|
-
fill: {
|
|
466
|
-
"!doc": "Fill color in the following format: #ffffff (hex triplet). Default is #ffffff.",
|
|
467
|
-
"!type": "string"
|
|
468
|
-
},
|
|
469
|
-
opacity: {
|
|
470
|
-
"!doc": "Opacity value, default is 0.5.",
|
|
471
|
-
"!type": "number"
|
|
472
|
-
},
|
|
473
|
-
stroke: {
|
|
474
|
-
"!doc": "Stroke color in the following format: #ffffff (hex triplet). Default is undefined (no stroke).",
|
|
475
|
-
"!type": "string"
|
|
476
|
-
},
|
|
477
|
-
strokeWidth: {
|
|
478
|
-
"!doc": "Stroke line width, default is 0.5.",
|
|
479
|
-
"!type": "number"
|
|
480
|
-
},
|
|
481
|
-
lineStyle: {
|
|
482
|
-
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
483
|
-
"!type": "string"
|
|
484
|
-
}
|
|
485
|
-
},
|
|
486
|
-
MapPolyStyle: {
|
|
487
|
-
fill: {
|
|
488
|
-
"!doc": "Fill color in the following format: #ffffff (hex triplet). Default is #ffffff.",
|
|
489
|
-
"!type": "string"
|
|
490
|
-
},
|
|
491
|
-
opacity: {
|
|
492
|
-
"!doc": "Opacity value, default is 0.5.",
|
|
493
|
-
"!type": "number"
|
|
494
|
-
},
|
|
495
|
-
stroke: {
|
|
496
|
-
"!doc": "Stroke color in the following format: #ffffff (hex triplet). Default is #ffffff.",
|
|
497
|
-
"!type": "string"
|
|
498
|
-
},
|
|
499
|
-
strokeWidth: {
|
|
500
|
-
"!doc": "Stroke line width, default is 0.5.",
|
|
501
|
-
"!type": "number"
|
|
502
|
-
},
|
|
503
|
-
lineStyle: {
|
|
504
|
-
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
505
|
-
"!type": "string"
|
|
506
|
-
}
|
|
507
|
-
},
|
|
508
|
-
TextStyle: {
|
|
509
|
-
color: {
|
|
510
|
-
"!doc": "Font color in any web format, default is #ffffff (white).",
|
|
511
|
-
"!type": "string"
|
|
512
|
-
},
|
|
513
|
-
font: {
|
|
514
|
-
"!doc": "Either a number or a string in one of the following forms:\n" +
|
|
515
|
-
"0.7 - relative size in game coordinates\n" +
|
|
516
|
-
"20px - absolute size in pixels\n" +
|
|
517
|
-
"0.7 serif\n" +
|
|
518
|
-
"bold italic 1.5 Times New Roman"
|
|
519
|
-
},
|
|
520
|
-
stroke: {
|
|
521
|
-
"!doc": "Stroke color in any web format, default is undefined (no stroke).",
|
|
522
|
-
"!type": "string"
|
|
523
|
-
},
|
|
524
|
-
strokeWidth: {
|
|
525
|
-
"!doc": "Stroke line width, default is 0.1.",
|
|
526
|
-
"!type": "number"
|
|
527
|
-
},
|
|
528
|
-
backgroundColor: {
|
|
529
|
-
"!doc": "Background color in any web format, default is undefined (no background). When background is enabled, text vertical align is set to middle (default is baseline).",
|
|
530
|
-
"!type": "string"
|
|
531
|
-
},
|
|
532
|
-
backgroundPadding: {
|
|
533
|
-
"!doc": "Background rectangle padding, default is 0.3.",
|
|
534
|
-
"!type": "number"
|
|
535
|
-
},
|
|
536
|
-
align: {
|
|
537
|
-
"!doc": "Text align, either center, left, or right. Default is center.",
|
|
538
|
-
"!type": "string"
|
|
539
|
-
},
|
|
540
|
-
opacity: {
|
|
541
|
-
"!doc": "Opacity value, default is 1.0.",
|
|
542
|
-
"!type": "number"
|
|
543
|
-
}
|
|
544
|
-
},
|
|
545
|
-
MapTextStyle: {
|
|
546
|
-
color: {
|
|
547
|
-
"!doc": "Font color in the following format: #ffffff (hex triplet). Default is #ffffff.",
|
|
548
|
-
"!type": "string"
|
|
549
|
-
},
|
|
550
|
-
fontFamily: {
|
|
551
|
-
"!doc": "The font family, default is sans-serif",
|
|
552
|
-
"!type": "string"
|
|
553
|
-
},
|
|
554
|
-
fontSize: {
|
|
555
|
-
"!doc": "The font size in game coordinates, default is 10",
|
|
556
|
-
"!type": "number"
|
|
557
|
-
},
|
|
558
|
-
fontStyle: {
|
|
559
|
-
"!doc": "The font style ('normal', 'italic' or 'oblique')",
|
|
560
|
-
"!type": "string"
|
|
561
|
-
},
|
|
562
|
-
fontVariant: {
|
|
563
|
-
"!doc": "The font variant ('normal' or 'small-caps')",
|
|
564
|
-
"!type": "string"
|
|
565
|
-
},
|
|
566
|
-
stroke: {
|
|
567
|
-
"!doc": "Stroke color in the following format: #ffffff (hex triplet). Default is undefined (no stroke).",
|
|
568
|
-
"!type": "string"
|
|
569
|
-
},
|
|
570
|
-
strokeWidth: {
|
|
571
|
-
"!doc": "Stroke line width, default is 0.15.",
|
|
572
|
-
"!type": "number"
|
|
573
|
-
},
|
|
574
|
-
backgroundColor: {
|
|
575
|
-
"!doc": "Background color in the following format: #ffffff (hex triplet). Default is undefined (no background). When background is enabled, text vertical align is set to middle (default is baseline).",
|
|
576
|
-
"!type": "string"
|
|
577
|
-
},
|
|
578
|
-
backgroundPadding: {
|
|
579
|
-
"!doc": "Background rectangle padding, default is 2.",
|
|
580
|
-
"!type": "number"
|
|
581
|
-
},
|
|
582
|
-
align: {
|
|
583
|
-
"!doc": "Text align, either center, left, or right. Default is center.",
|
|
584
|
-
"!type": "string"
|
|
585
|
-
},
|
|
586
|
-
opacity: {
|
|
587
|
-
"!doc": "Opacity value, default is 0.5.",
|
|
588
|
-
"!type": "number"
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
},
|
|
592
|
-
RoomObject: {
|
|
593
|
-
"!type": "fn()",
|
|
594
|
-
"!doc": "Any object with a position in a room. Almost all game objects prototypes are derived from RoomObject.",
|
|
595
|
-
prototype: {
|
|
596
|
-
pos: {
|
|
597
|
-
"!doc": "An object representing the position of this object in a room.",
|
|
598
|
-
"!type": "+RoomPosition"
|
|
599
|
-
},
|
|
600
|
-
room: {
|
|
601
|
-
"!doc": "The link to the Room object of this object. May be undefined in case if an object is a flag and is placed in a room that is not visible to you.",
|
|
602
|
-
"!type": "+Room"
|
|
603
|
-
},
|
|
604
|
-
effects: {
|
|
605
|
-
"!doc": "Applied effects, an array of objects.",
|
|
606
|
-
"!type": "[Effect]"
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
},
|
|
610
|
-
Store: {
|
|
611
|
-
"!type": "fn()",
|
|
612
|
-
"!doc": "An object that can contain resources in its cargo.",
|
|
613
|
-
prototype: {
|
|
614
|
-
getCapacity: {
|
|
615
|
-
"!doc": "Returns capacity of this store for the specified resource, or total capacity if resource is undefined.\n\nReturns capacity number, or null in case of a not valid resource for this store type.\n\nArguments:\n* resource (optional) - The type of the resource.",
|
|
616
|
-
"!type": "fn(resource?: string) -> number"
|
|
617
|
-
},
|
|
618
|
-
getFreeCapacity: {
|
|
619
|
-
"!doc": "A shorthand for getCapacity(resource) - getUsedCapacity(resource).\n\nArguments:\n* resource (optional) - The type of the resource.",
|
|
620
|
-
"!type": "fn(resource?: string) -> number"
|
|
621
|
-
},
|
|
622
|
-
getUsedCapacity: {
|
|
623
|
-
"!doc": "Returns the capacity used by the specified resource, or total used capacity for general purpose stores if resource is undefined.\n\nReturns used capacity number, or null in case of a not valid resource for this store type.\n\nArguments:\n* resource (optional) - The type of the resource.",
|
|
624
|
-
"!type": "fn(resource?: string) -> number"
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
_extend(def_screeps, {
|
|
630
|
-
Structure: {
|
|
631
|
-
"!type": "fn()",
|
|
632
|
-
"!doc": "Creeps are your units. Creeps can move, harvest energy, construct structures, attack another creeps, and perform other actions.",
|
|
633
|
-
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
634
|
-
id: {
|
|
635
|
-
"!type": "string",
|
|
636
|
-
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
637
|
-
},
|
|
638
|
-
hits: {
|
|
639
|
-
"!doc": "The current amount of hit points of the structure.",
|
|
640
|
-
"!type": "number"
|
|
641
|
-
},
|
|
642
|
-
hitsMax: {
|
|
643
|
-
"!doc": "The total amount of hit points of the structure.",
|
|
644
|
-
"!type": "number"
|
|
645
|
-
},
|
|
646
|
-
structureType: {
|
|
647
|
-
"!doc": "One of the STRUCTURE_* constants.",
|
|
648
|
-
"!type": "string"
|
|
649
|
-
},
|
|
650
|
-
destroy: {
|
|
651
|
-
"!doc": "Destroy this structure immediately. You are not allowed to destroy a structure when there are hostile creeps in the room.\n\nCPU cost: CONST",
|
|
652
|
-
"!type": "fn() -> number"
|
|
653
|
-
},
|
|
654
|
-
notifyWhenAttacked: {
|
|
655
|
-
"!doc": "Toggle auto notification when the structure is under attack. The notification will be sent to your account email. Turned on by default.\n\nArguments:\n* enabled - Whether to enable notification or disable.\n\nCPU cost: CONST",
|
|
656
|
-
"!type": "fn(enabled: bool) -> number"
|
|
657
|
-
},
|
|
658
|
-
isActive: {
|
|
659
|
-
"!doc": "Check whether this structure can be used. If the room controller level is not enough, then this method will return false, and the structure will be highlighted with red in the game.\n\nCPU cost: LOW",
|
|
660
|
-
"!type": "fn() -> bool"
|
|
661
|
-
},
|
|
662
|
-
|
|
663
|
-
})
|
|
664
|
-
},
|
|
665
|
-
});
|
|
666
|
-
|
|
667
|
-
_extend(def_screeps, {
|
|
668
|
-
OwnedStructure: {
|
|
669
|
-
"!type": "fn()",
|
|
670
|
-
"!doc": "The base prototype for a structure that has an owner. Such structures can be found using FIND_MY_STRUCTURES and FIND_HOSTILE_STRUCTURES constants.",
|
|
671
|
-
prototype: _extend({}, def_screeps.Structure.prototype, {
|
|
672
|
-
my: {
|
|
673
|
-
"!type": "bool",
|
|
674
|
-
"!doc": "Whether it is your own structure."
|
|
675
|
-
},
|
|
676
|
-
owner: {
|
|
677
|
-
"!": "An object with the owner info",
|
|
678
|
-
username: {
|
|
679
|
-
"!doc": "The name of the owner user.",
|
|
680
|
-
"!type": "string"
|
|
681
|
-
}
|
|
682
|
-
},
|
|
683
|
-
})
|
|
684
|
-
},
|
|
685
|
-
});
|
|
686
|
-
|
|
687
|
-
_extend(def_screeps, {
|
|
688
|
-
ConstructionSite: {
|
|
689
|
-
"!type": "fn()",
|
|
690
|
-
"!doc": "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() method. Construction sites are visible to their owners only.\n\nTo build a structure on the construction site, give a worker creep some amount of energy and perform Creep.build() action.",
|
|
691
|
-
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
692
|
-
id: {
|
|
693
|
-
"!type": "string",
|
|
694
|
-
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
695
|
-
},
|
|
696
|
-
my: {
|
|
697
|
-
"!type": "bool",
|
|
698
|
-
"!doc": "Whether it is your own construction site."
|
|
699
|
-
},
|
|
700
|
-
owner: {
|
|
701
|
-
"!doc": "An object with the owner info",
|
|
702
|
-
username: {
|
|
703
|
-
"!doc": "The name of the owner user.",
|
|
704
|
-
"!type": "string"
|
|
705
|
-
}
|
|
706
|
-
},
|
|
707
|
-
progress: {
|
|
708
|
-
"!doc": "The current construction progress.",
|
|
709
|
-
"!type": "number"
|
|
710
|
-
},
|
|
711
|
-
progressTotal: {
|
|
712
|
-
"!doc": "The total construction progress needed for the structure to be built.",
|
|
713
|
-
"!type": "number"
|
|
714
|
-
},
|
|
715
|
-
structureType: {
|
|
716
|
-
"!doc": "One of the STRUCTURE_* constants.",
|
|
717
|
-
"!type": "string"
|
|
718
|
-
},
|
|
719
|
-
remove: {
|
|
720
|
-
"!doc": "Remove the construction site.\n\nCPU cost: CONST",
|
|
721
|
-
"!type": "fn() -> number"
|
|
722
|
-
}
|
|
723
|
-
})
|
|
724
|
-
},
|
|
725
|
-
Creep: {
|
|
726
|
-
"!type": "fn()",
|
|
727
|
-
"!doc": "Creeps are your units. Creeps can move, harvest energy, construct structures, attack another creeps, and perform other actions.",
|
|
728
|
-
prototype: _extend({}, _docs.store, def_screeps.RoomObject.prototype, {
|
|
729
|
-
body: {
|
|
730
|
-
"!doc": "An array describing the creep’s body.",
|
|
731
|
-
"!type": "[BodyPart]",
|
|
732
|
-
"!url": "http://docs.screeps.com/api/#Creep.body"
|
|
733
|
-
},
|
|
734
|
-
fatigue: {
|
|
735
|
-
"!type": "number",
|
|
736
|
-
"!doc": "The movement fatigue indicator. If it is greater than zero, the creep cannot move.",
|
|
737
|
-
},
|
|
738
|
-
hits: {
|
|
739
|
-
"!type": "number",
|
|
740
|
-
"!doc": "The current amount of hit points of the creep.",
|
|
741
|
-
},
|
|
742
|
-
hitsMax: {
|
|
743
|
-
"!type": "number",
|
|
744
|
-
"!doc": "The maximum amount of hit points of the creep.",
|
|
745
|
-
},
|
|
746
|
-
id: {
|
|
747
|
-
"!type": "string",
|
|
748
|
-
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
749
|
-
},
|
|
750
|
-
memory: {
|
|
751
|
-
"!doc": "A shorthand to `Memory.creeps[creep.name]`. You can use it for quick access the creep’s specific memory data object.",
|
|
752
|
-
},
|
|
753
|
-
my: {
|
|
754
|
-
"!type": "bool",
|
|
755
|
-
"!doc": "Whether it is your creep or foe."
|
|
756
|
-
},
|
|
757
|
-
name: {
|
|
758
|
-
"!doc": "Creep's name. You can choose the name while creating a new creep, and it cannot be changed later. This name is a hash key to access the creep via the `Game.creeps` object.",
|
|
759
|
-
"!type": "string"
|
|
760
|
-
},
|
|
761
|
-
owner: {
|
|
762
|
-
"!doc": "An object with the owner info",
|
|
763
|
-
username: {
|
|
764
|
-
"!doc": "The name of the owner user.",
|
|
765
|
-
"!type": "string"
|
|
766
|
-
}
|
|
767
|
-
},
|
|
768
|
-
spawning: {
|
|
769
|
-
"!doc": "Whether this creep is still being spawned.",
|
|
770
|
-
"!type": "bool"
|
|
771
|
-
},
|
|
772
|
-
ticksToLive: {
|
|
773
|
-
"!doc": "The remaining amount of game ticks after which the creep will die.",
|
|
774
|
-
"!type": "number"
|
|
775
|
-
},
|
|
776
|
-
attack: {
|
|
777
|
-
"!type": "fn(target: object) -> number",
|
|
778
|
-
"!doc": "Attack another creep or structure in a short-ranged attack. Requires the ATTACK body part. If the target is inside a rampart, then the rampart is attacked instead. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target object to be attacked.\n\nCPU cost: CONST"
|
|
779
|
-
},
|
|
780
|
-
build: {
|
|
781
|
-
"!doc": "Build a structure at the target construction site using carried energy. Requires WORK and CARRY body parts. The target has to be within 3 squares range of the creep.\n\nArguments:\n* target - The target construction site to be built.\n\nCPU cost:CONST",
|
|
782
|
-
"!type": "fn(target: +ConstructionSite) -> number"
|
|
783
|
-
},
|
|
784
|
-
cancelOrder: {
|
|
785
|
-
"!doc": "Cancel the order given during the current game tick.\n\nArguments:\n* methodName - The name of a creep's method to be cancelled.\n\nCPU cost:NONE",
|
|
786
|
-
"!type": "fn(methodName: string) -> number"
|
|
787
|
-
},
|
|
788
|
-
claimController: {
|
|
789
|
-
"!doc": "Claims a neutral controller under your control. Requires the CLAIM body part. \n\nArguments:\n* target - The target controller object.\n\nCPU cost: CONST",
|
|
790
|
-
"!type": "fn(target: +Structure) -> number"
|
|
791
|
-
},
|
|
792
|
-
attackController: {
|
|
793
|
-
"!doc": "Decreases the controller's downgrade or reservation timer for 1 tick per every 5 CLAIM body parts (so the creep must have at least 5xCLAIM). The controller under attack cannot be upgraded for the next 1,000 ticks. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target controller object.\n\nCPU cost: CONST",
|
|
794
|
-
"!type": "fn(target: +Structure) -> number"
|
|
795
|
-
},
|
|
796
|
-
getActiveBodyparts: {
|
|
797
|
-
"!doc": "Get the quantity of live body parts of the given type. Fully damaged parts do not count.\n\nArguments:\n* type - A body part type, one of the body part constants.\n\nCPU cost: NONE",
|
|
798
|
-
"!type": "fn(type: string) -> number"
|
|
799
|
-
},
|
|
800
|
-
harvest: {
|
|
801
|
-
"!doc": "Harvest energy from the source. Requires the WORK body part. If the creep has an empty CARRY body part, the harvested energy is put into it; otherwise it is dropped on the ground. The target has to be at an adjacent square to the creep. You cannot harvest a source if the room controller is owned or reserved by another player.\n\nArguments:\n* target - The source object to be harvested.\n\nCPU cost: CONST",
|
|
802
|
-
"!type": "fn(target: +Source) -> number"
|
|
803
|
-
},
|
|
804
|
-
heal: {
|
|
805
|
-
"!doc": "Heal self or another creep. It will restore the target creep’s damaged body parts function and increase the hits counter. Requires the HEAL body part. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target creep object.\n\nCPU cost: CONST",
|
|
806
|
-
"!type": "fn(target: +Creep) -> number"
|
|
807
|
-
},
|
|
808
|
-
move: {
|
|
809
|
-
"!doc": "Move the creep one square in the specified direction. Requires the MOVE body part.\n\nArguments:\n* direction - One of the direction constants.\n\nCPU cost: CONST",
|
|
810
|
-
"!type": "fn(direction: number) -> number"
|
|
811
|
-
},
|
|
812
|
-
moveByPath: {
|
|
813
|
-
"!doc": "Move the creep using the specified predefined path. Requires the MOVE body part.\n\nArguments:\n* path - A path value as returned from `Room.findPath`, `RoomPosition.findPathTo`, or `PathFinder.search` methods. Both array form and serialized string form are accepted.\n\nCPU cost: CONST",
|
|
814
|
-
"!type": "fn(path: Path) -> number"
|
|
815
|
-
},
|
|
816
|
-
moveTo: {
|
|
817
|
-
"!doc": "Syntax:\nmoveTo(x, y, [opts])\nmoveTo(target, [opts])\n\nFind the optimal path to the target within the same room and move to it. A shorthand to consequent calls of pos.findPathTo() and move() methods. If the target is in another room, then the corresponding exit will be used as a target. Requires the MOVE body part.\n\nArguments:\n* x - X position of the target in the same room.\n* y - Y position of the target in the same room.\n* target - Can be a RoomPosition object or any object containing RoomPosition. The position doesn't have to be in the same room.\n* opts (optional) - An object containing pathfinding options flags (see Room.findPath for more info) or one of the following:\n - reusePath - This option enables reusing the path found along multiple game ticks. It allows to save CPU time, but can result in a slightly slower creep reaction behavior. The path is stored into the creep's memory to the _move property. The reusePath value defines the amount of ticks which the path should be reused for. The default value is 5. Increase the amount to save more CPU, decrease to make the movement more consistent. Set to 0 if you want to disable path reusing.\n - serializeMemory - If reusePath is enabled and this option is set to true, the path will be stored in memory in the short serialized form using Room.serializePath. The default value is true.\n - noPathFinding - If this option is set to true, moveTo method will return ERR_NOT_FOUND if there is no memorized path to reuse. This can significantly save CPU time in some cases. The default value is false.\n - visualizePathStyle - draw a line along the creep’s path using RoomVisual.poly. You can provide either an empty object or custom style parameters.\n\nCPU cost: HIGH",
|
|
818
|
-
"!type": "fn(arg1: ?, arg2?: ?, arg3?: ?) -> number"
|
|
819
|
-
},
|
|
820
|
-
notifyWhenAttacked: {
|
|
821
|
-
"!doc": "Toggle auto notification when the creep is under attack. The notification will be sent to your account email. Turned on by default.\n\nArguments:\n* enabled - Whether to enable notification or disable.\n\nCPU cost: CONST",
|
|
822
|
-
"!type": "fn(enabled: bool) -> number"
|
|
823
|
-
},
|
|
824
|
-
pickup: {
|
|
825
|
-
"!doc": "Pick up an item (a dropped piece of energy). Requires the CARRY body part. The target has to be at adjacent square to the creep or at the same square.\n\nArguments:\n* target - The target object to be picked up.\n\nCPU cost: CONST",
|
|
826
|
-
"!type": "fn(target: +Resource) -> number"
|
|
827
|
-
},
|
|
828
|
-
rangedAttack: {
|
|
829
|
-
"!doc": "A ranged attack against another creep or structure. Requires the RANGED_ATTACK body part. If the target is inside a rampart, the rampart is attacked instead. The target has to be within 3 squares range of the creep.\n\nArguments:\n* target - The target object to be attacked.\n\nCPU cost: CONST",
|
|
830
|
-
"!type": "fn(target: object) -> number"
|
|
831
|
-
},
|
|
832
|
-
rangedHeal: {
|
|
833
|
-
"!doc": "Heal another creep at a distance. It will restore the target creep’s damaged body parts function and increase the hits counter. Requires the HEAL body part. The target has to be within 3 squares range of the creep.\n\nArguments:\n* target - The target creep object.\n\nCPU cost: CONST",
|
|
834
|
-
"!type": "fn(target: +Creep) -> number"
|
|
835
|
-
},
|
|
836
|
-
rangedMassAttack: {
|
|
837
|
-
"!doc": "A ranged attack against all hostile creeps or structures within 3 squares range. Requires the RANGED_ATTACK body part. The attack power depends on the range to each target. Friendly units are not affected.\n\nCPU cost: CONST",
|
|
838
|
-
"!type": "fn() -> number"
|
|
839
|
-
},
|
|
840
|
-
repair: {
|
|
841
|
-
"!doc": "Repair a damaged structure using carried energy. Requires the WORK and CARRY body parts. The target has to be within 3 squares range of the creep.\n\nArguments:\n* target - The target structure to be repaired.\n\nCPU cost: CONST",
|
|
842
|
-
"!type": "fn(target: object) -> number"
|
|
843
|
-
},
|
|
844
|
-
reserveController: {
|
|
845
|
-
"!doc": "Temporarily block a neutral controller from claiming by other players. Each tick, this command increases the counter of the period during which the controller is unavailable by 1 tick per each CLAIM body part. The maximum reservation period to maintain is 5,000 ticks. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target controller object to be reserved.\n\nCPU cost: CONST",
|
|
846
|
-
"!type": "fn(target: +StructureController) -> number"
|
|
847
|
-
},
|
|
848
|
-
signController: {
|
|
849
|
-
"!doc": "Sign a controller with a random text visible to all players. This text will appear in the room UI, in the world map, and can be accessed via the API. You can sign unowned and hostile controllers. The target has to be at adjacent square to the creep. Pass an empty string to remove the sign.\n\nArguments:\n* target - The target controller object to be signed.\n* text - The sign text. The maximum text length is 100 characters.\n\nCPU cost: CONST",
|
|
850
|
-
"!type": "fn(target: +StructureController, target: string) -> number"
|
|
851
|
-
},
|
|
852
|
-
say: {
|
|
853
|
-
"!doc": "Display a visual speech balloon above the creep with the specified message. The message will be available for one tick. You can read the last message using the `saying` property.\n\nArguments:\n* message - The message to be displayed. Maximum length is 10 characters.\n* public (optional) - Set to true to allow other players to see this message. Default is false.\n\nCPU cost: NONE",
|
|
854
|
-
"!type": "fn(message: string, public?: boolean) -> number"
|
|
855
|
-
},
|
|
856
|
-
saying: {
|
|
857
|
-
"!doc": "The text message that the creep was saying at the last tick.",
|
|
858
|
-
"!type": "string"
|
|
859
|
-
},
|
|
860
|
-
suicide: {
|
|
861
|
-
"!doc": "Kill the creep immediately.\n\nCPU cost: CONST",
|
|
862
|
-
"!type": "fn() -> number"
|
|
863
|
-
},
|
|
864
|
-
upgradeController: {
|
|
865
|
-
"!doc": "Upgrade your controller to the next level using carried energy. Upgrading controllers raises your Global Control Level in parallel. Requires WORK and CARRY body parts. The target has to be within 3 squares range of the creep. A fully upgraded level 8 controller can't be upgraded with the power over 15 energy units per tick regardless of creeps power. The cumulative effect of all the creeps performing upgradeController in the current tick is taken into account. This limit can be increased by using ghodium mineral boost.\n\nArguments:\n* target - The target controller object to be upgraded.\n\nCPU cost: CONST",
|
|
866
|
-
"!type": "fn(target: +Structure) -> number"
|
|
867
|
-
},
|
|
868
|
-
drop: {
|
|
869
|
-
"!doc": "Drop resource on the ground.\n\nArguments:\n* resourceType - One of the RESOURCE_* constants.\n* amount - The amount of resource units to be dropped.\n\nCPU cost: CONST",
|
|
870
|
-
"!type": "fn(resourceType: string, amount?: number) -> number"
|
|
871
|
-
},
|
|
872
|
-
transfer: {
|
|
873
|
-
"!doc": "Transfer resource from the creep to another creep, storage, or power spawn. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target object.\n* resourceType - One of the RESOURCE_* constants.\n* amount (optional) - The amount of resources to be transferred. If omitted, all the available carried amount is used.\n\nCPU cost: CONST",
|
|
874
|
-
"!type": "fn(target: object, resourceType: string, amount?: number) -> number"
|
|
875
|
-
},
|
|
876
|
-
dismantle: {
|
|
877
|
-
"!type": "fn(target: +Structure) -> number",
|
|
878
|
-
"!doc": "Dismantles any (even hostile) structure returning 50% of the energy spent on its repair. Requires the WORK body part. If the creep has an empty CARRY body part, the energy is put into it; otherwise it is dropped on the ground. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target structure.\n\nCPU cost: CONST"
|
|
879
|
-
},
|
|
880
|
-
withdraw: {
|
|
881
|
-
"!doc": "Withdraw resources from a structure. The target has to be at adjacent square to the creep. Multiple creeps can withdraw from the same structure in the same tick. Your creeps can withdraw resources from hostile structures as well, in case if there is no hostile rampart on top of it.\n\nArguments:\n* target - The target object.\n* resourceType - One of the RESOURCE_* constants.\n* amount (optional) - The amount of resources to be transferred. If omitted, all the available amount is used.\n\nCPU cost: CONST",
|
|
882
|
-
"!type": "fn(target: +Structure, resourceType: string, amount?: number) -> number"
|
|
883
|
-
},
|
|
884
|
-
generateSafeMode: {
|
|
885
|
-
"!doc": "Add one more available safe mode activation to a room controller. The creep has to be at adjacent square to the target room controller and have 1000 ghodium resource.\n\nArguments:\n* target - The target room controller.\n\nCPU cost: CONST",
|
|
886
|
-
"!type": "fn(target: +StructureController) -> number"
|
|
887
|
-
}
|
|
888
|
-
})
|
|
889
|
-
},
|
|
890
|
-
PowerCreep: {
|
|
891
|
-
"!type": "fn()",
|
|
892
|
-
"!doc": "Power Creeps are immortal \"heroes\" that are tied to your account and can be respawned in any PowerSpawn after death.",
|
|
893
|
-
prototype: _extend({}, _docs.store, def_screeps.RoomObject.prototype, {
|
|
894
|
-
cancelOrder: {
|
|
895
|
-
"!doc": "Cancel the order given during the current game tick.\n\nArguments:\n* methodName - The name of a power creep's method to be cancelled.\n\nCPU cost:NONE",
|
|
896
|
-
"!type": "fn(methodName: string) -> number"
|
|
897
|
-
},
|
|
898
|
-
className: {
|
|
899
|
-
"!type": "string",
|
|
900
|
-
"!doc": "The power creep's class, one of the POWER_CLASS constants."
|
|
901
|
-
},
|
|
902
|
-
delete: {
|
|
903
|
-
"!doc": "Delete the power creep permanently from your account. It should NOT be spawned in the world. The creep is not deleted immediately, but a 24-hours delete timer is started instead (see deleteTime). You can cancel deletion by calling delete(true).",
|
|
904
|
-
"!type": "fn(cancel?: boolean) -> number"
|
|
905
|
-
},
|
|
906
|
-
deleteTime: {
|
|
907
|
-
"!type": "number",
|
|
908
|
-
"!doc": "A timestamp when this creep is marked to be permanently deleted from the account, or undefined otherwise.",
|
|
909
|
-
},
|
|
910
|
-
drop: {
|
|
911
|
-
"!doc": "Drop resource on the ground.\n\nArguments:\n* resourceType - One of the RESOURCE_* constants.\n* amount - The amount of resource units to be dropped.\n\nCPU cost: CONST",
|
|
912
|
-
"!type": "fn(resourceType: string, amount?: number) -> number"
|
|
913
|
-
},
|
|
914
|
-
enableRoom: {
|
|
915
|
-
"!doc": "Enable powers usage in this room.\n\nArguments:\n* controller - The room controller.\n\nCPU cost: CONST",
|
|
916
|
-
"!type": "fn(controller: +StructureController) -> number"
|
|
917
|
-
},
|
|
918
|
-
hits: {
|
|
919
|
-
"!type": "number",
|
|
920
|
-
"!doc": "The current amount of hit points of the power creep.",
|
|
921
|
-
},
|
|
922
|
-
hitsMax: {
|
|
923
|
-
"!type": "number",
|
|
924
|
-
"!doc": "The maximum amount of hit points of the power creep.",
|
|
925
|
-
},
|
|
926
|
-
id: {
|
|
927
|
-
"!type": "string",
|
|
928
|
-
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
929
|
-
},
|
|
930
|
-
level: {
|
|
931
|
-
"!type": "number",
|
|
932
|
-
"!doc": "The power creep's level.",
|
|
933
|
-
},
|
|
934
|
-
memory: {
|
|
935
|
-
"!doc": "A shorthand to `Memory.powerCreeps[creep.name]`. You can use it for quick access the power creep’s specific memory data object.",
|
|
936
|
-
},
|
|
937
|
-
move: {
|
|
938
|
-
"!doc": "Move the power creep one square in the specified direction.\n\nArguments:\n* direction - One of the direction constants.\n\nCPU cost: CONST",
|
|
939
|
-
"!type": "fn(direction: number) -> number"
|
|
940
|
-
},
|
|
941
|
-
moveByPath: {
|
|
942
|
-
"!doc": "Move the power creep using the specified predefined path.\n\nArguments:\n* path - A path value as returned from `Room.findPath`, `RoomPosition.findPathTo`, or `PathFinder.search` methods. Both array form and serialized string form are accepted.\n\nCPU cost: CONST",
|
|
943
|
-
"!type": "fn(path: Path) -> number"
|
|
944
|
-
},
|
|
945
|
-
moveTo: {
|
|
946
|
-
"!doc": "Syntax:\nmoveTo(x, y, [opts])\nmoveTo(target, [opts])\n\nFind the optimal path to the target within the same room and move to it.\n\nArguments:\n* x - X position of the target in the same room.\n* y - Y position of the target in the same room.\n* target - Can be a RoomPosition object or any object containing RoomPosition. The position doesn't have to be in the same room.\n* opts (optional) - An object containing pathfinding options flags (see Room.findPath for more info) or one of the following:\n - reusePath - This option enables reusing the path found along multiple game ticks. It allows to save CPU time, but can result in a slightly slower creep reaction behavior. The path is stored into the creep's memory to the _move property. The reusePath value defines the amount of ticks which the path should be reused for. The default value is 5. Increase the amount to save more CPU, decrease to make the movement more consistent. Set to 0 if you want to disable path reusing.\n - serializeMemory - If reusePath is enabled and this option is set to true, the path will be stored in memory in the short serialized form using Room.serializePath. The default value is true.\n - noPathFinding - If this option is set to true, moveTo method will return ERR_NOT_FOUND if there is no memorized path to reuse. This can significantly save CPU time in some cases. The default value is false.\n - visualizePathStyle - draw a line along the creep’s path using RoomVisual.poly. You can provide either an empty object or custom style parameters.\n\nCPU cost: HIGH",
|
|
947
|
-
"!type": "fn(arg1: ?, arg2?: ?, arg3?: ?) -> number"
|
|
948
|
-
},
|
|
949
|
-
my: {
|
|
950
|
-
"!type": "bool",
|
|
951
|
-
"!doc": "Whether it is your power creep or foe."
|
|
952
|
-
},
|
|
953
|
-
name: {
|
|
954
|
-
"!doc": "Power creep's name. You can choose the name while creating a new power creep, and it cannot be changed later. This name is a hash key to access the creep via the `Game.powerCreeps` object.",
|
|
955
|
-
"!type": "string"
|
|
956
|
-
},
|
|
957
|
-
notifyWhenAttacked: {
|
|
958
|
-
"!doc": "Toggle auto notification when the power creep is under attack. The notification will be sent to your account email. Turned on by default.\n\nArguments:\n* enabled - Whether to enable notification or disable.\n\nCPU cost: CONST",
|
|
959
|
-
"!type": "fn(enabled: bool) -> number"
|
|
960
|
-
},
|
|
961
|
-
owner: {
|
|
962
|
-
"!doc": "An object with the owner info",
|
|
963
|
-
username: {
|
|
964
|
-
"!doc": "The name of the owner user.",
|
|
965
|
-
"!type": "string"
|
|
966
|
-
}
|
|
967
|
-
},
|
|
968
|
-
pickup: {
|
|
969
|
-
"!doc": "Pick up an item (a dropped piece of energy). The target has to be at adjacent square to the creep or at the same square.\n\nArguments:\n* target - The target object to be picked up.\n\nCPU cost: CONST",
|
|
970
|
-
"!type": "fn(target: +Resource) -> number"
|
|
971
|
-
},
|
|
972
|
-
rename: {
|
|
973
|
-
"!doc": "Rename the power creep. It must not be spawned in the world.\n\nArguments:\n* name - The new name of the power creep.\n\nCPU cost: NONE",
|
|
974
|
-
"!type": "fn(name: string) -> number"
|
|
975
|
-
},
|
|
976
|
-
renew: {
|
|
977
|
-
"!doc": "Instantly restore time to live to the maximum using a Power Spawn or a Power Bank nearby.\n\nArguments:\n* target - The target structure\n\nCPU cost: CONST",
|
|
978
|
-
"!type": "fn(target: object) -> number"
|
|
979
|
-
},
|
|
980
|
-
powers: {
|
|
981
|
-
"!doc": "Available powers, an object with power ID as a key",
|
|
982
|
-
"!type": "[+Power]"
|
|
983
|
-
},
|
|
984
|
-
say: {
|
|
985
|
-
"!doc": "Display a visual speech balloon above the power creep with the specified message. The message will be available for one tick. You can read the last message using the `saying` property.\n\nArguments:\n* message - The message to be displayed. Maximum length is 10 characters.\n* public (optional) - Set to true to allow other players to see this message. Default is false.\n\nCPU cost: NONE",
|
|
986
|
-
"!type": "fn(message: string, public?: boolean) -> number"
|
|
987
|
-
},
|
|
988
|
-
saying: {
|
|
989
|
-
"!doc": "The text message that the power creep was saying at the last tick.",
|
|
990
|
-
"!type": "string"
|
|
991
|
-
},
|
|
992
|
-
shard: {
|
|
993
|
-
"!doc": "The name of the shard where the power creep is spawned, or undefined.",
|
|
994
|
-
"!type": "string"
|
|
995
|
-
},
|
|
996
|
-
spawn: {
|
|
997
|
-
"!doc": "Spawn this power creep in the specified Power Spawn.\n\nArguments:\n* powerSpawn - Your Power Spawn structure.\n\nCPU cost: CONST",
|
|
998
|
-
"!type": "fn(powerSpawn: +StructurePowerSpawn) -> number"
|
|
999
|
-
},
|
|
1000
|
-
spawnCooldownTime: {
|
|
1001
|
-
"!doc": "The timestamp when spawning or deleting this creep will become available. Undefined if the power creep is spawned in the world.",
|
|
1002
|
-
"!type": "number"
|
|
1003
|
-
},
|
|
1004
|
-
suicide: {
|
|
1005
|
-
"!doc": "Kill the power creep immediately. It will not be destroyed permanently, but will become unspawned, so that you can spawn it again.\n\nCPU cost: CONST",
|
|
1006
|
-
"!type": "fn() -> number"
|
|
1007
|
-
},
|
|
1008
|
-
ticksToLive: {
|
|
1009
|
-
"!doc": "The remaining amount of game ticks after which the creep will die and become unspawned. Undefined if the creep is not spawned in the world.",
|
|
1010
|
-
"!type": "number"
|
|
1011
|
-
},
|
|
1012
|
-
transfer: {
|
|
1013
|
-
"!doc": "Transfer resource from the power creep to another power creep, creep, or structure. The target has to be at adjacent square to the power creep.\n\nArguments:\n* target - The target object.\n* resourceType - One of the RESOURCE_* constants.\n* amount (optional) - The amount of resources to be transferred. If omitted, all the available carried amount is used.\n\nCPU cost: CONST",
|
|
1014
|
-
"!type": "fn(target: object, resourceType: string, amount?: number) -> number"
|
|
1015
|
-
},
|
|
1016
|
-
upgrade: {
|
|
1017
|
-
"!doc": "Upgrade the creep, adding a new power ability to it or increasing level of the existing power. You need one free Power Level in your account to perform this action.\n\nArguments:\n* power - The power ability to upgrade, one of the PWR_* constants.\n\nCPU cost: CONST",
|
|
1018
|
-
"!type": "fn(power: number) -> number"
|
|
1019
|
-
},
|
|
1020
|
-
usePower: {
|
|
1021
|
-
"!doc": "Apply one the creep's powers on the specified target. You can only use powers in rooms either without a controller, or with a power-enabled controller. Only one power can be used during the same tick, each usePower call will override the previous one. If the target has the same effect of a lower or equal level, it is overridden. If the existing effect level is higher, an error is returned.\n\nArguments:\n* power - The power ability to use, one of the PWR_* constants.\n* target - A target object in the room.\n\nCPU cost: CONST",
|
|
1022
|
-
"!type": "fn(power: number, target?: +RoomObject) -> number"
|
|
1023
|
-
},
|
|
1024
|
-
withdraw: {
|
|
1025
|
-
"!doc": "Withdraw resources from a structure, tombstone, or ruin. The target has to be at adjacent square to the power creep. Your power creeps can withdraw resources from hostile structures as well, in case if there is no hostile rampart on top of it.\n\nArguments:\n* target - The target object.\n* resourceType - One of the RESOURCE_* constants.\n* amount (optional) - The amount of resources to be transferred. If omitted, all the available amount is used.\n\nCPU cost: CONST",
|
|
1026
|
-
"!type": "fn(target: +Structure, resourceType: string, amount?: number) -> number"
|
|
1027
|
-
},
|
|
1028
|
-
}),
|
|
1029
|
-
create: {
|
|
1030
|
-
"!doc": "A static method to create new Power Creep instance in your account. It will be added in an unspawned state, use spawn method to spawn it in the world.\nYou need one free Power Level in your account to perform this action.\n\nArguments:\n* name - The name of the new power creep.\n* className - The class of the new power creep, one of the POWER_CLASS constants.\n\nCPU cost: CONST",
|
|
1031
|
-
"!type": "fn(name: string, className: string) -> number"
|
|
1032
|
-
}
|
|
1033
|
-
},
|
|
1034
|
-
Resource: {
|
|
1035
|
-
"!type": "fn()",
|
|
1036
|
-
"!doc": "A dropped pile of resource units, either energy or power. Dropped energy pile decays for `ceil(amount/1000)` units per tick if not picked up.",
|
|
1037
|
-
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
1038
|
-
id: {
|
|
1039
|
-
"!type": "string",
|
|
1040
|
-
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
1041
|
-
},
|
|
1042
|
-
amount: {
|
|
1043
|
-
"!doc": "The amount of resource units containing.",
|
|
1044
|
-
"!type": "number"
|
|
1045
|
-
},
|
|
1046
|
-
resourceType: {
|
|
1047
|
-
"!doc": "One of the RESOURCE_* constants.",
|
|
1048
|
-
"!type": "string"
|
|
1049
|
-
}
|
|
1050
|
-
})
|
|
1051
|
-
},
|
|
1052
|
-
Flag: {
|
|
1053
|
-
"!type": "fn()",
|
|
1054
|
-
"!doc": "A flag. Flags can be used to mark particular spots in a room. Flags are visible to their owners only.",
|
|
1055
|
-
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
1056
|
-
color: {
|
|
1057
|
-
"!doc": "Primary color of the flag. One of the COLOR_* constants.",
|
|
1058
|
-
"!type": "string"
|
|
1059
|
-
},
|
|
1060
|
-
secondaryColor: {
|
|
1061
|
-
"!doc": "Secondary color of the flag. One of the COLOR_* constants.",
|
|
1062
|
-
"!type": "string"
|
|
1063
|
-
},
|
|
1064
|
-
memory: {
|
|
1065
|
-
"!doc": "A shorthand to Memory.flags[flag.name]. You can use it for quick access the flag's specific memory data object."
|
|
1066
|
-
},
|
|
1067
|
-
name: {
|
|
1068
|
-
"!doc": "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 spawn via the Game.flags object.",
|
|
1069
|
-
"!type": "string"
|
|
1070
|
-
},
|
|
1071
|
-
remove: {
|
|
1072
|
-
"!doc": "Remove the flag.\n\nCPU cost: CONST",
|
|
1073
|
-
"!type": "fn() -> number"
|
|
1074
|
-
},
|
|
1075
|
-
setColor: {
|
|
1076
|
-
"!doc": "Set new color of the flag\n\nArguments:\n* color - One of the COLOR_* constants\n* secondaryColor (optional) - One of the COLOR_* constants.\n\nCPU cost: CONST",
|
|
1077
|
-
"!type": "fn(color: string, secondaryColor: string) -> number"
|
|
1078
|
-
},
|
|
1079
|
-
setPosition: {
|
|
1080
|
-
"!doc": "Syntax:\nsetPosition(x,y)\nsetPosition(pos)\n\nSet new position of the flag.\n\nArguments:\n* x - The X position in the room.\n* y - The Y position in the room.\n* pos - Can be a RoomPosition object or any object containing RoomPosition.\n\nCPU cost: CONST",
|
|
1081
|
-
"!type": "fn(arg1: ?, arg2?: ?) -> number"
|
|
1082
|
-
}
|
|
1083
|
-
})
|
|
1084
|
-
},
|
|
1085
|
-
Source: {
|
|
1086
|
-
"!type": "fn()",
|
|
1087
|
-
"!doc": "An energy source object. Can be harvested by creeps with a WORK body part.",
|
|
1088
|
-
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
1089
|
-
id: {
|
|
1090
|
-
"!type": "string",
|
|
1091
|
-
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
1092
|
-
},
|
|
1093
|
-
energy: {
|
|
1094
|
-
"!doc": "The remaining amount of energy.",
|
|
1095
|
-
"!type": "number"
|
|
1096
|
-
},
|
|
1097
|
-
energyCapacity: {
|
|
1098
|
-
"!doc": "The total amount of energy in the source. Equals to 3000 in most cases.",
|
|
1099
|
-
"!type": "number"
|
|
1100
|
-
},
|
|
1101
|
-
ticksToRegeneration: {
|
|
1102
|
-
"!doc": "The remaining time after which the source will be refilled.",
|
|
1103
|
-
"!type": "number"
|
|
1104
|
-
}
|
|
1105
|
-
})
|
|
1106
|
-
},
|
|
1107
|
-
Mineral: {
|
|
1108
|
-
"!type": "fn()",
|
|
1109
|
-
"!doc": "A mineral deposit object. Can be harvested by creeps with a WORK body part using the extractor structure.",
|
|
1110
|
-
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
1111
|
-
id: {
|
|
1112
|
-
"!type": "string",
|
|
1113
|
-
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
1114
|
-
},
|
|
1115
|
-
mineralAmount: {
|
|
1116
|
-
"!doc": "The remaining amount of resource.",
|
|
1117
|
-
"!type": "number"
|
|
1118
|
-
},
|
|
1119
|
-
mineralType: {
|
|
1120
|
-
"!doc": "The resource type, one of the RESOURCE_* constants.",
|
|
1121
|
-
"!type": "string"
|
|
1122
|
-
},
|
|
1123
|
-
ticksToRegeneration: {
|
|
1124
|
-
"!doc": "The remaining time after which the deposit will be refilled.",
|
|
1125
|
-
"!type": "number"
|
|
1126
|
-
},
|
|
1127
|
-
density: {
|
|
1128
|
-
"!doc": "The density of this mineral deposit, one of the DENSITY_* constants.",
|
|
1129
|
-
"!type": "number"
|
|
1130
|
-
}
|
|
1131
|
-
})
|
|
1132
|
-
},
|
|
1133
|
-
Nuke: {
|
|
1134
|
-
"!type": "fn()",
|
|
1135
|
-
"!doc": "",
|
|
1136
|
-
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
1137
|
-
id: {
|
|
1138
|
-
"!type": "string",
|
|
1139
|
-
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
1140
|
-
},
|
|
1141
|
-
launchRoomName: {
|
|
1142
|
-
"!type": "string",
|
|
1143
|
-
"!doc": "The name of the room where this nuke has been launched from.",
|
|
1144
|
-
},
|
|
1145
|
-
timeToLand: {
|
|
1146
|
-
"!type": "number",
|
|
1147
|
-
"!doc": "The remaining landing time.",
|
|
1148
|
-
}
|
|
1149
|
-
})
|
|
1150
|
-
},
|
|
1151
|
-
|
|
1152
|
-
StructureContainer: {
|
|
1153
|
-
"!type": "fn()",
|
|
1154
|
-
"!doc": "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.",
|
|
1155
|
-
prototype: _extend({}, _docs.store, def_screeps.Structure.prototype, {
|
|
1156
|
-
ticksToDecay: {
|
|
1157
|
-
"!doc": "The amount of game ticks when this container will lose some hit points.",
|
|
1158
|
-
"!type": "number"
|
|
1159
|
-
}
|
|
1160
|
-
})
|
|
1161
|
-
},
|
|
1162
|
-
StructureController: {
|
|
1163
|
-
"!type": "fn()",
|
|
1164
|
-
"!doc": "Claim this structure to take control over the room. The controller structure cannot be damaged or destroyed. It can be addressed by Room.controller property.",
|
|
1165
|
-
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1166
|
-
isPowerEnabled: {
|
|
1167
|
-
"!doc": "Whether using power is enabled in this room. Use PowerCreep.enableRoom to turn powers on.",
|
|
1168
|
-
"!type": "number"
|
|
1169
|
-
},
|
|
1170
|
-
level: {
|
|
1171
|
-
"!doc": "Current controller level, from 0 to 8.",
|
|
1172
|
-
"!type": "number"
|
|
1173
|
-
},
|
|
1174
|
-
progress: {
|
|
1175
|
-
"!doc": "The current progress of upgrading the controller to the next level.",
|
|
1176
|
-
"!type": "number"
|
|
1177
|
-
},
|
|
1178
|
-
progressTotal: {
|
|
1179
|
-
"!doc": "The progress needed to reach the next level.",
|
|
1180
|
-
"!type": "number"
|
|
1181
|
-
},
|
|
1182
|
-
reservation: {
|
|
1183
|
-
"!doc": "An object with the controller reservation info if present.",
|
|
1184
|
-
username: {
|
|
1185
|
-
"!doc": "The name of a player who reserved this controller.",
|
|
1186
|
-
"!type": "string"
|
|
1187
|
-
},
|
|
1188
|
-
ticksToEnd: {
|
|
1189
|
-
"!doc": "The amount of game ticks when the reservation will end.",
|
|
1190
|
-
"!type": "number"
|
|
1191
|
-
}
|
|
1192
|
-
},
|
|
1193
|
-
sign: {
|
|
1194
|
-
"!doc": "An object with the controller sign info if present.",
|
|
1195
|
-
username: {
|
|
1196
|
-
"!doc": "The name of a player who signed this controller.",
|
|
1197
|
-
"!type": "string"
|
|
1198
|
-
},
|
|
1199
|
-
text: {
|
|
1200
|
-
"!doc": "The sign text.",
|
|
1201
|
-
"!type": "string"
|
|
1202
|
-
},
|
|
1203
|
-
time: {
|
|
1204
|
-
"!doc": "The sign time in game ticks.",
|
|
1205
|
-
"!type": "number"
|
|
1206
|
-
},
|
|
1207
|
-
datetime: {
|
|
1208
|
-
"!doc": "The sign real date.",
|
|
1209
|
-
"!type": "Date"
|
|
1210
|
-
}
|
|
1211
|
-
},
|
|
1212
|
-
ticksToDowngrade: {
|
|
1213
|
-
"!doc": "The amount of game ticks when this controller will lose one level. This timer can be reset by using Creep.upgradeController.",
|
|
1214
|
-
"!type": "number"
|
|
1215
|
-
},
|
|
1216
|
-
upgradeBlocked: {
|
|
1217
|
-
"!doc": "The amount of game ticks while this controller cannot be upgraded due to attack.",
|
|
1218
|
-
"!type": "number"
|
|
1219
|
-
},
|
|
1220
|
-
unclaim: {
|
|
1221
|
-
"!doc": "Make your claimed controller neutral again.\n\nCPU cost: CONST",
|
|
1222
|
-
"!type": "fn() -> number"
|
|
1223
|
-
},
|
|
1224
|
-
safeMode: {
|
|
1225
|
-
"!doc": "How many ticks of safe mode remaining, or undefined.",
|
|
1226
|
-
"!type": "number"
|
|
1227
|
-
},
|
|
1228
|
-
safeModeAvailable: {
|
|
1229
|
-
"!doc": "Safe mode activations available to use.",
|
|
1230
|
-
"!type": "number"
|
|
1231
|
-
},
|
|
1232
|
-
safeModeCooldown: {
|
|
1233
|
-
"!doc": "During this period in ticks new safe mode activations will be blocked, undefined if cooldown is inactive.",
|
|
1234
|
-
"!type": "number"
|
|
1235
|
-
},
|
|
1236
|
-
activateSafeMode: {
|
|
1237
|
-
"!doc": "Activate safe mode if available.\n\nArguments:\n* \n\nCPU cost: CONST",
|
|
1238
|
-
"!type": "fn() -> number"
|
|
1239
|
-
}
|
|
1240
|
-
})
|
|
1241
|
-
},
|
|
1242
|
-
StructureExtension: {
|
|
1243
|
-
"!type": "fn()",
|
|
1244
|
-
"!doc": "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.",
|
|
1245
|
-
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype)
|
|
1246
|
-
},
|
|
1247
|
-
StructureExtractor: {
|
|
1248
|
-
"!type": "fn()",
|
|
1249
|
-
"!doc": "Allows to harvest a mineral deposit.",
|
|
1250
|
-
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1251
|
-
cooldown: {
|
|
1252
|
-
"!doc": "The amount of game ticks until the next harvest action is possible.",
|
|
1253
|
-
"!type": "number"
|
|
1254
|
-
}
|
|
1255
|
-
})
|
|
1256
|
-
},
|
|
1257
|
-
StructureKeeperLair: {
|
|
1258
|
-
"!type": "fn()",
|
|
1259
|
-
"!doc": "Non-player structure. Spawns NPC Source Keepers that guards energy sources and minerals in some rooms. This structure cannot be destroyed.",
|
|
1260
|
-
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1261
|
-
ticksToSpawn: {
|
|
1262
|
-
"!doc": "Time to spawning of the next Source Keeper.",
|
|
1263
|
-
"!type": "number"
|
|
1264
|
-
},
|
|
1265
|
-
})
|
|
1266
|
-
},
|
|
1267
|
-
StructureLab: {
|
|
1268
|
-
"!type": "fn()",
|
|
1269
|
-
"!doc": "Produces mineral compounds from base minerals and boosts creeps.",
|
|
1270
|
-
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1271
|
-
cooldown: {
|
|
1272
|
-
"!doc": "The amount of game ticks the lab has to wait until the next reaction is possible.",
|
|
1273
|
-
"!type": "number"
|
|
1274
|
-
},
|
|
1275
|
-
mineralType: {
|
|
1276
|
-
"!doc": "The type of minerals containing in the lab. Labs can contain only one mineral type at the same time.",
|
|
1277
|
-
"!type": "number"
|
|
1278
|
-
},
|
|
1279
|
-
boostCreep: {
|
|
1280
|
-
"!doc": "Boosts creep body part using the containing mineral compound. The creep has to be at adjacent square to the lab. Boosting one body part consumes 30 mineral units and 20 energy units.\n\nArguments:\n* creep - The target creep.\n* bodyPartsCount (optional) - The number of body parts of the corresponding type to be boosted. Body parts are always counted left-to-right for TOUGH, and right-to-left for other types. If undefined, all the eligible body parts are boosted.\n\nCPU cost: CONST",
|
|
1281
|
-
"!type": "fn(creep: +Creep, bodyPartsCount?: number) -> number"
|
|
1282
|
-
},
|
|
1283
|
-
runReaction: {
|
|
1284
|
-
"!doc": "Produce mineral compounds using reagents from two another labs. Labs have to be within 2 squares range. Each reaction produces 10 mineral units and has a 10 ticks cooldown period. The same input labs can be used by many output labs.\n\nArguments:\n* lab1 - The first source lab.\n* lab2 - The second source lab.\n\nCPU cost: CONST",
|
|
1285
|
-
"!type": "fn(lab1: +Structure, lab2: +Structure) -> number"
|
|
1286
|
-
},
|
|
1287
|
-
unboostCreep: {
|
|
1288
|
-
"!doc": "Immediately remove boosts from the creep and drop 50% of the mineral compounds used to boost it onto the ground regardless of the creep's remaining time to live. The creep has to be at adjacent square to the lab. Unboosting requires cooldown time equal to the total sum of the reactions needed to produce all the compounds applied to the creep.\n\nArguments:\n* creep - The target creep.\n\nCPU cost: CONST",
|
|
1289
|
-
"!type": "fn(creep: +Creep) -> number"
|
|
1290
|
-
},
|
|
1291
|
-
})
|
|
1292
|
-
},
|
|
1293
|
-
StructureLink: {
|
|
1294
|
-
"!type": "fn()",
|
|
1295
|
-
"!doc": "Remotely transfers energy to another Link in the same room.",
|
|
1296
|
-
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1297
|
-
cooldown: {
|
|
1298
|
-
"!doc": "The amount of game ticks the link has to wait until the next transfer is possible.",
|
|
1299
|
-
"!type": "number"
|
|
1300
|
-
},
|
|
1301
|
-
transferEnergy: {
|
|
1302
|
-
"!doc": "Transfer energy from the link to another link or a creep. If the target is a creep, it has to be at adjacent square to the link. If the target is a link, it can be at any location in the same room. Remote transfer process implies 3% energy loss and cooldown delay depending on the distance.\n\nArguments:\n* target - The target object.\n* amount (optional) - The amount of energy to be transferred. If omitted, all the available energy is used.\n\nCPU cost: CONST",
|
|
1303
|
-
"!type": "fn(target: object, amount: number) -> number"
|
|
1304
|
-
},
|
|
1305
|
-
})
|
|
1306
|
-
},
|
|
1307
|
-
StructureObserver: {
|
|
1308
|
-
"!type": "fn()",
|
|
1309
|
-
"!doc": "Provides visibility into a distant room from your script.",
|
|
1310
|
-
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1311
|
-
observeRoom: {
|
|
1312
|
-
"!doc": "Provide visibility into a distant room from your script. The target room object will be available on the next tick. The maximum range is 5 rooms.\n\nArguments:\n* roomName - The name of the target room.\n\nCPU cost: CONST",
|
|
1313
|
-
"!type": "fn(roomName: string) -> number"
|
|
1314
|
-
},
|
|
1315
|
-
})
|
|
1316
|
-
},
|
|
1317
|
-
StructurePowerBank: {
|
|
1318
|
-
"!type": "fn()",
|
|
1319
|
-
"!doc": "Non-player structure. Contains power resource which can be obtained by destroying the structure. Hits the attacker creep back on each attack. ",
|
|
1320
|
-
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1321
|
-
power: {
|
|
1322
|
-
"!doc": "The amount of power containing.",
|
|
1323
|
-
"!type": "number"
|
|
1324
|
-
},
|
|
1325
|
-
ticksToDecay: {
|
|
1326
|
-
"!doc": "The amount of game ticks when this structure will disappear.",
|
|
1327
|
-
"!type": "number"
|
|
1328
|
-
},
|
|
1329
|
-
})
|
|
1330
|
-
},
|
|
1331
|
-
StructurePowerSpawn: {
|
|
1332
|
-
"!type": "fn()",
|
|
1333
|
-
"!doc": "Processes power into your account, and spawns power creeps with special unique powers (in development).",
|
|
1334
|
-
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1335
|
-
processPower: {
|
|
1336
|
-
"!doc": "Register power resource units into your account. Registered power allows to develop power creeps skills. Consumes 1 power resource unit and 50 energy resource units.\n\nCPU cost: CONST",
|
|
1337
|
-
"!type": "fn() -> number"
|
|
1338
|
-
}
|
|
1339
|
-
})
|
|
1340
|
-
},
|
|
1341
|
-
StructureRampart: {
|
|
1342
|
-
"!type": "fn()",
|
|
1343
|
-
"!doc": "Blocks movement of hostile creeps, and defends your creeps and structures on the same tile.",
|
|
1344
|
-
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1345
|
-
ticksToDecay: {
|
|
1346
|
-
"!doc": "The amount of game ticks when this rampart will lose some hit points.",
|
|
1347
|
-
"!type": "number"
|
|
1348
|
-
},
|
|
1349
|
-
isPublic: {
|
|
1350
|
-
"!doc": "If false (default), only your creeps can step on the same square. If true, any hostile creeps can pass through.",
|
|
1351
|
-
"!type": "bool"
|
|
1352
|
-
},
|
|
1353
|
-
setPublic: {
|
|
1354
|
-
"!doc": "Make this rampart public to allow other players' creeps to pass through.\n\nArguments:\n* isPublic - Whether this rampart should be public or non-public.\n\nCPU cost: CONST",
|
|
1355
|
-
"!type": "fn(isPublic) -> number"
|
|
1356
|
-
}
|
|
1357
|
-
})
|
|
1358
|
-
},
|
|
1359
|
-
StructureRoad: {
|
|
1360
|
-
"!type": "fn()",
|
|
1361
|
-
"!doc": "Decreases movement cost to 1. Using roads allows creating creeps with less MOVE body parts.",
|
|
1362
|
-
prototype: _extend({}, def_screeps.Structure.prototype, {
|
|
1363
|
-
ticksToDecay: {
|
|
1364
|
-
"!doc": "The amount of game ticks when this road will lose some hit points.",
|
|
1365
|
-
"!type": "number"
|
|
1366
|
-
},
|
|
1367
|
-
})
|
|
1368
|
-
},
|
|
1369
|
-
StructureStorage: {
|
|
1370
|
-
"!type": "fn()",
|
|
1371
|
-
"!doc": "A structure that can store huge amount of resource units. Only one structure per room is allowed that can be addressed by Room.storage property.",
|
|
1372
|
-
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype)
|
|
1373
|
-
},
|
|
1374
|
-
StructureTerminal: {
|
|
1375
|
-
"!type": "fn()",
|
|
1376
|
-
"!doc": "Sends any resources to a Terminal in another room. The destination Terminal can belong to any player. If its storage is full, the resources are dropped on the ground. Each transaction requires additional energy (regardless of the transfer resource type) according to this formula: ceil(0.2 * amount * linearDistanceBetweenRooms). For example, sending 100 mineral units from W1N1 to W2N3 will consume 40 energy units. You can track your incoming and outgoing transactions and estimate range cost between rooms using the Game.market object. Only one Terminal per room is allowed that can be addressed by Room.terminal property.",
|
|
1377
|
-
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1378
|
-
send: {
|
|
1379
|
-
"!doc": "Sends resource to a Terminal in another room with the specified name.\n\nArguments:\n* resourceType - One of the RESOURCE_* constants.\n* amount - The amount of resources to be sent. The minimum amount is 100.\n* destination - The name of the target room. You don't have to gain visibility in this room.\n* description (optional) - The description of the transaction. It is visible to the recipient. The maximum length is 100 characters.\n\nCPU cost: CONST",
|
|
1380
|
-
"!type": "fn(resourceType: string, amount: number, destination: string, description?: string) -> number"
|
|
1381
|
-
},
|
|
1382
|
-
cooldown: {
|
|
1383
|
-
"!doc": "The remaining amount of ticks while this terminal cannot be used to make `StructureTerminal.send` or `Game.market.deal` calls.",
|
|
1384
|
-
"!type": "number"
|
|
1385
|
-
}
|
|
1386
|
-
})
|
|
1387
|
-
},
|
|
1388
|
-
StructureTower: {
|
|
1389
|
-
"!type": "fn()",
|
|
1390
|
-
"!doc": "Remotely attacks or heals creeps, or repairs structures. Can be targeted to any object in the room. However, its effectiveness highly depends on the distance. Each action consumes energy.",
|
|
1391
|
-
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1392
|
-
attack: {
|
|
1393
|
-
"!doc": "Remotely attack any creep in a room. \n\nArguments:\n* target - The target creep.\n\nCPU cost: CONST",
|
|
1394
|
-
"!type": "fn(target: +Creep) -> number"
|
|
1395
|
-
},
|
|
1396
|
-
heal: {
|
|
1397
|
-
"!doc": "Remotely heal any creep in a room. \n\nArguments:\n* target - The target creep.\n\nCPU cost: CONST",
|
|
1398
|
-
"!type": "fn(target: +Creep) -> number"
|
|
1399
|
-
},
|
|
1400
|
-
repair: {
|
|
1401
|
-
"!doc": "Remotely repair any structure in a room. \n\nArguments:\n* target - The target structure.\n\nCPU cost: CONST",
|
|
1402
|
-
"!type": "fn(target: +Structure) -> number"
|
|
1403
|
-
}
|
|
1404
|
-
})
|
|
1405
|
-
},
|
|
1406
|
-
StructureNuker: {
|
|
1407
|
-
"!type": "fn()",
|
|
1408
|
-
"!doc": "Launches a nuke to any room within 5 rooms range dealing huge damage to the landing area. Each launch has a cooldown and requires energy and ghodium resources. Launching creates a Nuke object at the target room position which is visible to any player until it is landed. Incoming nuke cannot be moved or cancelled.",
|
|
1409
|
-
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1410
|
-
launchNuke: {
|
|
1411
|
-
"!doc": "Launch a nuke to the specified position. \n\nArguments:\n* pos - The target room position.\n\nCPU cost: CONST",
|
|
1412
|
-
"!type": "fn(pos: +RoomPosition) -> number"
|
|
1413
|
-
},
|
|
1414
|
-
cooldown: {
|
|
1415
|
-
"!doc": "The amount of game ticks until the next launch is possible.",
|
|
1416
|
-
"!type": "number"
|
|
1417
|
-
},
|
|
1418
|
-
})
|
|
1419
|
-
},
|
|
1420
|
-
StructureWall: {
|
|
1421
|
-
"!type": "fn()",
|
|
1422
|
-
"!doc": "Blocks movement of all creeps.",
|
|
1423
|
-
prototype: _extend({}, def_screeps.Structure.prototype, {
|
|
1424
|
-
ticksToLive: {
|
|
1425
|
-
"!doc": "The amount of game ticks when the wall will disappear (only for automatically placed border walls at the start of the game).",
|
|
1426
|
-
"!type": "number"
|
|
1427
|
-
},
|
|
1428
|
-
})
|
|
1429
|
-
},
|
|
1430
|
-
StructureSpawn: {
|
|
1431
|
-
"!type": "fn()",
|
|
1432
|
-
"!doc": "Spawn is your colony center. This structure can create, renew, and recycle creeps. All your spawns are accessible through Game.spawns hash list.",
|
|
1433
|
-
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1434
|
-
memory: {
|
|
1435
|
-
"!doc": "A shorthand to Memory.spawns[spawn.name]. You can use it for quick access the spawn’s specific memory data object."
|
|
1436
|
-
},
|
|
1437
|
-
name: {
|
|
1438
|
-
"!doc": "Spawn’s name. You choose the name upon creating a new spawn, and it cannot be changed later. This name is a hash key to access the spawn via the Game.spawns object.",
|
|
1439
|
-
"!type": "string"
|
|
1440
|
-
},
|
|
1441
|
-
spawning: {
|
|
1442
|
-
"!doc": "If the spawn is in process of spawning a new creep, this object will contain the new creep’s information, or null otherwise.",
|
|
1443
|
-
"!type": "+StructureSpawnSpawning"
|
|
1444
|
-
},
|
|
1445
|
-
spawnCreep: {
|
|
1446
|
-
"!doc": "Start the creep spawning process. The required energy amount can be withdrawn from all spawns and extensions in the room.\n\nArguments:\n* body - An array describing the new creep’s body. Should contain 1 to 50 elements with one of the body part constants.\n* name - The name of a new creep. It should be unique creep name, i.e. the Game.creeps object should not contain another creep with the same name (hash key).\n* opts (optional) - An object with following properties:\n - memory - The memory of a new creep. If provided, it will be immediately stored into Memory.creeps[name].\n - energyStructures - Array of spawns/extensions from which to draw energy for the spawning process.\n - dryRun - If dryRun is true, the operation will only check if it is possible to create a creep.\n - directions - Set desired directions where the creep should move when spawned. An array with the direction constants.\n\nCPU cost: CONST",
|
|
1447
|
-
"!type": "fn(body: [string], name: string, opts?: object) -> number"
|
|
1448
|
-
},
|
|
1449
|
-
renewCreep: {
|
|
1450
|
-
"!doc": "Increase the remaining time to live of the target creep. The target should be at adjacent square. The spawn should not be busy with the spawning process. Each execution increases the creep's timer by amount of ticks according to this formula: floor(600/body_size). Energy required for each execution is determined using this formula: ceil(creep_cost/2.5/body_size).\n\nArguments:\n* target - The creep to be renewed.\n\nCPU cost: CONST",
|
|
1451
|
-
"!type": "fn(target: +Creep) -> number"
|
|
1452
|
-
},
|
|
1453
|
-
recycleCreep: {
|
|
1454
|
-
"!doc": "Kill the creep and drop up to 100% of resources spent on its spawning and boosting depending on remaining life time. The target should be at adjacent square. \n\nArguments:\n* target - The creep to be recycled.\n\nCPU cost: CONST",
|
|
1455
|
-
"!type": "fn(target: +Creep) -> number"
|
|
1456
|
-
}
|
|
1457
|
-
}),
|
|
1458
|
-
Spawning: {
|
|
1459
|
-
"!type": "StructureSpawnSpawning"
|
|
1460
|
-
}
|
|
1461
|
-
},
|
|
1462
|
-
|
|
1463
|
-
StructurePortal: {
|
|
1464
|
-
"!type": "fn()",
|
|
1465
|
-
"!doc": "A non-player structure. Instantly teleports your creeps to a distant room acting as a room exit tile. Portals appear randomly in the central room of each sector.",
|
|
1466
|
-
prototype: _extend({}, def_screeps.Structure.prototype, {
|
|
1467
|
-
destination: {
|
|
1468
|
-
'!doc': 'The position object in the destination room.',
|
|
1469
|
-
'!type': '+RoomPosition'
|
|
1470
|
-
},
|
|
1471
|
-
ticksToDecay: {
|
|
1472
|
-
"!doc": "The amount of game ticks when the portal disappears, or undefined when the portal is stable.",
|
|
1473
|
-
"!type": "number"
|
|
1474
|
-
}
|
|
1475
|
-
})
|
|
1476
|
-
},
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
"!type": "fn()",
|
|
1480
|
-
"!doc": "
|
|
1481
|
-
prototype: _extend({},
|
|
1482
|
-
|
|
1483
|
-
"!doc": "
|
|
1484
|
-
"!type": "fn(
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
"!doc": "
|
|
1503
|
-
"!type": "number"
|
|
1504
|
-
},
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
"!
|
|
1518
|
-
"!
|
|
1519
|
-
},
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
"!doc": "
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
"!
|
|
1541
|
-
"!
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
"!doc": "
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
"!
|
|
1564
|
-
"!
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
"!doc": "
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
"!
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
"!doc": "
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
"!
|
|
1615
|
-
},
|
|
1616
|
-
|
|
1617
|
-
"!doc": "
|
|
1618
|
-
"!type": "
|
|
1619
|
-
},
|
|
1620
|
-
|
|
1621
|
-
"!doc": "
|
|
1622
|
-
"!type": "
|
|
1623
|
-
},
|
|
1624
|
-
|
|
1625
|
-
"!doc": "
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
"!
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
"!
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
"!
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
"!
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
"!
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
"!
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
"!
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
"!
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
"!
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
"!
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
"!
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
"!
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
"!
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
"!
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
"!
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
"!
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
"!
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
"!
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
"!
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
"!type": "fn(arg1
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
"!
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
"!
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
"!doc": "Syntax:\
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
"!
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
"!
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
"!
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
"!
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
"!
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
"!
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
"!
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
"!
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
"!
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
"!
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
"!
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
"!doc": "Syntax:\
|
|
1816
|
-
"!type": "fn(
|
|
1817
|
-
},
|
|
1818
|
-
|
|
1819
|
-
"!doc": "
|
|
1820
|
-
"!type": "fn(
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
"!
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
"!
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
"!
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
"!
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
"!
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
"!
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
"!doc": "
|
|
1855
|
-
"!type": "fn() ->
|
|
1856
|
-
},
|
|
1857
|
-
|
|
1858
|
-
"!doc": "
|
|
1859
|
-
"!type": "fn(
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
"!doc": "
|
|
1866
|
-
"!type": "fn(
|
|
1867
|
-
},
|
|
1868
|
-
|
|
1869
|
-
"!doc": "
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
"!
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
"!doc": "
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
"!
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
"!
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
"!
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
"!
|
|
1944
|
-
},
|
|
1945
|
-
|
|
1946
|
-
"!doc": "
|
|
1947
|
-
"!type": "
|
|
1948
|
-
},
|
|
1949
|
-
|
|
1950
|
-
"!doc": "
|
|
1951
|
-
"!type": "fn() ->
|
|
1952
|
-
},
|
|
1953
|
-
|
|
1954
|
-
"!doc": "
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
"!
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
"!
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
"!
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
"!doc": "The current level.",
|
|
2003
|
-
"!type": "number"
|
|
2004
|
-
},
|
|
2005
|
-
|
|
2006
|
-
"!doc": "The
|
|
2007
|
-
"!type": "number"
|
|
2008
|
-
}
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
"!doc": "
|
|
2018
|
-
"!type": "
|
|
2019
|
-
},
|
|
2020
|
-
|
|
2021
|
-
"!doc": "
|
|
2022
|
-
"!type": "
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
"!
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
"!
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
"!
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
"!
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
"!
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
"!
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
"!
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
"!
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
"!
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
"!
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
"!doc": "
|
|
2073
|
-
"!type": "fn(
|
|
2074
|
-
},
|
|
2075
|
-
|
|
2076
|
-
"!doc": "
|
|
2077
|
-
"!type": "fn(
|
|
2078
|
-
},
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
"!
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
"!
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
"!
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
"!
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
"!
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
"!
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
},
|
|
2126
|
-
|
|
2127
|
-
"!doc": "
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
"!
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
function _extend() {
|
|
4
|
+
var dst = arguments[0];
|
|
5
|
+
var srcs = Array.prototype.slice.call(arguments, 1);
|
|
6
|
+
srcs.forEach(function(src) {
|
|
7
|
+
for(var i in src) {
|
|
8
|
+
dst[i] = src[i];
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
return dst;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _docs = {
|
|
16
|
+
store: {
|
|
17
|
+
store: {
|
|
18
|
+
"!doc": "A Store object that contains cargo of this creep.",
|
|
19
|
+
"!type": "+Store"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
_extend(_docs, {
|
|
25
|
+
pathfindingOptions: {
|
|
26
|
+
roomCallback: {
|
|
27
|
+
"!doc": "Request from the pathfinder to generate a CostMatrix for a certain room. The callback accepts one argument, roomName. This callback will only be called once per room per search. If you are running multiple pathfinding operations in a single room and in a single tick you may consider caching your CostMatrix to speed up your code. Please read the CostMatrix documentation below for more information on CostMatrix. If you return false from the callback the requested room will not be searched, and it won't count against maxRooms",
|
|
28
|
+
"!type": "fn(roomName: string) -> +CostMatrix"
|
|
29
|
+
},
|
|
30
|
+
plainCost: {
|
|
31
|
+
"!doc": "Cost for walking on plain positions. The default is 1.",
|
|
32
|
+
"!type": "number"
|
|
33
|
+
},
|
|
34
|
+
swampCost: {
|
|
35
|
+
"!doc": "Cost for walking on swamp positions. The default is 5.",
|
|
36
|
+
"!type": "number"
|
|
37
|
+
},
|
|
38
|
+
flee: {
|
|
39
|
+
"!doc": "Instead of searching for a path to the goals this will search for a path away from the goals. The cheapest path that is out of range of every goal will be returned. The default is false.",
|
|
40
|
+
"!type": "bool"
|
|
41
|
+
},
|
|
42
|
+
maxOps: {
|
|
43
|
+
"!doc": "The maximum allowed pathfinding operations. You can limit CPU time used for the search based on ratio 1 op ~ 0.001 CPU. The default value is 2000.",
|
|
44
|
+
"!type": "number"
|
|
45
|
+
},
|
|
46
|
+
maxRooms: {
|
|
47
|
+
"!doc": "The maximum allowed rooms to search. The default is 16, maximum is 64.",
|
|
48
|
+
"!type": "number"
|
|
49
|
+
},
|
|
50
|
+
maxCost: {
|
|
51
|
+
"!doc": "The maximum allowed cost of the path returned. If at any point the pathfinder detects that it is impossible to find a path with a cost less than or equal to maxCost it will immediately halt the search. The default is Infinity.",
|
|
52
|
+
"!type": "number"
|
|
53
|
+
},
|
|
54
|
+
heuristicWeight: {
|
|
55
|
+
"!doc": "Weight to apply to the heuristic in the A* formula F = G + weight * H. Use this option only if you understand the underlying A* algorithm mechanics! The default value is 1.",
|
|
56
|
+
"!type": "number"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
_extend(_docs, {
|
|
62
|
+
roomFindPathOptions: _extend({}, _docs.pathfindingOptions, {
|
|
63
|
+
ignoreCreeps: {
|
|
64
|
+
"!doc": "Treat squares with creeps as walkable. Can be useful with too many moving creeps around or in some other cases. The default value is false.",
|
|
65
|
+
"!type": "boolean"
|
|
66
|
+
},
|
|
67
|
+
ignoreDestructibleStructures: {
|
|
68
|
+
"!doc": "Treat squares with destructible structures (constructed walls, ramparts, spawns, extensions) as walkable. The default value is false.",
|
|
69
|
+
"!type": "boolean"
|
|
70
|
+
},
|
|
71
|
+
ignoreRoads: {
|
|
72
|
+
"!doc": "Ignore road structures. Enabling this option can speed up the search. The default value is false. This is only used when the new PathFinder is enabled.",
|
|
73
|
+
"!type": "boolean"
|
|
74
|
+
},
|
|
75
|
+
ignore: {
|
|
76
|
+
"!doc": "An array of the room's objects or RoomPosition objects which should be treated as walkable tiles during the search. This option cannot be used when the new PathFinder is enabled (use costCallback option instead).",
|
|
77
|
+
"!type": "[+RoomObject]"
|
|
78
|
+
},
|
|
79
|
+
avoid: {
|
|
80
|
+
"!doc": "An array of the room's objects or RoomPosition objects which should be treated as obstacles during the search. This option cannot be used when the new PathFinder is enabled (use costCallback option instead).",
|
|
81
|
+
"!type": "[+RoomObject]"
|
|
82
|
+
},
|
|
83
|
+
serialize: {
|
|
84
|
+
"!doc": "If true, the result path will be serialized using Room.serializePath. The default is false.",
|
|
85
|
+
"!type": "boolean"
|
|
86
|
+
},
|
|
87
|
+
range: {
|
|
88
|
+
"!doc": "Find a path to a position in specified linear range of target. The default is 0.",
|
|
89
|
+
"!type": "number"
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
_extend(_docs, {
|
|
95
|
+
moveToOptions: _extend({}, _docs.roomFindPathOptions, {
|
|
96
|
+
reusePath: {
|
|
97
|
+
"!doc": "This option enables reusing the path found along multiple game ticks. It allows to save CPU time, but can result in a slightly slower creep reaction behavior. The path is stored into the creep's memory to the _move property. The reusePath value defines the amount of ticks which the path should be reused for. The default value is 5. Increase the amount to save more CPU, decrease to make the movement more consistent. Set to 0 if you want to disable path reusing.",
|
|
98
|
+
"!type": "boolean"
|
|
99
|
+
},
|
|
100
|
+
serializeMemory: {
|
|
101
|
+
"!doc": "If reusePath is enabled and this option is set to true, the path will be stored in memory in the short serialized form using Room.serializePath. The default value is true.",
|
|
102
|
+
"!type": "boolean"
|
|
103
|
+
},
|
|
104
|
+
noPathFinding: {
|
|
105
|
+
"!doc": "If this option is set to true, moveTo method will return ERR_NOT_FOUND if there is no memorized path to reuse. This can significantly save CPU time in some cases. The default value is false.",
|
|
106
|
+
"!type": "boolean"
|
|
107
|
+
},
|
|
108
|
+
visualizePathStyle: {
|
|
109
|
+
"!doc": "Draw a line along the creep’s path using RoomVisual.poly. You can provide either an empty object or custom style parameters.",
|
|
110
|
+
"!type": "object"
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
var def_screeps = {
|
|
116
|
+
"!name": "screeps",
|
|
117
|
+
"!define": {
|
|
118
|
+
object: {},
|
|
119
|
+
BodyPart: {
|
|
120
|
+
type: {
|
|
121
|
+
"!doc": "One of the body part types constants",
|
|
122
|
+
"!type": "string"
|
|
123
|
+
},
|
|
124
|
+
hits: {
|
|
125
|
+
"!doc": "The remaining amount of hit points of this body part.",
|
|
126
|
+
"!type": "number"
|
|
127
|
+
},
|
|
128
|
+
boost: {
|
|
129
|
+
"!doc": "If the body part is boosted, this property specifies the mineral type which is used for boosting. One of the RESOURCE_* constants.",
|
|
130
|
+
"!type": "string"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
PathStep: {
|
|
134
|
+
x: "number",
|
|
135
|
+
y: "number",
|
|
136
|
+
dx: "number",
|
|
137
|
+
dy: "number",
|
|
138
|
+
direction: "number"
|
|
139
|
+
},
|
|
140
|
+
Path: {
|
|
141
|
+
"!type": "[PathStep]"
|
|
142
|
+
},
|
|
143
|
+
PathfindingResult: {
|
|
144
|
+
path: {
|
|
145
|
+
"!doc": "An array of RoomPosition objects.",
|
|
146
|
+
"!type": "[+RoomPosition]"
|
|
147
|
+
},
|
|
148
|
+
ops: {
|
|
149
|
+
"!doc": "Total number of operations performed before this path was calculated.",
|
|
150
|
+
"!type": "number"
|
|
151
|
+
},
|
|
152
|
+
cost: {
|
|
153
|
+
"!doc": "The total cost of the path as derived from plainCost, swampCost and any given CostMatrix instances.",
|
|
154
|
+
"!type": "number"
|
|
155
|
+
},
|
|
156
|
+
incomplete: {
|
|
157
|
+
"!doc": "If the pathfinder fails to find a complete path, this will be true. Note that path will still be populated with a partial path which represents the closest path it could find given the search parameters.",
|
|
158
|
+
"!type": "boolean"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
PathfindingOptions: _docs.pathfindingOptions,
|
|
162
|
+
RoomFindPathOptions: _docs.roomFindPathOptions,
|
|
163
|
+
MoveToOptions: _docs.moveToOptions,
|
|
164
|
+
FindRouteOptions: {
|
|
165
|
+
routeCallback: {
|
|
166
|
+
"!doc": "This callback accepts two arguments: function(roomName, fromRoomName). It can be used to calculate the cost of entering that room. You can use this to do things like prioritize your own rooms, or avoid some rooms. You can return a floating point cost or Infinity to block the room.",
|
|
167
|
+
"!type": "fn(roomName: string, fromRoomName: string) -> number"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
LookItem: {
|
|
171
|
+
type: "string",
|
|
172
|
+
creep: "+Creep",
|
|
173
|
+
structure: "+Structure",
|
|
174
|
+
energy: "+Resource",
|
|
175
|
+
resource: "+Resource",
|
|
176
|
+
flag: "+Flag",
|
|
177
|
+
source: "+Source",
|
|
178
|
+
constructionSite: "+ConstructionSite",
|
|
179
|
+
terrain: "string"
|
|
180
|
+
},
|
|
181
|
+
LookArray: {
|
|
182
|
+
"!type": "[LookItem]"
|
|
183
|
+
},
|
|
184
|
+
LookRowArray: {
|
|
185
|
+
"!type": "[LookArray]"
|
|
186
|
+
},
|
|
187
|
+
LookAreaArray: {
|
|
188
|
+
"!type": "[LookRowArray]"
|
|
189
|
+
},
|
|
190
|
+
MapRouteStep: {
|
|
191
|
+
exit: "number",
|
|
192
|
+
room: "string"
|
|
193
|
+
},
|
|
194
|
+
CostMatrix: {
|
|
195
|
+
"!type": "fn()",
|
|
196
|
+
"!doc": "Container for custom navigation cost data. By default PathFinder will only consider terrain data (plain, swamp, wall) — if you need to route around obstacles such as buildings or creeps you must put them into a CostMatrix. Generally you will create your CostMatrix from within roomCallback. If a non-0 value is found in a room's CostMatrix then that value will be used instead of the default terrain cost. You should avoid using large values in your CostMatrix and terrain cost flags. For example, running PathFinder.search with { plainCost: 1, swampCost: 5 } is faster than running it with {plainCost: 2, swampCost: 10 } even though your paths will be the same.",
|
|
197
|
+
prototype: {
|
|
198
|
+
"set": {
|
|
199
|
+
"!doc": "Set the cost of a position in this CostMatrix.",
|
|
200
|
+
"!type": "fn(x: number, y: number, cost: number)"
|
|
201
|
+
},
|
|
202
|
+
"get": {
|
|
203
|
+
"!doc": "Get the cost of a position in this CostMatrix.",
|
|
204
|
+
"!type": "fn(x: number, y: number)"
|
|
205
|
+
},
|
|
206
|
+
"clone": {
|
|
207
|
+
"!doc": "Copy this CostMatrix into a new CostMatrix with the same data.",
|
|
208
|
+
"!type": "fn() -> +CostMatrix"
|
|
209
|
+
},
|
|
210
|
+
serialize: {
|
|
211
|
+
"!doc": "Returns a compact representation of this CostMatrix which can be stored via JSON.stringify",
|
|
212
|
+
"!type": "fn() -> [number]"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
deserialize: {
|
|
216
|
+
"!doc": "Static method which deserializes a new CostMatrix using the return value of `serialize`.",
|
|
217
|
+
"!type": "fn(val: [number]) -> +CostMatrix"
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
Transaction: {
|
|
221
|
+
transactionId: "string",
|
|
222
|
+
time: "number",
|
|
223
|
+
sender: {
|
|
224
|
+
username: "string"
|
|
225
|
+
},
|
|
226
|
+
recipient: {
|
|
227
|
+
username: "string"
|
|
228
|
+
},
|
|
229
|
+
resouceType: "string",
|
|
230
|
+
amount: "number",
|
|
231
|
+
from: "string",
|
|
232
|
+
to: "string",
|
|
233
|
+
description: "string",
|
|
234
|
+
order: {
|
|
235
|
+
id: "string",
|
|
236
|
+
type: "string",
|
|
237
|
+
price: "number"
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
MarketOrder: {
|
|
241
|
+
id: "string",
|
|
242
|
+
created: "number",
|
|
243
|
+
type: "string",
|
|
244
|
+
resourceType: "string",
|
|
245
|
+
roomName: "string",
|
|
246
|
+
amount: "number",
|
|
247
|
+
remainingAmount: "number",
|
|
248
|
+
price: "number",
|
|
249
|
+
active: "boolean",
|
|
250
|
+
totalAmount: "number"
|
|
251
|
+
},
|
|
252
|
+
MarketHistoryItem: {
|
|
253
|
+
"resourceType": "string",
|
|
254
|
+
"date": "string",
|
|
255
|
+
"transactions": "number",
|
|
256
|
+
"volume": "number",
|
|
257
|
+
"avgPrice": "number",
|
|
258
|
+
"stddevPrice": "number"
|
|
259
|
+
},
|
|
260
|
+
HeapStatistics: {
|
|
261
|
+
"total_heap_size": "number",
|
|
262
|
+
"total_heap_size_executable": "number",
|
|
263
|
+
"total_physical_size": "number",
|
|
264
|
+
"total_available_size": "number",
|
|
265
|
+
"used_heap_size": "number",
|
|
266
|
+
"heap_size_limit": "number",
|
|
267
|
+
"malloced_memory": "number",
|
|
268
|
+
"peak_malloced_memory": "number",
|
|
269
|
+
"does_zap_garbage": "number",
|
|
270
|
+
"externally_allocated_size": "number"
|
|
271
|
+
},
|
|
272
|
+
Effect: {
|
|
273
|
+
effect: {
|
|
274
|
+
"!doc": "Effect ID of the applied effect. Can be either natural effect ID or Power ID.",
|
|
275
|
+
"!type": "number"
|
|
276
|
+
},
|
|
277
|
+
level: {
|
|
278
|
+
"!doc": "Power level of the applied effect. Absent if the effect is not a Power effect.",
|
|
279
|
+
"!type": "number"
|
|
280
|
+
},
|
|
281
|
+
ticksRemaining: {
|
|
282
|
+
"!doc": "How many ticks will the effect last.",
|
|
283
|
+
"!type": "number"
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
RoomTerrain: {
|
|
287
|
+
"!type": "fn()",
|
|
288
|
+
"!doc": "An object which provides fast access to room terrain data. These objects can be constructed for any room in the world even if you have no access to it. Technically every Room.Terrain object is a very lightweight adapter to underlying static terrain buffers with corresponding minimal accessors.",
|
|
289
|
+
prototype: {
|
|
290
|
+
get: {
|
|
291
|
+
"!doc": "Get terrain type at the specified room position by (x,y) coordinates. Unlike the Game.map.getTerrainAt(...) method, this one doesn't perform any string operations and returns integer terrain type values (see below).\n\nArguments:\n* x - X position in the room.\n* y - Y position in the room.\n\nCPU Cost: LOW",
|
|
292
|
+
"!type": "fn(x: number, y: number) -> number",
|
|
293
|
+
},
|
|
294
|
+
getRawBuffer: {
|
|
295
|
+
"!doc": "Get copy of underlying static terrain buffer. Current underlying representation is Uint8Array.\n\nArguments:\n* destinationArray (optional) - A typed array view in which terrain will be copied to.\n\nCPU Cost: LOW",
|
|
296
|
+
"!type": "fn(destinationArray?: bool) -> +Uint8Array"
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
StructureSpawnSpawning: {
|
|
301
|
+
"!type": "fn()",
|
|
302
|
+
"!doc": "Details of the creep being spawned currently that can be addressed by the StructureSpawn.spawning property.",
|
|
303
|
+
prototype: {
|
|
304
|
+
name: {
|
|
305
|
+
"!doc": "The name of a new creep.",
|
|
306
|
+
"!type": "string"
|
|
307
|
+
},
|
|
308
|
+
needTime: {
|
|
309
|
+
"!doc": "Time needed in total to complete the spawning.",
|
|
310
|
+
"!type": "number"
|
|
311
|
+
},
|
|
312
|
+
remainingTime: {
|
|
313
|
+
"!doc": "Remaining time to go.",
|
|
314
|
+
"!type": "number"
|
|
315
|
+
},
|
|
316
|
+
directions: {
|
|
317
|
+
"!doc": "An array with the spawn directions, see StructureSpawn.Spawning.setDirections.",
|
|
318
|
+
"!type": "[number]"
|
|
319
|
+
},
|
|
320
|
+
spawn: {
|
|
321
|
+
"!doc": "A link to the spawn.",
|
|
322
|
+
"!type": "+StructureSpawn"
|
|
323
|
+
},
|
|
324
|
+
cancel: {
|
|
325
|
+
"!doc": "Cancel spawning immediately. Energy spent on spawning is not returned.",
|
|
326
|
+
"!type": "fn() -> number"
|
|
327
|
+
},
|
|
328
|
+
setDirections: {
|
|
329
|
+
"!doc": "Set desired directions where the creep should move when spawned.\n\nArguments:\n* directions - An array with the direction constants as items.\n\nCPU cost: CONST",
|
|
330
|
+
"!type": "fn(directions: [number]) -> number"
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
Power: {
|
|
335
|
+
level: {
|
|
336
|
+
"!doc": "Current level of the power.",
|
|
337
|
+
"!type": "number"
|
|
338
|
+
},
|
|
339
|
+
cooldown: {
|
|
340
|
+
"!doc": "Cooldown ticks remaining, or undefined if the power creep is not spawned in the world.",
|
|
341
|
+
"!type": "number"
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
RoomStatus: {
|
|
345
|
+
status: {
|
|
346
|
+
"!doc": "One of the following string values:\n* normal – the room has no restrictions\n* closed – the room is not available\n* novice – the room is part of a novice area\n* respawn – the room is part of a respawn area",
|
|
347
|
+
"!type": "string"
|
|
348
|
+
},
|
|
349
|
+
timestamp: {
|
|
350
|
+
"!doc": "Status expiration time in milliseconds since UNIX epoch time. This property is null if the status is permanent.",
|
|
351
|
+
"!type": "number"
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
LineStyle: {
|
|
355
|
+
width: {
|
|
356
|
+
"!doc": "Line width, default is 0.1.",
|
|
357
|
+
"!type": "number"
|
|
358
|
+
},
|
|
359
|
+
color: {
|
|
360
|
+
"!doc": "Line color in any web format, default is #ffffff (white).",
|
|
361
|
+
"!type": "string"
|
|
362
|
+
},
|
|
363
|
+
opacity: {
|
|
364
|
+
"!doc": "Opacity value, default is 0.5.",
|
|
365
|
+
"!type": "number"
|
|
366
|
+
},
|
|
367
|
+
lineStyle: {
|
|
368
|
+
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
369
|
+
"!type": "string"
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
MapLineStyle: {
|
|
373
|
+
width: {
|
|
374
|
+
"!doc": "Line width, default is 0.5.",
|
|
375
|
+
"!type": "number"
|
|
376
|
+
},
|
|
377
|
+
color: {
|
|
378
|
+
"!doc": "Line color in any web format, default is #ffffff (white).",
|
|
379
|
+
"!type": "string"
|
|
380
|
+
},
|
|
381
|
+
opacity: {
|
|
382
|
+
"!doc": "Opacity value, default is 0.5.",
|
|
383
|
+
"!type": "number"
|
|
384
|
+
},
|
|
385
|
+
lineStyle: {
|
|
386
|
+
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
387
|
+
"!type": "string"
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
CircleStyle: {
|
|
391
|
+
radius: {
|
|
392
|
+
"!doc": "Circle radius, default is 0.15.",
|
|
393
|
+
"!type": "number"
|
|
394
|
+
},
|
|
395
|
+
fill: {
|
|
396
|
+
"!doc": "Fill color in any web format, default is #ffffff (white).",
|
|
397
|
+
"!type": "string"
|
|
398
|
+
},
|
|
399
|
+
opacity: {
|
|
400
|
+
"!doc": "Opacity value, default is 0.5.",
|
|
401
|
+
"!type": "number"
|
|
402
|
+
},
|
|
403
|
+
stroke: {
|
|
404
|
+
"!doc": "Stroke color in any web format, default is undefined (no stroke).",
|
|
405
|
+
"!type": "string"
|
|
406
|
+
},
|
|
407
|
+
strokeWidth: {
|
|
408
|
+
"!doc": "Stroke line width, default is 0.1.",
|
|
409
|
+
"!type": "number"
|
|
410
|
+
},
|
|
411
|
+
lineStyle: {
|
|
412
|
+
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
413
|
+
"!type": "string"
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
MapCircleStyle: {
|
|
417
|
+
radius: {
|
|
418
|
+
"!doc": "Circle radius, default is 10.",
|
|
419
|
+
"!type": "number"
|
|
420
|
+
},
|
|
421
|
+
fill: {
|
|
422
|
+
"!doc": "Fill color in the following format: #ffffff (hex triplet). Default is #ffffff.",
|
|
423
|
+
"!type": "string"
|
|
424
|
+
},
|
|
425
|
+
opacity: {
|
|
426
|
+
"!doc": "Opacity value, default is 0.5.",
|
|
427
|
+
"!type": "number"
|
|
428
|
+
},
|
|
429
|
+
stroke: {
|
|
430
|
+
"!doc": "Stroke color in the following format: #ffffff (hex triplet). Default is undefined (no stroke).",
|
|
431
|
+
"!type": "string"
|
|
432
|
+
},
|
|
433
|
+
strokeWidth: {
|
|
434
|
+
"!doc": "Stroke line width, default is 0.5.",
|
|
435
|
+
"!type": "number"
|
|
436
|
+
},
|
|
437
|
+
lineStyle: {
|
|
438
|
+
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
439
|
+
"!type": "string"
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
PolyStyle: {
|
|
443
|
+
fill: {
|
|
444
|
+
"!doc": "Fill color in any web format, default is #ffffff (white).",
|
|
445
|
+
"!type": "string"
|
|
446
|
+
},
|
|
447
|
+
opacity: {
|
|
448
|
+
"!doc": "Opacity value, default is 0.5.",
|
|
449
|
+
"!type": "number"
|
|
450
|
+
},
|
|
451
|
+
stroke: {
|
|
452
|
+
"!doc": "Stroke color in any web format, default is undefined (no stroke).",
|
|
453
|
+
"!type": "string"
|
|
454
|
+
},
|
|
455
|
+
strokeWidth: {
|
|
456
|
+
"!doc": "Stroke line width, default is 0.1.",
|
|
457
|
+
"!type": "number"
|
|
458
|
+
},
|
|
459
|
+
lineStyle: {
|
|
460
|
+
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
461
|
+
"!type": "string"
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
MapRectStyle: {
|
|
465
|
+
fill: {
|
|
466
|
+
"!doc": "Fill color in the following format: #ffffff (hex triplet). Default is #ffffff.",
|
|
467
|
+
"!type": "string"
|
|
468
|
+
},
|
|
469
|
+
opacity: {
|
|
470
|
+
"!doc": "Opacity value, default is 0.5.",
|
|
471
|
+
"!type": "number"
|
|
472
|
+
},
|
|
473
|
+
stroke: {
|
|
474
|
+
"!doc": "Stroke color in the following format: #ffffff (hex triplet). Default is undefined (no stroke).",
|
|
475
|
+
"!type": "string"
|
|
476
|
+
},
|
|
477
|
+
strokeWidth: {
|
|
478
|
+
"!doc": "Stroke line width, default is 0.5.",
|
|
479
|
+
"!type": "number"
|
|
480
|
+
},
|
|
481
|
+
lineStyle: {
|
|
482
|
+
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
483
|
+
"!type": "string"
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
MapPolyStyle: {
|
|
487
|
+
fill: {
|
|
488
|
+
"!doc": "Fill color in the following format: #ffffff (hex triplet). Default is #ffffff.",
|
|
489
|
+
"!type": "string"
|
|
490
|
+
},
|
|
491
|
+
opacity: {
|
|
492
|
+
"!doc": "Opacity value, default is 0.5.",
|
|
493
|
+
"!type": "number"
|
|
494
|
+
},
|
|
495
|
+
stroke: {
|
|
496
|
+
"!doc": "Stroke color in the following format: #ffffff (hex triplet). Default is #ffffff.",
|
|
497
|
+
"!type": "string"
|
|
498
|
+
},
|
|
499
|
+
strokeWidth: {
|
|
500
|
+
"!doc": "Stroke line width, default is 0.5.",
|
|
501
|
+
"!type": "number"
|
|
502
|
+
},
|
|
503
|
+
lineStyle: {
|
|
504
|
+
"!doc": "Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
505
|
+
"!type": "string"
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
TextStyle: {
|
|
509
|
+
color: {
|
|
510
|
+
"!doc": "Font color in any web format, default is #ffffff (white).",
|
|
511
|
+
"!type": "string"
|
|
512
|
+
},
|
|
513
|
+
font: {
|
|
514
|
+
"!doc": "Either a number or a string in one of the following forms:\n" +
|
|
515
|
+
"0.7 - relative size in game coordinates\n" +
|
|
516
|
+
"20px - absolute size in pixels\n" +
|
|
517
|
+
"0.7 serif\n" +
|
|
518
|
+
"bold italic 1.5 Times New Roman"
|
|
519
|
+
},
|
|
520
|
+
stroke: {
|
|
521
|
+
"!doc": "Stroke color in any web format, default is undefined (no stroke).",
|
|
522
|
+
"!type": "string"
|
|
523
|
+
},
|
|
524
|
+
strokeWidth: {
|
|
525
|
+
"!doc": "Stroke line width, default is 0.1.",
|
|
526
|
+
"!type": "number"
|
|
527
|
+
},
|
|
528
|
+
backgroundColor: {
|
|
529
|
+
"!doc": "Background color in any web format, default is undefined (no background). When background is enabled, text vertical align is set to middle (default is baseline).",
|
|
530
|
+
"!type": "string"
|
|
531
|
+
},
|
|
532
|
+
backgroundPadding: {
|
|
533
|
+
"!doc": "Background rectangle padding, default is 0.3.",
|
|
534
|
+
"!type": "number"
|
|
535
|
+
},
|
|
536
|
+
align: {
|
|
537
|
+
"!doc": "Text align, either center, left, or right. Default is center.",
|
|
538
|
+
"!type": "string"
|
|
539
|
+
},
|
|
540
|
+
opacity: {
|
|
541
|
+
"!doc": "Opacity value, default is 1.0.",
|
|
542
|
+
"!type": "number"
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
MapTextStyle: {
|
|
546
|
+
color: {
|
|
547
|
+
"!doc": "Font color in the following format: #ffffff (hex triplet). Default is #ffffff.",
|
|
548
|
+
"!type": "string"
|
|
549
|
+
},
|
|
550
|
+
fontFamily: {
|
|
551
|
+
"!doc": "The font family, default is sans-serif",
|
|
552
|
+
"!type": "string"
|
|
553
|
+
},
|
|
554
|
+
fontSize: {
|
|
555
|
+
"!doc": "The font size in game coordinates, default is 10",
|
|
556
|
+
"!type": "number"
|
|
557
|
+
},
|
|
558
|
+
fontStyle: {
|
|
559
|
+
"!doc": "The font style ('normal', 'italic' or 'oblique')",
|
|
560
|
+
"!type": "string"
|
|
561
|
+
},
|
|
562
|
+
fontVariant: {
|
|
563
|
+
"!doc": "The font variant ('normal' or 'small-caps')",
|
|
564
|
+
"!type": "string"
|
|
565
|
+
},
|
|
566
|
+
stroke: {
|
|
567
|
+
"!doc": "Stroke color in the following format: #ffffff (hex triplet). Default is undefined (no stroke).",
|
|
568
|
+
"!type": "string"
|
|
569
|
+
},
|
|
570
|
+
strokeWidth: {
|
|
571
|
+
"!doc": "Stroke line width, default is 0.15.",
|
|
572
|
+
"!type": "number"
|
|
573
|
+
},
|
|
574
|
+
backgroundColor: {
|
|
575
|
+
"!doc": "Background color in the following format: #ffffff (hex triplet). Default is undefined (no background). When background is enabled, text vertical align is set to middle (default is baseline).",
|
|
576
|
+
"!type": "string"
|
|
577
|
+
},
|
|
578
|
+
backgroundPadding: {
|
|
579
|
+
"!doc": "Background rectangle padding, default is 2.",
|
|
580
|
+
"!type": "number"
|
|
581
|
+
},
|
|
582
|
+
align: {
|
|
583
|
+
"!doc": "Text align, either center, left, or right. Default is center.",
|
|
584
|
+
"!type": "string"
|
|
585
|
+
},
|
|
586
|
+
opacity: {
|
|
587
|
+
"!doc": "Opacity value, default is 0.5.",
|
|
588
|
+
"!type": "number"
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
RoomObject: {
|
|
593
|
+
"!type": "fn()",
|
|
594
|
+
"!doc": "Any object with a position in a room. Almost all game objects prototypes are derived from RoomObject.",
|
|
595
|
+
prototype: {
|
|
596
|
+
pos: {
|
|
597
|
+
"!doc": "An object representing the position of this object in a room.",
|
|
598
|
+
"!type": "+RoomPosition"
|
|
599
|
+
},
|
|
600
|
+
room: {
|
|
601
|
+
"!doc": "The link to the Room object of this object. May be undefined in case if an object is a flag and is placed in a room that is not visible to you.",
|
|
602
|
+
"!type": "+Room"
|
|
603
|
+
},
|
|
604
|
+
effects: {
|
|
605
|
+
"!doc": "Applied effects, an array of objects.",
|
|
606
|
+
"!type": "[Effect]"
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
Store: {
|
|
611
|
+
"!type": "fn()",
|
|
612
|
+
"!doc": "An object that can contain resources in its cargo.",
|
|
613
|
+
prototype: {
|
|
614
|
+
getCapacity: {
|
|
615
|
+
"!doc": "Returns capacity of this store for the specified resource, or total capacity if resource is undefined.\n\nReturns capacity number, or null in case of a not valid resource for this store type.\n\nArguments:\n* resource (optional) - The type of the resource.",
|
|
616
|
+
"!type": "fn(resource?: string) -> number"
|
|
617
|
+
},
|
|
618
|
+
getFreeCapacity: {
|
|
619
|
+
"!doc": "A shorthand for getCapacity(resource) - getUsedCapacity(resource).\n\nArguments:\n* resource (optional) - The type of the resource.",
|
|
620
|
+
"!type": "fn(resource?: string) -> number"
|
|
621
|
+
},
|
|
622
|
+
getUsedCapacity: {
|
|
623
|
+
"!doc": "Returns the capacity used by the specified resource, or total used capacity for general purpose stores if resource is undefined.\n\nReturns used capacity number, or null in case of a not valid resource for this store type.\n\nArguments:\n* resource (optional) - The type of the resource.",
|
|
624
|
+
"!type": "fn(resource?: string) -> number"
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
_extend(def_screeps, {
|
|
630
|
+
Structure: {
|
|
631
|
+
"!type": "fn()",
|
|
632
|
+
"!doc": "Creeps are your units. Creeps can move, harvest energy, construct structures, attack another creeps, and perform other actions.",
|
|
633
|
+
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
634
|
+
id: {
|
|
635
|
+
"!type": "string",
|
|
636
|
+
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
637
|
+
},
|
|
638
|
+
hits: {
|
|
639
|
+
"!doc": "The current amount of hit points of the structure.",
|
|
640
|
+
"!type": "number"
|
|
641
|
+
},
|
|
642
|
+
hitsMax: {
|
|
643
|
+
"!doc": "The total amount of hit points of the structure.",
|
|
644
|
+
"!type": "number"
|
|
645
|
+
},
|
|
646
|
+
structureType: {
|
|
647
|
+
"!doc": "One of the STRUCTURE_* constants.",
|
|
648
|
+
"!type": "string"
|
|
649
|
+
},
|
|
650
|
+
destroy: {
|
|
651
|
+
"!doc": "Destroy this structure immediately. You are not allowed to destroy a structure when there are hostile creeps in the room.\n\nCPU cost: CONST",
|
|
652
|
+
"!type": "fn() -> number"
|
|
653
|
+
},
|
|
654
|
+
notifyWhenAttacked: {
|
|
655
|
+
"!doc": "Toggle auto notification when the structure is under attack. The notification will be sent to your account email. Turned on by default.\n\nArguments:\n* enabled - Whether to enable notification or disable.\n\nCPU cost: CONST",
|
|
656
|
+
"!type": "fn(enabled: bool) -> number"
|
|
657
|
+
},
|
|
658
|
+
isActive: {
|
|
659
|
+
"!doc": "Check whether this structure can be used. If the room controller level is not enough, then this method will return false, and the structure will be highlighted with red in the game.\n\nCPU cost: LOW",
|
|
660
|
+
"!type": "fn() -> bool"
|
|
661
|
+
},
|
|
662
|
+
|
|
663
|
+
})
|
|
664
|
+
},
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
_extend(def_screeps, {
|
|
668
|
+
OwnedStructure: {
|
|
669
|
+
"!type": "fn()",
|
|
670
|
+
"!doc": "The base prototype for a structure that has an owner. Such structures can be found using FIND_MY_STRUCTURES and FIND_HOSTILE_STRUCTURES constants.",
|
|
671
|
+
prototype: _extend({}, def_screeps.Structure.prototype, {
|
|
672
|
+
my: {
|
|
673
|
+
"!type": "bool",
|
|
674
|
+
"!doc": "Whether it is your own structure."
|
|
675
|
+
},
|
|
676
|
+
owner: {
|
|
677
|
+
"!": "An object with the owner info",
|
|
678
|
+
username: {
|
|
679
|
+
"!doc": "The name of the owner user.",
|
|
680
|
+
"!type": "string"
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
})
|
|
684
|
+
},
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
_extend(def_screeps, {
|
|
688
|
+
ConstructionSite: {
|
|
689
|
+
"!type": "fn()",
|
|
690
|
+
"!doc": "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() method. Construction sites are visible to their owners only.\n\nTo build a structure on the construction site, give a worker creep some amount of energy and perform Creep.build() action.",
|
|
691
|
+
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
692
|
+
id: {
|
|
693
|
+
"!type": "string",
|
|
694
|
+
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
695
|
+
},
|
|
696
|
+
my: {
|
|
697
|
+
"!type": "bool",
|
|
698
|
+
"!doc": "Whether it is your own construction site."
|
|
699
|
+
},
|
|
700
|
+
owner: {
|
|
701
|
+
"!doc": "An object with the owner info",
|
|
702
|
+
username: {
|
|
703
|
+
"!doc": "The name of the owner user.",
|
|
704
|
+
"!type": "string"
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
progress: {
|
|
708
|
+
"!doc": "The current construction progress.",
|
|
709
|
+
"!type": "number"
|
|
710
|
+
},
|
|
711
|
+
progressTotal: {
|
|
712
|
+
"!doc": "The total construction progress needed for the structure to be built.",
|
|
713
|
+
"!type": "number"
|
|
714
|
+
},
|
|
715
|
+
structureType: {
|
|
716
|
+
"!doc": "One of the STRUCTURE_* constants.",
|
|
717
|
+
"!type": "string"
|
|
718
|
+
},
|
|
719
|
+
remove: {
|
|
720
|
+
"!doc": "Remove the construction site.\n\nCPU cost: CONST",
|
|
721
|
+
"!type": "fn() -> number"
|
|
722
|
+
}
|
|
723
|
+
})
|
|
724
|
+
},
|
|
725
|
+
Creep: {
|
|
726
|
+
"!type": "fn()",
|
|
727
|
+
"!doc": "Creeps are your units. Creeps can move, harvest energy, construct structures, attack another creeps, and perform other actions.",
|
|
728
|
+
prototype: _extend({}, _docs.store, def_screeps.RoomObject.prototype, {
|
|
729
|
+
body: {
|
|
730
|
+
"!doc": "An array describing the creep’s body.",
|
|
731
|
+
"!type": "[BodyPart]",
|
|
732
|
+
"!url": "http://docs.screeps.com/api/#Creep.body"
|
|
733
|
+
},
|
|
734
|
+
fatigue: {
|
|
735
|
+
"!type": "number",
|
|
736
|
+
"!doc": "The movement fatigue indicator. If it is greater than zero, the creep cannot move.",
|
|
737
|
+
},
|
|
738
|
+
hits: {
|
|
739
|
+
"!type": "number",
|
|
740
|
+
"!doc": "The current amount of hit points of the creep.",
|
|
741
|
+
},
|
|
742
|
+
hitsMax: {
|
|
743
|
+
"!type": "number",
|
|
744
|
+
"!doc": "The maximum amount of hit points of the creep.",
|
|
745
|
+
},
|
|
746
|
+
id: {
|
|
747
|
+
"!type": "string",
|
|
748
|
+
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
749
|
+
},
|
|
750
|
+
memory: {
|
|
751
|
+
"!doc": "A shorthand to `Memory.creeps[creep.name]`. You can use it for quick access the creep’s specific memory data object.",
|
|
752
|
+
},
|
|
753
|
+
my: {
|
|
754
|
+
"!type": "bool",
|
|
755
|
+
"!doc": "Whether it is your creep or foe."
|
|
756
|
+
},
|
|
757
|
+
name: {
|
|
758
|
+
"!doc": "Creep's name. You can choose the name while creating a new creep, and it cannot be changed later. This name is a hash key to access the creep via the `Game.creeps` object.",
|
|
759
|
+
"!type": "string"
|
|
760
|
+
},
|
|
761
|
+
owner: {
|
|
762
|
+
"!doc": "An object with the owner info",
|
|
763
|
+
username: {
|
|
764
|
+
"!doc": "The name of the owner user.",
|
|
765
|
+
"!type": "string"
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
spawning: {
|
|
769
|
+
"!doc": "Whether this creep is still being spawned.",
|
|
770
|
+
"!type": "bool"
|
|
771
|
+
},
|
|
772
|
+
ticksToLive: {
|
|
773
|
+
"!doc": "The remaining amount of game ticks after which the creep will die.",
|
|
774
|
+
"!type": "number"
|
|
775
|
+
},
|
|
776
|
+
attack: {
|
|
777
|
+
"!type": "fn(target: object) -> number",
|
|
778
|
+
"!doc": "Attack another creep or structure in a short-ranged attack. Requires the ATTACK body part. If the target is inside a rampart, then the rampart is attacked instead. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target object to be attacked.\n\nCPU cost: CONST"
|
|
779
|
+
},
|
|
780
|
+
build: {
|
|
781
|
+
"!doc": "Build a structure at the target construction site using carried energy. Requires WORK and CARRY body parts. The target has to be within 3 squares range of the creep.\n\nArguments:\n* target - The target construction site to be built.\n\nCPU cost:CONST",
|
|
782
|
+
"!type": "fn(target: +ConstructionSite) -> number"
|
|
783
|
+
},
|
|
784
|
+
cancelOrder: {
|
|
785
|
+
"!doc": "Cancel the order given during the current game tick.\n\nArguments:\n* methodName - The name of a creep's method to be cancelled.\n\nCPU cost:NONE",
|
|
786
|
+
"!type": "fn(methodName: string) -> number"
|
|
787
|
+
},
|
|
788
|
+
claimController: {
|
|
789
|
+
"!doc": "Claims a neutral controller under your control. Requires the CLAIM body part. \n\nArguments:\n* target - The target controller object.\n\nCPU cost: CONST",
|
|
790
|
+
"!type": "fn(target: +Structure) -> number"
|
|
791
|
+
},
|
|
792
|
+
attackController: {
|
|
793
|
+
"!doc": "Decreases the controller's downgrade or reservation timer for 1 tick per every 5 CLAIM body parts (so the creep must have at least 5xCLAIM). The controller under attack cannot be upgraded for the next 1,000 ticks. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target controller object.\n\nCPU cost: CONST",
|
|
794
|
+
"!type": "fn(target: +Structure) -> number"
|
|
795
|
+
},
|
|
796
|
+
getActiveBodyparts: {
|
|
797
|
+
"!doc": "Get the quantity of live body parts of the given type. Fully damaged parts do not count.\n\nArguments:\n* type - A body part type, one of the body part constants.\n\nCPU cost: NONE",
|
|
798
|
+
"!type": "fn(type: string) -> number"
|
|
799
|
+
},
|
|
800
|
+
harvest: {
|
|
801
|
+
"!doc": "Harvest energy from the source. Requires the WORK body part. If the creep has an empty CARRY body part, the harvested energy is put into it; otherwise it is dropped on the ground. The target has to be at an adjacent square to the creep. You cannot harvest a source if the room controller is owned or reserved by another player.\n\nArguments:\n* target - The source object to be harvested.\n\nCPU cost: CONST",
|
|
802
|
+
"!type": "fn(target: +Source) -> number"
|
|
803
|
+
},
|
|
804
|
+
heal: {
|
|
805
|
+
"!doc": "Heal self or another creep. It will restore the target creep’s damaged body parts function and increase the hits counter. Requires the HEAL body part. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target creep object.\n\nCPU cost: CONST",
|
|
806
|
+
"!type": "fn(target: +Creep) -> number"
|
|
807
|
+
},
|
|
808
|
+
move: {
|
|
809
|
+
"!doc": "Move the creep one square in the specified direction. Requires the MOVE body part.\n\nArguments:\n* direction - One of the direction constants.\n\nCPU cost: CONST",
|
|
810
|
+
"!type": "fn(direction: number) -> number"
|
|
811
|
+
},
|
|
812
|
+
moveByPath: {
|
|
813
|
+
"!doc": "Move the creep using the specified predefined path. Requires the MOVE body part.\n\nArguments:\n* path - A path value as returned from `Room.findPath`, `RoomPosition.findPathTo`, or `PathFinder.search` methods. Both array form and serialized string form are accepted.\n\nCPU cost: CONST",
|
|
814
|
+
"!type": "fn(path: Path) -> number"
|
|
815
|
+
},
|
|
816
|
+
moveTo: {
|
|
817
|
+
"!doc": "Syntax:\nmoveTo(x, y, [opts])\nmoveTo(target, [opts])\n\nFind the optimal path to the target within the same room and move to it. A shorthand to consequent calls of pos.findPathTo() and move() methods. If the target is in another room, then the corresponding exit will be used as a target. Requires the MOVE body part.\n\nArguments:\n* x - X position of the target in the same room.\n* y - Y position of the target in the same room.\n* target - Can be a RoomPosition object or any object containing RoomPosition. The position doesn't have to be in the same room.\n* opts (optional) - An object containing pathfinding options flags (see Room.findPath for more info) or one of the following:\n - reusePath - This option enables reusing the path found along multiple game ticks. It allows to save CPU time, but can result in a slightly slower creep reaction behavior. The path is stored into the creep's memory to the _move property. The reusePath value defines the amount of ticks which the path should be reused for. The default value is 5. Increase the amount to save more CPU, decrease to make the movement more consistent. Set to 0 if you want to disable path reusing.\n - serializeMemory - If reusePath is enabled and this option is set to true, the path will be stored in memory in the short serialized form using Room.serializePath. The default value is true.\n - noPathFinding - If this option is set to true, moveTo method will return ERR_NOT_FOUND if there is no memorized path to reuse. This can significantly save CPU time in some cases. The default value is false.\n - visualizePathStyle - draw a line along the creep’s path using RoomVisual.poly. You can provide either an empty object or custom style parameters.\n\nCPU cost: HIGH",
|
|
818
|
+
"!type": "fn(arg1: ?, arg2?: ?, arg3?: ?) -> number"
|
|
819
|
+
},
|
|
820
|
+
notifyWhenAttacked: {
|
|
821
|
+
"!doc": "Toggle auto notification when the creep is under attack. The notification will be sent to your account email. Turned on by default.\n\nArguments:\n* enabled - Whether to enable notification or disable.\n\nCPU cost: CONST",
|
|
822
|
+
"!type": "fn(enabled: bool) -> number"
|
|
823
|
+
},
|
|
824
|
+
pickup: {
|
|
825
|
+
"!doc": "Pick up an item (a dropped piece of energy). Requires the CARRY body part. The target has to be at adjacent square to the creep or at the same square.\n\nArguments:\n* target - The target object to be picked up.\n\nCPU cost: CONST",
|
|
826
|
+
"!type": "fn(target: +Resource) -> number"
|
|
827
|
+
},
|
|
828
|
+
rangedAttack: {
|
|
829
|
+
"!doc": "A ranged attack against another creep or structure. Requires the RANGED_ATTACK body part. If the target is inside a rampart, the rampart is attacked instead. The target has to be within 3 squares range of the creep.\n\nArguments:\n* target - The target object to be attacked.\n\nCPU cost: CONST",
|
|
830
|
+
"!type": "fn(target: object) -> number"
|
|
831
|
+
},
|
|
832
|
+
rangedHeal: {
|
|
833
|
+
"!doc": "Heal another creep at a distance. It will restore the target creep’s damaged body parts function and increase the hits counter. Requires the HEAL body part. The target has to be within 3 squares range of the creep.\n\nArguments:\n* target - The target creep object.\n\nCPU cost: CONST",
|
|
834
|
+
"!type": "fn(target: +Creep) -> number"
|
|
835
|
+
},
|
|
836
|
+
rangedMassAttack: {
|
|
837
|
+
"!doc": "A ranged attack against all hostile creeps or structures within 3 squares range. Requires the RANGED_ATTACK body part. The attack power depends on the range to each target. Friendly units are not affected.\n\nCPU cost: CONST",
|
|
838
|
+
"!type": "fn() -> number"
|
|
839
|
+
},
|
|
840
|
+
repair: {
|
|
841
|
+
"!doc": "Repair a damaged structure using carried energy. Requires the WORK and CARRY body parts. The target has to be within 3 squares range of the creep.\n\nArguments:\n* target - The target structure to be repaired.\n\nCPU cost: CONST",
|
|
842
|
+
"!type": "fn(target: object) -> number"
|
|
843
|
+
},
|
|
844
|
+
reserveController: {
|
|
845
|
+
"!doc": "Temporarily block a neutral controller from claiming by other players. Each tick, this command increases the counter of the period during which the controller is unavailable by 1 tick per each CLAIM body part. The maximum reservation period to maintain is 5,000 ticks. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target controller object to be reserved.\n\nCPU cost: CONST",
|
|
846
|
+
"!type": "fn(target: +StructureController) -> number"
|
|
847
|
+
},
|
|
848
|
+
signController: {
|
|
849
|
+
"!doc": "Sign a controller with a random text visible to all players. This text will appear in the room UI, in the world map, and can be accessed via the API. You can sign unowned and hostile controllers. The target has to be at adjacent square to the creep. Pass an empty string to remove the sign.\n\nArguments:\n* target - The target controller object to be signed.\n* text - The sign text. The maximum text length is 100 characters.\n\nCPU cost: CONST",
|
|
850
|
+
"!type": "fn(target: +StructureController, target: string) -> number"
|
|
851
|
+
},
|
|
852
|
+
say: {
|
|
853
|
+
"!doc": "Display a visual speech balloon above the creep with the specified message. The message will be available for one tick. You can read the last message using the `saying` property.\n\nArguments:\n* message - The message to be displayed. Maximum length is 10 characters.\n* public (optional) - Set to true to allow other players to see this message. Default is false.\n\nCPU cost: NONE",
|
|
854
|
+
"!type": "fn(message: string, public?: boolean) -> number"
|
|
855
|
+
},
|
|
856
|
+
saying: {
|
|
857
|
+
"!doc": "The text message that the creep was saying at the last tick.",
|
|
858
|
+
"!type": "string"
|
|
859
|
+
},
|
|
860
|
+
suicide: {
|
|
861
|
+
"!doc": "Kill the creep immediately.\n\nCPU cost: CONST",
|
|
862
|
+
"!type": "fn() -> number"
|
|
863
|
+
},
|
|
864
|
+
upgradeController: {
|
|
865
|
+
"!doc": "Upgrade your controller to the next level using carried energy. Upgrading controllers raises your Global Control Level in parallel. Requires WORK and CARRY body parts. The target has to be within 3 squares range of the creep. A fully upgraded level 8 controller can't be upgraded with the power over 15 energy units per tick regardless of creeps power. The cumulative effect of all the creeps performing upgradeController in the current tick is taken into account. This limit can be increased by using ghodium mineral boost.\n\nArguments:\n* target - The target controller object to be upgraded.\n\nCPU cost: CONST",
|
|
866
|
+
"!type": "fn(target: +Structure) -> number"
|
|
867
|
+
},
|
|
868
|
+
drop: {
|
|
869
|
+
"!doc": "Drop resource on the ground.\n\nArguments:\n* resourceType - One of the RESOURCE_* constants.\n* amount - The amount of resource units to be dropped.\n\nCPU cost: CONST",
|
|
870
|
+
"!type": "fn(resourceType: string, amount?: number) -> number"
|
|
871
|
+
},
|
|
872
|
+
transfer: {
|
|
873
|
+
"!doc": "Transfer resource from the creep to another creep, storage, or power spawn. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target object.\n* resourceType - One of the RESOURCE_* constants.\n* amount (optional) - The amount of resources to be transferred. If omitted, all the available carried amount is used.\n\nCPU cost: CONST",
|
|
874
|
+
"!type": "fn(target: object, resourceType: string, amount?: number) -> number"
|
|
875
|
+
},
|
|
876
|
+
dismantle: {
|
|
877
|
+
"!type": "fn(target: +Structure) -> number",
|
|
878
|
+
"!doc": "Dismantles any (even hostile) structure returning 50% of the energy spent on its repair. Requires the WORK body part. If the creep has an empty CARRY body part, the energy is put into it; otherwise it is dropped on the ground. The target has to be at adjacent square to the creep.\n\nArguments:\n* target - The target structure.\n\nCPU cost: CONST"
|
|
879
|
+
},
|
|
880
|
+
withdraw: {
|
|
881
|
+
"!doc": "Withdraw resources from a structure. The target has to be at adjacent square to the creep. Multiple creeps can withdraw from the same structure in the same tick. Your creeps can withdraw resources from hostile structures as well, in case if there is no hostile rampart on top of it.\n\nArguments:\n* target - The target object.\n* resourceType - One of the RESOURCE_* constants.\n* amount (optional) - The amount of resources to be transferred. If omitted, all the available amount is used.\n\nCPU cost: CONST",
|
|
882
|
+
"!type": "fn(target: +Structure, resourceType: string, amount?: number) -> number"
|
|
883
|
+
},
|
|
884
|
+
generateSafeMode: {
|
|
885
|
+
"!doc": "Add one more available safe mode activation to a room controller. The creep has to be at adjacent square to the target room controller and have 1000 ghodium resource.\n\nArguments:\n* target - The target room controller.\n\nCPU cost: CONST",
|
|
886
|
+
"!type": "fn(target: +StructureController) -> number"
|
|
887
|
+
}
|
|
888
|
+
})
|
|
889
|
+
},
|
|
890
|
+
PowerCreep: {
|
|
891
|
+
"!type": "fn()",
|
|
892
|
+
"!doc": "Power Creeps are immortal \"heroes\" that are tied to your account and can be respawned in any PowerSpawn after death.",
|
|
893
|
+
prototype: _extend({}, _docs.store, def_screeps.RoomObject.prototype, {
|
|
894
|
+
cancelOrder: {
|
|
895
|
+
"!doc": "Cancel the order given during the current game tick.\n\nArguments:\n* methodName - The name of a power creep's method to be cancelled.\n\nCPU cost:NONE",
|
|
896
|
+
"!type": "fn(methodName: string) -> number"
|
|
897
|
+
},
|
|
898
|
+
className: {
|
|
899
|
+
"!type": "string",
|
|
900
|
+
"!doc": "The power creep's class, one of the POWER_CLASS constants."
|
|
901
|
+
},
|
|
902
|
+
delete: {
|
|
903
|
+
"!doc": "Delete the power creep permanently from your account. It should NOT be spawned in the world. The creep is not deleted immediately, but a 24-hours delete timer is started instead (see deleteTime). You can cancel deletion by calling delete(true).",
|
|
904
|
+
"!type": "fn(cancel?: boolean) -> number"
|
|
905
|
+
},
|
|
906
|
+
deleteTime: {
|
|
907
|
+
"!type": "number",
|
|
908
|
+
"!doc": "A timestamp when this creep is marked to be permanently deleted from the account, or undefined otherwise.",
|
|
909
|
+
},
|
|
910
|
+
drop: {
|
|
911
|
+
"!doc": "Drop resource on the ground.\n\nArguments:\n* resourceType - One of the RESOURCE_* constants.\n* amount - The amount of resource units to be dropped.\n\nCPU cost: CONST",
|
|
912
|
+
"!type": "fn(resourceType: string, amount?: number) -> number"
|
|
913
|
+
},
|
|
914
|
+
enableRoom: {
|
|
915
|
+
"!doc": "Enable powers usage in this room.\n\nArguments:\n* controller - The room controller.\n\nCPU cost: CONST",
|
|
916
|
+
"!type": "fn(controller: +StructureController) -> number"
|
|
917
|
+
},
|
|
918
|
+
hits: {
|
|
919
|
+
"!type": "number",
|
|
920
|
+
"!doc": "The current amount of hit points of the power creep.",
|
|
921
|
+
},
|
|
922
|
+
hitsMax: {
|
|
923
|
+
"!type": "number",
|
|
924
|
+
"!doc": "The maximum amount of hit points of the power creep.",
|
|
925
|
+
},
|
|
926
|
+
id: {
|
|
927
|
+
"!type": "string",
|
|
928
|
+
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
929
|
+
},
|
|
930
|
+
level: {
|
|
931
|
+
"!type": "number",
|
|
932
|
+
"!doc": "The power creep's level.",
|
|
933
|
+
},
|
|
934
|
+
memory: {
|
|
935
|
+
"!doc": "A shorthand to `Memory.powerCreeps[creep.name]`. You can use it for quick access the power creep’s specific memory data object.",
|
|
936
|
+
},
|
|
937
|
+
move: {
|
|
938
|
+
"!doc": "Move the power creep one square in the specified direction.\n\nArguments:\n* direction - One of the direction constants.\n\nCPU cost: CONST",
|
|
939
|
+
"!type": "fn(direction: number) -> number"
|
|
940
|
+
},
|
|
941
|
+
moveByPath: {
|
|
942
|
+
"!doc": "Move the power creep using the specified predefined path.\n\nArguments:\n* path - A path value as returned from `Room.findPath`, `RoomPosition.findPathTo`, or `PathFinder.search` methods. Both array form and serialized string form are accepted.\n\nCPU cost: CONST",
|
|
943
|
+
"!type": "fn(path: Path) -> number"
|
|
944
|
+
},
|
|
945
|
+
moveTo: {
|
|
946
|
+
"!doc": "Syntax:\nmoveTo(x, y, [opts])\nmoveTo(target, [opts])\n\nFind the optimal path to the target within the same room and move to it.\n\nArguments:\n* x - X position of the target in the same room.\n* y - Y position of the target in the same room.\n* target - Can be a RoomPosition object or any object containing RoomPosition. The position doesn't have to be in the same room.\n* opts (optional) - An object containing pathfinding options flags (see Room.findPath for more info) or one of the following:\n - reusePath - This option enables reusing the path found along multiple game ticks. It allows to save CPU time, but can result in a slightly slower creep reaction behavior. The path is stored into the creep's memory to the _move property. The reusePath value defines the amount of ticks which the path should be reused for. The default value is 5. Increase the amount to save more CPU, decrease to make the movement more consistent. Set to 0 if you want to disable path reusing.\n - serializeMemory - If reusePath is enabled and this option is set to true, the path will be stored in memory in the short serialized form using Room.serializePath. The default value is true.\n - noPathFinding - If this option is set to true, moveTo method will return ERR_NOT_FOUND if there is no memorized path to reuse. This can significantly save CPU time in some cases. The default value is false.\n - visualizePathStyle - draw a line along the creep’s path using RoomVisual.poly. You can provide either an empty object or custom style parameters.\n\nCPU cost: HIGH",
|
|
947
|
+
"!type": "fn(arg1: ?, arg2?: ?, arg3?: ?) -> number"
|
|
948
|
+
},
|
|
949
|
+
my: {
|
|
950
|
+
"!type": "bool",
|
|
951
|
+
"!doc": "Whether it is your power creep or foe."
|
|
952
|
+
},
|
|
953
|
+
name: {
|
|
954
|
+
"!doc": "Power creep's name. You can choose the name while creating a new power creep, and it cannot be changed later. This name is a hash key to access the creep via the `Game.powerCreeps` object.",
|
|
955
|
+
"!type": "string"
|
|
956
|
+
},
|
|
957
|
+
notifyWhenAttacked: {
|
|
958
|
+
"!doc": "Toggle auto notification when the power creep is under attack. The notification will be sent to your account email. Turned on by default.\n\nArguments:\n* enabled - Whether to enable notification or disable.\n\nCPU cost: CONST",
|
|
959
|
+
"!type": "fn(enabled: bool) -> number"
|
|
960
|
+
},
|
|
961
|
+
owner: {
|
|
962
|
+
"!doc": "An object with the owner info",
|
|
963
|
+
username: {
|
|
964
|
+
"!doc": "The name of the owner user.",
|
|
965
|
+
"!type": "string"
|
|
966
|
+
}
|
|
967
|
+
},
|
|
968
|
+
pickup: {
|
|
969
|
+
"!doc": "Pick up an item (a dropped piece of energy). The target has to be at adjacent square to the creep or at the same square.\n\nArguments:\n* target - The target object to be picked up.\n\nCPU cost: CONST",
|
|
970
|
+
"!type": "fn(target: +Resource) -> number"
|
|
971
|
+
},
|
|
972
|
+
rename: {
|
|
973
|
+
"!doc": "Rename the power creep. It must not be spawned in the world.\n\nArguments:\n* name - The new name of the power creep.\n\nCPU cost: NONE",
|
|
974
|
+
"!type": "fn(name: string) -> number"
|
|
975
|
+
},
|
|
976
|
+
renew: {
|
|
977
|
+
"!doc": "Instantly restore time to live to the maximum using a Power Spawn or a Power Bank nearby.\n\nArguments:\n* target - The target structure\n\nCPU cost: CONST",
|
|
978
|
+
"!type": "fn(target: object) -> number"
|
|
979
|
+
},
|
|
980
|
+
powers: {
|
|
981
|
+
"!doc": "Available powers, an object with power ID as a key",
|
|
982
|
+
"!type": "[+Power]"
|
|
983
|
+
},
|
|
984
|
+
say: {
|
|
985
|
+
"!doc": "Display a visual speech balloon above the power creep with the specified message. The message will be available for one tick. You can read the last message using the `saying` property.\n\nArguments:\n* message - The message to be displayed. Maximum length is 10 characters.\n* public (optional) - Set to true to allow other players to see this message. Default is false.\n\nCPU cost: NONE",
|
|
986
|
+
"!type": "fn(message: string, public?: boolean) -> number"
|
|
987
|
+
},
|
|
988
|
+
saying: {
|
|
989
|
+
"!doc": "The text message that the power creep was saying at the last tick.",
|
|
990
|
+
"!type": "string"
|
|
991
|
+
},
|
|
992
|
+
shard: {
|
|
993
|
+
"!doc": "The name of the shard where the power creep is spawned, or undefined.",
|
|
994
|
+
"!type": "string"
|
|
995
|
+
},
|
|
996
|
+
spawn: {
|
|
997
|
+
"!doc": "Spawn this power creep in the specified Power Spawn.\n\nArguments:\n* powerSpawn - Your Power Spawn structure.\n\nCPU cost: CONST",
|
|
998
|
+
"!type": "fn(powerSpawn: +StructurePowerSpawn) -> number"
|
|
999
|
+
},
|
|
1000
|
+
spawnCooldownTime: {
|
|
1001
|
+
"!doc": "The timestamp when spawning or deleting this creep will become available. Undefined if the power creep is spawned in the world.",
|
|
1002
|
+
"!type": "number"
|
|
1003
|
+
},
|
|
1004
|
+
suicide: {
|
|
1005
|
+
"!doc": "Kill the power creep immediately. It will not be destroyed permanently, but will become unspawned, so that you can spawn it again.\n\nCPU cost: CONST",
|
|
1006
|
+
"!type": "fn() -> number"
|
|
1007
|
+
},
|
|
1008
|
+
ticksToLive: {
|
|
1009
|
+
"!doc": "The remaining amount of game ticks after which the creep will die and become unspawned. Undefined if the creep is not spawned in the world.",
|
|
1010
|
+
"!type": "number"
|
|
1011
|
+
},
|
|
1012
|
+
transfer: {
|
|
1013
|
+
"!doc": "Transfer resource from the power creep to another power creep, creep, or structure. The target has to be at adjacent square to the power creep.\n\nArguments:\n* target - The target object.\n* resourceType - One of the RESOURCE_* constants.\n* amount (optional) - The amount of resources to be transferred. If omitted, all the available carried amount is used.\n\nCPU cost: CONST",
|
|
1014
|
+
"!type": "fn(target: object, resourceType: string, amount?: number) -> number"
|
|
1015
|
+
},
|
|
1016
|
+
upgrade: {
|
|
1017
|
+
"!doc": "Upgrade the creep, adding a new power ability to it or increasing level of the existing power. You need one free Power Level in your account to perform this action.\n\nArguments:\n* power - The power ability to upgrade, one of the PWR_* constants.\n\nCPU cost: CONST",
|
|
1018
|
+
"!type": "fn(power: number) -> number"
|
|
1019
|
+
},
|
|
1020
|
+
usePower: {
|
|
1021
|
+
"!doc": "Apply one the creep's powers on the specified target. You can only use powers in rooms either without a controller, or with a power-enabled controller. Only one power can be used during the same tick, each usePower call will override the previous one. If the target has the same effect of a lower or equal level, it is overridden. If the existing effect level is higher, an error is returned.\n\nArguments:\n* power - The power ability to use, one of the PWR_* constants.\n* target - A target object in the room.\n\nCPU cost: CONST",
|
|
1022
|
+
"!type": "fn(power: number, target?: +RoomObject) -> number"
|
|
1023
|
+
},
|
|
1024
|
+
withdraw: {
|
|
1025
|
+
"!doc": "Withdraw resources from a structure, tombstone, or ruin. The target has to be at adjacent square to the power creep. Your power creeps can withdraw resources from hostile structures as well, in case if there is no hostile rampart on top of it.\n\nArguments:\n* target - The target object.\n* resourceType - One of the RESOURCE_* constants.\n* amount (optional) - The amount of resources to be transferred. If omitted, all the available amount is used.\n\nCPU cost: CONST",
|
|
1026
|
+
"!type": "fn(target: +Structure, resourceType: string, amount?: number) -> number"
|
|
1027
|
+
},
|
|
1028
|
+
}),
|
|
1029
|
+
create: {
|
|
1030
|
+
"!doc": "A static method to create new Power Creep instance in your account. It will be added in an unspawned state, use spawn method to spawn it in the world.\nYou need one free Power Level in your account to perform this action.\n\nArguments:\n* name - The name of the new power creep.\n* className - The class of the new power creep, one of the POWER_CLASS constants.\n\nCPU cost: CONST",
|
|
1031
|
+
"!type": "fn(name: string, className: string) -> number"
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
Resource: {
|
|
1035
|
+
"!type": "fn()",
|
|
1036
|
+
"!doc": "A dropped pile of resource units, either energy or power. Dropped energy pile decays for `ceil(amount/1000)` units per tick if not picked up.",
|
|
1037
|
+
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
1038
|
+
id: {
|
|
1039
|
+
"!type": "string",
|
|
1040
|
+
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
1041
|
+
},
|
|
1042
|
+
amount: {
|
|
1043
|
+
"!doc": "The amount of resource units containing.",
|
|
1044
|
+
"!type": "number"
|
|
1045
|
+
},
|
|
1046
|
+
resourceType: {
|
|
1047
|
+
"!doc": "One of the RESOURCE_* constants.",
|
|
1048
|
+
"!type": "string"
|
|
1049
|
+
}
|
|
1050
|
+
})
|
|
1051
|
+
},
|
|
1052
|
+
Flag: {
|
|
1053
|
+
"!type": "fn()",
|
|
1054
|
+
"!doc": "A flag. Flags can be used to mark particular spots in a room. Flags are visible to their owners only.",
|
|
1055
|
+
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
1056
|
+
color: {
|
|
1057
|
+
"!doc": "Primary color of the flag. One of the COLOR_* constants.",
|
|
1058
|
+
"!type": "string"
|
|
1059
|
+
},
|
|
1060
|
+
secondaryColor: {
|
|
1061
|
+
"!doc": "Secondary color of the flag. One of the COLOR_* constants.",
|
|
1062
|
+
"!type": "string"
|
|
1063
|
+
},
|
|
1064
|
+
memory: {
|
|
1065
|
+
"!doc": "A shorthand to Memory.flags[flag.name]. You can use it for quick access the flag's specific memory data object."
|
|
1066
|
+
},
|
|
1067
|
+
name: {
|
|
1068
|
+
"!doc": "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 spawn via the Game.flags object.",
|
|
1069
|
+
"!type": "string"
|
|
1070
|
+
},
|
|
1071
|
+
remove: {
|
|
1072
|
+
"!doc": "Remove the flag.\n\nCPU cost: CONST",
|
|
1073
|
+
"!type": "fn() -> number"
|
|
1074
|
+
},
|
|
1075
|
+
setColor: {
|
|
1076
|
+
"!doc": "Set new color of the flag\n\nArguments:\n* color - One of the COLOR_* constants\n* secondaryColor (optional) - One of the COLOR_* constants.\n\nCPU cost: CONST",
|
|
1077
|
+
"!type": "fn(color: string, secondaryColor: string) -> number"
|
|
1078
|
+
},
|
|
1079
|
+
setPosition: {
|
|
1080
|
+
"!doc": "Syntax:\nsetPosition(x,y)\nsetPosition(pos)\n\nSet new position of the flag.\n\nArguments:\n* x - The X position in the room.\n* y - The Y position in the room.\n* pos - Can be a RoomPosition object or any object containing RoomPosition.\n\nCPU cost: CONST",
|
|
1081
|
+
"!type": "fn(arg1: ?, arg2?: ?) -> number"
|
|
1082
|
+
}
|
|
1083
|
+
})
|
|
1084
|
+
},
|
|
1085
|
+
Source: {
|
|
1086
|
+
"!type": "fn()",
|
|
1087
|
+
"!doc": "An energy source object. Can be harvested by creeps with a WORK body part.",
|
|
1088
|
+
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
1089
|
+
id: {
|
|
1090
|
+
"!type": "string",
|
|
1091
|
+
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
1092
|
+
},
|
|
1093
|
+
energy: {
|
|
1094
|
+
"!doc": "The remaining amount of energy.",
|
|
1095
|
+
"!type": "number"
|
|
1096
|
+
},
|
|
1097
|
+
energyCapacity: {
|
|
1098
|
+
"!doc": "The total amount of energy in the source. Equals to 3000 in most cases.",
|
|
1099
|
+
"!type": "number"
|
|
1100
|
+
},
|
|
1101
|
+
ticksToRegeneration: {
|
|
1102
|
+
"!doc": "The remaining time after which the source will be refilled.",
|
|
1103
|
+
"!type": "number"
|
|
1104
|
+
}
|
|
1105
|
+
})
|
|
1106
|
+
},
|
|
1107
|
+
Mineral: {
|
|
1108
|
+
"!type": "fn()",
|
|
1109
|
+
"!doc": "A mineral deposit object. Can be harvested by creeps with a WORK body part using the extractor structure.",
|
|
1110
|
+
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
1111
|
+
id: {
|
|
1112
|
+
"!type": "string",
|
|
1113
|
+
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
1114
|
+
},
|
|
1115
|
+
mineralAmount: {
|
|
1116
|
+
"!doc": "The remaining amount of resource.",
|
|
1117
|
+
"!type": "number"
|
|
1118
|
+
},
|
|
1119
|
+
mineralType: {
|
|
1120
|
+
"!doc": "The resource type, one of the RESOURCE_* constants.",
|
|
1121
|
+
"!type": "string"
|
|
1122
|
+
},
|
|
1123
|
+
ticksToRegeneration: {
|
|
1124
|
+
"!doc": "The remaining time after which the deposit will be refilled.",
|
|
1125
|
+
"!type": "number"
|
|
1126
|
+
},
|
|
1127
|
+
density: {
|
|
1128
|
+
"!doc": "The density of this mineral deposit, one of the DENSITY_* constants.",
|
|
1129
|
+
"!type": "number"
|
|
1130
|
+
}
|
|
1131
|
+
})
|
|
1132
|
+
},
|
|
1133
|
+
Nuke: {
|
|
1134
|
+
"!type": "fn()",
|
|
1135
|
+
"!doc": "",
|
|
1136
|
+
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
1137
|
+
id: {
|
|
1138
|
+
"!type": "string",
|
|
1139
|
+
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
1140
|
+
},
|
|
1141
|
+
launchRoomName: {
|
|
1142
|
+
"!type": "string",
|
|
1143
|
+
"!doc": "The name of the room where this nuke has been launched from.",
|
|
1144
|
+
},
|
|
1145
|
+
timeToLand: {
|
|
1146
|
+
"!type": "number",
|
|
1147
|
+
"!doc": "The remaining landing time.",
|
|
1148
|
+
}
|
|
1149
|
+
})
|
|
1150
|
+
},
|
|
1151
|
+
|
|
1152
|
+
StructureContainer: {
|
|
1153
|
+
"!type": "fn()",
|
|
1154
|
+
"!doc": "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.",
|
|
1155
|
+
prototype: _extend({}, _docs.store, def_screeps.Structure.prototype, {
|
|
1156
|
+
ticksToDecay: {
|
|
1157
|
+
"!doc": "The amount of game ticks when this container will lose some hit points.",
|
|
1158
|
+
"!type": "number"
|
|
1159
|
+
}
|
|
1160
|
+
})
|
|
1161
|
+
},
|
|
1162
|
+
StructureController: {
|
|
1163
|
+
"!type": "fn()",
|
|
1164
|
+
"!doc": "Claim this structure to take control over the room. The controller structure cannot be damaged or destroyed. It can be addressed by Room.controller property.",
|
|
1165
|
+
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1166
|
+
isPowerEnabled: {
|
|
1167
|
+
"!doc": "Whether using power is enabled in this room. Use PowerCreep.enableRoom to turn powers on.",
|
|
1168
|
+
"!type": "number"
|
|
1169
|
+
},
|
|
1170
|
+
level: {
|
|
1171
|
+
"!doc": "Current controller level, from 0 to 8.",
|
|
1172
|
+
"!type": "number"
|
|
1173
|
+
},
|
|
1174
|
+
progress: {
|
|
1175
|
+
"!doc": "The current progress of upgrading the controller to the next level.",
|
|
1176
|
+
"!type": "number"
|
|
1177
|
+
},
|
|
1178
|
+
progressTotal: {
|
|
1179
|
+
"!doc": "The progress needed to reach the next level.",
|
|
1180
|
+
"!type": "number"
|
|
1181
|
+
},
|
|
1182
|
+
reservation: {
|
|
1183
|
+
"!doc": "An object with the controller reservation info if present.",
|
|
1184
|
+
username: {
|
|
1185
|
+
"!doc": "The name of a player who reserved this controller.",
|
|
1186
|
+
"!type": "string"
|
|
1187
|
+
},
|
|
1188
|
+
ticksToEnd: {
|
|
1189
|
+
"!doc": "The amount of game ticks when the reservation will end.",
|
|
1190
|
+
"!type": "number"
|
|
1191
|
+
}
|
|
1192
|
+
},
|
|
1193
|
+
sign: {
|
|
1194
|
+
"!doc": "An object with the controller sign info if present.",
|
|
1195
|
+
username: {
|
|
1196
|
+
"!doc": "The name of a player who signed this controller.",
|
|
1197
|
+
"!type": "string"
|
|
1198
|
+
},
|
|
1199
|
+
text: {
|
|
1200
|
+
"!doc": "The sign text.",
|
|
1201
|
+
"!type": "string"
|
|
1202
|
+
},
|
|
1203
|
+
time: {
|
|
1204
|
+
"!doc": "The sign time in game ticks.",
|
|
1205
|
+
"!type": "number"
|
|
1206
|
+
},
|
|
1207
|
+
datetime: {
|
|
1208
|
+
"!doc": "The sign real date.",
|
|
1209
|
+
"!type": "Date"
|
|
1210
|
+
}
|
|
1211
|
+
},
|
|
1212
|
+
ticksToDowngrade: {
|
|
1213
|
+
"!doc": "The amount of game ticks when this controller will lose one level. This timer can be reset by using Creep.upgradeController.",
|
|
1214
|
+
"!type": "number"
|
|
1215
|
+
},
|
|
1216
|
+
upgradeBlocked: {
|
|
1217
|
+
"!doc": "The amount of game ticks while this controller cannot be upgraded due to attack.",
|
|
1218
|
+
"!type": "number"
|
|
1219
|
+
},
|
|
1220
|
+
unclaim: {
|
|
1221
|
+
"!doc": "Make your claimed controller neutral again.\n\nCPU cost: CONST",
|
|
1222
|
+
"!type": "fn() -> number"
|
|
1223
|
+
},
|
|
1224
|
+
safeMode: {
|
|
1225
|
+
"!doc": "How many ticks of safe mode remaining, or undefined.",
|
|
1226
|
+
"!type": "number"
|
|
1227
|
+
},
|
|
1228
|
+
safeModeAvailable: {
|
|
1229
|
+
"!doc": "Safe mode activations available to use.",
|
|
1230
|
+
"!type": "number"
|
|
1231
|
+
},
|
|
1232
|
+
safeModeCooldown: {
|
|
1233
|
+
"!doc": "During this period in ticks new safe mode activations will be blocked, undefined if cooldown is inactive.",
|
|
1234
|
+
"!type": "number"
|
|
1235
|
+
},
|
|
1236
|
+
activateSafeMode: {
|
|
1237
|
+
"!doc": "Activate safe mode if available.\n\nArguments:\n* \n\nCPU cost: CONST",
|
|
1238
|
+
"!type": "fn() -> number"
|
|
1239
|
+
}
|
|
1240
|
+
})
|
|
1241
|
+
},
|
|
1242
|
+
StructureExtension: {
|
|
1243
|
+
"!type": "fn()",
|
|
1244
|
+
"!doc": "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.",
|
|
1245
|
+
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype)
|
|
1246
|
+
},
|
|
1247
|
+
StructureExtractor: {
|
|
1248
|
+
"!type": "fn()",
|
|
1249
|
+
"!doc": "Allows to harvest a mineral deposit.",
|
|
1250
|
+
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1251
|
+
cooldown: {
|
|
1252
|
+
"!doc": "The amount of game ticks until the next harvest action is possible.",
|
|
1253
|
+
"!type": "number"
|
|
1254
|
+
}
|
|
1255
|
+
})
|
|
1256
|
+
},
|
|
1257
|
+
StructureKeeperLair: {
|
|
1258
|
+
"!type": "fn()",
|
|
1259
|
+
"!doc": "Non-player structure. Spawns NPC Source Keepers that guards energy sources and minerals in some rooms. This structure cannot be destroyed.",
|
|
1260
|
+
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1261
|
+
ticksToSpawn: {
|
|
1262
|
+
"!doc": "Time to spawning of the next Source Keeper.",
|
|
1263
|
+
"!type": "number"
|
|
1264
|
+
},
|
|
1265
|
+
})
|
|
1266
|
+
},
|
|
1267
|
+
StructureLab: {
|
|
1268
|
+
"!type": "fn()",
|
|
1269
|
+
"!doc": "Produces mineral compounds from base minerals and boosts creeps.",
|
|
1270
|
+
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1271
|
+
cooldown: {
|
|
1272
|
+
"!doc": "The amount of game ticks the lab has to wait until the next reaction is possible.",
|
|
1273
|
+
"!type": "number"
|
|
1274
|
+
},
|
|
1275
|
+
mineralType: {
|
|
1276
|
+
"!doc": "The type of minerals containing in the lab. Labs can contain only one mineral type at the same time.",
|
|
1277
|
+
"!type": "number"
|
|
1278
|
+
},
|
|
1279
|
+
boostCreep: {
|
|
1280
|
+
"!doc": "Boosts creep body part using the containing mineral compound. The creep has to be at adjacent square to the lab. Boosting one body part consumes 30 mineral units and 20 energy units.\n\nArguments:\n* creep - The target creep.\n* bodyPartsCount (optional) - The number of body parts of the corresponding type to be boosted. Body parts are always counted left-to-right for TOUGH, and right-to-left for other types. If undefined, all the eligible body parts are boosted.\n\nCPU cost: CONST",
|
|
1281
|
+
"!type": "fn(creep: +Creep, bodyPartsCount?: number) -> number"
|
|
1282
|
+
},
|
|
1283
|
+
runReaction: {
|
|
1284
|
+
"!doc": "Produce mineral compounds using reagents from two another labs. Labs have to be within 2 squares range. Each reaction produces 10 mineral units and has a 10 ticks cooldown period. The same input labs can be used by many output labs.\n\nArguments:\n* lab1 - The first source lab.\n* lab2 - The second source lab.\n\nCPU cost: CONST",
|
|
1285
|
+
"!type": "fn(lab1: +Structure, lab2: +Structure) -> number"
|
|
1286
|
+
},
|
|
1287
|
+
unboostCreep: {
|
|
1288
|
+
"!doc": "Immediately remove boosts from the creep and drop 50% of the mineral compounds used to boost it onto the ground regardless of the creep's remaining time to live. The creep has to be at adjacent square to the lab. Unboosting requires cooldown time equal to the total sum of the reactions needed to produce all the compounds applied to the creep.\n\nArguments:\n* creep - The target creep.\n\nCPU cost: CONST",
|
|
1289
|
+
"!type": "fn(creep: +Creep) -> number"
|
|
1290
|
+
},
|
|
1291
|
+
})
|
|
1292
|
+
},
|
|
1293
|
+
StructureLink: {
|
|
1294
|
+
"!type": "fn()",
|
|
1295
|
+
"!doc": "Remotely transfers energy to another Link in the same room.",
|
|
1296
|
+
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1297
|
+
cooldown: {
|
|
1298
|
+
"!doc": "The amount of game ticks the link has to wait until the next transfer is possible.",
|
|
1299
|
+
"!type": "number"
|
|
1300
|
+
},
|
|
1301
|
+
transferEnergy: {
|
|
1302
|
+
"!doc": "Transfer energy from the link to another link or a creep. If the target is a creep, it has to be at adjacent square to the link. If the target is a link, it can be at any location in the same room. Remote transfer process implies 3% energy loss and cooldown delay depending on the distance.\n\nArguments:\n* target - The target object.\n* amount (optional) - The amount of energy to be transferred. If omitted, all the available energy is used.\n\nCPU cost: CONST",
|
|
1303
|
+
"!type": "fn(target: object, amount: number) -> number"
|
|
1304
|
+
},
|
|
1305
|
+
})
|
|
1306
|
+
},
|
|
1307
|
+
StructureObserver: {
|
|
1308
|
+
"!type": "fn()",
|
|
1309
|
+
"!doc": "Provides visibility into a distant room from your script.",
|
|
1310
|
+
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1311
|
+
observeRoom: {
|
|
1312
|
+
"!doc": "Provide visibility into a distant room from your script. The target room object will be available on the next tick. The maximum range is 5 rooms.\n\nArguments:\n* roomName - The name of the target room.\n\nCPU cost: CONST",
|
|
1313
|
+
"!type": "fn(roomName: string) -> number"
|
|
1314
|
+
},
|
|
1315
|
+
})
|
|
1316
|
+
},
|
|
1317
|
+
StructurePowerBank: {
|
|
1318
|
+
"!type": "fn()",
|
|
1319
|
+
"!doc": "Non-player structure. Contains power resource which can be obtained by destroying the structure. Hits the attacker creep back on each attack. ",
|
|
1320
|
+
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1321
|
+
power: {
|
|
1322
|
+
"!doc": "The amount of power containing.",
|
|
1323
|
+
"!type": "number"
|
|
1324
|
+
},
|
|
1325
|
+
ticksToDecay: {
|
|
1326
|
+
"!doc": "The amount of game ticks when this structure will disappear.",
|
|
1327
|
+
"!type": "number"
|
|
1328
|
+
},
|
|
1329
|
+
})
|
|
1330
|
+
},
|
|
1331
|
+
StructurePowerSpawn: {
|
|
1332
|
+
"!type": "fn()",
|
|
1333
|
+
"!doc": "Processes power into your account, and spawns power creeps with special unique powers (in development).",
|
|
1334
|
+
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1335
|
+
processPower: {
|
|
1336
|
+
"!doc": "Register power resource units into your account. Registered power allows to develop power creeps skills. Consumes 1 power resource unit and 50 energy resource units.\n\nCPU cost: CONST",
|
|
1337
|
+
"!type": "fn() -> number"
|
|
1338
|
+
}
|
|
1339
|
+
})
|
|
1340
|
+
},
|
|
1341
|
+
StructureRampart: {
|
|
1342
|
+
"!type": "fn()",
|
|
1343
|
+
"!doc": "Blocks movement of hostile creeps, and defends your creeps and structures on the same tile.",
|
|
1344
|
+
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1345
|
+
ticksToDecay: {
|
|
1346
|
+
"!doc": "The amount of game ticks when this rampart will lose some hit points.",
|
|
1347
|
+
"!type": "number"
|
|
1348
|
+
},
|
|
1349
|
+
isPublic: {
|
|
1350
|
+
"!doc": "If false (default), only your creeps can step on the same square. If true, any hostile creeps can pass through.",
|
|
1351
|
+
"!type": "bool"
|
|
1352
|
+
},
|
|
1353
|
+
setPublic: {
|
|
1354
|
+
"!doc": "Make this rampart public to allow other players' creeps to pass through.\n\nArguments:\n* isPublic - Whether this rampart should be public or non-public.\n\nCPU cost: CONST",
|
|
1355
|
+
"!type": "fn(isPublic) -> number"
|
|
1356
|
+
}
|
|
1357
|
+
})
|
|
1358
|
+
},
|
|
1359
|
+
StructureRoad: {
|
|
1360
|
+
"!type": "fn()",
|
|
1361
|
+
"!doc": "Decreases movement cost to 1. Using roads allows creating creeps with less MOVE body parts.",
|
|
1362
|
+
prototype: _extend({}, def_screeps.Structure.prototype, {
|
|
1363
|
+
ticksToDecay: {
|
|
1364
|
+
"!doc": "The amount of game ticks when this road will lose some hit points.",
|
|
1365
|
+
"!type": "number"
|
|
1366
|
+
},
|
|
1367
|
+
})
|
|
1368
|
+
},
|
|
1369
|
+
StructureStorage: {
|
|
1370
|
+
"!type": "fn()",
|
|
1371
|
+
"!doc": "A structure that can store huge amount of resource units. Only one structure per room is allowed that can be addressed by Room.storage property.",
|
|
1372
|
+
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype)
|
|
1373
|
+
},
|
|
1374
|
+
StructureTerminal: {
|
|
1375
|
+
"!type": "fn()",
|
|
1376
|
+
"!doc": "Sends any resources to a Terminal in another room. The destination Terminal can belong to any player. If its storage is full, the resources are dropped on the ground. Each transaction requires additional energy (regardless of the transfer resource type) according to this formula: ceil(0.2 * amount * linearDistanceBetweenRooms). For example, sending 100 mineral units from W1N1 to W2N3 will consume 40 energy units. You can track your incoming and outgoing transactions and estimate range cost between rooms using the Game.market object. Only one Terminal per room is allowed that can be addressed by Room.terminal property.\n\nTerminals in rooms that share a side can always trade with each other. Transfers and market deals between other rooms need a chain of active terminal nodes connecting the rooms, see Game.map.hasTerminalConnection. Connectivity is determined at the start of each tick and does not change until the next tick.",
|
|
1377
|
+
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1378
|
+
send: {
|
|
1379
|
+
"!doc": "Sends resource to a Terminal in another room with the specified name. The destination room has to be connected to this terminal's room in the current tick, otherwise ERR_NO_PATH is returned.\n\nArguments:\n* resourceType - One of the RESOURCE_* constants.\n* amount - The amount of resources to be sent. The minimum amount is 100.\n* destination - The name of the target room. You don't have to gain visibility in this room.\n* description (optional) - The description of the transaction. It is visible to the recipient. The maximum length is 100 characters.\n\nCPU cost: CONST",
|
|
1380
|
+
"!type": "fn(resourceType: string, amount: number, destination: string, description?: string) -> number"
|
|
1381
|
+
},
|
|
1382
|
+
cooldown: {
|
|
1383
|
+
"!doc": "The remaining amount of ticks while this terminal cannot be used to make `StructureTerminal.send` or `Game.market.deal` calls.",
|
|
1384
|
+
"!type": "number"
|
|
1385
|
+
}
|
|
1386
|
+
})
|
|
1387
|
+
},
|
|
1388
|
+
StructureTower: {
|
|
1389
|
+
"!type": "fn()",
|
|
1390
|
+
"!doc": "Remotely attacks or heals creeps, or repairs structures. Can be targeted to any object in the room. However, its effectiveness highly depends on the distance. Each action consumes energy.",
|
|
1391
|
+
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1392
|
+
attack: {
|
|
1393
|
+
"!doc": "Remotely attack any creep in a room. \n\nArguments:\n* target - The target creep.\n\nCPU cost: CONST",
|
|
1394
|
+
"!type": "fn(target: +Creep) -> number"
|
|
1395
|
+
},
|
|
1396
|
+
heal: {
|
|
1397
|
+
"!doc": "Remotely heal any creep in a room. \n\nArguments:\n* target - The target creep.\n\nCPU cost: CONST",
|
|
1398
|
+
"!type": "fn(target: +Creep) -> number"
|
|
1399
|
+
},
|
|
1400
|
+
repair: {
|
|
1401
|
+
"!doc": "Remotely repair any structure in a room. \n\nArguments:\n* target - The target structure.\n\nCPU cost: CONST",
|
|
1402
|
+
"!type": "fn(target: +Structure) -> number"
|
|
1403
|
+
}
|
|
1404
|
+
})
|
|
1405
|
+
},
|
|
1406
|
+
StructureNuker: {
|
|
1407
|
+
"!type": "fn()",
|
|
1408
|
+
"!doc": "Launches a nuke to any room within 5 rooms range dealing huge damage to the landing area. Each launch has a cooldown and requires energy and ghodium resources. Launching creates a Nuke object at the target room position which is visible to any player until it is landed. Incoming nuke cannot be moved or cancelled.",
|
|
1409
|
+
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1410
|
+
launchNuke: {
|
|
1411
|
+
"!doc": "Launch a nuke to the specified position. \n\nArguments:\n* pos - The target room position.\n\nCPU cost: CONST",
|
|
1412
|
+
"!type": "fn(pos: +RoomPosition) -> number"
|
|
1413
|
+
},
|
|
1414
|
+
cooldown: {
|
|
1415
|
+
"!doc": "The amount of game ticks until the next launch is possible.",
|
|
1416
|
+
"!type": "number"
|
|
1417
|
+
},
|
|
1418
|
+
})
|
|
1419
|
+
},
|
|
1420
|
+
StructureWall: {
|
|
1421
|
+
"!type": "fn()",
|
|
1422
|
+
"!doc": "Blocks movement of all creeps.",
|
|
1423
|
+
prototype: _extend({}, def_screeps.Structure.prototype, {
|
|
1424
|
+
ticksToLive: {
|
|
1425
|
+
"!doc": "The amount of game ticks when the wall will disappear (only for automatically placed border walls at the start of the game).",
|
|
1426
|
+
"!type": "number"
|
|
1427
|
+
},
|
|
1428
|
+
})
|
|
1429
|
+
},
|
|
1430
|
+
StructureSpawn: {
|
|
1431
|
+
"!type": "fn()",
|
|
1432
|
+
"!doc": "Spawn is your colony center. This structure can create, renew, and recycle creeps. All your spawns are accessible through Game.spawns hash list.",
|
|
1433
|
+
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1434
|
+
memory: {
|
|
1435
|
+
"!doc": "A shorthand to Memory.spawns[spawn.name]. You can use it for quick access the spawn’s specific memory data object."
|
|
1436
|
+
},
|
|
1437
|
+
name: {
|
|
1438
|
+
"!doc": "Spawn’s name. You choose the name upon creating a new spawn, and it cannot be changed later. This name is a hash key to access the spawn via the Game.spawns object.",
|
|
1439
|
+
"!type": "string"
|
|
1440
|
+
},
|
|
1441
|
+
spawning: {
|
|
1442
|
+
"!doc": "If the spawn is in process of spawning a new creep, this object will contain the new creep’s information, or null otherwise.",
|
|
1443
|
+
"!type": "+StructureSpawnSpawning"
|
|
1444
|
+
},
|
|
1445
|
+
spawnCreep: {
|
|
1446
|
+
"!doc": "Start the creep spawning process. The required energy amount can be withdrawn from all spawns and extensions in the room.\n\nArguments:\n* body - An array describing the new creep’s body. Should contain 1 to 50 elements with one of the body part constants.\n* name - The name of a new creep. It should be unique creep name, i.e. the Game.creeps object should not contain another creep with the same name (hash key).\n* opts (optional) - An object with following properties:\n - memory - The memory of a new creep. If provided, it will be immediately stored into Memory.creeps[name].\n - energyStructures - Array of spawns/extensions from which to draw energy for the spawning process.\n - dryRun - If dryRun is true, the operation will only check if it is possible to create a creep.\n - directions - Set desired directions where the creep should move when spawned. An array with the direction constants.\n\nCPU cost: CONST",
|
|
1447
|
+
"!type": "fn(body: [string], name: string, opts?: object) -> number"
|
|
1448
|
+
},
|
|
1449
|
+
renewCreep: {
|
|
1450
|
+
"!doc": "Increase the remaining time to live of the target creep. The target should be at adjacent square. The spawn should not be busy with the spawning process. Each execution increases the creep's timer by amount of ticks according to this formula: floor(600/body_size). Energy required for each execution is determined using this formula: ceil(creep_cost/2.5/body_size).\n\nArguments:\n* target - The creep to be renewed.\n\nCPU cost: CONST",
|
|
1451
|
+
"!type": "fn(target: +Creep) -> number"
|
|
1452
|
+
},
|
|
1453
|
+
recycleCreep: {
|
|
1454
|
+
"!doc": "Kill the creep and drop up to 100% of resources spent on its spawning and boosting depending on remaining life time. The target should be at adjacent square. \n\nArguments:\n* target - The creep to be recycled.\n\nCPU cost: CONST",
|
|
1455
|
+
"!type": "fn(target: +Creep) -> number"
|
|
1456
|
+
}
|
|
1457
|
+
}),
|
|
1458
|
+
Spawning: {
|
|
1459
|
+
"!type": "StructureSpawnSpawning"
|
|
1460
|
+
}
|
|
1461
|
+
},
|
|
1462
|
+
|
|
1463
|
+
StructurePortal: {
|
|
1464
|
+
"!type": "fn()",
|
|
1465
|
+
"!doc": "A non-player structure. Instantly teleports your creeps to a distant room acting as a room exit tile. Portals appear randomly in the central room of each sector.",
|
|
1466
|
+
prototype: _extend({}, def_screeps.Structure.prototype, {
|
|
1467
|
+
destination: {
|
|
1468
|
+
'!doc': 'The position object in the destination room.',
|
|
1469
|
+
'!type': '+RoomPosition'
|
|
1470
|
+
},
|
|
1471
|
+
ticksToDecay: {
|
|
1472
|
+
"!doc": "The amount of game ticks when the portal disappears, or undefined when the portal is stable.",
|
|
1473
|
+
"!type": "number"
|
|
1474
|
+
}
|
|
1475
|
+
})
|
|
1476
|
+
},
|
|
1477
|
+
|
|
1478
|
+
StructureTerminalNode: {
|
|
1479
|
+
"!type": "fn()",
|
|
1480
|
+
"!doc": "A non-player structure that relays terminal transfers. Every room of the world has one terminal node in a wall tile. Transfers and market deals between rooms that don't share a side need a chain of active nodes in rooms sharing sides. Connectivity is fixed for each tick and uses the nodes that were active at the start of the tick.\n\nCreeps can damage nodes with melee and targeted ranged attacks, and towers and nukes can damage them as well. Players cannot repair, dismantle or destroy a node. A node repairs itself by TERMINAL_NODE_REPAIR_PER_TICK hits every tick and stays active while damaged. A destroyed node leaves a ruin; when neither the node nor its ruin remains, a new inactive node appears and becomes active when it regrows to full hits.",
|
|
1481
|
+
prototype: _extend({}, def_screeps.Structure.prototype, {
|
|
1482
|
+
isActive: {
|
|
1483
|
+
"!doc": "Whether this node relays terminal transfers. A regrowing node is inactive until it reaches full hits.\n\nCPU cost: LOW",
|
|
1484
|
+
"!type": "fn() -> bool"
|
|
1485
|
+
}
|
|
1486
|
+
})
|
|
1487
|
+
},
|
|
1488
|
+
|
|
1489
|
+
StructureFactory: {
|
|
1490
|
+
"!type": "fn()",
|
|
1491
|
+
"!doc": "Produces trade commodities from base minerals and other commodities.",
|
|
1492
|
+
prototype: _extend({}, _docs.store, def_screeps.OwnedStructure.prototype, {
|
|
1493
|
+
produce: {
|
|
1494
|
+
"!doc": "Produces the specified commodity. All ingredients should be available in the factory store. \n\nArguments:\n* resourceType - One of the RESOURCE_* constants.\n\nCPU cost: CONST",
|
|
1495
|
+
"!type": "fn(resourceType: string) -> number"
|
|
1496
|
+
},
|
|
1497
|
+
cooldown: {
|
|
1498
|
+
"!doc": "The amount of game ticks the factory has to wait until the next production is possible.",
|
|
1499
|
+
"!type": "number"
|
|
1500
|
+
},
|
|
1501
|
+
level: {
|
|
1502
|
+
"!doc": "The factory's level. Can be set by applying the PWR_OPERATE_FACTORY power to a newly built factory. Once set, the level cannot be changed.",
|
|
1503
|
+
"!type": "number"
|
|
1504
|
+
},
|
|
1505
|
+
})
|
|
1506
|
+
},
|
|
1507
|
+
|
|
1508
|
+
StructureInvaderCore: {
|
|
1509
|
+
"!type": "fn()",
|
|
1510
|
+
"!doc": "This NPC structure is a control center of NPC Strongholds, and also rules all invaders in the sector. ",
|
|
1511
|
+
prototype: _extend({}, def_screeps.OwnedStructure.prototype, {
|
|
1512
|
+
ticksToDeploy: {
|
|
1513
|
+
"!doc": "Shows the timer for a ot yet deployed stronghold, undefined otherwise.",
|
|
1514
|
+
"!type": "number"
|
|
1515
|
+
},
|
|
1516
|
+
level: {
|
|
1517
|
+
"!doc": "The level of the stronghold. The amount and quality of the loot depends on the level.",
|
|
1518
|
+
"!type": "number"
|
|
1519
|
+
},
|
|
1520
|
+
})
|
|
1521
|
+
},
|
|
1522
|
+
|
|
1523
|
+
Tombstone: {
|
|
1524
|
+
"!type": "fn()",
|
|
1525
|
+
"!doc": "A remnant of dead creeps. This is a walkable structure.",
|
|
1526
|
+
prototype: _extend({}, _docs.store, def_screeps.RoomObject.prototype, {
|
|
1527
|
+
id: {
|
|
1528
|
+
"!type": "string",
|
|
1529
|
+
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
1530
|
+
},
|
|
1531
|
+
creep: {
|
|
1532
|
+
"!doc": "An object containing the deceased creep.",
|
|
1533
|
+
"!type": "+Creep"
|
|
1534
|
+
},
|
|
1535
|
+
deathTime: {
|
|
1536
|
+
"!doc": "Time of death.",
|
|
1537
|
+
"!type": "number"
|
|
1538
|
+
},
|
|
1539
|
+
ticksToDecay: {
|
|
1540
|
+
"!doc": "The amount of game ticks before this tombstone decays.",
|
|
1541
|
+
"!type": "number"
|
|
1542
|
+
}
|
|
1543
|
+
})
|
|
1544
|
+
},
|
|
1545
|
+
|
|
1546
|
+
Ruin: {
|
|
1547
|
+
"!type": "fn()",
|
|
1548
|
+
"!doc": "A destroyed structure. This is a walkable object.",
|
|
1549
|
+
prototype: _extend({}, _docs.store, def_screeps.RoomObject.prototype, {
|
|
1550
|
+
id: {
|
|
1551
|
+
"!type": "string",
|
|
1552
|
+
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
1553
|
+
},
|
|
1554
|
+
structure: {
|
|
1555
|
+
"!doc": "An object containing basic data of the destroyed structure.",
|
|
1556
|
+
"!type": "+Structure"
|
|
1557
|
+
},
|
|
1558
|
+
destroyTime: {
|
|
1559
|
+
"!doc": "The time when the structure has been destroyed.",
|
|
1560
|
+
"!type": "number"
|
|
1561
|
+
},
|
|
1562
|
+
ticksToDecay: {
|
|
1563
|
+
"!doc": "The amount of game ticks before this ruin decays.",
|
|
1564
|
+
"!type": "number"
|
|
1565
|
+
}
|
|
1566
|
+
})
|
|
1567
|
+
},
|
|
1568
|
+
|
|
1569
|
+
Deposit: {
|
|
1570
|
+
"!type": "fn()",
|
|
1571
|
+
"!doc": "A rare resource deposit needed for producing commodities.",
|
|
1572
|
+
prototype: _extend({}, def_screeps.RoomObject.prototype, {
|
|
1573
|
+
id: {
|
|
1574
|
+
"!type": "string",
|
|
1575
|
+
"!doc": "A unique object identificator. You can use `Game.getObjectById` method to retrieve an object instance by its `id`.",
|
|
1576
|
+
},
|
|
1577
|
+
cooldown: {
|
|
1578
|
+
"!doc": "The amount of game ticks until the next harvest action is possible.",
|
|
1579
|
+
"!type": "number"
|
|
1580
|
+
},
|
|
1581
|
+
depositType: {
|
|
1582
|
+
"!doc": "The deposit type, one of the following constants: RESOURCE_MIST, RESOURCE_BIOMASS, RESOURCE_METAL, RESOURCE_SILICON.",
|
|
1583
|
+
"!type": "number"
|
|
1584
|
+
},
|
|
1585
|
+
lastCooldown: {
|
|
1586
|
+
"!doc": "The cooldown of the last harvest operation on this deposit.",
|
|
1587
|
+
"!type": "number"
|
|
1588
|
+
},
|
|
1589
|
+
ticksToDecay: {
|
|
1590
|
+
"!doc": "The amount of game ticks when this deposit will disappear.",
|
|
1591
|
+
"!type": "number"
|
|
1592
|
+
}
|
|
1593
|
+
})
|
|
1594
|
+
},
|
|
1595
|
+
})
|
|
1596
|
+
|
|
1597
|
+
_extend(def_screeps, {
|
|
1598
|
+
PathFinder: {
|
|
1599
|
+
"!doc": "Contains powerful methods for pathfinding in the game world. Support exists for custom navigation costs and paths which span multiple rooms. Additionally PathFinder can search for paths through rooms you can't see, although you won't be able to detect any dynamic obstacles like creeps or buildings.\n\nThis module is experimental and disabled by default. Run `PathFinder.use(true)` to enable it in the game methods.",
|
|
1600
|
+
search: {
|
|
1601
|
+
"!doc": "Find an optimal path between origin and goal.\n\nArguments:\n* origin - The start position.\n* goal - A goal or an array of goals. If more than one goal is supplied then the cheapest path found out of all the goals will be returned. A goal is either a RoomPosition or an object as defined below. Important: Please note that if your goal is not walkable (for instance, a source) then you should set range to at least 1 or else you will waste many CPU cycles searching for a target that you can't walk on.\n - pos - The target.\n - range - Range to pos before goal is considered reached. The default is 0.\n\n* opts (optional) - An object containing additional pathfinding flags.\n - roomCallback - Request from the pathfinder to generate a CostMatrix for a certain room. The callback accepts one argument, roomName. This callback will only be called once per room per search. If you are running multiple pathfinding operations in a single room and in a single tick you may consider caching your CostMatrix to speed up your code. Please read the CostMatrix documentation below for more information on CostMatrix.\n - plainCost - Cost for walking on plain positions. The default is 1.\n - swampCost - Cost for walking on swamp positions. The default is 5.\n - flee - Instead of searching for a path to the goals this will search for a path away from the goals. The cheapest path that is out of range of every goal will be returned. The default is false.\n - maxOps - The maximum allowed pathfinding operations. You can limit CPU time used for the search based on ratio 1 op ~ 0.001 CPU. The default value is 2000.\n - maxCost - The maximum allowed cost of the path returned. If at any point the pathfinder detects that it is impossible to find a path with a cost less than or equal to `maxCost` it will immediately halt the search. The default is Infinity.\n - maxRooms - The maximum allowed rooms to search. The default (and maximum) is 16.\n - heuristicWeight - Weight to apply to the heuristic in the A* formula F = G + weight * H. Use this option only if you understand the underlying A* algorithm mechanics! The default value is 1.2.\n\nReturn value\n\nAn object containing:\n* path - An array of RoomPosition objects.\n* ops - Total number of operations performed before this path was calculated.",
|
|
1602
|
+
"!type": "fn(origin: +RoomPosition, goal: ?, opts?: +PathfindingOptions) -> +PathfindingResult"
|
|
1603
|
+
},
|
|
1604
|
+
CostMatrix: {
|
|
1605
|
+
"!type": "CostMatrix"
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
Room: {
|
|
1609
|
+
"!type": "fn()",
|
|
1610
|
+
"!doc": "An object representing the room in which your units and structures are in. It can be used to look around, find paths, etc. Every object in the room contains its linked Room instance in the `room` property.",
|
|
1611
|
+
prototype: {
|
|
1612
|
+
controller: {
|
|
1613
|
+
"!doc": "The Controller structure of this room, if present, otherwise undefined.",
|
|
1614
|
+
"!type": "+StructureController"
|
|
1615
|
+
},
|
|
1616
|
+
energyAvailable: {
|
|
1617
|
+
"!doc": "Total amount of energy available in all spawns and extensions in the room.",
|
|
1618
|
+
"!type": "number"
|
|
1619
|
+
},
|
|
1620
|
+
energyCapacityAvailable: {
|
|
1621
|
+
"!doc": "Total amount of energy capacity of all spawns and extensions in the room.",
|
|
1622
|
+
"!type": "number"
|
|
1623
|
+
},
|
|
1624
|
+
memory: {
|
|
1625
|
+
"!doc": "A shorthand to Memory.rooms[room.name]. You can use it for quick access the room’s specific memory data object."
|
|
1626
|
+
},
|
|
1627
|
+
mode: {
|
|
1628
|
+
"!doc": "One of the MODE_* constants.",
|
|
1629
|
+
"!type": "string"
|
|
1630
|
+
},
|
|
1631
|
+
name: {
|
|
1632
|
+
"!doc": "The name of the room.",
|
|
1633
|
+
"!type": "string"
|
|
1634
|
+
},
|
|
1635
|
+
storage: {
|
|
1636
|
+
"!doc": "The Storage structure of this room, if present, otherwise undefined.",
|
|
1637
|
+
"!type": "+StructureStorage"
|
|
1638
|
+
},
|
|
1639
|
+
terminal: {
|
|
1640
|
+
"!doc": "The Terminal structure of this room, if present, otherwise undefined.",
|
|
1641
|
+
"!type": "+StructureTerminal"
|
|
1642
|
+
},
|
|
1643
|
+
createConstructionSite: {
|
|
1644
|
+
"!doc": "Syntax:\ncreateConstructionSite(x, y, structureType, [name])\ncreateConstructionSite(pos, structureType, [name])\n\nCreate new ConstructionSite at the specified location.\n\nArguments:\n* x - The X position.\n* y - The Y position.\n* pos - Can be a RoomPosition object or any object containing RoomPosition.\n* structureType - One of the STRUCTURE_* constants.\n* name (optional) - The name of the structure, for structures that support it (currently only spawns).\n\nCPU cost: CONST",
|
|
1645
|
+
"!type": "fn(arg1: ?, arg2: ?, arg3?: ?, arg4?: ?) -> number"
|
|
1646
|
+
},
|
|
1647
|
+
createFlag: {
|
|
1648
|
+
"!doc": "Syntax:\ncreateFlag(x, y, [name], [color], [secondaryColor])\ncreateFlag(pos, [name], [color], [secondaryColor])\n\nCreate new Flag at the specified location.\n\nArguments:\n* x - The X position.\n* y - The Y position.\n* pos - Can be a RoomPosition object or any object containing RoomPosition.\n* name (optional) - The name of a new flag. It should be unique, i.e. the Game.flags object should not contain another flag with the same name (hash key). If not defined, a random name will be generated.\n* color (optional) - The color of a new flag.\n* secondaryColor (optional) - The secondary color of a new flag.\n\nCPU cost: CONST",
|
|
1649
|
+
"!type": "fn(arg1: ?, arg2?: ?, arg3?: ?, arg4?: ?) -> number"
|
|
1650
|
+
},
|
|
1651
|
+
find: {
|
|
1652
|
+
"!doc": "Find all objects of the specified type in the room.\n\nArguments:\n* type - One of the FIND_* constants.\n* opts (optional) - An object with additional options:\n - filter - The result list will be filtered using the Lodash.filter method.\n\nCPU cost: AVERAGE",
|
|
1653
|
+
"!type": "fn(type: number, opts?: object) -> [object]"
|
|
1654
|
+
},
|
|
1655
|
+
findExitTo: {
|
|
1656
|
+
"!doc": "Find the exit direction en route to another room.\n\nArguments:\n* room - Another room name or room object.\n\nCPU cost: HIGH",
|
|
1657
|
+
"!type": "fn(room: ?) -> number"
|
|
1658
|
+
},
|
|
1659
|
+
findPath: {
|
|
1660
|
+
"!doc": "Find an optimal path inside the room between fromPos and toPos using A* search algorithm.\n\nArguments:\n* fromPos - The start position.\n* toPos - The end position.\n* opts (optional) - An object containing additonal pathfinding flags:\n - ignoreCreeps - Treat squares with creeps as walkable. Can be useful with too many moving creeps around or in some other cases. The default value is false.\n - ignoreDestructibleStructures - Treat squares with destructible structures (constructed walls, ramparts, spawns, extensions) as walkable. Use this flag when you need to move through a territory blocked by hostile structures. If a creep with an ATTACK body part steps on such a square, it automatically attacks the structure. The default value is false.\n - ignoreRoads - Ignore road structures. Enabling this option can speed up the search. The default value is false. This is only used when the new PathFinder is enabled.\n - costCallback - You can use this callback to modify a CostMatrix for any room during the search. The callback accepts two arguments, roomName and costMatrix. Use the costMatrix instance to make changes to the positions costs. If you return a new matrix from this callback, it will be used instead of the built-in cached one. This option is only used when the new PathFinder is enabled.\n - ignore - An array of the room's objects or RoomPosition objects which should be treated as walkable tiles during the search. This option cannot be used when the new PathFinder is enabled (use costCallback option instead).\n - avoid - An array of the room's objects or RoomPosition objects which should be treated as obstacles during the search. This option cannot be used when the new PathFinder is enabled (use costCallback option instead).\n - maxOps - The maximum limit of possible pathfinding operations. You can limit CPU time used for the search based on ratio 1 op ~ 0.001 CPU. The default value is 2000.\n - heuristicWeight - Weight to apply to the heuristic in the A* formula F = G + weight * H. Use this option only if you understand the underlying A* algorithm mechanics! The default value is 1.2.\n - serialize - If true, the result path will be serialized using Room.serializePath. The default is false.\n - maxRooms - The maximum allowed rooms to search. The default (and maximum) is 16. This is only used when the new PathFinder is enabled.\n - range - Find a path to a position in specified linear range of target. The default is 0.\n - plainCost - Cost for walking on plain positions. The default is 1.\n - swampCost - Cost for walking on swamp positions. The default is 5.\n\nCPU cost: HIGH",
|
|
1661
|
+
"!type": "fn(fromPos: +RoomPosition, toPos: +RoomPosition, opts?: +RoomFindPathOptions) -> Path"
|
|
1662
|
+
},
|
|
1663
|
+
getPositionAt: {
|
|
1664
|
+
"!doc": "Creates a RoomPosition object at the specified location.\n\nArguments:\n* x - The X position.\n* y - The Y Position.\n\nCPU cost: LOW",
|
|
1665
|
+
"!type": "fn(x: number, y: number) -> +RoomPosition"
|
|
1666
|
+
},
|
|
1667
|
+
lookAt: {
|
|
1668
|
+
"!doc": "Syntax:\nlookAt(x, y)\nlookAt(target)\n\nGet the list of objects at the specified room position.\n\nArguments:\n* x - X position in the room.\n* y - Y position in the room.\n* target - Can be a RoomPosition object or any object containing RoomPosition.\n\nCPU cost: AVERAGE",
|
|
1669
|
+
"!type": "fn(arg1: ?, arg2?: ?) -> LookArray"
|
|
1670
|
+
},
|
|
1671
|
+
lookAtArea: {
|
|
1672
|
+
"!doc": "Get the list of objects at the specified room area.\n\nArguments:\n* top - The top Y boundary of the area.\n* left - The left X boundary of the area.\n* bottom - The bottom Y boundary of the area.\n* right - The right X boundary of the area.\n* asArray (optional) - Set to true if you want to get the result as a plain array.\n\nCPU cost: AVERAGE",
|
|
1673
|
+
"!type": "fn(top: number, left: number, bottom: number, right: number, asArray?: bool) -> LookAreaArray"
|
|
1674
|
+
},
|
|
1675
|
+
lookForAt: {
|
|
1676
|
+
"!doc": "Syntax:\nlookForAt(type, x, y)\nlookForAt(type, target)\n\nGet an object with the given type at the specified room position.\n\nArguments:\n* type - One of the following string constants:\n - constructionSite\n - creep\n - energy\n - exit\n - flag\n - source\n - structure\n - terrain\n* x - X position in the room.\n* y - Y position in the room.\n* target - Can be a RoomPosition object or any object containing RoomPosition.\n\nCPU cost: LOW",
|
|
1677
|
+
"!type": "fn(arg1: ?, arg2: ?, arg3?: ?) -> [object]"
|
|
1678
|
+
},
|
|
1679
|
+
lookForAtArea: {
|
|
1680
|
+
"!doc": "Get the list of objects with the given type at the specified room area.\n\nArguments:\n* type - One of the following string constants:\n - constructionSite\n - creep\n - energy\n - exit\n - flag\n - source\n - structure\n - terrain\n* top - The top Y boundary of the area.\n* left - The left X boundary of the area.\n* bottom - The bottom Y boundary of the area.\n* right - The right X boundary of the area.\n* asArray (optional) - Set to true if you want to get the result as a plain array.\n\nCPU cost: LOW",
|
|
1681
|
+
"!type": "fn(type: string, top: number, left: number, bottom: number, right: number, asArray?: bool) -> LookAreaArray"
|
|
1682
|
+
},
|
|
1683
|
+
visual: {
|
|
1684
|
+
"!doc": "A RoomVisual object for this room. You can use this object to draw simple shapes (lines, circles, text labels) in the room.",
|
|
1685
|
+
"!type": "+RoomVisual"
|
|
1686
|
+
},
|
|
1687
|
+
getTerrain: {
|
|
1688
|
+
"!doc": "Get a Room.Terrain object which provides fast access to static terrain data. This method works for any room in the world even if you have no access to it.",
|
|
1689
|
+
"!type": "fn() -> +RoomTerrain"
|
|
1690
|
+
},
|
|
1691
|
+
getEventLog: {
|
|
1692
|
+
"!doc": "Returns an array of events happened on the previous tick in this room.\n\nArguments:\n* raw (optional) - If this parameter is false or undefined, the method returns an object parsed using JSON.parse which incurs some CPU cost on the first access (the return value is cached on subsequent calls). If raw is truthy, then raw JSON in string format is returned.\n\nCPU Cost: NONE",
|
|
1693
|
+
"!type": "fn(raw?: bool) -> [object]",
|
|
1694
|
+
},
|
|
1695
|
+
|
|
1696
|
+
},
|
|
1697
|
+
serializePath: {
|
|
1698
|
+
"!doc": "Serialize a path array into a short string representation, which is suitable to store in memory.\n\nArguments:\n* path - A path array retrieved from Room.findPath.\n\nCPU cost: LOW",
|
|
1699
|
+
"!type": "fn(path: Path) -> string"
|
|
1700
|
+
},
|
|
1701
|
+
deserializePath: {
|
|
1702
|
+
"!doc": "Deserialize a short string path representation into an array form.\n\nArguments:\n* path - A serialized path string.\n\nCPU cost: LOW",
|
|
1703
|
+
"!type": "fn(path: string) -> Path"
|
|
1704
|
+
},
|
|
1705
|
+
Terrain: {
|
|
1706
|
+
"!type": "RoomTerrain"
|
|
1707
|
+
}
|
|
1708
|
+
},
|
|
1709
|
+
RoomPosition: {
|
|
1710
|
+
"!type": "fn(x: number, y: number, roomName: string) -> +RoomPosition",
|
|
1711
|
+
"!doc": "An object representing the specified position in the room. Every object in the room contains RoomPosition as the pos property. The position object of a custom location can be obtained using the `Room.getPositionAt()` method or using the constructor.",
|
|
1712
|
+
prototype: {
|
|
1713
|
+
roomName: {
|
|
1714
|
+
"!doc": "The name of the room.",
|
|
1715
|
+
"!type": "string"
|
|
1716
|
+
},
|
|
1717
|
+
x: {
|
|
1718
|
+
"!doc": "X position in the room.",
|
|
1719
|
+
"!type": "number"
|
|
1720
|
+
},
|
|
1721
|
+
y: {
|
|
1722
|
+
"!doc": "Y position in the room.",
|
|
1723
|
+
"!type": "number"
|
|
1724
|
+
},
|
|
1725
|
+
createConstructionSite: {
|
|
1726
|
+
"!doc": "Create new ConstructionSite at the specified location.\n\nArguments:\n* structureType - One of the STRUCTURE_* constants.\n* name (optional) - The name of the structure, for structures that support it (currently only spawns).\n\nCPU cost: CONST",
|
|
1727
|
+
"!type": "fn(structureType: string, name?: string) -> number"
|
|
1728
|
+
},
|
|
1729
|
+
createFlag: {
|
|
1730
|
+
"!doc": "Create new Flag at the specified location.\n\nArguments:\n* name (optional) - The name of a new flag. It should be unique, i.e. the Game.flags object should not contain another flag with the same name (hash key). If not defined, a random name will be generated.\n* color (optional) - The color of a new flag.\n* secondaryColor (optional) - The secondary color of a new flag.\n\nCPU cost: CONST",
|
|
1731
|
+
"!type": "fn(name?: string, color?: string, secondaryColor?: string) -> number"
|
|
1732
|
+
},
|
|
1733
|
+
findClosestByPath: {
|
|
1734
|
+
"!doc": "Syntax:\nfindClosestByPath(type, [opts])\nfindClosestByPath(objects, [opts])\n\nFind an object with the shortest path from the given position. Uses A* search algorithm and Dijkstra's algorithm.\n\nArguments:\n* type - See Room.find.\n* objects - An array of room's objects or RoomPosition objects that the search should be executed against.\n* opts (optional) - An object containing pathfinding options (see Room.findPath), or one of the following:\n - filter - Only the objects which pass the filter using the Lodash.filter method will be used.\n - algorithm - One of the following constants:\n + astar - is faster when there are relatively few possible targets;\n + dijkstra - is faster when there are a lot of possible targets or when the closest target is nearby.\n The default value is determined automatically using heuristics.\n\nCPU cost: HIGH",
|
|
1735
|
+
"!type": "fn(arg1: ?, opts?: object) -> object"
|
|
1736
|
+
},
|
|
1737
|
+
findClosestByRange: {
|
|
1738
|
+
"!doc": "Syntax:\nfindClosestByRange(type, [opts])\nfindClosestByRange(objects, [opts])\n\nFind an object with the shortest linear distance from the given position.\n\nArguments:\n* type - See Room.find.\n* objects - An array of room's objects or RoomPosition objects that the search should be executed against.\n* opts (optional) - An object containing one of the following options:\n - filter - Only the objects which pass the filter using the Lodash.filter method will be used.\n\nCPU cost: AVERAGE",
|
|
1739
|
+
"!type": "fn(arg1: ?, opts?: object) -> number"
|
|
1740
|
+
},
|
|
1741
|
+
findInRange: {
|
|
1742
|
+
"!doc": "Syntax:\nfindInRange(type, range, [opts])\nfindInRange(objects, range, [opts])\n\nFind all objects in the specified linear range.\n\nArguments:\n* type - See Room.find.\n* objects - An array of room's objects or RoomPosition objects that the search should be executed against.\n* range - The range distance\n* opts (optional) - See Room.find.\n\nCPU cost: CONST",
|
|
1743
|
+
"!type": "fn(arg1: ?, range: number, opts?: object) -> [object]"
|
|
1744
|
+
},
|
|
1745
|
+
findPathTo: {
|
|
1746
|
+
"!type": "fn(arg1?: ?, arg2?: ?, arg3?: ?) -> Path",
|
|
1747
|
+
"!doc": "Syntax:\nfindPathTo(x, y, [opts])\nfindPathTo(target, [opts])\n\nFind an optimal path to the specified position using A* search algorithm. This method is a shorthand for `Room.findPath`. If the target is in another room, then the corresponding exit will be used as a target.\n\nCPU cost: HIGH"
|
|
1748
|
+
},
|
|
1749
|
+
getDirectionTo: {
|
|
1750
|
+
"!doc": "Syntax:\ngetDirectionTo(x,y)\ngetDirectionTo(target)\n\nGet linear direction to the specified position.\n\nArguments:\n* x - X position in the room.\n* y - Y position in the room.\n * target - Can be a RoomPosition object or any object containing RoomPosition.\n\nCPU cost: LOW",
|
|
1751
|
+
"!type": "fn(arg1: ?, arg2?: ?) -> number"
|
|
1752
|
+
},
|
|
1753
|
+
getRangeTo: {
|
|
1754
|
+
"!doc": "Syntax:\ngetRangeTo(x,y)\ngetRangeTo(target)\n\nGet linear range to the specified position.\n\nArguments:\n* x - X position in the room.\n* y - Y position in the room.\n * target - Can be a RoomPosition object or any object containing RoomPosition.\n\nCPU cost: LOW",
|
|
1755
|
+
"!type": "fn(arg1: ?, arg2?: ?) -> number"
|
|
1756
|
+
},
|
|
1757
|
+
inRangeTo: {
|
|
1758
|
+
"!doc": "Syntax:\ninRangeTo(x,y,range)\ninRangeTo(target,range)\n\nCheck whether this position is in the given range of another position.\n\nArguments:\n* x - X position in the room.\n* y - Y position in the room.\n* target - The target position.\n* range - The range distance.\n\nCPU cost: LOW",
|
|
1759
|
+
"!type": "fn(arg1: ?, arg2: ?, arg3?: ?) -> bool"
|
|
1760
|
+
},
|
|
1761
|
+
isEqualTo: {
|
|
1762
|
+
"!doc": "Syntax:\nisEqualTo(x,y)\nisEqualTo(target)\n\nCheck whether this position is the same as the specified position.\n\nArguments:\n* x - X position in the room.\n* y - Y position in the room.\n * target - Can be a RoomPosition object or any object containing RoomPosition.\n\nCPU cost: LOW",
|
|
1763
|
+
"!type": "fn(arg1: ?, arg2?: ?) -> bool"
|
|
1764
|
+
},
|
|
1765
|
+
isNearTo: {
|
|
1766
|
+
"!doc": "Syntax:\nisNearTo(x,y)\nisNearTo(target)\n\nCheck whether this position is on the adjacent square to the specified position. The same as inRangeTo(target, 1).\n\nArguments:\n* x - X position in the room.\n* y - Y position in the room.\n * target - Can be a RoomPosition object or any object containing RoomPosition.\n\nCPU cost: LOW",
|
|
1767
|
+
"!type": "fn(arg1: ?, arg2?: ?) -> bool"
|
|
1768
|
+
},
|
|
1769
|
+
look: {
|
|
1770
|
+
"!doc": "Get the list of objects at the specified room position.\n\nCPU cost: AVERAGE",
|
|
1771
|
+
"!type": "fn() -> LookArray"
|
|
1772
|
+
},
|
|
1773
|
+
lookFor: {
|
|
1774
|
+
"!doc": "Get an object with the given type at the specified room position.\n\nArguments:\n* type - One of the following string constants:\n - constructionSite\n - creep\n - energy\n - exit\n - flag\n - source\n - structure\n - terrain\n\nCPU cost: LOW",
|
|
1775
|
+
"!type": "fn(type: string) -> [object]"
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
},
|
|
1779
|
+
RoomVisual: {
|
|
1780
|
+
"!type": "fn(roomName: string) -> +RoomVisual",
|
|
1781
|
+
"!doc": "Room visuals provide a way to show various visual debug info in game rooms. You can use the RoomVisual object to draw simple shapes that are visible only to you.",
|
|
1782
|
+
roomName: {
|
|
1783
|
+
"!doc": "The name of the room.",
|
|
1784
|
+
"!type": "string"
|
|
1785
|
+
},
|
|
1786
|
+
line: {
|
|
1787
|
+
"!doc": "Syntax:\nline(x1, y1, x2, y2, [style])\nline(pos1, pos2, [style])\n\nDraw a line.\n\nArguments:\n* x1 - The start X coordinate.\n* y1 - The start Y coordinate.\n* x2 - The finish X coordinate.\n* y2 - The finish Y coordinate.\n* pos1 - The start position object.\n* pos2 - The finish position object.\n* style (optional) - An object with the following properties:\n - width - Line width, default is 0.1.\n - color - Line color in any web format, default is #ffffff (white).\n - opacity - Opacity value, default is 0.5.\n - lineStyle - Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
1788
|
+
"!type": "fn(x1: number, y1: number, x2: number, y2: number, style?: +LineStyle) -> +RoomVisual"
|
|
1789
|
+
},
|
|
1790
|
+
circle: {
|
|
1791
|
+
"!doc": "Syntax:\ncircle(x, y, [style])\ncircle(pos, [style])\n\nDraw a circle.\n\nArguments:\n* x - The X coordinate of the center.\n* y - The Y coordinate of the center.\n* pos - The position object of the center.\n* style (optional) - An object with the following properties:\n - radius - Circle radius, default is 0.15.\n - fill - Fill color in any web format, default is #ffffff (white).\n - opacity - Opacity value, default is 0.5.\n - stroke - Stroke color in any web format, default is undefined (no stroke).\n - strokeWidth - Stroke line width, default is 0.1.\n - lineStyle - Either undefined (solid line), 'dashed', or 'dotted'. Default is undefined.",
|
|
1792
|
+
"!type": "fn(x: number, y: number, style?: +CircleStyle) -> +RoomVisual"
|
|
1793
|
+
},
|
|
1794
|
+
rect: {
|
|
1795
|
+
"!doc": "Syntax:\nrect(x, y, width, height, [style])\nrect(topLeftPos, width, height, [style])\n\nDraw a rectangle.\n\nArguments:\n* x - The X coordinate of the top-left corner.\n* y - The Y coordinate of the top-left corner.\n* topLeftPos - The position object of the top-left corner.\n* width - The width of the rectangle.\n* height - The height of the rectangle.\n* style (optional) - An object with the following properties:\n - fill - Fill color in any web format, default is #ffffff (white).\n - opacity - Opacity value, default is 0.5.\n - stroke - Stroke color in any web format, default is undefined (no stroke).\n - strokeWidth - Stroke line width, default is 0.1.\n - lineStyle - Either undefined (solid line), 'dashed', or 'dotted'. Default is undefined.",
|
|
1796
|
+
"!type": "fn(x: number, y: number, width: number, height: number, style?: +PolyStyle) -> +RoomVisual"
|
|
1797
|
+
},
|
|
1798
|
+
poly: {
|
|
1799
|
+
"!doc": "Draw a polyline.\n\nArguments:\n* points - An array of points. Every item should be either an array with 2 numbers (i.e. [10,15]), or a RoomPosition object.\n* style (optional) - An object with the following properties:\n - fill - Fill color in any web format, default is undefined (no fill).\n - opacity - Opacity value, default is 0.5.\n - stroke - Stroke color in any web format, default is #ffffff (white).\n - strokeWidth - Stroke line width, default is 0.1.\n - lineStyle - Either undefined (solid line), 'dashed', or 'dotted'. Default is undefined.",
|
|
1800
|
+
"!type": "fn(points: [object], style?: +PolyStyle) -> +RoomVisual"
|
|
1801
|
+
},
|
|
1802
|
+
text: {
|
|
1803
|
+
"!doc": "Syntax:\ntext(text, x, y, [style])\ntext(text, pos, [style])\n\nDraw a text label.\n\nArguments:\n* text - The text message.\n* x - The X coordinate of the label baseline point.\n* y - The Y coordinate of the label baseline point.\n* pos - The position object of the label baseline.\n* style (optional) - An object with the following properties:\n - color - Font color in any web format, default is #ffffff (white).\n - font - Either a number or a string.\n - stroke - Stroke color in any web format, default is undefined (no stroke).\n - strokeWidth - Stroke width, default is 0.15.\n - background - Background color in any web format, default is undefined (no background). When background is enabled, text vertical align is set to middle (default is baseline).\n - backgroundPadding - Background rectangle padding, default is 0.3.\n - align - Text align, either 'center', 'left', or 'right'. Default is 'center'.\n - opacity - Opacity value, default is 1.0.",
|
|
1804
|
+
"!type": "fn(text: string, x: number, y: number, style?: +TextStyle) -> +RoomVisual"
|
|
1805
|
+
},
|
|
1806
|
+
clear: {
|
|
1807
|
+
"!doc": "Remove all visuals from the room.",
|
|
1808
|
+
"!type": "fn() -> +RoomVisual"
|
|
1809
|
+
},
|
|
1810
|
+
getSize: {
|
|
1811
|
+
"!doc": "Get the stored size of all visuals added in the room in the current tick. It must not exceed 512,000 (500 KB).",
|
|
1812
|
+
"!type": "fn() -> number"
|
|
1813
|
+
},
|
|
1814
|
+
import: {
|
|
1815
|
+
"!doc": "Syntax:\nimport(value)\n\nAdd previously exported room visuals to the room visual data of the current tick.\n\nArguments:\n*value - The string with visuals data",
|
|
1816
|
+
"!type": "fn(string) -> +RoomVisual"
|
|
1817
|
+
},
|
|
1818
|
+
export: {
|
|
1819
|
+
"!doc": "Returns a compact representation of all visuals added in the room in the current tick.",
|
|
1820
|
+
"!type": "fn() -> string"
|
|
1821
|
+
}
|
|
1822
|
+
},
|
|
1823
|
+
MapVisual: {
|
|
1824
|
+
"!doc": "Map visuals provide a way to show various visual debug info on the game map. You can use the Game.map.visual object to draw simple shapes that are visible only to you.",
|
|
1825
|
+
line: {
|
|
1826
|
+
"!doc": "Syntax:\nline(pos1, pos2, [style])\n\nDraw a line.\n\nArguments:\n* pos1 - The start position object.\n* pos2 - The finish position object.\n* style (optional) - An object with the following properties:\n - width - Line width, default is 0.5.\n - color - Line color in the following format: #ffffff (hex triplet).\n - opacity - Opacity value, default is 0.5.\n - lineStyle - Either undefined (solid line), dashed, or dotted. Default is undefined.",
|
|
1827
|
+
"!type": "fn(pos1: +RoomPosition, pos2: +RoomPosition, style?: +MapLineStyle) -> +MapVisual"
|
|
1828
|
+
},
|
|
1829
|
+
circle: {
|
|
1830
|
+
"!doc": "Syntax:\ncircle(pos, [style])\n\nDraw a circle.\n\nArguments:\n* pos - The position object of the center.\n* style (optional) - An object with the following properties:\n - radius - Circle radius, default is 10.\n - fill - Fill color in the following format: #ffffff (hex triplet). Default is #ffffff.\n - opacity - Opacity value, default is 0.5.\n - stroke - Stroke color in the following format: #ffffff (hex triplet). Default is undefined (no stroke).\n - strokeWidth - Stroke line width, default is 0.5.\n - lineStyle - Either undefined (solid line), 'dashed', or 'dotted'. Default is undefined.",
|
|
1831
|
+
"!type": "fn(pos: +RoomPosition, style?: +MapCircleStyle) -> +MapVisual"
|
|
1832
|
+
},
|
|
1833
|
+
rect: {
|
|
1834
|
+
"!doc": "Syntax:\nrect(topLeftPos, width, height, [style])\n\nDraw a rectangle.\n\nArguments:\n* topLeftPos - The position object of the top-left corner.\n* width - The width of the rectangle.\n* height - The height of the rectangle.\n* style (optional) - An object with the following properties:\n - fill - Fill color in the following format: #ffffff (hex triplet). Default is #ffffff.\n - opacity - Opacity value, default is 0.5.\n - stroke - Stroke color in the following format: #ffffff (hex triplet). Default is undefined (no stroke).\n - strokeWidth - Stroke line width, default is 0.5.\n - lineStyle - Either undefined (solid line), 'dashed', or 'dotted'. Default is undefined.",
|
|
1835
|
+
"!type": "fn(topLeftPos: +RoomPosition, width: number, height: number, style?: +MapRectStyle) -> +MapVisual"
|
|
1836
|
+
},
|
|
1837
|
+
poly: {
|
|
1838
|
+
"!doc": "Draw a polyline.\n\nArguments:\n* points - An array of points. Every item should be a RoomPosition object.\n* style (optional) - An object with the following properties:\n - fill - Fill color in the following format: #ffffff (hex triplet). Default is #ffffff.\n - opacity - Opacity value, default is 0.5.\n - stroke - Stroke color in the following format: #ffffff (hex triplet). Default is #ffffff.\n - strokeWidth - Stroke line width, default is 0.5.\n - lineStyle - Either undefined (solid line), 'dashed', or 'dotted'. Default is undefined.",
|
|
1839
|
+
"!type": "fn(points: [+RoomPosition], style?: +MapPolyStyle) -> +MapVisual"
|
|
1840
|
+
},
|
|
1841
|
+
text: {
|
|
1842
|
+
"!doc": "Syntax:\ntext(text, pos, [style])\n\nDraw a text label.\n\nArguments:\n* text - The text message.\n* pos - The position object of the label baseline.\n* style (optional) - An object with the following properties:\n - color - Font color in the following format: #ffffff (hex triplet). Default is #ffffff.\n - fontFamily - The font family, default is sans-serif.\n - fontSize - The font size in game coordinates, default is 10.\n - fontStyle - The font style ('normal', 'italic' or 'oblique').\n - The font variant ('normal' or 'small-caps').\n - stroke - Stroke color in the following format: #ffffff (hex triplet). Default is undefined (no stroke).\n - strokeWidth - Stroke width, default is 0.15.\n - background - Background color in any web format, default is undefined (no background). When background is enabled, text vertical align is set to middle (default is baseline).\n - backgroundPadding - Background rectangle padding, default is 2.\n - align - Text align, either 'center', 'left', or 'right'. Default is 'center'.\n - opacity - Opacity value, default is 0.5.",
|
|
1843
|
+
"!type": "fn(text: string, pos: +RoomPosition, style?: +MapTextStyle) -> +RoomVisual"
|
|
1844
|
+
},
|
|
1845
|
+
clear: {
|
|
1846
|
+
"!doc": "Remove all visuals from the map.",
|
|
1847
|
+
"!type": "fn() -> +MapVisual"
|
|
1848
|
+
},
|
|
1849
|
+
getSize: {
|
|
1850
|
+
"!doc": "Get the stored size of all visuals added on the map in the current tick. It must not exceed 1024,000 (1000 KB).",
|
|
1851
|
+
"!type": "fn() -> number"
|
|
1852
|
+
},
|
|
1853
|
+
import: {
|
|
1854
|
+
"!doc": "Syntax:\nimport(value)\n\nAdd previously exported map visuals to the map visual data of the current tick.\n\nArguments:\n*value - The string with visuals data",
|
|
1855
|
+
"!type": "fn(string) -> +MapVisual"
|
|
1856
|
+
},
|
|
1857
|
+
export: {
|
|
1858
|
+
"!doc": "Returns a compact representation of all visuals added on the map in the current tick.",
|
|
1859
|
+
"!type": "fn() -> string"
|
|
1860
|
+
}
|
|
1861
|
+
},
|
|
1862
|
+
RawMemory: {
|
|
1863
|
+
"!doc": "RawMemory object allows to implement your own memory stringifier instead of built-in serializer based on JSON.stringify.",
|
|
1864
|
+
"get": {
|
|
1865
|
+
"!doc": "Get a raw string representation of the Memory object.",
|
|
1866
|
+
"!type": "fn() -> string"
|
|
1867
|
+
},
|
|
1868
|
+
"set": {
|
|
1869
|
+
"!doc": "Set new memory value.\n\nArguments:\n* value - New memory value as a string.",
|
|
1870
|
+
"!type": "fn(value: string)"
|
|
1871
|
+
},
|
|
1872
|
+
segments: {
|
|
1873
|
+
"!doc": "An object with asynchronous memory segments available on this tick. Each object key is the segment ID with data in string values. Use RawMemory.setActiveSegments to fetch segments on the next tick. Segments data is saved automatically in the end of the tick.",
|
|
1874
|
+
},
|
|
1875
|
+
setActiveSegments: {
|
|
1876
|
+
"!doc": "Request memory segments using the list of their IDs. Memory segments will become available on the next tick in RawMemory.segments object.\n\nArguments:\n* ids - An array of segment IDs. Each ID should be a number from 0 to 99. Maximum 10 segments can be requested simultaneously. Subsequent calls of setActiveSegments override previous ones.",
|
|
1877
|
+
"!type": "fn(ids: [number])"
|
|
1878
|
+
},
|
|
1879
|
+
foreignSegment: {
|
|
1880
|
+
"!doc": "An object with a memory segment of another player available on this tick. Use setActiveForeignSegment to fetch segments on the next tick. ",
|
|
1881
|
+
username: {
|
|
1882
|
+
"!doc": "Another player's name",
|
|
1883
|
+
"!type": "string"
|
|
1884
|
+
},
|
|
1885
|
+
id: {
|
|
1886
|
+
"!doc": "The ID of the requested memory segment.",
|
|
1887
|
+
"!type": "number"
|
|
1888
|
+
},
|
|
1889
|
+
data: {
|
|
1890
|
+
"!doc": "The segment contents",
|
|
1891
|
+
"!type": "string"
|
|
1892
|
+
}
|
|
1893
|
+
},
|
|
1894
|
+
setActiveForeignSegment: {
|
|
1895
|
+
"!doc": "Request a memory segment of another user. The segment should be marked by its owner as public using setPublicSegments. The segment data will become available on the next tick in foreignSegment object. You can only have access to one foreign segment at the same time.\n\nArguments:\n* username - The name of another user. Pass null to clear the foreign segment.\n* id - The ID of the requested segment from 0 to 99. If undefined, the user's default public segment is requested as set by setDefaultPublicSegment.",
|
|
1896
|
+
"!type": "fn(username: string, id?: number)"
|
|
1897
|
+
},
|
|
1898
|
+
setDefaultPublicSegment: {
|
|
1899
|
+
"!doc": "Set the specified segment as your default public segment. It will be returned if no id parameter is passed to setActiveForeignSegment by another user.\n\nArguments:\n* id - The ID of the memory segment from 0 to 99. Pass null to remove your default public segment.",
|
|
1900
|
+
"!type": "fn(id: number)"
|
|
1901
|
+
},
|
|
1902
|
+
setPublicSegments: {
|
|
1903
|
+
"!doc": "Set specified segments as public. Other users will be able to request access to them using setActiveForeignSegment.\n\nArguments:\n* ids - An array of segment IDs. Each ID should be a number from 0 to 99. Subsequent calls of setPublicSegments override previous ones.",
|
|
1904
|
+
"!type": "fn(ids: [number])"
|
|
1905
|
+
}
|
|
1906
|
+
},
|
|
1907
|
+
Memory: {
|
|
1908
|
+
"!doc": "The global object Memory in which you may store any information in the JSON format."
|
|
1909
|
+
},
|
|
1910
|
+
InterShardMemory: {
|
|
1911
|
+
"!doc": "InterShardMemory object provides an interface for communicating between shards.\n\nEvery shard can have its own 100 KB of data in string format that can be accessed by all other shards. A shard can write only to its own data, other shards' data is read-only.\n\nThis data has nothing to do with Memory contents, it's a separate data container.",
|
|
1912
|
+
getLocal: {
|
|
1913
|
+
"!doc": "Returns the string contents of the current shard's data.",
|
|
1914
|
+
"!type": "fn() -> string"
|
|
1915
|
+
},
|
|
1916
|
+
setLocal: {
|
|
1917
|
+
"!doc": "Replace the current shard's data with the new value.\n\nArguments:\n* value - New data value in string format.\n",
|
|
1918
|
+
"!type": "fn(value: string)"
|
|
1919
|
+
},
|
|
1920
|
+
getRemote: {
|
|
1921
|
+
"!doc": "Returns the string contents of another shard's data.\n\nArguments:\n* shard - Shard name.\n",
|
|
1922
|
+
"!type": "fn(shard: string) -> string"
|
|
1923
|
+
}
|
|
1924
|
+
},
|
|
1925
|
+
Game: {
|
|
1926
|
+
"!doc": "The main global game object containing all the gameplay information.",
|
|
1927
|
+
cpu: {
|
|
1928
|
+
"!doc": "An object containing information about your CPU usage.",
|
|
1929
|
+
limit: {
|
|
1930
|
+
"!doc": "Your CPU limit depending on your Global Control Level.",
|
|
1931
|
+
"!type": "number"
|
|
1932
|
+
},
|
|
1933
|
+
tickLimit: {
|
|
1934
|
+
"!doc": "An amount of available CPU time at the current game tick. It can be higher than `Game.cpu.limit`.",
|
|
1935
|
+
"!type": "number"
|
|
1936
|
+
},
|
|
1937
|
+
bucket: {
|
|
1938
|
+
"!doc": "An amount of unused CPU accumulated in your bucket.",
|
|
1939
|
+
"!type": "number"
|
|
1940
|
+
},
|
|
1941
|
+
unlocked: {
|
|
1942
|
+
"!doc": "Whether full CPU is currently unlocked for your account.",
|
|
1943
|
+
"!type": "bool"
|
|
1944
|
+
},
|
|
1945
|
+
unlockedTime: {
|
|
1946
|
+
"!doc": "The time in milliseconds since UNIX epoch time until full CPU is unlocked for your account. This property is not defined when full CPU is not unlocked for your account or it's unlocked with a subscription.",
|
|
1947
|
+
"!type": "number"
|
|
1948
|
+
},
|
|
1949
|
+
getUsed: {
|
|
1950
|
+
"!doc": "Get amount of CPU time used from the beginning of the current game tick. Always returns 0 in the Simulation mode.\n\nCPU cost: LOW",
|
|
1951
|
+
"!type": "fn() -> number"
|
|
1952
|
+
},
|
|
1953
|
+
shardLimits: {
|
|
1954
|
+
"!doc": "An object with limits for each shard with shard names as keys. You can use setShardLimits method to re-assign them."
|
|
1955
|
+
},
|
|
1956
|
+
setShardLimits: {
|
|
1957
|
+
"!doc": "Allocate CPU limits to different shards. Total amount of CPU should remain equal to Game.cpu.shardLimits. This method can be used only once per 12 hours.",
|
|
1958
|
+
"!type": "fn(limits: object) -> number"
|
|
1959
|
+
},
|
|
1960
|
+
getHeapStatistics: {
|
|
1961
|
+
"!doc": "Use this method to get heap statistics for your virtual machine. The return value is almost identical to the Node.js function v8.getHeapStatistics(). This function returns one additional property: externally_allocated_size which is the total amount of currently allocated memory which is not included in the v8 heap but counts against this isolate's memory limit. ArrayBuffer instances over a certain size are externally allocated and will be counted here.",
|
|
1962
|
+
"!type": "fn() -> +HeapStatistics"
|
|
1963
|
+
},
|
|
1964
|
+
halt: {
|
|
1965
|
+
"!doc": "Reset your runtime environment and wipe all data in heap memory.",
|
|
1966
|
+
"!type": "fn()"
|
|
1967
|
+
},
|
|
1968
|
+
generatePixel: {
|
|
1969
|
+
"!doc": "Generate 1 pixel resource unit for 10000 CPU from your bucket.\n\nCPU cost: HIGH",
|
|
1970
|
+
"!type": "fn() -> number"
|
|
1971
|
+
},
|
|
1972
|
+
unlock: {
|
|
1973
|
+
"!doc": "Unlock full CPU for your account for additional 24 hours.\n\nCPU cost: CONST",
|
|
1974
|
+
"!type": "fn() -> number"
|
|
1975
|
+
}
|
|
1976
|
+
},
|
|
1977
|
+
|
|
1978
|
+
constructionSites: {
|
|
1979
|
+
"!doc": "A hash containing all your construction sites with their id as hash keys.",
|
|
1980
|
+
"!type": "[+ConstructionSite]"
|
|
1981
|
+
},
|
|
1982
|
+
|
|
1983
|
+
creeps: {
|
|
1984
|
+
"!doc": "A hash containing all your creeps with creep names as hash keys.",
|
|
1985
|
+
"!type": "[+Creep]"
|
|
1986
|
+
},
|
|
1987
|
+
powerCreeps: {
|
|
1988
|
+
"!doc": "A hash containing all your Power Creeps with their names as hash keys.",
|
|
1989
|
+
"!type": "[+PowerCreep]"
|
|
1990
|
+
},
|
|
1991
|
+
flags: {
|
|
1992
|
+
"!doc": "A hash containing all your flags with flag names as hash keys.",
|
|
1993
|
+
"!type": "[+Flag]"
|
|
1994
|
+
},
|
|
1995
|
+
gcl: {
|
|
1996
|
+
"!doc": "Your Global Control Level, an object with the following properties :",
|
|
1997
|
+
level: {
|
|
1998
|
+
"!doc": "The current level.",
|
|
1999
|
+
"!type": "number"
|
|
2000
|
+
},
|
|
2001
|
+
progress: {
|
|
2002
|
+
"!doc": "The current progress to the next level.",
|
|
2003
|
+
"!type": "number"
|
|
2004
|
+
},
|
|
2005
|
+
progressTotal: {
|
|
2006
|
+
"!doc": "The progress required to reach the next level.",
|
|
2007
|
+
"!type": "number"
|
|
2008
|
+
}
|
|
2009
|
+
},
|
|
2010
|
+
gpl: {
|
|
2011
|
+
"!doc": "Your Global Power Level, an object with the following properties:",
|
|
2012
|
+
level: {
|
|
2013
|
+
"!doc": "The current level.",
|
|
2014
|
+
"!type": "number"
|
|
2015
|
+
},
|
|
2016
|
+
progress: {
|
|
2017
|
+
"!doc": "The current progress to the next level.",
|
|
2018
|
+
"!type": "number"
|
|
2019
|
+
},
|
|
2020
|
+
progressTotal: {
|
|
2021
|
+
"!doc": "The progress required to reach the next level.",
|
|
2022
|
+
"!type": "number"
|
|
2023
|
+
}
|
|
2024
|
+
},
|
|
2025
|
+
market: {
|
|
2026
|
+
"!doc": "A global object representing the in-game market. You can use this object to track resource transactions to/from your terminals, and your buy/sell orders.",
|
|
2027
|
+
incomingTransactions: {
|
|
2028
|
+
"!doc": "An array of the last 100 incoming transactions to your terminals.",
|
|
2029
|
+
"!type": "[Transaction]"
|
|
2030
|
+
},
|
|
2031
|
+
outgoingTransactions: {
|
|
2032
|
+
"!doc": "An array of the last 100 outgoing transactions from your terminals.",
|
|
2033
|
+
"!type": "[Transaction]"
|
|
2034
|
+
},
|
|
2035
|
+
calcTransactionCost: {
|
|
2036
|
+
"!doc": "Estimate the energy transaction cost of StructureTerminal.send and Market.deal methods. The formula: Math.ceil( amount * (Math.log(0.1*linearDistanceBetweenRooms + 0.9) + 0.1) )\n\nArguments:\n* amount - Amount of resources to be sent.\n* roomName1 - The name of the first room.\n* roomName2 - The name of the second room.\n\nCPU cost: NONE",
|
|
2037
|
+
"!type": "fn(amount: number, roomName1: string, roomName2: string) -> number"
|
|
2038
|
+
},
|
|
2039
|
+
credits: {
|
|
2040
|
+
"!doc": "Your current credits balance.",
|
|
2041
|
+
"!type": "number"
|
|
2042
|
+
},
|
|
2043
|
+
orders: {
|
|
2044
|
+
"!doc": "An object with your active and inactive buy/sell orders on the market.",
|
|
2045
|
+
"!type": "[MarketOrder]"
|
|
2046
|
+
},
|
|
2047
|
+
cancelOrder: {
|
|
2048
|
+
"!doc": "Cancel a previously created order. The 5% fee is not returned.\n\nArguments:\n* orderId - The order ID as provided in Game.market.orders.\n\nCPU cost: CONST",
|
|
2049
|
+
"!type": "fn(orderId: string) -> number"
|
|
2050
|
+
},
|
|
2051
|
+
createOrder: {
|
|
2052
|
+
"!doc": "Create a market order in your terminal. You will be charged price*amount*0.05 credits when the order is placed. The maximum orders count is 20 per player. You can create an order at any time with any amount, it will be automatically activated and deactivated depending on the resource/credits availability.\n\nArguments:\n* type - The order type, either ORDER_SELL or ORDER_BUY.\n* resourceType - Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN. If your Terminal doesn't have the specified resource, the order will be temporary inactive.\n* price - The price for one resource unit in credits. Can be a decimal number.\n* totalAmount - The amount of resources to be traded in total. The minimum amount is 100.\n* roomName (optional) - The room where your order will be created. You must have your own Terminal structure in this room, otherwise the created order will be temporary inactive. This argument is not used when resourceType equals to SUBSCRIPTION_TOKEN.\n\nCPU cost: CONST",
|
|
2053
|
+
"!type": "fn(type: string, resourceType: string, price: number, totalAmount: number, roomName?: string) -> number"
|
|
2054
|
+
},
|
|
2055
|
+
deal: {
|
|
2056
|
+
"!doc": "Execute a trade deal from your Terminal to another player's Terminal using the specified buy/sell order. Your Terminal will be charged energy units of transfer cost regardless of the order resource type. You can use Game.market.calcTransactionCost method to estimate it. When multiple players try to execute the same deal, the one with the shortest distance takes precedence.\n\nFor orders of room resources, the order's room has to be connected to targetRoomName in the current tick (see Game.map.hasTerminalConnection), otherwise ERR_NO_PATH is returned.\n\nArguments:\n* orderId - The order ID as provided in Game.market.getAllOrders.\n* amount - The amount of resources to transfer. The minimum amount is 100.\n* targetRoomName (optional) - The name of your room which has to contain an active Terminal with enough amount of energy. This argument is not used when the order resource type equals to SUBSCRIPTION_TOKEN.\n\nCPU cost: CONST",
|
|
2057
|
+
"!type": "fn(orderId: string, amount: number, targetRoomName?: string) -> number"
|
|
2058
|
+
},
|
|
2059
|
+
getAllOrders: {
|
|
2060
|
+
"!doc": "Get other players' orders currently active on the market.\n\nArguments:\n* filter (optional) - An object or function that will filter the resulting list using the lodash.filter method.\n* roomName (optional) - If specified, only orders of room resources in rooms connected to this room in the current tick are returned, see Game.map.hasTerminalConnection. Orders in this room itself are always returned. The room needs neither vision nor a terminal. Orders of account-bound resources are returned regardless of the room. If the room name is invalid or lies outside the world, no orders of room resources are returned.\n\nCPU cost: AVERAGE",
|
|
2061
|
+
"!type": "fn(filter?: any, roomName?: string) -> [MarketOrder]"
|
|
2062
|
+
},
|
|
2063
|
+
getOrderById: {
|
|
2064
|
+
"!doc": "Retrieve info for specific market order.\n\nArguments:\n* orderId - The order ID.\n\nCPU cost: LOW",
|
|
2065
|
+
"!type": "fn(id: string) -> +MarketOrder"
|
|
2066
|
+
},
|
|
2067
|
+
extendOrder: {
|
|
2068
|
+
"!doc": "Add more capacity to an existing order. It will affect remainingAmount and totalAmount properties. You will be charged price*addAmount*0.05 credits.\n\nArguments:\n* orderId - The order ID as provided in Game.market.orders.\n* addAmount - How much capacity to add. Cannot be a negative value.\n\nCPU cost: CONST",
|
|
2069
|
+
"!type": "fn(orderId: string, addAmount: number) -> number"
|
|
2070
|
+
},
|
|
2071
|
+
changeOrderPrice: {
|
|
2072
|
+
"!doc": "Change the price of an existing order. If newPrice is greater than old price, you will be charged (newPrice-oldPrice)*remainingAmount*0.05 credits.\n\nArguments:\n* orderId - The order ID as provided in Game.market.orders.\n* newPrice - The new order price.\n\nCPU cost: CONST",
|
|
2073
|
+
"!type": "fn(orderId: string, newPrice: number) -> number"
|
|
2074
|
+
},
|
|
2075
|
+
getHistory: {
|
|
2076
|
+
"!doc": "Get daily price history of the specified resource on the market for the last 14 days.\n\nArguments\n\n* resorceType (optional) - One of the RESOURCE_* constants. If undefined, returns history data for all resources.",
|
|
2077
|
+
"!type": "fn(resourceType?: string) -> [MarketHistoryItem]"
|
|
2078
|
+
},
|
|
2079
|
+
},
|
|
2080
|
+
map: {
|
|
2081
|
+
"!doc": "A global object representing world map. Use it to navigate between rooms.",
|
|
2082
|
+
describeExits: {
|
|
2083
|
+
"!doc": "List all exits available from the room with the given name.\n\nArguments:\n* roomName - The room name.\n\nCPU cost: LOW",
|
|
2084
|
+
"!type": "fn(roomName: string) -> [string]"
|
|
2085
|
+
},
|
|
2086
|
+
findExit: {
|
|
2087
|
+
"!doc": "Find the exit direction from the given room en route to another room.\n\nArguments:\n* fromRoom - Start room name or room object.\n* toRoom - Finish room name or room object.\n\nCPU cost: HIGH",
|
|
2088
|
+
"!type": "fn(fromRoom: ?, toRoom: ?) -> number"
|
|
2089
|
+
},
|
|
2090
|
+
findRoute: {
|
|
2091
|
+
"!doc": "Find route from the given room to another room.\n\nArguments:\n* fromRoom - Start room name or room object.\n* toRoom - Finish room name or room object.\n* opts - An object with the following options:\n - routeCallback - This callback accepts two arguments: function(roomName, fromRoomName). It can be used to calculate the cost of entering that room. You can use this to do things like prioritize your own rooms, or avoid some rooms. You can return a floating point cost or Infinity to block the room.\n\nCPU cost: HIGH",
|
|
2092
|
+
"!type": "fn(fromRoom: ?, toRoom: ?, opts?: +FindRouteOptions) -> [MapRouteStep]"
|
|
2093
|
+
},
|
|
2094
|
+
getRoomStatus: {
|
|
2095
|
+
"!doc": "Returns status of the room with the given name (whether the room in a protected area or not) \n\nArguments:\n* roomName - The room name.\n\nCPU cost: LOW",
|
|
2096
|
+
"!type": "fn(roomName: string) -> +RoomStatus"
|
|
2097
|
+
},
|
|
2098
|
+
getRoomLinearDistance: {
|
|
2099
|
+
"!doc": "Get linear distance (in rooms) between two rooms. You can use this function to estimate the energy cost of sending resources through terminals, or using observers and nukes. \n\nArguments:\n* roomName1 - The name of the first room.\n* roomName2 - The name of the second room.\n* continuous (optional) - Whether to treat the world map continuous on borders. Set to true if you want to calculate the terminal send or trade fee.\n\nCPU cost: NONE",
|
|
2100
|
+
"!type": "fn(roomName1: string, roomName2: string, continuous?: boolean) -> number"
|
|
2101
|
+
},
|
|
2102
|
+
hasTerminalConnection: {
|
|
2103
|
+
"!doc": "Check whether terminals in the two rooms can trade with each other in the current tick, using StructureTerminal.send or Game.market.deal. Neither room needs vision or a terminal.\n\nA room is connected to itself and to the rooms that share a side with it. Other rooms are connected when each of them shares a side with a room that has an active terminal node, and these two nodes belong to one chain of active nodes in rooms sharing sides. The terminal rooms' own nodes do not count, and rooms that only meet at a corner are not joined. The result is based on the nodes that were active at the start of the tick. Returns false when a room name is invalid or the room lies outside the world.\n\nArguments:\n* roomName1 - The name of the first room.\n* roomName2 - The name of the second room.\n\nCPU cost: NONE",
|
|
2104
|
+
"!type": "fn(roomName1: string, roomName2: string) -> bool"
|
|
2105
|
+
},
|
|
2106
|
+
getWorldSize: {
|
|
2107
|
+
"!doc": "Returns the world size as a number of rooms between world corners. For example, for a world with rooms from W50N50 to E50S50 this method will return 102.\n\nCPU cost: NONE",
|
|
2108
|
+
"!type": "fn() -> number"
|
|
2109
|
+
},
|
|
2110
|
+
getRoomTerrain: {
|
|
2111
|
+
"!doc": "Get a Room.Terrain object which provides fast access to static terrain data. This method works for any room in the world even if you have no access to it.\n\nArguments:\n* roomName - The room name\n\nCPU Cost: LOW",
|
|
2112
|
+
"!type": "fn(roomName: string) -> +RoomTerrain"
|
|
2113
|
+
},
|
|
2114
|
+
visual: {
|
|
2115
|
+
"!doc": "A MapVisual object for the map of the current shard. You can use this object to draw simple shapes (lines, circles, text labels) on the map.",
|
|
2116
|
+
"!type": "+MapVisual"
|
|
2117
|
+
}
|
|
2118
|
+
},
|
|
2119
|
+
resources: {
|
|
2120
|
+
"!doc": "An object with your global resources that are bound to the account, like pixels or CPU unlocks. Each object key is a resource constant, values are resources amounts.",
|
|
2121
|
+
},
|
|
2122
|
+
rooms: {
|
|
2123
|
+
"!doc": "A hash containing all the rooms available to you with room names as hash keys. A room is visible if you have a creep or an owned structure in it.",
|
|
2124
|
+
"!type": "[+Room]"
|
|
2125
|
+
},
|
|
2126
|
+
shard: {
|
|
2127
|
+
"!doc": "An object describing the world shard where your script is currently being executed in.",
|
|
2128
|
+
name: {
|
|
2129
|
+
"!doc": "The name of the shard",
|
|
2130
|
+
"!type": "string"
|
|
2131
|
+
},
|
|
2132
|
+
type: {
|
|
2133
|
+
"!doc": "Currently always equals to 'normal'.",
|
|
2134
|
+
"!type": "string"
|
|
2135
|
+
},
|
|
2136
|
+
ptr: {
|
|
2137
|
+
"!doc": "Whether this shard belongs to the PTR.",
|
|
2138
|
+
"!type": "boolean"
|
|
2139
|
+
}
|
|
2140
|
+
},
|
|
2141
|
+
spawns: {
|
|
2142
|
+
"!doc": "A hash containing all your spawns with spawn names as hash keys.",
|
|
2143
|
+
"!type": "[+StructureSpawn]"
|
|
2144
|
+
},
|
|
2145
|
+
structures: {
|
|
2146
|
+
"!doc": "A hash containing all your structures with structure id as hash keys.",
|
|
2147
|
+
"!type": "[+OwnedStructure]"
|
|
2148
|
+
},
|
|
2149
|
+
time: {
|
|
2150
|
+
"!doc": "System game tick counter. It is automatically incremented on every tick.",
|
|
2151
|
+
"!type": "number"
|
|
2152
|
+
},
|
|
2153
|
+
getObjectById: {
|
|
2154
|
+
"!doc": "Get an object with the specified unique ID. It may be a game object of any type. Only objects from the rooms which are visible to you can be accessed.\n\nArguments:\n* id - The unique identificator.\n\nCPU cost: NONE",
|
|
2155
|
+
"!type": "fn(id: string) -> object"
|
|
2156
|
+
},
|
|
2157
|
+
notify: {
|
|
2158
|
+
"!doc": "Send a custom message at your profile email. This way, you can set up notifications to yourself on any occasion within the game. You can schedule up to 20 notifications during one game tick. Not available in the Simulation Room.\n\nArguments:\n* message - Custom text which will be sent in the message. Maximum length is 1000 characters.\n* groupInterval - If set to 0 (default), the notification will be scheduled immediately. Otherwise, it will be grouped with other notifications and mailed out later using the specified time in minutes.\n\nCPU cost: CONST",
|
|
2159
|
+
"!type": "fn(message: string, groupInterval?: number) -> number"
|
|
2160
|
+
}
|
|
2161
|
+
},
|
|
2162
|
+
});
|
|
2163
|
+
|
|
2164
|
+
const constants = require('@screeps/common/lib/constants');
|
|
2165
|
+
|
|
2166
|
+
for(var i in constants) {
|
|
2167
|
+
def_screeps[i] = typeof constants[i];
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
|
|
2171
|
+
fs.mkdirSync('defs', {recursive: true});
|
|
2172
|
+
fs.writeFileSync('defs/screeps.json', JSON.stringify(def_screeps, undefined, 2));
|