-
Notifications
You must be signed in to change notification settings - Fork 106
/
Copy pathGame.js
865 lines (803 loc) · 29.9 KB
/
Game.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
/**
* The main global game object containing all the game play information.
*
* @see {@link https://docs.screeps.com/api/#Game}
*
* @class
*/
Game = {
/**
* A hash containing all your construction sites with their id as hash keys.
*
* @see {@link https://docs.screeps.com/api/#Game.constructionSites}
*
* @type {Object<string, ConstructionSite>}
*/
constructionSites: {},
/**
* An object containing information about your CPU usage
*
* @see {@link https://docs.screeps.com/api/#Game.cpu}
*/
cpu: {
/**
* Your assigned CPU limit for the current shard.
*
* @type {number}
*/
limit: 0,
/**
* An amount of available CPU time at the current game tick.
* Usually it is higher than Game.cpu.limit.
*
* @type {number}
*/
tickLimit: 0,
/**
* An amount of unused CPU accumulated in your bucket.
*
* @type {number}
*/
bucket: 0,
/**
* An object with limits for each shard with shard names as keys. You can use setShardLimits method to re-assign them.
*
* @type {Object<string,number>}
*/
shardLimits: {},
/**
* Whether full CPU is currently unlocked for your account.
*
* @type {boolean}
*/
unlocked: false,
/**
* 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.
*
* @type {number}
*/
unlockedTime: 0,
/**
* This method is only available when Virtual machine is set to Isolated in your account runtime settings.
* 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.
*
* @see {@link https://docs.screeps.com/api/#Game.cpu.getHeapStatistics}
*
* @type {function}
*
* @return {object} Returns an objects with heap statistics in the following format:
* {
"total_heap_size": 29085696,
"total_heap_size_executable": 3670016,
"total_physical_size": 26447928,
"total_available_size": 319649520,
"used_heap_size": 17493824,
"heap_size_limit": 343932928,
"malloced_memory": 8192,
"peak_malloced_memory": 1060096,
"does_zap_garbage": 0,
"externally_allocated_size": 38430000
}
*/
getHeapStatistics: function() {},
/**
* Get amount of CPU time used from the beginning of the current game tick. Always returns 0 in the Simulation mode.
*
* @see {@link https://docs.screeps.com/api/#Game.cpu.getUsed}
*
* @type {function}
*
* @return {number} Returns currently used CPU time as a float number.
*/
getUsed: function () {},
/**
* This method is only available when Virtual machine is set to Isolated in your account runtime settings.
* Reset your runtime environment and wipe all data in heap memory.
*
* @see {@link https://docs.screeps.com/api/#Game.cpu.getHeapStatistics}
*
* @type {function}
*
* @return {void}
*/
halt: function() {},
/**
* 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.
*
* @see {@link https://docs.screeps.com/api/#Game.cpu.setShardLimits}
*
* @type {function}
*
* @param {object<string, number>} limits An object with CPU values for each shard in the same format as Game.cpu.shardLimits.
*
* @return {number|OK|ERR_BUSY|ERR_INVALID_ARGS}
*/
setShardLimits: function(limits) {},
/**
* Unlock full CPU for your account for additional 24 hours.
* This method will consume 1 CPU unlock bound to your account (See Game.resources).
*
* @see {@link https://docs.screeps.com/api/#Game.cpu.unlock}
*
* @type {function}
*
* @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_FULL}
*/
unlock: function() {},
/**
* Generate 1 pixel resource unit for 10000 CPU from your bucket.
*
* @see {@link https://docs.screeps.com/api/#Game.cpu.generatePixel}
*
* @type {function}
*
* @return {number|OK|ERR_NOT_ENOUGH_RESOURCES}
*/
generatePixel: function() {}
},
/**
* A hash containing all your creeps with creep names as hash keys.
*
* @see {@link https://docs.screeps.com/api/#Game.creeps}
* @type {Object<string, Creep>}
* @example
* for(var i in Game.creeps) {
* Game.creeps[i].moveTo(flag);
* }
*/
creeps: {},
/**
* A hash containing all your power creeps with their names as hash keys. Even power creeps not spawned in the world can be accessed here.
*
* @see {@link https://docs.screeps.com/api/#Game.powerCreeps}
* @type {Object<string, PowerCreep>}
* @example
* for(var i in Game.powerCreeps) {
* Game.powerCreeps[i].moveTo(flag);
* }
*/
powerCreeps: {},
/**
* A hash containing all your flags with flag names as hash keys.
*
* @see {@link https://docs.screeps.com/api/#Game.flags}
* @type {Object<string, Flag>}
* @example
* creep.moveTo(Game.flags.Flag1);
*/
flags: {},
/**
* Your Global Control Level
*
* @see {@link https://docs.screeps.com/control.html}
* @see {@link https://docs.screeps.com/api/#Game.gcl}
*/
gcl: {
/**
* The current level.
*
* @type {number}
*/
level: 0,
/**
* The current progress to the next level.
*
* @type {number}
*/
progress: 0,
/**
* The progress required to reach the next level.
*
* @type {number}
*/
progressTotal: 0
},
/**
* Your Global Power Level, an object with the following properties :
*
* @see {@link https://docs.screeps.com/power.html}
* @see {@link https://docs.screeps.com/api/#Game.gpl}
*/
gpl: {
/**
* The current level.
*
* @type {number}
*/
level: 0,
/**
* The current progress to the next level.
*
* @type {number}
*/
progress: 0,
/**
* The progress required to reach the next level.
*
* @type {number}
*/
progressTotal: 0
},
/**
* A global object representing world map.
*
* @see {@link https://docs.screeps.com/api/#Game.map}
*/
map: {
/**
* Gets availablity status of the room with the specified name.
*
* @see {@link https://docs.screeps.com/api/#Game.map.getRoomStatus}
*
* @type {function}
*
* @param {string} roomName The room name.
* @return {{status: 'normal' | 'closed' | 'novice' | 'respawn', timestamp: number | null}}
*/
getRoomStatus: function (roomName) {},
/**
* List all exits available from the room with the given name.
*
* @param {string} roomName The room name.
*
* @return {null|object} The exits information in the following format, or null if the room not found.
{
"1": "W8N4", // TOP
"3": "W7N3", // RIGHT
"5": "W8N2", // BOTTOM
"7": "W9N3" // LEFT
}
*
* @type {function}
* @see {@link https://docs.screeps.com/api/#Game.map.describeExits}
* @example
* var exits = Game.map.describeExits('W8N3');
*/
describeExits: function (roomName) {},
/**
* Find the exit direction from the given room en route to another room.
*
* @param {string|Room} fromRoom Start room name or room object.
* @param {string|Room} toRoom Finish room name or room object.
* @param {object} [opts] An object with the pathfinding options. See findRoute.
*
* @return {number|FIND_EXIT_TOP|FIND_EXIT_RIGHT|FIND_EXIT_BOTTOM|FIND_EXIT_LEFT|ERR_NO_PATH|ERR_INVALID_ARGS}
* @type {function}
*
* @see {@link https://docs.screeps.com/api/#Game.map.findExit}
*/
findExit: function (fromRoom, toRoom, opts) {},
/**
* Find route from the given room to another room.
*
* @see {@link https://docs.screeps.com/api/#Game.map.findRoute}
*
* @type {function}
*
* @param {string|Room} fromRoom Start room name or room object.
* @param {string|Room} toRoom Finish room name or room object.
* @param {object} [opts] An object with the pathfinding options.
* @param {function} [opts.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.
*
* @return {Array|number|ERR_NO_PATH} The route array in the following format:
[
{ exit: FIND_EXIT_RIGHT, room: 'arena21' },
{ exit: FIND_EXIT_BOTTOM, room: 'arena22' }
]
*/
findRoute: function (fromRoom, toRoom, opts) {},
/**
* Get the linear distance (in rooms) between two rooms.
* You can use this function to estimate the energy cost of sending resources through terminals, or using observers and nukes.
*
* @see {@link https://docs.screeps.com/api/#Game.map.getRoomLinearDistance}
*
* @type {function}
*
* @param {string} roomName1 The name of the first room.
* @param {string} roomName2 The name of the second room.
* @param {boolean} [continuous] Whether to treat the world map continuous on borders. Set to true if you want to calculate the trade or terminal send cost. Default is false.
*
* @return {number} A number of rooms between the given two rooms.
*/
getRoomLinearDistance: function (roomName1, roomName2, continuous) {},
/**
* 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.
*
* @see {@link https://docs.screeps.com/api/#Game.map.getRoomTerrain}
*
* @type {function}
*
* @param {string} roomName The room name.
*
* @return {Room.Terrain} Returns new Room.Terrain object.
*/
getRoomTerrain: function(roomName) {},
/**
* Get terrain type at the specified room position.
* This method works for any room in the world even if you have no access to it.
*
* @deprecated use Game.map.getRoomTerrain instead.
*
* @see {@link https://docs.screeps.com/api/#Game.map.getTerrainAt}
*
* @type {function}
*
* @param {number|RoomPosition} x X position in the room.
* @param {number} [y] Y position in the room.
* @param {string} [roomName] The room name.
*
* @note Alternative function: getTerrainAt(pos)
* @param {RoomPosition} pos The position object.
*
* @return {"plain"|"swamp"|"wall"}
*/
getTerrainAt: function (x, y, roomName) {},
/**
* Returns the world size as a number of rooms between world corners.
*
* @see {@link https://docs.screeps.com/api/#Game.map.getWorldSize}
*
* @type {function}
*
* @return {number}
*/
getWorldSize: function () {},
/**
* Check if the room is available to move into.
*
* @see {@link https://docs.screeps.com/api/#Game.map.isRoomAvailable}
*
* @type {function}
*
* @param {string} roomName The room name.
*
* @return {boolean}
*/
isRoomAvailable: function (roomName) {},
/**
* Map visuals provide a way to show various visual debug info on the game map.
* @type {MapVisual}
*/
visual: {}
},
/**
* A global object representing the in-game market.
*
* @see {@link https://docs.screeps.com/api/#Game.market}
* @see {@link https://docs.screeps.com/market.html}
*/
market: {
/**
* Your current credits balance.
*
* @see {@link https://docs.screeps.com/api/#Game.market.credits}
*
* @type {number}
*/
credits: 0,
/**
* An array of the last 100 incoming transactions to your terminals with the following format:
[{
transactionId : "56dec546a180ce641dd65960",
time : 10390687,
sender : {username: "Sender"},
recipient : {username: "Me"},
resourceType : "U",
amount : 100,
from : "W0N0",
to : "W10N10",
description : "trade contract #1",
order: { // optional
id : "55c34a6b5be41a0a6e80c68b",
type : "sell",
price : 2.95
}
}]
* @see {@link https://docs.screeps.com/api/#Game.market.incomingTransactions}
*
* @type {Array}
*/
incomingTransactions: [],
/**
* An array of the last 100 outgoing transactions from your terminals with the following format:
[{
transactionId : "56dec546a180ce641dd65960",
time : 10390687,
sender : {username: "Me"},
recipient : {username: "Recipient"},
resourceType : "U",
amount : 100,
from : "W0N0",
to : "W10N10",
description : "trade contract #1",
order: { // optional
id : "55c34a6b5be41a0a6e80c68b",
type : "sell",
price : 2.95
}
}]
* @see {@link https://docs.screeps.com/api/#Game.market.outgoingTransactions}
*
* @type {Array}
*/
outgoingTransactions: [],
/**
*An object with your active and inactive buy/sell orders on the market.
* {
"55c34a6b5be41a0a6e80c68b": {
id : "55c34a6b5be41a0a6e80c68b",
created : 13131117,
active: true,
type : "sell"
resourceType : "OH",
roomName : "W1N1",
amount : 15821,
remainingAmount : 30000,
totalAmount : 50000,
price : 2.95
},
"55c34a6b52411a0a6e80693a": {
id : "55c34a6b52411a0a6e80693a",
created : 13134122,
active: true,
type : "buy"
resourceType : "energy",
roomName : "W1N1",
amount : 94000,
remainingAmount : 94000,
totalAmount : 94000
price : 0.45
},
"55c34a6b5be41a0a6e80c123": {
id : "55c34a6b5be41a0a6e80c123",
created : 13105123,
active: false,
type : "sell"
resourceType : "token",
amount : 0,
remainingAmount : 10,
totalAmount : 10,
price : 50000
}
}
* @see {@link https://docs.screeps.com/api/#Game.market.orders}
*
* @type {Object<string,Order>}
*/
orders: {},
/**
* Estimate the energy transaction cost of StructureTerminal.send and Game.market.deal methods.
* The formula: Math.ceil( amount * ( 1 - Math.exp(-distanceBetweenRooms/30) ) )
*
* @see {@link https://docs.screeps.com/api/#Game.market.calcTransactionCost}
*
* @type {function}
*
* @param {number} amount Amount of resources to be sent.
* @param {string} roomName1 The name of the first room.
* @param {string} roomName2 The name of the second room.
*
* @return {number} The amount of energy required to perform the transaction.
*/
calcTransactionCost: function (amount, roomName1, roomName2) { },
/**
* Cancel a previously created order.
* The 5% fee is not returned.
*
* @see {@link https://docs.screeps.com/api/#Game.market.cancelOrder}
*
* @type {function}
*
* @param {string} orderId The order ID as provided in Game.market.orders.
*
* @return {number|OK|ERR_INVALID_ARGS}
*/
cancelOrder: function (orderId) { },
/**
* Change the price of an existing order.
* If newPrice is greater than old price, you will be charged (newPrice-oldPrice)*remainingAmount*0.05 credits.
*
* @see {@link https://docs.screeps.com/api/#Game.market.changeOrderPrice}
*
* @type {function}
*
* @param {string} orderId The order ID as provided in Game.market.orders.
* @param {number} newPrice The new order price.
* @return {number|OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_ARGS}
*/
changeOrderPrice: function (orderId, newPrice) { },
/**
* Create a market order in your terminal.
* You will be charged price*amount*0.05 credits when the order is placed.
* The maximum orders count is 300 per player.
* You can create an order at any time with any amount, it will be automatically activated and deactivated depending on the resource/credits availability.
*
* @see {@link https://docs.screeps.com/api/#Game.market.createOrder}
*
* @type {function}
*
* @param {object} params
* @param {string|ORDER_SELL|ORDER_BUY} params.type The order type, either ORDER_SELL or ORDER_BUY.
* @param {string} params.resourceType Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN.
* @param {number} params.price The price for one resource unit in credits. Can be a decimal number.
* @param {number} params.totalAmount The amount of resources to be traded in total.
* @param {string} [params.roomName] 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 GAMETIME_TOKEN.
*
* @return {number|OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS}
*/
createOrder: function (params) { },
/**
* Execute a trade deal from your Terminal in yourRoomName 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.
* You cannot execute more than 10 deals during one tick.
*
* @see {@link https://docs.screeps.com/api/#Game.market.deal}
*
* @type {function}
*
* @param {string} orderId The order ID as provided in Game.market.getAllOrders.
* @param {number} amount The amount of resources to transfer.
* @param {string} [yourRoomName] The name of your room which has to contain an active Terminal with enough amount of energy. This argument is not used when the order resource type is one of account-bound resources (See INTERSHARD_RESOURCES constant).
*
* @return {number|OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS|ERR_TIRED}
*/
deal: function (orderId, amount, yourRoomName) { },
/**
* Add more capacity to an existing order. It will affect remainingAmount and totalAmount properties. You will
* be charged price*addAmount*0.05 credits.
*
* @see {@link https://docs.screeps.com/api/#Game.market.extendOrder}
*
* @type {function}
*
* @param {string} orderId The order ID as provided in Game.market.orders.
* @param {number} addAmount How much capacity to add. Cannot be a negative value.
*
* @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_ARGS}
*/
extendOrder: function (orderId, addAmount) { },
/**
* Get other players' orders currently active on the market.
*
* @see {@link https://docs.screeps.com/api/#Game.market.getAllOrders}
*
* @type {function}
*
* @param {object|function} [filter] An object or function that will filter the resulting list using the lodash.filter method.
*
* @return {Array<Order>} An array of Orders
*/
getAllOrders: function (filter) { },
/**
* Get daily price history of the specified resource on the market for the last 14 days.
*
* @see {@link https://docs.screeps.com/api/#Game.market.getHistory}
*
* @type {function}
*
* @param {string} [resourceType] One of the RESOURCE_* constants. If undefined, returns history data for all resources.
*
* @return {Array<{resourceType:string, date:string, transactions:number, volume:number, avgPrice:number, stddevPrice:number}>} Returns an array of objects
*/
getHistory: function (resourceType) { },
/**
* Retrieve info for specific market order.
*
* @see {@link https://docs.screeps.com/api/#Game.market.getOrderById}
*
* @type {function}
*
* @param {string} id The order ID.
*
* @return {Order} An object with the order info.
*/
getOrderById: function (id) { }
},
/**
* 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.
*
* @see {@link https://docs.screeps.com/api/#Game.resources}
*
* @type {Object<string, number>}
*/
resources: {},
/**
* 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.
*
* @see {@link https://docs.screeps.com/api/#Game.rooms}
*
* @type {Object<string, Room>}
*/
rooms: {},
/**
* An object describing the world shard where your script is currently being executed in.
*
* @see {@link https://docs.screeps.com/api/#Game.shard}
*
* @type {object} name - The name of the shard; type - Currently always equals to normal; ptr - Wether this shard belongs to the PTR.
*/
shard: {},
/**
* A hash containing all your spawns with spawn names as hash keys.
*
* @see {@link https://docs.screeps.com/api/#Game.spawns}
*
* @type {Object<string, StructureSpawn>}
*/
spawns: {},
/**
* A hash containing all your structures with structure id as hash keys.
*
* @see {@link https://docs.screeps.com/api/#Game.structures}
*
* @type {Object<string, Structure>}
*/
structures: {},
/**
* System game tick counter. It is automatically incremented on every tick.
*
* @see {@link https://docs.screeps.com/api/#Game.time}
*
* @type {number}
*/
time: 0,
/**
* 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.
*
* @see {@link https://docs.screeps.com/api/#Game.getObjectById}
*
* @type {function}
*
* @param {string} id The unique identificator.
*
* @return {object|null} Returns an object instance or null if it cannot be found.
*/
getObjectById: function (id) { },
/**
* 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.
*
* @see {@link https://docs.screeps.com/api/#Game.notify}
*
* @type {function}
*
* @param {string} message Custom text which will be sent in the message. Maximum length is 1000 characters.
* @param {number} [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.
*
* @return {void}
*/
notify: function (message, groupInterval) { }
};
/**
* Map visuals provide a way to show various visual debug info on the game map.
*
* @class
* @constructor
*
* @see {@link https://docs.screeps.com/api/#Game-map-visual}
*/
MapVisual = function() { };
MapVisual.prototype = {
/**
* Draw a line.
*
* @see {@link https://docs.screeps.com/api/#Game.map-visual.line}
*
* @type {function}
*
* @param {RoomPosition} pos1 The start position object.
* @param {RoomPosition} pos2 The finish position object.
* @param {Object} [style] Style object
*
* @return {MapVisual} The MapVisual object itself, so that you can chain calls.
*/
line: function(pos1, pos2, style) { },
/**
* Draw a circle.
*
* @see {@link https://docs.screeps.com/api/#Game.map-visual.circle}
*
* @type {function}
*
* @param {RoomPosition} pos The position object of the center.
* @param {Object} [style] Style object
*
* @return {MapVisual} The MapVisual object itself, so that you can chain calls.
*/
circle: function(pos, style) { },
/**
* Draw a rectangle.
*
* @see {@link https://docs.screeps.com/api/#Game.map-visual.rect}
*
* @type {function}
*
* @param {RoomPosition} topLeftPos The position object of the top-left corner.
* @param {number} width The width of the rectangle.
* @param {number} height The height of the rectangle.
* @param {Object} [style] Style object
*
* @return {MapVisual} The MapVisual object itself, so that you can chain calls.
*/
rect: function(topLeftPos, width, height, [style]) { },
/**
* Draw a polyline.
*
* @see {@link https://docs.screeps.com/api/#Game.map-visual.poly}
*
* @type {function}
*
* @param {array} points An array of points. Every item should be a RoomPosition object.
* @param {Object} [style] Style object
*
* @return {MapVisual} The MapVisual object itself, so that you can chain calls.
*/
poly: function(points, style) { },
/**
* Draw a text label. You can use any valid Unicode characters, including emoji.
*
* @see {@link https://docs.screeps.com/api/#Game.map-visual.text}
*
* @type {function}
*
* @param {string} text The text message.
* @param {RoomPosition} pos The position object of the label baseline.
* @param {Object} [style] Style object
*
* @return {MapVisual} The MapVisual object itself, so that you can chain calls.
*/
text: function(text, pos, style) { },
/**
* Remove all visuals from the map.
*
* @see {@link https://docs.screeps.com/api/#Game.map-visual.clear}
*
* @type {function}
*
* @return {MapVisual} The MapVisual object itself, so that you can chain calls.
*/
clear: function() { },
/**
* Get the stored size of all visuals added on the map in the current tick. It must not exceed 1024,000 (1000 KB).
*
* @see {@link https://docs.screeps.com/api/#Game.map-visual.getSize}
*
* @type {function}
*
* @return {number} The size of the visuals in bytes.
*/
getSize: function() { },
/**
* Returns a compact representation of all visuals added on the map in the current tick.
*
* @see {@link https://docs.screeps.com/api/#Game.map-visual.export}
*
* @type {function}
*
* @return {string} A string with visuals data. There's not much you can do with the string besides store them for later.
*/
export: function() { },
/**
* Add previously exported (with Game.map.visual.export) map visuals to the map visual data of the current tick.
*
* @see {@link https://docs.screeps.com/api/#Game.map-visual.import}
*
* @type {function}
*
* @param {string} val The string returned from Game.map.visual.export.
* @return {MapVisual} The MapVisual object itself, so that you can chain calls.
*/
import: function(val) { }
}