You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Greatly improve documentation for methods and their return types (#270)
* Copy over all the return type info
* Add comment for @link constants
* Revert listing bodypart constants
* Revert changes of return type to keep this pr pure
* Revert listing `DepositConstant`
---------
Co-authored-by: Mofeng <[email protected]>
Copy file name to clipboardExpand all lines: src/flag.ts
+21-11Lines changed: 21 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,27 +1,31 @@
1
1
/**
2
-
* A flag. Flags can be used to mark particular spots in a room. Flags are visible to their owners only.
2
+
* A flag.
3
+
*
4
+
* Flags can be used to mark particular spots in a room. Flags are visible to their owners only. You cannot have more than 10,000 flags.
3
5
*/
4
6
interfaceFlagextendsRoomObject{
5
7
readonlyprototype: Flag;
6
8
7
9
/**
8
-
* Flag color. One of the `COLOR_*` constants.
10
+
* Flag color. One of the {@link ColorConstant COLOR_*} constants.
9
11
*/
10
12
color: ColorConstant;
11
13
/**
14
+
* The flag's memory.
15
+
*
12
16
* A shorthand to Memory.flags[flag.name]. You can use it for quick access the flag's specific memory data object.
13
17
*/
14
18
memory: FlagMemory;
15
19
/**
16
-
* Flag’s name.
20
+
* The flag’s name.
17
21
*
18
22
* You can choose the name while creating a new flag, and it cannot be changed later.
19
23
*
20
-
* This name is a hash key to access the flag via the `Game.flags` object. The maximum name length is 60 characters.
24
+
* This name is a hash key to access the flag via the {@linkGame.flags} object. The maximum name length is 60 characters.
21
25
*/
22
26
name: string;
23
27
/**
24
-
* Flag secondary color. One of the `COLOR_*` constants.
28
+
* Flag secondary color. One of the {@link ColorConstant COLOR_*} constants.
25
29
*/
26
30
secondaryColor: ColorConstant;
27
31
/**
@@ -31,22 +35,28 @@ interface Flag extends RoomObject {
31
35
remove(): OK;
32
36
/**
33
37
* Set new color of the flag.
34
-
* @param color One of the following constants: COLOR_WHITE, COLOR_GREY, COLOR_RED, COLOR_PURPLE, COLOR_BLUE, COLOR_CYAN, COLOR_GREEN, COLOR_YELLOW, COLOR_ORANGE, COLOR_BROWN
35
-
* @parma secondaryColor Secondary color of the flag. One of the COLOR_* constants.
36
-
* @returns Result Code: OK, ERR_INVALID_ARGS
38
+
* @param color One of the {@link ColorConstant COLOR_*} constants.
39
+
* @param secondaryColor Secondary color of the flag. One of the {@link ColorConstant COLOR_*} constants.
40
+
* @returns One of the following codes:
41
+
* - OK: The operation has been scheduled successfully.
42
+
* - ERR_INVALID_ARGS: color or secondaryColor is not a valid color constant.
Copy file name to clipboardExpand all lines: src/game.ts
+18-6Lines changed: 18 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -31,15 +31,20 @@ interface Game {
31
31
*/
32
32
market: Market;
33
33
/**
34
-
* 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.
34
+
* A hash containing all your power creeps with their names as hash keys.
35
+
*
36
+
* Even power creeps not spawned in the world can be accessed here.
35
37
*/
36
38
powerCreeps: {[creepName: string]: PowerCreep};
37
39
/**
38
-
* 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.
40
+
* An object with your global resources that are bound to the account, like pixels or cpu unlocks.
41
+
*
42
+
* Each object key is a resource constant, values are resources amounts.
39
43
*/
40
44
resources: {[key: string]: any};
41
45
/**
42
46
* A hash containing all the rooms available to you with room names as hash keys.
47
+
*
43
48
* A room is visible if you have a creep or an owned structure in it.
44
49
*/
45
50
rooms: {[roomName: string]: Room};
@@ -63,12 +68,16 @@ interface Game {
63
68
shard: Shard;
64
69
65
70
/**
66
-
* System game tick counter. It is automatically incremented on every tick.
71
+
* System game tick counter.
72
+
*
73
+
* It is automatically incremented on every tick.
67
74
*/
68
75
time: number;
69
76
70
77
/**
71
-
* 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.
78
+
* Get an object with the specified unique ID.
79
+
*
80
+
* It may be a game object of any type. Only objects from the rooms which are visible to you can be accessed.
72
81
* @param id The unique identifier.
73
82
* @returns an object instance or null if it cannot be found.
74
83
*/
@@ -80,12 +89,15 @@ interface Game {
80
89
*
81
90
* This way, you can set up notifications to yourself on any occasion within the game.
82
91
*
83
-
* You can schedule up to 20 notifications during one game tick. Not available in the Simulation Room.
92
+
* You can schedule up to 20 notifications during one game tick. Not available in the Simulator.
84
93
* @param message Custom text which will be sent in the message. Maximum length is 1000 characters.
85
94
* @param groupInterval If set to 0 (default), the notification will be scheduled immediately.
86
95
* Otherwise, it will be grouped with other notifications and mailed out later using the specified time in minutes.
96
+
* @returns One of the following codes:
97
+
* - OK: The message has been sent successfully.
98
+
* - ERR_FULL: More than 20 notifications sent this tick.
0 commit comments