From abbd4ad53eab244cbefde8bdbbd8387e9c71750e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Maggioni?= Date: Wed, 13 Jul 2016 23:59:58 +0200 Subject: [PATCH 01/63] Creep's `transfer` method is not deprecated Only structure's method is so. --- Creep.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/Creep.js b/Creep.js index 34b952e..7ca4cd7 100644 --- a/Creep.js +++ b/Creep.js @@ -406,8 +406,6 @@ Creep.prototype = suicide: function() { }, /** - * @deprecated Since version 2016-07-11 - * * Transfer resource from the creep to another object. * The target has to be at adjacent square to the creep. * From 70bcbfba22cfbad5c4147d4c82cd56c8cd36d3ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Maggioni?= Date: Thu, 14 Jul 2016 00:05:14 +0200 Subject: [PATCH 02/63] Structure's `transfer` method are deprecated --- Structures/StructureContainer.js | 2 ++ Structures/StructureExtension.js | 2 ++ Structures/StructureLab.js | 2 ++ Structures/StructureLink.js | 2 ++ Structures/StructurePowerSpawn.js | 2 ++ Structures/StructureSpawn.js | 2 ++ Structures/StructureStorage.js | 2 ++ Structures/StructureTerminal.js | 2 ++ Structures/StructureTower.js | 2 ++ 9 files changed, 18 insertions(+) diff --git a/Structures/StructureContainer.js b/Structures/StructureContainer.js index e68b5a7..40b3d9a 100644 --- a/Structures/StructureContainer.js +++ b/Structures/StructureContainer.js @@ -29,6 +29,8 @@ StructureContainer.prototype = storeCapacity: 0, /** + * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. + * * Transfer resource from this structure to a creep. * The target has to be at adjacent square. * diff --git a/Structures/StructureExtension.js b/Structures/StructureExtension.js index 1e97da8..be2fc54 100644 --- a/Structures/StructureExtension.js +++ b/Structures/StructureExtension.js @@ -24,6 +24,8 @@ StructureExtension.prototype = energyCapacity: 0, /** + * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. + * * Transfer the energy from the extension to a creep. * You can transfer resources to your creeps from hostile structures as well. * diff --git a/Structures/StructureLab.js b/Structures/StructureLab.js index 8d0c4ed..0f40d22 100644 --- a/Structures/StructureLab.js +++ b/Structures/StructureLab.js @@ -77,6 +77,8 @@ StructureLab.prototype = runReaction: function(lab1, lab2) { }, /** + * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. + * * Transfer resource from this structure to a creep. * The target has to be at adjacent square. * You can transfer resources to your creeps from hostile structures as well. diff --git a/Structures/StructureLink.js b/Structures/StructureLink.js index ac7c9f3..ec218ac 100644 --- a/Structures/StructureLink.js +++ b/Structures/StructureLink.js @@ -30,6 +30,8 @@ StructureLink.prototype = energyCapacity: 0, /** + * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. + * * 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. diff --git a/Structures/StructurePowerSpawn.js b/Structures/StructurePowerSpawn.js index 9088baf..eed71ba 100644 --- a/Structures/StructurePowerSpawn.js +++ b/Structures/StructurePowerSpawn.js @@ -59,6 +59,8 @@ StructurePowerSpawn.prototype = processPower: function() { }, /** + * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. + * * Transfer the energy from this structure to a creep. * You can transfer resources to your creeps from hostile structures as well. * diff --git a/Structures/StructureSpawn.js b/Structures/StructureSpawn.js index aacaa3c..74855b9 100644 --- a/Structures/StructureSpawn.js +++ b/Structures/StructureSpawn.js @@ -111,6 +111,8 @@ StructureSpawn.prototype = renewCreep: function(target) { }, /** + * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. + * * Transfer the energy from the spawn to a creep. * * @type {function} diff --git a/Structures/StructureStorage.js b/Structures/StructureStorage.js index 5358a19..a831d2f 100644 --- a/Structures/StructureStorage.js +++ b/Structures/StructureStorage.js @@ -26,6 +26,8 @@ StructureStorage.prototype = storeCapacity: 0, /** + * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. + * * Transfer resource from this storage to a creep. * The target has to be at adjacent square. * You can transfer resources to your creeps from hostile structures as well. diff --git a/Structures/StructureTerminal.js b/Structures/StructureTerminal.js index 7f1bba8..e4d8265 100644 --- a/Structures/StructureTerminal.js +++ b/Structures/StructureTerminal.js @@ -45,6 +45,8 @@ StructureTerminal.prototype = send: function(resourceType, amount, destination, description) { }, /** + * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. + * * Transfer resource from this terminal to a creep. * The target has to be at adjacent square. * You can transfer resources to your creeps from hostile structures as well. diff --git a/Structures/StructureTower.js b/Structures/StructureTower.js index d1866f3..9154e84 100644 --- a/Structures/StructureTower.js +++ b/Structures/StructureTower.js @@ -62,6 +62,8 @@ StructureTower.prototype = /** + * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. + * * Transfer energy from the structure to a creep. * You can transfer resources to your creeps from hostile structures as well. * From c23fa33463db9e34a1b49c7601acf007314b8d56 Mon Sep 17 00:00:00 2001 From: ArSn Date: Sat, 16 Jul 2016 13:18:36 +0200 Subject: [PATCH 03/63] StructureLink.transferEnergy() is not deprecated, as it is not replaced with Creep.withdraw(). --- Structures/StructureLink.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/Structures/StructureLink.js b/Structures/StructureLink.js index ec218ac..ac7c9f3 100644 --- a/Structures/StructureLink.js +++ b/Structures/StructureLink.js @@ -30,8 +30,6 @@ StructureLink.prototype = energyCapacity: 0, /** - * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. - * * 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. From 3bcac0b62a0412544ff34c03f5bff5c9cfe26f3e Mon Sep 17 00:00:00 2001 From: Gareth Date: Sun, 17 Jul 2016 15:40:32 +0100 Subject: [PATCH 04/63] Added Atom install instructions --- Readme.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 6cb1268..c87a048 100644 --- a/Readme.md +++ b/Readme.md @@ -40,4 +40,21 @@ There are two ways to enable Autocomplete in Sublime Text, both of them require * `SublimeCodeIntel` - Install `SublimeCodeIntel` through `Package Control`. Go to `Preferences > Package Settings > SublimeCodeIntel > Settings -- User` and copy the contents of `ScreepsAutocomplete/config/SublimeCodeIntel.json` in to the file that opens. Save and restart Sublime - Text. After waiting for CodeIntel to process JavaScript, Autocomplete should be working \ No newline at end of file + Text. After waiting for CodeIntel to process JavaScript, Autocomplete should be working + +#### Atom +Integration with Atom is done through use of the [`atom-ternjs`](https://github.com/tststs/atom-ternjs) package. Here's the steps + + * Copy `ScreepsAutocomplete` in to your project folder + * Install the `atom-ternjs` package + * Put the following in your `.tern-project` file +```json +{ + "ecmaVersion": 6, + "libs": [], + "loadEagerly": [ + "ScreepsAutocomplete/**/*.js" + ] +} +``` + * Restart and Enjoy \ No newline at end of file From e625d740390631e926c66b1d6474267639098be3 Mon Sep 17 00:00:00 2001 From: ArSn Date: Fri, 22 Jul 2016 21:10:03 +0200 Subject: [PATCH 05/63] Creep.say() does now have a public param. Creep does now have a saying property. --- Creep.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Creep.js b/Creep.js index 7ca4cd7..df7a53d 100644 --- a/Creep.js +++ b/Creep.js @@ -88,6 +88,13 @@ Creep.prototype = */ name: "", + /** + * The text message that the creep was saying at the last tick. + * + * @type {string} + */ + saying: "", + /** * An object with the creep’s owner info * @@ -383,18 +390,17 @@ Creep.prototype = reserveController: function(target) { }, /** - * Display a visual speech balloon above the creep with the specified message. - * The message will disappear after a few seconds. - * Useful for debugging purposes. - * Only the creep's owner can see the speech message. + * 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. * * @type {function} * * @param {string} message The message to be displayed. Maximum length is 10 characters. + * @param {boolean} [public] Set to true to allow other players to see this message. Default is false. * * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY} */ - say: function(message) { }, + say: function(message, public) { }, /** * Kill the creep immediately. From b5a97486c0c4a9326bec7dbcd0f08f56db29132c Mon Sep 17 00:00:00 2001 From: kaiheilos Date: Sun, 31 Jul 2016 03:45:52 +0100 Subject: [PATCH 06/63] Added missing constants --- Global/Constants.js | 524 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 499 insertions(+), 25 deletions(-) diff --git a/Global/Constants.js b/Global/Constants.js index 2b303d5..2d9f62d 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -35,13 +35,13 @@ const RANGED_ATTACK = "ranged_attack"; * @constant * @type {string} */ -const HEAL = "heal"; +const TOUGH = "tough"; /** * @constant * @type {string} */ -const TOUGH = "tough"; +const HEAL = "heal"; /** * @constant @@ -207,63 +207,63 @@ const ERR_GCL_NOT_ENOUGH = -15; /** * @constant - * @type {string} + * @type {number} */ -const COLOR_WHITE = "white"; +const COLOR_RED = 1; /** * @constant - * @type {string} + * @type {number} */ -const COLOR_GREY = "grey"; +const COLOR_PURPLE = 2; /** * @constant - * @type {string} + * @type {number} */ -const COLOR_RED = "red"; +const COLOR_BLUE = 3; /** * @constant - * @type {string} + * @type {number} */ -const COLOR_PURPLE = "purple"; +const COLOR_CYAN = 4; /** * @constant - * @type {string} + * @type {number} */ -const COLOR_BLUE = "blue"; +const COLOR_GREEN = 5; /** * @constant - * @type {string} + * @type {number} */ -const COLOR_CYAN = "cyan"; +const COLOR_YELLOW = 6; /** * @constant - * @type {string} + * @type {number} */ -const COLOR_GREEN = "green"; +const COLOR_ORANGE = 7; /** * @constant - * @type {string} + * @type {number} */ -const COLOR_YELLOW = "yellow"; +const COLOR_BROWN = 8; /** * @constant - * @type {string} + * @type {number} */ -const COLOR_ORANGE = "orange"; +const COLOR_GREY = 9; /** * @constant - * @type {string} + * @type {number} */ -const COLOR_BROWN = "brown"; +const COLOR_WHITE = 10; /** FIND CONSTANTS **/ @@ -807,6 +807,262 @@ const RESOURCE_CATALYZED_GHODIUM_ACID = "XGH2O"; */ const RESOURCE_CATALYZED_GHODIUM_ALKALIDE = "XGHO2"; +/** + * @constant + * @type {object} + */ +const REACTIONS = { + H: { + O: "OH", + L: "LH", + K: "KH", + U: "UH", + Z: "ZH", + G: "GH" + }, + O: { + H: "OH", + L: "LO", + K: "KO", + U: "UO", + Z: "ZO", + G: "GO" + }, + Z: { + K: "ZK", + H: "ZH", + O: "ZO" + }, + L: { + U: "UL", + H: "LH", + O: "LO" + }, + K: { + Z: "ZK", + H: "KH", + O: "KO" + }, + G: { + H: "GH", + O: "GO" + }, + U: { + L: "UL", + H: "UH", + O: "UO" + }, + OH: { + UH: "UH2O", + UO: "UHO2", + ZH: "ZH2O", + ZO: "ZHO2", + KH: "KH2O", + KO: "KHO2", + LH: "LH2O", + LO: "LHO2", + GH: "GH2O", + GO: "GHO2" + }, + X: { + UH2O: "XUH2O", + UHO2: "XUHO2", + LH2O: "XLH2O", + LHO2: "XLHO2", + KH2O: "XKH2O", + KHO2: "XKHO2", + ZH2O: "XZH2O", + ZHO2: "XZHO2", + GH2O: "XGH2O", + GHO2: "XGHO2" + }, + ZK: { + UL: "G" + }, + UL: { + ZK: "G" + }, + LH: { + OH: "LH2O" + }, + ZH: { + OH: "ZH2O" + }, + GH: { + OH: "GH2O" + }, + KH: { + OH: "KH2O" + }, + UH: { + OH: "UH2O" + }, + LO: { + OH: "LHO2" + }, + ZO: { + OH: "ZHO2" + }, + KO: { + OH: "KHO2" + }, + UO: { + OH: "UHO2" + }, + GO: { + OH: "GHO2" + }, + LH2O: { + X: "XLH2O" + }, + KH2O: { + X: "XKH2O" + }, + ZH2O: { + X: "XZH2O" + }, + UH2O: { + X: "XUH2O" + }, + GH2O: { + X: "XGH2O" + }, + LHO2: { + X: "XLHO2" + }, + UHO2: { + X: "XUHO2" + }, + KHO2: { + X: "XKHO2" + }, + ZHO2: { + X: "XZHO2" + }, + GHO2: { + X: "XGHO2" + } +}; + +/** + * @constant + * @type {object} + */ +const BOOSTS = { + work: { + UO: { + harvest: 2 + }, + UHO2: { + harvest: 3 + }, + XUHO2: { + harvest: 4 + }, + LH: { + build: 1.3, + repair: 1.3 + }, + LH2O: { + build: 1.65, + repair: 1.65 + }, + XLH2O: { + build: 2, + repair: 2 + }, + ZH: { + dismantle: 2 + }, + ZH2O: { + dismantle: 3 + }, + XZH2O: { + dismantle: 4 + }, + GH: { + upgradeController: 1.3 + }, + GH2O: { + upgradeController: 1.65 + }, + XGH2O: { + upgradeController: 2 + } + }, + attack: { + UH: { + attack: 2 + }, + UH2O: { + attack: 3 + }, + XUH2O: { + attack: 4 + } + }, + ranged_attack: { + KO: { + rangedAttack: 2, + rangedMassAttack: 2 + }, + KHO2: { + rangedAttack: 3, + rangedMassAttack: 3 + }, + XKHO2: { + rangedAttack: 4, + rangedMassAttack: 4 + } + }, + heal: { + LO: { + heal: 2, + rangedHeal: 2 + }, + LHO2: { + heal: 3, + rangedHeal: 3 + }, + XLHO2: { + heal: 4, + rangedHeal: 4 + } + }, + carry: { + KH: { + capacity: 2 + }, + KH2O: { + capacity: 3 + }, + XKH2O: { + capacity: 4 + } + }, + move: { + ZO: { + fatigue: 2 + }, + ZHO2: { + fatigue: 3 + }, + XZHO2: { + fatigue: 4 + } + }, + tough: { + GO: { + damage: .7 + }, + GHO2: { + damage: .5 + }, + XGHO2: { + damage: .3 + } + } +}; /** * @constant @@ -857,6 +1113,7 @@ const RESOURCES_ALL = [ RESOURCE_CATALYZED_GHODIUM_ACID, RESOURCE_CATALYZED_GHODIUM_ALKALIDE ]; + /** * @constant * @type {string[]} @@ -872,6 +1129,23 @@ const BODYPARTS_ALL = [ CLAIM ]; +/** + * @constant + * @type {string[]} + */ +const COLORS_ALL = [ + COLOR_RED, + COLOR_PURPLE, + COLOR_BLUE, + COLOR_CYAN, + COLOR_GREEN, + COLOR_YELLOW, + COLOR_ORANGE, + COLOR_BROWN, + COLOR_GREY, + COLOR_WHITE +]; + /** * @constant * @type {object} @@ -894,6 +1168,12 @@ const BODYPART_COST = { */ const CREEP_SPAWN_TIME = 3; +/** + * @constant + * @type {number} + */ +const CREEP_RENEW_RATIO = 1.2; + /** * Lifetime of a creep * @constant @@ -931,7 +1211,10 @@ const OBSTACLE_OBJECT_TYPES = [ 'tower', 'observer', 'powerSpawn', - 'powerBank' + 'powerBank', + 'lab', + 'terminal', + 'nuker' ]; /** @@ -946,6 +1229,32 @@ const ENERGY_REGEN_TIME = 300; */ const ENERGY_DECAY = 1000; +/** + * @constant + * @type {number} + */ +const MINERAL_REGEN_TIME = 50000; + +/** + * @constant + * @type {object} + */ +const MINERAL_MIN_AMOUNT = { + H: 140000, + O: 140000, + L: 70000, + K: 70000, + Z: 70000, + U: 70000, + X: 70000 +}; + +/** + * @constant + * @type {number} + */ +const MINERAL_RANDOM_FACTOR = 2; + /** * @constant * @type {number} @@ -1020,6 +1329,12 @@ const SOURCE_ENERGY_CAPACITY = 3000; */ const SOURCE_ENERGY_NEUTRAL_CAPACITY = 1500; +/** + * @constant + * @type {number} + */ +const SOURCE_ENERGY_KEEPER_CAPACITY = 4500; + /** * @constant * @type {number} @@ -1108,6 +1423,88 @@ const LINK_COOLDOWN = 1; */ const LINK_LOSS_RATIO = 0.03; +/** + * @constant + * @type {number} + */ +const CONTAINER_HITS = 250000; + +/** + * @constant + * @type {number} + */ +const CONTAINER_CAPACITY = 2000; + +/** + * @constant + * @type {number} + */ +const CONTAINER_DECAY = 5000; + +/** + * @constant + * @type {number} + */ +const CONTAINER_DECAY_TIME = 100; + +/** + * @constant + * @type {number} + */ +const CONTAINER_DECAY_TIME_OWNED = 500; + +/** + * @constant + * @type {number} + */ +const NUKER_HITS = 1000; + +/** + * @constant + * @type {number} + */ +const NUKER_COOLDOWN = 100000; + +/** + * @constant + * @type {number} + */ +const NUKER_ENERGY_CAPACITY = 5000; + +/** + * @constant + * @type {number} + */ +const NUKER_GHODIUM_CAPACITY = 5000; + +/** + * @constant + * @type {number} + */ +const NUKE_LAND_TIME = 50000; + +/** + * @constant + * @type {number} + */ +const NUKE_RANGE = 5; + +/** + * @constant + * @type {object} + */ +const NUKE_DAMAGE = { + 0: 10000000, + 1: 1000000, + 4: 100000 +}; + +/** + * @constant + * @type {number} + */ +const PORTAL_DECAY = 30000; + /** * @constant * @type {number} @@ -1132,6 +1529,12 @@ const CARRY_CAPACITY = 50; */ const HARVEST_POWER = 2; +/** + * @constant + * @type {number} + */ +const HARVEST_MINERAL_POWER = 1; + /** * @constant * @type {number} @@ -1194,7 +1597,12 @@ const CONSTRUCTION_COST = { storage: 30000, tower: 5000, observer: 8000, - powerSpawn: 100000 + powerSpawn: 100000, + extractor: 5000, + lab: 50000, + terminal: 100000, + container: 5000, + nuker: 100000 }; /** @@ -1273,6 +1681,36 @@ const CONTROLLER_RESERVE_MAX = 5000; */ const CONTROLLER_MAX_UPGRADE_PER_TICK = 15; +/** + * @constant + * @type {number} + */ +const CONTROLLER_ATTACK_BLOCKED_UPGRADE = 1000; + +/** + * @constant + * @type {number} + */ +const TERMINAL_CAPACITY = 300000; + +/** + * @constant + * @type {number} + */ +const TERMINAL_HITS = 3000; + +/** + * @constant + * @type {number} + */ +const TERMINAL_SEND_COST = 0.1; + +/** + * @constant + * @type {number} + */ +const TERMINAL_MIN_SEND = 100; + /** * @constant * @type {number} @@ -1399,6 +1837,42 @@ const POWER_SPAWN_POWER_CAPACITY = 100; */ const POWER_SPAWN_ENERGY_RATIO = 50; +/** + * @constant + * @type {number} + */ +const LAB_HITS = 500; + +/** + * @constant + * @type {number} + */ +const LAB_MINERAL_CAPACITY = 3000; + +/** + * @constant + * @type {number} + */ +const LAB_ENERGY_CAPACITY = 2000; + +/** + * @constant + * @type {number} + */ +const LAB_BOOST_ENERGY = 20; + +/** + * @constant + * @type {number} + */ +const LAB_BOOST_MINERAL = 30; + +/** + * @constant + * @type {number} + */ +const LAB_COOLDOWN = 10; + /** * @constant * @type {number} @@ -1507,4 +1981,4 @@ const LOOK_NUKES = "nuke"; * @constant * @type {string} */ -const LOOK_TERRAIN = "terrain"; \ No newline at end of file +const LOOK_TERRAIN = "terrain"; From 06c996d91b2f12bde9156e22a58cfa57dc058cf8 Mon Sep 17 00:00:00 2001 From: ArSn Date: Tue, 9 Aug 2016 20:52:02 +0200 Subject: [PATCH 07/63] Updated StructureTerminal description as the calculation for the cost changed. --- Structures/StructureTerminal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Structures/StructureTerminal.js b/Structures/StructureTerminal.js index e4d8265..60d1b20 100644 --- a/Structures/StructureTerminal.js +++ b/Structures/StructureTerminal.js @@ -2,8 +2,8 @@ * 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.1 * amount * linearDistanceBetweenRooms). - * For example, sending 100 mineral units from W1N1 to W2N3 will consume 20 energy units. + * Each transaction requires additional energy (regardless of the transfer resource type) that can be calculated using Game.market.calcTransactionCost method. + * For example, sending 1000 mineral units from W0N0 to W10N5 will consume 742 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. * From 52994686dd33c29b7c0c4bb4ffb02f4e87b82fac Mon Sep 17 00:00:00 2001 From: ArSn Date: Tue, 9 Aug 2016 20:57:44 +0200 Subject: [PATCH 08/63] Added new method Game.market.calcTransactionCost(). --- Game.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Game.js b/Game.js index b8d7081..f2f5478 100644 --- a/Game.js +++ b/Game.js @@ -303,6 +303,20 @@ Game = */ orders: [], + /** + * 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) ) + * + * @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) { }, + /** * This method is still under development. * Cancel a previously created order. From df048dcb8bf2fc8f8e1aff1be8f528f291bc134e Mon Sep 17 00:00:00 2001 From: Zsw007 Date: Wed, 24 Aug 2016 02:27:58 -0400 Subject: [PATCH 09/63] Fixed typo for getActiveBodyparts, resolves #41 --- Creep.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Creep.js b/Creep.js index df7a53d..8b3e6ba 100644 --- a/Creep.js +++ b/Creep.js @@ -220,7 +220,7 @@ Creep.prototype = * * @return {number} A number representing the quantity of body parts. */ - getActiveBodyParts: function(type) { }, + getActiveBodyparts: function(type) { }, /** * Harvest energy from the source or minerals from the mineral deposit. From 801458961632935285b30df6bb4d3046a6a1cc0f Mon Sep 17 00:00:00 2001 From: Tymoteusz Paul Date: Tue, 27 Sep 2016 13:24:00 +0100 Subject: [PATCH 10/63] Updating nuker and observer constants Updating nuker and observer constants + introducing new constant CONTROLLER_NUKE_BLOCKED_UPGRADE from recent patch. --- Global/Constants.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Global/Constants.js b/Global/Constants.js index 2d9f62d..4474a06 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -1469,7 +1469,7 @@ const NUKER_COOLDOWN = 100000; * @constant * @type {number} */ -const NUKER_ENERGY_CAPACITY = 5000; +const NUKER_ENERGY_CAPACITY = 300000; /** * @constant @@ -1487,7 +1487,7 @@ const NUKE_LAND_TIME = 50000; * @constant * @type {number} */ -const NUKE_RANGE = 5; +const NUKE_RANGE = 10; /** * @constant @@ -1495,8 +1495,7 @@ const NUKE_RANGE = 5; */ const NUKE_DAMAGE = { 0: 10000000, - 1: 1000000, - 4: 100000 + 2: 5000000 }; /** @@ -1687,6 +1686,12 @@ const CONTROLLER_MAX_UPGRADE_PER_TICK = 15; */ const CONTROLLER_ATTACK_BLOCKED_UPGRADE = 1000; +/** + * @constant + * @type {number} + */ +const CONTROLLER_NUKE_BLOCKED_UPGRADE = 200; + /** * @constant * @type {number} @@ -1775,7 +1780,7 @@ const OBSERVER_HITS = 500; * @constant * @type {number} */ -const OBSERVER_RANGE = 5; +const OBSERVER_RANGE = 10; /** * @constant From 4d1d7385d63d8cb1deecb9f41d3df216c15cd955 Mon Sep 17 00:00:00 2001 From: Thomas Kneisel Date: Wed, 12 Oct 2016 21:08:15 +0200 Subject: [PATCH 11/63] Create package.json to install via npm --- package.json | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..7d7b525 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "ScreepsAutocomplete", + "version": "1.0.0", + "description": "IDE Autocomplete for Screeps", + "dependencies": { + }, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Garethp/ScreepsAutocomplete.git" + }, + "keywords": [ + "game", + "screeps" + ], + "author": "Garethp", + "license": "MIT", + "bugs": { + "url": "https://github.com/Garethp/ScreepsAutocomplete/issues" + }, + "homepage": "https://github.com/Garethp/ScreepsAutocomplete#readme" +} From b3cc74497ce46836f5695fd30b3d54d624a86ed0 Mon Sep 17 00:00:00 2001 From: Russell Bryson Date: Wed, 12 Oct 2016 21:57:46 -0600 Subject: [PATCH 12/63] Added missing Game.market methods --- Game.js | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/Game.js b/Game.js index f2f5478..2b1e2ce 100644 --- a/Game.js +++ b/Game.js @@ -380,7 +380,100 @@ Game = * * @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_ARGS} */ - deal: function(orderId, targetRoomName, amount) { } + deal: function(orderId, targetRoomName, amount) { }, + + /** + * This method is still under development. + * Add more capacity to an existing order. It will affect remainingAmount and totalAmount properties. You will + * be charged price*addAmount*0.05 credits. + * + * @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) { }, + + /** + * This method is still under development. + * Get other players' orders currently active on the market. + * + * @type {function} + * + * @param {object|function} [filter] An object or function that will filter the resulting list using the lodash.filter method. + * + * @return {Array} An orders array in the following form: + + id - The unique order ID. + created - The order creation time in game ticks. + type - Either ORDER_SELL or ORDER_BUY. + resourceType - Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN. + roomName - The room where this order is placed. + amount - Currently available amount to trade. + remainingAmount - How many resources are left to trade via this order. When it becomes equal to zero, the order is removed. + + [{ + id : "55c34a6b5be41a0a6e80c68b", + created : 13131117, + type : "sell" + resourceType : "OH", + roomName : "W1N1", + amount : 15821, + remainingAmount : 30000, + price : 2.95 + }, { + id : "55c34a6b52411a0a6e80693a", + created : 13134122, + type : "buy" + resourceType : "energy", + roomName : "W1N1", + amount : 94000, + remainingAmount : 94000, + price : 0.45 + }, { + id : "55c34a6b5be41a0a6e80c123", + created : 13105123, + type : "sell" + resourceType : "token", + amount : 3, + remainingAmount : 10, + price : 50000 + }] + */ + getAllOrders: function(filter) { }, + + /** + * This method is still under development. + * Retrieve info for specific market order. + * + * @type {function} + * + * @param {string} id The order ID + * + * @return {object} An object with the order info in the following form: + + id - The unique order ID. + created - The order creation time in game ticks. + type - Either ORDER_SELL or ORDER_BUY. + resourceType - Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN. + roomName - The room where this order is placed. + amount - Currently available amount to trade. + remainingAmount - How many resources are left to trade via this order. When it becomes equal to zero, the order is removed. + + { + id : "55c34a6b5be41a0a6e80c68b", + created : 13131117, + type : "sell" + resourceType : "OH", + roomName : "W1N1", + amount : 15821, + remainingAmount : 30000, + price : 2.95 + } + */ + getOrderById: function(id) { } }, /** From 140f9e3dc4543911feb0a8458ce7d770602094c2 Mon Sep 17 00:00:00 2001 From: Russell Bryson Date: Wed, 12 Oct 2016 22:28:41 -0600 Subject: [PATCH 13/63] Moved serialize path and deserialize path out of the prototype. --- Room.js | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Room.js b/Room.js index 2be75d7..04f9679 100644 --- a/Room.js +++ b/Room.js @@ -5,7 +5,29 @@ * * @class */ -Room = function() { }; +Room = { + /** + * Serialize a path array into a short string representation, which is suitable to store in memory. + * + * @type {function} + * + * @param {Array} path A path array retrieved from Room.findPath. + * + * @return {string} A serialized string form of the given path. + */ + serializePath: function(path) { }, + + /** + * Deserialize a short string path representation into an array form. + * + * @type {function} + * + * @param {string} path A serialized path string. + * + * return {Array} A path array. + */ + deserializePath: function(path) { } +}; Room.prototype = { @@ -66,28 +88,6 @@ Room.prototype = */ terminal: null, - /** - * Serialize a path array into a short string representation, which is suitable to store in memory. - * - * @type {function} - * - * @param {Array} path A path array retrieved from Room.findPath. - * - * @return {string} A serialized string form of the given path. - */ - serializePath: function(path) { }, - - /** - * Deserialize a short string path representation into an array form. - * - * @type {function} - * - * @param {string} path A serialized path string. - * - * return {Array} A path array. - */ - deserializePath: function(path) { }, - /** * Create new ConstructionSite at the specified location. * From c5df4cafe68540c9b0742edd43cf63d072754465 Mon Sep 17 00:00:00 2001 From: Russell Bryson Date: Wed, 12 Oct 2016 22:36:59 -0600 Subject: [PATCH 14/63] added isRoomAvailable to Game.map --- Game.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Game.js b/Game.js index 2b1e2ce..576770d 100644 --- a/Game.js +++ b/Game.js @@ -174,8 +174,20 @@ Game = */ getTerrainAt: function(x, y, roomName) { }, + /** + * Check if the room with the given name is available to move into + * + * @type {function} + * + * @param {string} roomName The room name. + * + * @return {boolean} + */ + isRoomAvailable: function(roomName) { }, + /** * Check if the room with the given name is protected by temporary "newbie" walls. + * This method has been deprecated in favor of isRoomAvailable * * @type {function} * From 803058b66b7118775dd0e9e006e042dd1c3ea791 Mon Sep 17 00:00:00 2001 From: Russell Bryson Date: Wed, 12 Oct 2016 22:58:31 -0600 Subject: [PATCH 15/63] removed object descriptors for getOrderById --- Game.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Game.js b/Game.js index 576770d..463919a 100644 --- a/Game.js +++ b/Game.js @@ -425,6 +425,7 @@ Game = roomName - The room where this order is placed. amount - Currently available amount to trade. remainingAmount - How many resources are left to trade via this order. When it becomes equal to zero, the order is removed. + price - The price per unit of the resourceType [{ id : "55c34a6b5be41a0a6e80c68b", @@ -465,15 +466,6 @@ Game = * @param {string} id The order ID * * @return {object} An object with the order info in the following form: - - id - The unique order ID. - created - The order creation time in game ticks. - type - Either ORDER_SELL or ORDER_BUY. - resourceType - Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN. - roomName - The room where this order is placed. - amount - Currently available amount to trade. - remainingAmount - How many resources are left to trade via this order. When it becomes equal to zero, the order is removed. - { id : "55c34a6b5be41a0a6e80c68b", created : 13131117, From ac47a5e5fbdb1458eba36656e39cd4149061cc83 Mon Sep 17 00:00:00 2001 From: Proximitron Date: Fri, 21 Oct 2016 04:15:04 +0200 Subject: [PATCH 16/63] Update StructureController.js --- Structures/StructureController.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Structures/StructureController.js b/Structures/StructureController.js index 0000ecc..eac0bea 100644 --- a/Structures/StructureController.js +++ b/Structures/StructureController.js @@ -10,6 +10,37 @@ StructureController = function() { }; StructureController.prototype = { + + /** + * Ticks left before another safeMode can be used + * + * @type {number} + */ + safeModeCooldown: 0, + + /** + * The number of available safeMode activations + * + * @type {number} + */ + safeModeAvailable: 0, + + /** + * Returns if safeMode is active. If not this will return undefined, not false. + * + * @type {Boolean|undefined} + */ + safeMode: undefined, + + /** + * Triggers the activation of a saveMode if possible and available + * + * @type {function} + * + * @return {OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_TIRED} + */ + activateSafeMode: function() {}, + /** * Current controller level, from 0 to 8. * From 574577013d749eca6830ba3a07e6f7d697e9fcf6 Mon Sep 17 00:00:00 2001 From: Russell Bryson Date: Wed, 9 Nov 2016 20:10:11 -0700 Subject: [PATCH 17/63] updated PathFinder.js to reference the static methods correctly. --- PathFinder.js | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/PathFinder.js b/PathFinder.js index c8e3a61..da94ccf 100644 --- a/PathFinder.js +++ b/PathFinder.js @@ -2,25 +2,24 @@ * * @class */ -PathFinder = function() { }; - -PathFinder.prototype = +PathFinder = { /** * Find an optimal path between origin and goal. + * @static * * @type {function} * * @param {RoomPosition} origin The start position. * @param {object} 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. + 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. - pos - RoomPosition - The target. - range - number - Range to pos before goal is considered reached. The default is 0. + pos + RoomPosition + The target. + range + number + Range to pos before goal is considered reached. The default is 0. * @param {object} [opts] An object containing additional pathfinding flags. * @param {function} [opts.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. If you return false from the callback the requested room will not be searched, and it won't count against maxRooms * @param {number} [opts.plainCost] Cost for walking on plain positions. The default is 1. @@ -37,6 +36,7 @@ PathFinder.prototype = /** * Specify whether to use this new experimental pathfinder in game objects methods. * This method should be invoked every tick. + * @static * * @note It affects the following methods behavior: Room.findPath, RoomPosition.findPathTo, RoomPosition.findClosestByPath, Creep.moveTo. * @@ -55,6 +55,19 @@ PathFinder.prototype = */ PathFinder.CostMatrix = function() { }; +/** + * Static method which deserializes a new CostMatrix using the return value of serialize. + * @static + * + * @type {function} + * + * @param {object} val Whatever serialize returned + * + * @return {CostMatrix} + */ +PathFinder.CostMatrix.deserialize = function(val) { }; + + PathFinder.CostMatrix.prototype = { /** @@ -96,17 +109,5 @@ PathFinder.CostMatrix.prototype = * * @return {Array} An array of numbers. There's not much you can do with the numbers besides store them for later. */ - serialize: function() { }, - - /** - * Static method which deserializes a new CostMatrix using the return value of serialize. - * @static - * - * @type {function} - * - * @param {object} val Whatever serialize returned - * - * @return {CostMatrix} - */ - deserialize: function(val) { } + serialize: function() { } }; From 0f20b02c1d52be0519239ba9e42e9fe497afe42f Mon Sep 17 00:00:00 2001 From: PostCrafter Date: Wed, 23 Nov 2016 15:09:53 +0100 Subject: [PATCH 18/63] Add Links to Screeps documentation --- ConstructionSite.js | 16 +++++++ Creep.js | 80 +++++++++++++++++++++++++++++++ Flag.js | 16 +++++++ Game.js | 72 +++++++++++++++++++++++++++- Mineral.js | 10 ++++ Nuke.js | 8 ++++ OwnedStructure.js | 6 +++ PathFinder.js | 18 +++++++ RawMemory.js | 6 +++ Resource.js | 8 ++++ Room.js | 42 ++++++++++++++++ RoomObject.js | 6 +++ RoomPosition.js | 34 +++++++++++++ Source.js | 10 ++++ Structure.js | 16 +++++++ Structures/StructureContainer.js | 8 ++++ Structures/StructureController.js | 24 ++++++++++ Structures/StructureExtension.js | 8 ++++ Structures/StructureExtractor.js | 2 + Structures/StructureKeeperLair.js | 4 ++ Structures/StructureLab.js | 20 ++++++++ Structures/StructureLink.js | 10 ++++ Structures/StructureNuker.js | 14 ++++++ Structures/StructureObserver.js | 4 ++ Structures/StructurePortal.js | 6 +++ Structures/StructurePowerBank.js | 6 +++ Structures/StructurePowerSpawn.js | 16 +++++++ Structures/StructureRampart.js | 4 ++ Structures/StructureRoad.js | 4 ++ Structures/StructureSpawn.js | 24 ++++++++++ Structures/StructureStorage.js | 8 ++++ Structures/StructureTerminal.js | 10 ++++ Structures/StructureTower.js | 13 ++++- Structures/StructureWall.js | 4 ++ 34 files changed, 535 insertions(+), 2 deletions(-) diff --git a/ConstructionSite.js b/ConstructionSite.js index c20ef04..6c453d7 100644 --- a/ConstructionSite.js +++ b/ConstructionSite.js @@ -5,6 +5,8 @@ * * @class * @extends {RoomObject} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016342-ConstructionSite} */ ConstructionSite = function() { }; @@ -14,6 +16,8 @@ ConstructionSite.prototype = * A unique object identificator. * You can use Game.getObjectById method to retrieve an object instance by its id. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016342-ConstructionSite#id} + * * @type {string} */ id: "", @@ -21,6 +25,8 @@ ConstructionSite.prototype = /** * Whether this is your own construction site. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016342-ConstructionSite#my} + * * @type {boolean} */ my: true, @@ -28,6 +34,8 @@ ConstructionSite.prototype = /** * An object with the structure’s owner info * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016342-ConstructionSite#owner} + * * @type {{username: ""}} */ owner: @@ -38,6 +46,8 @@ ConstructionSite.prototype = /** * The current construction progress. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016342-ConstructionSite#progress} + * * @type {number} */ progress: 0, @@ -45,6 +55,8 @@ ConstructionSite.prototype = /** * The total construction progress needed for the structure to be built. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016342-ConstructionSite#progressTotal} + * * @type {number} */ progressTotal: 0, @@ -52,6 +64,8 @@ ConstructionSite.prototype = /** * One of the STRUCTURE_* constants. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016342-ConstructionSite#structureType} + * * @type {string} */ structureType: "", @@ -59,6 +73,8 @@ ConstructionSite.prototype = /** * Remove the construction site. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016342-ConstructionSite#remove} + * * @type {function} * * @return {number|OK|ERR_NOT_OWNER} diff --git a/Creep.js b/Creep.js index 8b3e6ba..8b4263f 100644 --- a/Creep.js +++ b/Creep.js @@ -2,6 +2,8 @@ * * @class * @extends {RoomObject} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep} */ Creep = function() { }; @@ -10,6 +12,8 @@ Creep.prototype = /** * An array describing the creep’s body * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#body} + * * @type {Array<{boost:string, type:string, hits:number}>} * * @note boost: If the body part is boosted, this property specifies the mineral type which is used for boosting. One of the RESOURCE_* constants. @@ -24,6 +28,8 @@ Creep.prototype = * Each object key is one of the RESOURCE_* constants, values are resources amounts. * Use _.sum(creep.carry) to get the total amount of contents. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#carry} + * * @type {object} */ carry: {}, @@ -31,6 +37,8 @@ Creep.prototype = /** * The total amount of resources the creep can carry. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#carryCapacity} + * * @type {number} */ carryCapacity: 0, @@ -38,6 +46,8 @@ Creep.prototype = /** * The movement fatigue indicator. If it is greater than zero, the creep cannot move. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#fatigue} + * * @type {number} */ fatigue: 0, @@ -45,6 +55,8 @@ Creep.prototype = /** * The current amount of hit points of the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#hits} + * * @type {number} */ hits: 0, @@ -52,6 +64,8 @@ Creep.prototype = /** * The maximum amount of hit points of the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#hitsMax} + * * @type {number} */ hitsMax: 0, @@ -60,6 +74,8 @@ Creep.prototype = * A unique object identificator. * You can use Game.getObjectById method to retrieve an object instance by its id. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#id} + * * @type {string} */ id: "", @@ -68,6 +84,8 @@ Creep.prototype = * A shorthand to Memory.creeps[creep.name]. * You can use it for quick access the creep’s specific memory data object. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#memory} + * * @type {*} */ memory: {}, @@ -75,6 +93,8 @@ Creep.prototype = /** * Whether it is your creep or foe. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#my} + * * @type {boolean} */ my: true, @@ -84,6 +104,8 @@ Creep.prototype = * 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. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#name} + * * @type {string} */ name: "", @@ -91,6 +113,8 @@ Creep.prototype = /** * The text message that the creep was saying at the last tick. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#saying} + * * @type {string} */ saying: "", @@ -98,6 +122,8 @@ Creep.prototype = /** * An object with the creep’s owner info * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#owner} + * * @type {{username:string}} */ owner: @@ -108,6 +134,8 @@ Creep.prototype = /** * Whether this creep is still being spawned. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#spawning} + * * @type {boolean} */ spawning: false, @@ -115,6 +143,8 @@ Creep.prototype = /** * The remaining amount of game ticks after which the creep will die. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#ticksToLive} + * * @type {number} */ ticksToLive: 0, @@ -126,6 +156,8 @@ Creep.prototype = * The target has to be at adjacent square to the creep. * If the target is a creep with ATTACK body parts and is not inside a rampart, it will automatically hit back at the attacker. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#attack} + * * @type {function} * * @param {Creep|Spawn|Structure} target The target object to be attacked. @@ -139,6 +171,8 @@ Creep.prototype = * The controller under attack cannot be upgraded for the next 1,000 ticks. * The target has to be at adjacent square to the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#attackController} + * * @type {function} * * @param {StructureController} target The target controller object. @@ -152,6 +186,8 @@ Creep.prototype = * Requires WORK and CARRY body parts. * The target has to be within 3 squares range of the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#build} + * * @type {function} * * @param {ConstructionSite} target The target construction site to be built. @@ -163,6 +199,8 @@ Creep.prototype = /** * Cancel the order given during the current game tick. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#cancelOrder} + * * @type {function} * * @param {string} methodName The name of a creep's method to be cancelled. @@ -176,6 +214,8 @@ Creep.prototype = * Requires the CLAIM body part. * The target has to be at adjacent square to the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#claimController} + * * @type {function} * * @param {StructureController} target The target controller object. @@ -190,6 +230,8 @@ Creep.prototype = * 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. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#dismantle} + * * @type {function} * * @param {Spawn|Structure} target The target structure. @@ -201,6 +243,8 @@ Creep.prototype = /** * Drop this resource on the ground. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#drop} + * * @type {function} * * @param {string} resourceType One of the RESOURCE_* constants. @@ -214,6 +258,8 @@ Creep.prototype = * Get the quantity of live body parts of the given type. * Fully damaged parts do not count. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#getActiveBodyparts} + * * @type {function} * * @param {string} type A body part type, one of the following body part constants: MOVE, WORK, CARRY, ATTACK, RANGED_ATTACK, HEAL, TOUGH @@ -228,6 +274,8 @@ Creep.prototype = * If the creep has an empty CARRY body part, the harvested resource is put into it; otherwise it is dropped on the ground. * The target has to be at an adjacent square to the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#harvest} + * * @type {function} * * @param {Source|Mineral} target The object to be harvested. @@ -242,6 +290,8 @@ Creep.prototype = * Requires the HEAL body part. * The target has to be at adjacent square to the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#heal} + * * @type {function} * * @param {Creep} target The target creep object. @@ -254,6 +304,8 @@ Creep.prototype = * Move the creep one square in the specified direction. * Requires the MOVE body part. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#move} + * * @type {function} * * @param {number} direction One of the following constants: TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT @@ -266,6 +318,8 @@ Creep.prototype = * Move the creep using the specified predefined path. * Requires the MOVE body part. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#moveByPath} + * * @type {function} * * @param {Array|string} path A path value as returned from Room.findPath or RoomPosition.findPathTo methods. Both array form and serialized string form are accepted. @@ -280,6 +334,8 @@ Creep.prototype = * If the target is in another room, then the corresponding exit will be used as a target. * Requires the MOVE body part. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#moveTo} + * * @type {function} * * @param {number} x X position of the target in the same room. @@ -301,6 +357,8 @@ Creep.prototype = * The notification will be sent to your account email. * Turned on by default. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#notifyWhenAttacked} + * * @type {function} * * @param {boolean} enabled Whether to enable notification or disable. @@ -314,6 +372,8 @@ Creep.prototype = * Requires the CARRY body part. * The target has to be at adjacent square to the creep or at the same square. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#pickup} + * * @type {function} * * @param {Resource} target The target object to be picked up. @@ -328,6 +388,8 @@ Creep.prototype = * If the target is inside a rampart, the rampart is attacked instead. * The target has to be within 3 squares range of the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#rangedAttack} + * * @type {function} * * @param {Creep|Spawn|Structure} target The target object to be attacked. @@ -342,6 +404,8 @@ Creep.prototype = * Requires the HEAL body part. * The target has to be within 3 squares range of the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#rangedHeal} + * * @type {function} * * @param {Creep} target The target creep object. @@ -356,6 +420,8 @@ Creep.prototype = * The attack power depends on the range to each target. * Friendly units are not affected. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#rangedMassAttack} + * * @type {function} * * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NO_BODYPART} @@ -367,6 +433,8 @@ Creep.prototype = * Requires the WORK and CARRY body parts. * The target has to be within 3 squares range of the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#repair} + * * @type {function} * * @param {Spawn|Structure} target The target structure to be repaired. @@ -381,6 +449,8 @@ Creep.prototype = * The maximum reservation period to maintain is 5,000 ticks. * The target has to be at adjacent square to the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#reserveController} + * * @type {function} * * @param {StructureController} target The target controller object to be reserved. @@ -393,6 +463,8 @@ Creep.prototype = * 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. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#say} + * * @type {function} * * @param {string} message The message to be displayed. Maximum length is 10 characters. @@ -405,6 +477,8 @@ Creep.prototype = /** * Kill the creep immediately. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#suicide} + * * @type {function} * * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY} @@ -415,6 +489,8 @@ Creep.prototype = * Transfer resource from the creep to another object. * The target has to be at adjacent square to the creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#transfer} + * * @type {function} * * @param {Creep|Spawn|Structure} target The target object. @@ -434,6 +510,8 @@ Creep.prototype = * The cumulative effect of all the creeps performing upgradeController in the current tick is taken into account. * The effect can be boosted by ghodium mineral compounds (including limit increase). * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#upgradeController} + * * @type {function} * * @param {StructureController} target The target controller object to be upgraded. @@ -448,6 +526,8 @@ Creep.prototype = * 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. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203013212-Creep#withdraw} + * * @type {function} * * @param {Structure} target The target object. diff --git a/Flag.js b/Flag.js index fda4151..7e3330f 100644 --- a/Flag.js +++ b/Flag.js @@ -3,6 +3,8 @@ * Flags can be used to mark particular spots in a room. * Flags are visible to their owners only. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079181-Flag} + * * @class * @extends {RoomObject} */ @@ -13,6 +15,8 @@ Flag.prototype = /** * Flag primary color. One of the COLOR_* constants. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079181-Flag#color} + * * @type {string} */ color: "", @@ -21,6 +25,8 @@ Flag.prototype = * A shorthand to Memory.flags[flag.name]. * You can use it for quick access the flag's specific memory data object. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079181-Flag#memory} + * * @type {*} */ memory: {}, @@ -30,6 +36,8 @@ Flag.prototype = * 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. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079181-Flag#name} + * * @type {string} */ name: "", @@ -37,6 +45,8 @@ Flag.prototype = /** * Flag secondary color. One of the COLOR_* constants. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079181-Flag#secondaryColor} + * * @type {string} */ secondaryColor: "", @@ -44,6 +54,8 @@ Flag.prototype = /** * Remove the flag. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079181-Flag#remove} + * * @type {function} * * @return {number|OK} @@ -53,6 +65,8 @@ Flag.prototype = /** * Set new color of the flag. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079181-Flag#setColor} + * * @type {function} * * @param {string} color Primary color of the flag. One of the COLOR_* constants. @@ -65,6 +79,8 @@ Flag.prototype = /** * Set new position of the flag. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079181-Flag#setPosition} + * * @type {function} * * @param {number|RoomPosition|RoomObject} x The X position in the room. diff --git a/Game.js b/Game.js index 463919a..61e4fea 100644 --- a/Game.js +++ b/Game.js @@ -1,12 +1,16 @@ /** * The main global game object containing all the gameplay information. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game} + * * @class */ Game = { /** * An object containing information about your CPU usage + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#cpu} */ cpu: { @@ -36,6 +40,8 @@ Game = * Get amount of CPU time used from the beginning of the current game tick. * Always returns 0 in the Simulation mode. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#cpu.getUsed} + * * @type {function} * * @return {number} @@ -46,6 +52,8 @@ Game = /** * A hash containing all your construction sites with their id as hash keys. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#constructionSites} + * * @type {Array} */ constructionSites: {}, @@ -53,6 +61,8 @@ Game = /** * A hash containing all your creeps with creep names as hash keys. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#creeps} + * * @type {Array} */ creeps: {}, @@ -60,12 +70,16 @@ Game = /** * A hash containing all your flags with flag names as hash keys. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#flags} + * * @type {Array} */ flags: {}, /** * Your Global Control Level + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#gcl} */ gcl: { @@ -93,12 +107,18 @@ Game = /** * A global object representing world map. + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#map} + * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map} + * */ map: { /** * List all exits available from the room with the given name. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#describeExits} + * * @type {function} * * @param {string} roomName The room name. @@ -116,6 +136,8 @@ Game = /** * Find the exit direction from the given room en route to another room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#findExit} + * * @type {function} * * @param {string|Room} fromRoom Start room name or room object. @@ -129,6 +151,8 @@ Game = /** * Find route from the given room to another room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#findRoute} + * * @type {function} * * @param {string|Room} fromRoom Start room name or room object. @@ -148,6 +172,8 @@ Game = * 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 http://support.screeps.com/hc/en-us/articles/203079191-Map#getRoomLinearDistance} + * * @type {function} * * @param {string} roomName1 The name of the first room. @@ -161,6 +187,8 @@ Game = * 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. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#getTerrainAt} + * * @type {function} * * @param {number|RoomPosition} x X position in the room. @@ -177,6 +205,8 @@ Game = /** * Check if the room with the given name is available to move into * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#isRoomAvailable} + * * @type {function} * * @param {string} roomName The room name. @@ -189,6 +219,8 @@ Game = * Check if the room with the given name is protected by temporary "newbie" walls. * This method has been deprecated in favor of isRoomAvailable * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#isRoomProtected} + * * @type {function} * * @param {string} roomName The room name. @@ -200,6 +232,9 @@ Game = /** * A global object representing the in-game market. + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#market} + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market} */ market: { @@ -221,7 +256,8 @@ Game = price : 2.95 } }] - + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#incomingTransactions} + * * @type {Array} */ incomingTransactions: [], @@ -245,6 +281,8 @@ Game = } }] + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#outgoingTransactions} + * * @type {Array} */ outgoingTransactions: [], @@ -279,6 +317,8 @@ Game = } ] + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#myOrders} + * * @type {Array} */ myOrders: [], @@ -311,6 +351,8 @@ Game = } ] + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#orders} + * * @type {Array} */ orders: [], @@ -319,6 +361,8 @@ Game = * 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) ) * + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#calcTransactionCost} + * * @type {function} * * @param {number} amount Amount of resources to be sent. @@ -335,6 +379,8 @@ Game = * If a buy order provided, then the reserved credits amount will be refunded in full. * The 5% fee is not returned. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#cancelOrder} + * * @type {function} * * @param {string} orderId The order ID as provided in Game.market.myOrders. @@ -350,6 +396,8 @@ Game = * The maximum buy orders count is 50 per player. * You can cancel an order to refund the reserved credits amount. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#createBuyOrder} + * * @type {function} * * @param {string} resourceType Either one of the RESOURCE_* constants or GAMETIME_TOKEN. @@ -367,6 +415,8 @@ Game = * You will be charged price*amount*0.05 credits when the order is placed. * The maximum sell orders count is 50 per player. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#createSellOrder} + * * @type {function} * * @param {string} resourceType Either one of the RESOURCE_* constants or GAMETIME_TOKEN. If your Terminal doesn't have the specified resource, the order will be temporary inactive. @@ -384,6 +434,8 @@ Game = * Your Terminal will be charged amount*linearDistanceBetweenRooms*0.1 energy units of transfer cost regardless of the order resource type. * You can use Game.map.getRoomLinearDistance method to estimate it. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#deal} + * * @type {function} * * @param {string} orderId The order ID as provided in Game.market.orders. @@ -399,6 +451,8 @@ Game = * 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 http://support.screeps.com/hc/en-us/articles/207928635-Market#extendOrder} + * * @type {function} * * @param {string} orderId The order ID as provided in Game.market.orders. @@ -412,6 +466,8 @@ Game = * This method is still under development. * Get other players' orders currently active on the market. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#getAllOrders} + * * @type {function} * * @param {object|function} [filter] An object or function that will filter the resulting list using the lodash.filter method. @@ -461,6 +517,8 @@ Game = * This method is still under development. * Retrieve info for specific market order. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#getOrderById} + * * @type {function} * * @param {string} id The order ID @@ -483,6 +541,8 @@ Game = /** * A hash containing all the rooms available to you with room names as hash keys. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#rooms} + * * @type {Array} */ rooms: {}, @@ -490,6 +550,8 @@ Game = /** * A hash containing all your spawns with spawn names as hash keys. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#spawns} + * * @type {Array} */ spawns: {}, @@ -497,6 +559,8 @@ Game = /** * A hash containing all your structures with structure id as hash keys. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#structures} + * * @type {Array} */ structures: {}, @@ -504,6 +568,8 @@ Game = /** * System game tick counter. It is automatically incremented on every tick. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#time} + * * @type {number} */ time: 0, @@ -513,6 +579,8 @@ Game = * It may be a game object of any type. * Only objects from the rooms which are visible to you can be accessed. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#getObjectById} + * * @type {function} * * @param {string} id The unique identificator. @@ -527,6 +595,8 @@ Game = * You can schedule up to 20 notifications during one game tick. * Not available in the Simulation Room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#notify} + * * @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. * diff --git a/Mineral.js b/Mineral.js index 7b994d1..d1a1ff3 100644 --- a/Mineral.js +++ b/Mineral.js @@ -4,6 +4,8 @@ * * @class * @extends {RoomObject} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207218579-Mineral} */ Mineral = function() { }; @@ -12,6 +14,8 @@ Mineral.prototype = /** * The remaining amount of resources. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207218579-Mineral#mineralAmount} + * * @type {number} */ mineralAmount: 0, @@ -19,6 +23,8 @@ Mineral.prototype = /** * The resource type, one of the RESOURCE_* constants. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207218579-Mineral#mineralType} + * * @type {number} */ mineralType: 0, @@ -27,6 +33,8 @@ Mineral.prototype = * A unique object identificator. * You can use Game.getObjectById method to retrieve an object instance by its id. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207218579-Mineral#id} + * * @type {string} */ id: "", @@ -34,6 +42,8 @@ Mineral.prototype = /** * The remaining time after which the deposit will be refilled. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207218579-Mineral#ticksToRegeneration} + * * @type {number} */ ticksToRegeneration: 0 diff --git a/Nuke.js b/Nuke.js index 1c26b96..ee4e506 100644 --- a/Nuke.js +++ b/Nuke.js @@ -4,6 +4,8 @@ * You can find incoming nukes in the room using the FIND_NUKES constant. * @class * @extends {RoomObject} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488525-Nuke} */ Nuke = function() { }; @@ -13,6 +15,8 @@ Nuke.prototype = * A unique object identificator. * You can use Game.getObjectById method to retrieve an object instance by its id. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488525-Nuke#id} + * * @type {string} */ id: "", @@ -20,6 +24,8 @@ Nuke.prototype = /** * The name of the room where this nuke has been launched from. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488525-Nuke#launchRoomName} + * * @type {string} */ launchRoomName: "", @@ -27,6 +33,8 @@ Nuke.prototype = /** * The remaining landing time. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488525-Nuke#timeToLand} + * * @type {number} */ timeToLand: 0 diff --git a/OwnedStructure.js b/OwnedStructure.js index 0c95491..efc724c 100644 --- a/OwnedStructure.js +++ b/OwnedStructure.js @@ -4,6 +4,8 @@ * * @class * @extends {Structure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207710979-OwnedStructure} */ OwnedStructure = function() { }; @@ -12,6 +14,8 @@ OwnedStructure.prototype = /** * Whether this is your own structure. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207710979-OwnedStructure#my} + * * @type {boolean} */ my: true, @@ -19,6 +23,8 @@ OwnedStructure.prototype = /** * An object with the structure’s owner info * + * @see {@link http://support.screeps.com/hc/en-us/articles/207710979-OwnedStructure#owner} + * * @type {{username: string}} */ owner: diff --git a/PathFinder.js b/PathFinder.js index da94ccf..36e82ac 100644 --- a/PathFinder.js +++ b/PathFinder.js @@ -1,6 +1,8 @@ /** * * @class + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207023879-PathFinder} */ PathFinder = { @@ -8,6 +10,8 @@ PathFinder = * Find an optimal path between origin and goal. * @static * + * @see {@link http://support.screeps.com/hc/en-us/articles/207023879-PathFinder#search} + * * @type {function} * * @param {RoomPosition} origin The start position. @@ -40,6 +44,8 @@ PathFinder = * * @note It affects the following methods behavior: Room.findPath, RoomPosition.findPathTo, RoomPosition.findClosestByPath, Creep.moveTo. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207023879-PathFinder#use} + * * @type {function} * * @param {boolean} isEnabled Whether to activate the new pathfinder or deactivate. @@ -52,6 +58,8 @@ PathFinder = * * @constructor * @class + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207023879-PathFinder#CostMatrix} */ PathFinder.CostMatrix = function() { }; @@ -59,6 +67,8 @@ PathFinder.CostMatrix = function() { }; * Static method which deserializes a new CostMatrix using the return value of serialize. * @static * + * @see {@link http://support.screeps.com/hc/en-us/articles/207023879-PathFinder#deserialize} + * * @type {function} * * @param {object} val Whatever serialize returned @@ -73,6 +83,8 @@ PathFinder.CostMatrix.prototype = /** * Set the cost of a position in this CostMatrix. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207023879-PathFinder#set} + * * @type {function} * * @param {number} x X position in the room. @@ -84,6 +96,8 @@ PathFinder.CostMatrix.prototype = /** * Get the cost of a position in this CostMatrix. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207023879-PathFinder#get} + * * @type {function} * * @param {number} x X position in the room. @@ -96,6 +110,8 @@ PathFinder.CostMatrix.prototype = /** * Copy this CostMatrix into a new CostMatrix with the same data. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207023879-PathFinder#clone} + * * @type {function} * * @return {CostMatrix} @@ -105,6 +121,8 @@ PathFinder.CostMatrix.prototype = /** * Returns a compact representation of this CostMatrix which can be stored via JSON.stringify * + * @see {@link http://support.screeps.com/hc/en-us/articles/207023879-PathFinder#serialize} + * * @type {function} * * @return {Array} An array of numbers. There's not much you can do with the numbers besides store them for later. diff --git a/RawMemory.js b/RawMemory.js index 5d266c4..e64b469 100644 --- a/RawMemory.js +++ b/RawMemory.js @@ -2,6 +2,8 @@ * RawMemory object allows to implement your own memory stringifier instead of built-in serializer based on JSON.stringify. * * @class + * + * @see {@link http://support.screeps.com/hc/en-us/articles/205619121-RawMemory} */ RawMemory = function() { }; @@ -10,6 +12,8 @@ RawMemory.prototype = /** * Get a raw string representation of the Memory object. * + * @see {@link http://support.screeps.com/hc/en-us/articles/205619121-RawMemory#get} + * * @type {function} * * @return {string} @@ -19,6 +23,8 @@ RawMemory.prototype = /** * Set new memory value. * + * @see {@link http://support.screeps.com/hc/en-us/articles/205619121-RawMemory#set} + * * @type {function} * * @param {string} value diff --git a/Resource.js b/Resource.js index a7b20ef..b48b546 100644 --- a/Resource.js +++ b/Resource.js @@ -5,6 +5,8 @@ * * @class * @extends {RoomObject} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016362-Resource} */ Resource = function() { }; @@ -13,6 +15,8 @@ Resource.prototype = /** * The amount of resource units containing. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016362-Resource#amount} + * * @type {number} */ amount: 0, @@ -21,6 +25,8 @@ Resource.prototype = * A unique object identificator. * You can use Game.getObjectById method to retrieve an object instance by its id. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016362-Resource#id} + * * @type {string} */ id: "", @@ -28,6 +34,8 @@ Resource.prototype = /** * One of the RESOURCE_* constants. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016362-Resource#resourceType} + * * @type {string} */ resourceType: "" diff --git a/Room.js b/Room.js index 04f9679..884aa19 100644 --- a/Room.js +++ b/Room.js @@ -4,11 +4,15 @@ * Every object in the room contains its linked Room instance in the room property. * * @class + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room} */ Room = { /** * Serialize a path array into a short string representation, which is suitable to store in memory. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#serializePath} + * * @type {function} * * @param {Array} path A path array retrieved from Room.findPath. @@ -20,6 +24,8 @@ Room = { /** * Deserialize a short string path representation into an array form. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#deserializePath} + * * @type {function} * * @param {string} path A serialized path string. @@ -34,6 +40,8 @@ Room.prototype = /** * The Controller structure of this room, if present, otherwise undefined. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#controller} + * * @type {undefined|StructureController} */ controller: null, @@ -41,6 +49,8 @@ Room.prototype = /** * Total amount of energy available in all spawns and extensions in the room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#energyAvailable} + * * @type {number} */ energyAvailable: 0, @@ -48,6 +58,8 @@ Room.prototype = /** * Total amount of energyCapacity of all spawns and extensions in the room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#energyCapacityAvailable} + * * @type {number} */ energyCapacityAvailable: 0, @@ -56,6 +68,8 @@ Room.prototype = * A shorthand to Memory.rooms[room.name]. * You can use it for quick access the room’s specific memory data object. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#memory} + * * @type {*} */ memory: {}, @@ -63,6 +77,8 @@ Room.prototype = /** * The mode of the room * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#mode} + * * @type {string|MODE_SIMULATION|MODE_SURVIVAL|MODE_WORLD|MODE_ARENA} */ mode: "", @@ -70,6 +86,8 @@ Room.prototype = /** * The name of the room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#name} + * * @type {string} */ name: "", @@ -77,6 +95,8 @@ Room.prototype = /** * The Storage structure of this room, if present, otherwise undefined. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#storage} + * * @type {undefined|StructureStorage} */ storage: null, @@ -84,6 +104,8 @@ Room.prototype = /** * The Terminal structure of this room, if present, otherwise undefined. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#terminal} + * * @type {undefined|StructureTerminal} */ terminal: null, @@ -91,6 +113,8 @@ Room.prototype = /** * Create new ConstructionSite at the specified location. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#createConstructionSite} + * * @type {function} * * @param {number|RoomPosition|RoomObject} x The X position. @@ -107,6 +131,8 @@ Room.prototype = /** * Create new Flag at the specified location. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#createFlag} + * * @type {function} * * @param {number|RoomPosition|RoomObject} x The X position. @@ -125,6 +151,8 @@ Room.prototype = /** * Find all objects of the specified type in the room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#find} + * * @type {function} * * @param {number} type One of the FIND_* constants. @@ -138,6 +166,8 @@ Room.prototype = /** * Find the exit direction en route to another room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#findExitTo} + * * @type {function} * * @param {string|Room} room Another room name or room object. @@ -149,6 +179,8 @@ Room.prototype = /** * Find an optimal path inside the room between fromPos and toPos using A* search algorithm. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#findPath} + * * @type {function} * * @param {RoomPosition} fromPos The start position. @@ -179,6 +211,8 @@ Room.prototype = /** * Creates a RoomPosition object at the specified location. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#getPositionAt} + * * @type {function} * * @param {number} x The X position. @@ -191,6 +225,8 @@ Room.prototype = /** * Get the list of objects at the specified room position. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#lookAt} + * * @type {function} * * @param {number} x X position in the room. @@ -212,6 +248,8 @@ Room.prototype = /** * Get the list of objects at the specified room area. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#lookAtArea} + * * @type {function} * * @param {number} top The top Y boundary of the area. @@ -292,6 +330,8 @@ Room.prototype = /** * Get an object with the given type at the specified room position. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#lookForAt} + * * @type {function} * * @param {string} type One of the LOOK_* constants. @@ -308,6 +348,8 @@ Room.prototype = /** * Get the list of objects with the given type at the specified room area. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#lookForAtArea} + * * @type {function} * * @param {string} type One of the LOOK_* constants. diff --git a/RoomObject.js b/RoomObject.js index 7c3af87..ad0d76a 100644 --- a/RoomObject.js +++ b/RoomObject.js @@ -2,6 +2,8 @@ * Any object with a position in a room. * Almost all game objects prototypes are derived from RoomObject. * @class + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208435305-RoomObject} */ RoomObject = function() { }; @@ -10,6 +12,8 @@ RoomObject.prototype = /** * An object representing the position of this object in the room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208435305-RoomObject#pos} + * * @type {RoomPosition} */ pos: null, @@ -18,6 +22,8 @@ RoomObject.prototype = * The link to the Room object. * May be undefined in case if an object is a flag and is placed in a room that is not visible to you. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208435305-RoomObject#room} + * * @type {Room} */ room: null diff --git a/RoomPosition.js b/RoomPosition.js index 084aa2b..32a5368 100644 --- a/RoomPosition.js +++ b/RoomPosition.js @@ -9,6 +9,8 @@ * * @class * @constructor + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition} */ RoomPosition = function(x, y, roomName) { }; @@ -17,6 +19,8 @@ RoomPosition.prototype = /** * The name of the room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#roomName} + * * @type {string} */ roomName: "", @@ -24,6 +28,8 @@ RoomPosition.prototype = /** * X position in the room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#x} + * * @type {number} */ x: 0, @@ -31,6 +37,8 @@ RoomPosition.prototype = /** * Y position in the room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#y} + * * @type {number} */ y: 0, @@ -38,6 +46,8 @@ RoomPosition.prototype = /** * Create new ConstructionSite at the specified location. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#createConstructionSite} + * * @type {function} * * @param {string} structureType One of the STRUCTURE_* constants. @@ -49,6 +59,8 @@ RoomPosition.prototype = /** * Create new Flag at the specified location. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#createFlag} + * * @type {function} * * @param {string} [name] 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. @@ -63,6 +75,8 @@ RoomPosition.prototype = * Find an object with the shortest path from the given position. * Uses A* search algorithm and Dijkstra's algorithm. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#findClosestByPath} + * * @type {function} * * @param {number|Array|Array} type See Room.find. @@ -83,6 +97,8 @@ RoomPosition.prototype = /** * Find an object with the shortest linear distance from the given position. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#findClosestByRange} + * * @type {function} * * @param {number|Array|Array} type See Room.find. @@ -99,6 +115,8 @@ RoomPosition.prototype = /** * Find all objects in the specified linear range. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#findInRange} + * * @type {function} * * @param {number|Array|Array} type See Room.find. @@ -117,6 +135,8 @@ RoomPosition.prototype = * 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. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#findPathTo} + * * @type {function} * * @param {number|RoomPosition|RoomObject} x X position in the room. @@ -139,6 +159,8 @@ RoomPosition.prototype = /** * Get linear direction to the specified position. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#getDirectionTo} + * * @type {function} * * @param {number|RoomPosition|RoomObject} x X position in the room. @@ -154,6 +176,8 @@ RoomPosition.prototype = /** * Get linear range to the specified position. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#getRangeTo} + * * @type {function} * * @param {number|RoomPosition|RoomObject} x X position in the room. @@ -169,6 +193,8 @@ RoomPosition.prototype = /** * Check whether this position is in the given range of another position. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#inRangeTo} + * * @type {function} * * @param {number|RoomPosition|RoomObject} x X position in the room. @@ -186,6 +212,8 @@ RoomPosition.prototype = /** * Check whether this position is the same as the specified position. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#isEqualTo} + * * @type {function} * * @param {number|RoomPosition|RoomObject} x X position in the room. @@ -202,6 +230,8 @@ RoomPosition.prototype = * Check whether this position is on the adjacent square to the specified position. * The same as inRangeTo(target, 1) * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#isNearTo} + * * @type {function} * * @param {number|RoomPosition|RoomObject} x X position in the room. @@ -217,6 +247,8 @@ RoomPosition.prototype = /** * Get the list of objects at the specified room position. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#look} + * * @type {function} * * @return {array} An array with objects at the specified position in the following format: @@ -232,6 +264,8 @@ RoomPosition.prototype = /** * Get an object with the given type at the specified room position. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079201-RoomPosition#lookFor} + * * @type {function} * * @param {string} type One of the LOOK_* constants. diff --git a/Source.js b/Source.js index 89cbf60..efdd53b 100644 --- a/Source.js +++ b/Source.js @@ -4,6 +4,8 @@ * * @class * @extends {RoomObject} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079211-Source} */ Source = function() { }; @@ -12,6 +14,8 @@ Source.prototype = /** * The remaining amount of energy. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079211-Source#energy} + * * @type {number} */ energy: 0, @@ -19,6 +23,8 @@ Source.prototype = /** * The total amount of energy in the source. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079211-Source#energyCapacity} + * * @type {number} */ energyCapacity: 0, @@ -27,6 +33,8 @@ Source.prototype = * A unique object identificator. * You can use Game.getObjectById method to retrieve an object instance by its id. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079211-Source#id} + * * @type {string} */ id: "", @@ -34,6 +42,8 @@ Source.prototype = /** * The remaining time after which the source will be refilled. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079211-Source#ticksToRegeneration} + * * @type {number} */ ticksToRegeneration: 0 diff --git a/Structure.js b/Structure.js index eee1cfe..86c56e7 100644 --- a/Structure.js +++ b/Structure.js @@ -2,6 +2,8 @@ * The base prototype object of all structures. * @class * @extends {RoomObject} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079221-Structure} */ Structure = function() { }; @@ -10,6 +12,8 @@ Structure.prototype = /** * The current amount of hit points of the structure. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079221-Structure#hits} + * * @type {number} */ hits: 0, @@ -17,6 +21,8 @@ Structure.prototype = /** * The total amount of hit points of the structure. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079221-Structure#hitsMax} + * * @type {number} */ hitsMax: 0, @@ -25,6 +31,8 @@ Structure.prototype = * A unique object identificator. * You can use Game.getObjectById method to retrieve an object instance by its id. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079221-Structure#id} + * * @type {string} */ id: "", @@ -32,6 +40,8 @@ Structure.prototype = /** * One of the STRUCTURE_* constants. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079221-Structure#structureType} + * * @type {string} */ structureType: "", @@ -39,6 +49,8 @@ Structure.prototype = /** * Destroy this structure immediately. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079221-Structure#destroy} + * * @type {function} * * @return {number|OK|ERR_NOT_OWNER} @@ -50,6 +62,8 @@ Structure.prototype = * 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. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079221-Structure#isActive} + * * @type {function} * * @return {boolean} @@ -61,6 +75,8 @@ Structure.prototype = * The notification will be sent to your account email. * Turned on by default. * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079221-Structure#notifyWhenAttacked} + * * @type {function} * * @param {boolean} enabled Whether to enable notification or disable. diff --git a/Structures/StructureContainer.js b/Structures/StructureContainer.js index 40b3d9a..85aee1b 100644 --- a/Structures/StructureContainer.js +++ b/Structures/StructureContainer.js @@ -5,6 +5,8 @@ * * @class * @extends {Structure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208435885-StructureContainer} */ StructureContainer = function() { }; @@ -17,6 +19,8 @@ StructureContainer.prototype = * Each object key is one of the RESOURCE_* constants, values are resources amounts. * Use _.sum(structure.store) to get the total amount of contents. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208435885-StructureContainer#store} + * * @type {Array} */ store: {}, @@ -24,6 +28,8 @@ StructureContainer.prototype = /** * The total amount of resources the structure can contain. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208435885-StructureContainer#storeCapacity} + * * @type {number} */ storeCapacity: 0, @@ -34,6 +40,8 @@ StructureContainer.prototype = * Transfer resource from this structure to a creep. * The target has to be at adjacent square. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208435885-StructureContainer#transfer} + * * @type {function} * * @param {Creep} target The target object. diff --git a/Structures/StructureController.js b/Structures/StructureController.js index eac0bea..09a08c8 100644 --- a/Structures/StructureController.js +++ b/Structures/StructureController.js @@ -5,6 +5,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController} */ StructureController = function() { }; @@ -14,6 +16,8 @@ StructureController.prototype = /** * Ticks left before another safeMode can be used * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController#safeModeCooldown} + * * @type {number} */ safeModeCooldown: 0, @@ -21,6 +25,8 @@ StructureController.prototype = /** * The number of available safeMode activations * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController#safeModeAvailable} + * * @type {number} */ safeModeAvailable: 0, @@ -28,6 +34,8 @@ StructureController.prototype = /** * Returns if safeMode is active. If not this will return undefined, not false. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController#safeMode} + * * @type {Boolean|undefined} */ safeMode: undefined, @@ -35,6 +43,8 @@ StructureController.prototype = /** * Triggers the activation of a saveMode if possible and available * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController#activateSafeMode} + * * @type {function} * * @return {OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_TIRED} @@ -44,6 +54,8 @@ StructureController.prototype = /** * Current controller level, from 0 to 8. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController#level} + * * @type {number} */ level: 0, @@ -51,6 +63,8 @@ StructureController.prototype = /** * The current progress of upgrading the controller to the next level. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController#progress} + * * @type {number} */ progress: 0, @@ -58,6 +72,8 @@ StructureController.prototype = /** * The progress needed to reach the next level. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController#progressTotal} + * * @type {number} */ progressTotal: 0, @@ -65,6 +81,8 @@ StructureController.prototype = /** * An object with the controller reservation info if present * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController#reservation} + * * @type {null|{username: string, ticksToEnd: number}} */ reservation: {}, @@ -73,6 +91,8 @@ StructureController.prototype = * The amount of game ticks when this controller will lose one level. * This timer can be reset by using Creep.upgradeController. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController#ticksToDowngrade} + * * @type {number} */ ticksToDowngrade: 0, @@ -80,6 +100,8 @@ StructureController.prototype = /** * The amount of game ticks while this controller cannot be upgraded due to attack. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController#upgradeBlocked} + * * @type {number} */ upgradeBlocked: 0, @@ -87,6 +109,8 @@ StructureController.prototype = /** * Make your claimed controller neutral again. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711889-StructureController#unclaim} + * * @type {function} * * @return {number|OK|ERR_NOT_OWNER} diff --git a/Structures/StructureExtension.js b/Structures/StructureExtension.js index be2fc54..85d0d37 100644 --- a/Structures/StructureExtension.js +++ b/Structures/StructureExtension.js @@ -4,6 +4,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711949-StructureExtension} */ StructureExtension = function() { }; @@ -12,6 +14,8 @@ StructureExtension.prototype = /** * The amount of energy containing in the extension. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711949-StructureExtension#energy} + * * @type {number} */ energy: 0, @@ -19,6 +23,8 @@ StructureExtension.prototype = /** * The total amount of energy the extension can contain. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711949-StructureExtension#energyCapacity} + * * @type {number} */ energyCapacity: 0, @@ -29,6 +35,8 @@ StructureExtension.prototype = * Transfer the energy from the extension to a creep. * You can transfer resources to your creeps from hostile structures as well. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207711949-StructureExtension#transferEnergy} + * * @type {function} * * @param {Creep} target The creep object which energy should be transferred to. diff --git a/Structures/StructureExtractor.js b/Structures/StructureExtractor.js index 31df322..5bd9212 100644 --- a/Structures/StructureExtractor.js +++ b/Structures/StructureExtractor.js @@ -3,6 +3,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207715739-StructureExtractor} */ StructureExtractor = function() { }; diff --git a/Structures/StructureKeeperLair.js b/Structures/StructureKeeperLair.js index a9d9fb0..ed62409 100644 --- a/Structures/StructureKeeperLair.js +++ b/Structures/StructureKeeperLair.js @@ -5,6 +5,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207712119-StructureKeeperLair} */ StructureKeeperLair = function() { }; @@ -13,6 +15,8 @@ StructureKeeperLair.prototype = /** * Time to spawning of the next Source Keeper. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207712119-StructureKeeperLair#ticksToSpawn} + * * @type {number} */ ticksToSpawn: 0 diff --git a/Structures/StructureLab.js b/Structures/StructureLab.js index 0f40d22..25dde51 100644 --- a/Structures/StructureLab.js +++ b/Structures/StructureLab.js @@ -2,6 +2,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436195-StructureLab} */ StructureLab = function() { }; @@ -10,6 +12,8 @@ StructureLab.prototype = /** * The amount of game ticks the lab has to wait until the next reaction is possible. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436195-StructureLab#cooldown} + * * @type {number} */ cooldown: 0, @@ -17,6 +21,8 @@ StructureLab.prototype = /** * The amount of energy containing in the lab. Energy is used for boosting creeps. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436195-StructureLab#energy} + * * @type {number} */ energy: 0, @@ -24,6 +30,8 @@ StructureLab.prototype = /** * The total amount of energy the lab can contain. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436195-StructureLab#energyCapacity} + * * @type {number} */ energyCapacity: 0, @@ -31,6 +39,8 @@ StructureLab.prototype = /** * The amount of mineral resources containing in the lab. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436195-StructureLab#mineralAmount} + * * @type {number} */ mineralAmount: 0, @@ -39,6 +49,8 @@ StructureLab.prototype = * The type of minerals containing in the lab. * Labs can contain only one mineral type at the same time. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436195-StructureLab#mineralType} + * * @type {string} */ mineralType: "", @@ -46,6 +58,8 @@ StructureLab.prototype = /** * The total amount of minerals the lab can contain. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436195-StructureLab#mineralCapacity} + * * @type {number} */ mineralCapacity: 0, @@ -54,6 +68,8 @@ StructureLab.prototype = * Boosts creep body part using the containing mineral compound. * The creep has to be at adjacent square to the lab. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436195-StructureLab#boostCreep} + * * @type {function} * * @param {Creep} creep The target creep. @@ -67,6 +83,8 @@ StructureLab.prototype = * Produce mineral compounds using reagents from two another labs. * The same input labs can be used by many output labs. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436195-StructureLab#runReaction} + * * @type {function} * * @param {StructureLab} lab1 The first source lab. @@ -83,6 +101,8 @@ StructureLab.prototype = * The target has to be at adjacent square. * You can transfer resources to your creeps from hostile structures as well. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436195-StructureLab#transfer} + * * @type {function} * * @param {Creep} target The target object. diff --git a/Structures/StructureLink.js b/Structures/StructureLink.js index ac7c9f3..f569471 100644 --- a/Structures/StructureLink.js +++ b/Structures/StructureLink.js @@ -3,6 +3,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436275-StructureLink} */ StructureLink = function() { }; @@ -11,6 +13,8 @@ StructureLink.prototype = /** * The amount of game ticks the link has to wait until the next transfer is possible. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436275-StructureLink#cooldown} + * * @type {number} */ cooldown: 0, @@ -18,6 +22,8 @@ StructureLink.prototype = /** * The amount of energy containing in the link. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436275-StructureLink#energy} + * * @type {number} */ energy: 0, @@ -25,6 +31,8 @@ StructureLink.prototype = /** * The total amount of energy the link can contain. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436275-StructureLink#energyCapacity} + * * @type {number} */ energyCapacity: 0, @@ -34,6 +42,8 @@ StructureLink.prototype = * 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. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436275-StructureLink#transferEnergy} + * * @type {function} * * @param {Creep|StructureLink} target The target object. diff --git a/Structures/StructureNuker.js b/Structures/StructureNuker.js index d2e2bbd..de37dbf 100644 --- a/Structures/StructureNuker.js +++ b/Structures/StructureNuker.js @@ -6,6 +6,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488255-StructureNuker} */ StructureNuker = function() { }; @@ -14,6 +16,8 @@ StructureNuker.prototype = /** * The amount of energy containing in this structure. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488255-StructureNuker#energy} + * * @type {number} */ energy: 0, @@ -21,6 +25,8 @@ StructureNuker.prototype = /** * The total amount of energy this structure can contain. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488255-StructureNuker#energyCapacity} + * * @type {number} */ energyCapacity: 0, @@ -28,6 +34,8 @@ StructureNuker.prototype = /** * The amount of ghodium containing in this structure. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488255-StructureNuker#ghodium} + * * @type {number} */ ghodium: 0, @@ -35,6 +43,8 @@ StructureNuker.prototype = /** * The total amount of ghodium this structure can contain. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488255-StructureNuker#ghodiumCapacity} + * * @type {number} */ ghodiumCapacity: 0, @@ -42,6 +52,8 @@ StructureNuker.prototype = /** * The amount of game ticks until the next launch is possible. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488255-StructureNuker#cooldown} + * * @type {number} */ cooldown: 0, @@ -49,6 +61,8 @@ StructureNuker.prototype = /** * Launch a nuke to the specified position. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488255-StructureNuker#launchNuke} + * * @type {function} * * @param {RoomPosition} pos The target room position. diff --git a/Structures/StructureObserver.js b/Structures/StructureObserver.js index df1846f..c1caa95 100644 --- a/Structures/StructureObserver.js +++ b/Structures/StructureObserver.js @@ -3,6 +3,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436365-StructureObserver} */ StructureObserver = function() { }; @@ -12,6 +14,8 @@ StructureObserver.prototype = * Provide visibility into a distant room from your script. * The target room object will be available on the next tick. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436365-StructureObserver#observeRoom} + * * @type {function} * * @param {string} roomName The name of the target room. diff --git a/Structures/StructurePortal.js b/Structures/StructurePortal.js index c84508f..997f7fe 100644 --- a/Structures/StructurePortal.js +++ b/Structures/StructurePortal.js @@ -5,6 +5,8 @@ * * @class * @extends {Structure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208647345-StructurePortal} */ StructurePortal = function() { }; @@ -13,6 +15,8 @@ StructurePortal.prototype = /** * The position object in the destination room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208647345-StructurePortal#destination} + * * @type {RoomPosition} */ destination: null, @@ -20,6 +24,8 @@ StructurePortal.prototype = /** * The amount of game ticks when the portal disappears, or undefined when the portal is stable. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208647345-StructurePortal#ticksToDecay} + * * @type {undefined|number} */ ticksToDecay: 0 diff --git a/Structures/StructurePowerBank.js b/Structures/StructurePowerBank.js index 8460767..27b229d 100644 --- a/Structures/StructurePowerBank.js +++ b/Structures/StructurePowerBank.js @@ -5,6 +5,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207712729-StructurePowerBank} */ StructurePowerBank = function() { }; @@ -13,6 +15,8 @@ StructurePowerBank.prototype = /** * The amount of power containing. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207712729-StructurePowerBank#power} + * * @type {number} */ power: 0, @@ -20,6 +24,8 @@ StructurePowerBank.prototype = /** * The amount of game ticks when this structure will disappear. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207712729-StructurePowerBank#ticksToDecay} + * * @type {number} */ ticksToDecay: 0 diff --git a/Structures/StructurePowerSpawn.js b/Structures/StructurePowerSpawn.js index eed71ba..ae928bb 100644 --- a/Structures/StructurePowerSpawn.js +++ b/Structures/StructurePowerSpawn.js @@ -3,6 +3,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436585-StructurePowerSpawn} */ StructurePowerSpawn = function() { }; @@ -11,6 +13,8 @@ StructurePowerSpawn.prototype = /** * The amount of energy containing in this structure. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436585-StructurePowerSpawn#energy} + * * @type {number} */ energy: 0, @@ -18,6 +22,8 @@ StructurePowerSpawn.prototype = /** * The total amount of energy this structure can contain. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436585-StructurePowerSpawn#energyCapacity} + * * @type {number} */ energyCapacity: 0, @@ -25,6 +31,8 @@ StructurePowerSpawn.prototype = /** * The amount of power containing in this structure. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436585-StructurePowerSpawn#power} + * * @type {number} */ power: 0, @@ -32,6 +40,8 @@ StructurePowerSpawn.prototype = /** * The total amount of power this structure can contain. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436585-StructurePowerSpawn#powerCapacity} + * * @type {number} */ powerCapacity: 0, @@ -40,6 +50,8 @@ StructurePowerSpawn.prototype = * Create a power creep. * @note This method is under development. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436585-StructurePowerSpawn#createPowerCreep} + * * @type {function} * * @param {string} roomName The name of the power creep. @@ -52,6 +64,8 @@ StructurePowerSpawn.prototype = * Register power resource units into your account. * Registered power allows to develop power creeps skills. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436585-StructurePowerSpawn#processPower} + * * @type {function} * * @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_RCL_NOT_ENOUGH} @@ -64,6 +78,8 @@ StructurePowerSpawn.prototype = * Transfer the energy from this structure to a creep. * You can transfer resources to your creeps from hostile structures as well. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436585-StructurePowerSpawn#transferEnergy} + * * @type {function} * * @param {Creep} target The creep object which energy should be transferred to. diff --git a/Structures/StructureRampart.js b/Structures/StructureRampart.js index 1a7024b..4e7f649 100644 --- a/Structures/StructureRampart.js +++ b/Structures/StructureRampart.js @@ -3,6 +3,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207712959-StructureRampart} */ StructureRampart = function() { }; @@ -11,6 +13,8 @@ StructureRampart.prototype = /** * The amount of game ticks when this rampart will lose some hit points. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207712959-StructureRampart#ticksToDecay} + * * @type {number} */ ticksToDecay: 0 diff --git a/Structures/StructureRoad.js b/Structures/StructureRoad.js index 6803ec0..3345f0b 100644 --- a/Structures/StructureRoad.js +++ b/Structures/StructureRoad.js @@ -4,6 +4,8 @@ * * @class * @extends {Structure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207713089-StructureRoad} */ StructureRoad = function() { }; @@ -12,6 +14,8 @@ StructureRoad.prototype = /** * The amount of game ticks when this road will lose some hit points. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207713089-StructureRoad#ticksToDecay} + * * @type {number} */ ticksToDecay: 0 diff --git a/Structures/StructureSpawn.js b/Structures/StructureSpawn.js index 74855b9..21cb3c6 100644 --- a/Structures/StructureSpawn.js +++ b/Structures/StructureSpawn.js @@ -5,6 +5,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn} */ StructureSpawn = function() { }; @@ -12,6 +14,8 @@ StructureSpawn = function() { }; * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn} */ Spawn = StructureSpawn; Spawn.prototype = StructureSpawn.prototype; @@ -21,6 +25,8 @@ StructureSpawn.prototype = /** * The amount of energy containing in the spawn. * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#energy} + * * @type {number} */ energy: 0, @@ -28,6 +34,8 @@ StructureSpawn.prototype = /** * The total amount of energy the spawn can contain * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#energyCapacity} + * * @type {number} */ energyCapacity: 0, @@ -36,6 +44,8 @@ StructureSpawn.prototype = * A shorthand to Memory.spawns[spawn.name]. * You can use it for quick access the spawn’s specific memory data object. * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#memory} + * * @type {*} */ memory: {}, @@ -45,6 +55,8 @@ StructureSpawn.prototype = * 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. * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#name} + * * @type {string} */ name: "", @@ -52,6 +64,8 @@ StructureSpawn.prototype = /** * If the spawn is in process of spawning a new creep, this object will contain the new creep’s information, or null otherwise. * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#spawning} + * * @type {object|null} */ spawning: null, @@ -59,6 +73,8 @@ StructureSpawn.prototype = /** * Check if a creep can be created. * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#canCreateCreep} + * * @type {function} * * @param {Array} body An array describing the new creep’s body. Should contain 1 to 50 elements. @@ -72,6 +88,8 @@ StructureSpawn.prototype = /** * Start the creep spawning process. * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#createCreep} + * * @type {function} * * @param {Array} body An array describing the new creep’s body. Should contain 1 to 50 elements. @@ -86,6 +104,8 @@ StructureSpawn.prototype = * 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. * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#recycleCreep} + * * @type {function} * * @param {Creep} target The target creep object. @@ -102,6 +122,8 @@ StructureSpawn.prototype = * Energy required for each execution is determined using this formula: ceil(creep_cost/3/body_size). * Renewing a creep removes all of its boosts. * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#renewCreep} + * * @type {function} * * @param {Creep} target The target creep object. @@ -115,6 +137,8 @@ StructureSpawn.prototype = * * Transfer the energy from the spawn to a creep. * + * @see {@link http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#transferEnergy} + * * @type {function} * * @param {Creep} target The creep object which energy should be transferred to. diff --git a/Structures/StructureStorage.js b/Structures/StructureStorage.js index a831d2f..dc9eb7e 100644 --- a/Structures/StructureStorage.js +++ b/Structures/StructureStorage.js @@ -4,6 +4,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436805-StructureStorage} */ StructureStorage = function() { }; @@ -14,6 +16,8 @@ StructureStorage.prototype = * Each object key is one of the RESOURCE_* constants, values are resources amounts. * Use _.sum(structure.store) to get the total amount of contents. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436805-StructureStorage#store} + * * @type {Array} */ store: {}, @@ -21,6 +25,8 @@ StructureStorage.prototype = /** * The total amount of resources the storage can contain. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436805-StructureStorage#storeCapacity} + * * @type {number} */ storeCapacity: 0, @@ -32,6 +38,8 @@ StructureStorage.prototype = * The target has to be at adjacent square. * You can transfer resources to your creeps from hostile structures as well. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208436805-StructureStorage#transfer} + * * @type {function} * * @param {Creep} target The target object. diff --git a/Structures/StructureTerminal.js b/Structures/StructureTerminal.js index 60d1b20..cf0590c 100644 --- a/Structures/StructureTerminal.js +++ b/Structures/StructureTerminal.js @@ -9,6 +9,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/207713399-StructureTerminal} */ StructureTerminal = function() { }; @@ -19,6 +21,8 @@ StructureTerminal.prototype = * Each object key is one of the RESOURCE_* constants, values are resources amounts. * Use _.sum(structure.store) to get the total amount of contents. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207713399-StructureTerminal#store} + * * @type {Array} */ store: {}, @@ -26,6 +30,8 @@ StructureTerminal.prototype = /** * The total amount of resources the storage can contain. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207713399-StructureTerminal#storeCapacity} + * * @type {number} */ storeCapacity: 0, @@ -33,6 +39,8 @@ StructureTerminal.prototype = /** * Sends resource to a Terminal in another room with the specified name. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207713399-StructureTerminal#send} + * * @type {function} * * @param {string} resourceType One of the RESOURCE_* constants. @@ -51,6 +59,8 @@ StructureTerminal.prototype = * The target has to be at adjacent square. * You can transfer resources to your creeps from hostile structures as well. * + * @see {@link http://support.screeps.com/hc/en-us/articles/207713399-StructureTerminal#transfer} + * * @type {function} * * @param {Creep} target The target object. diff --git a/Structures/StructureTower.js b/Structures/StructureTower.js index 9154e84..4f27353 100644 --- a/Structures/StructureTower.js +++ b/Structures/StructureTower.js @@ -6,6 +6,8 @@ * * @class * @extends {OwnedStructure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208437105-StructureTower} */ StructureTower = function() { }; @@ -13,13 +15,14 @@ StructureTower.prototype = { /** * + * @see {@link http://support.screeps.com/hc/en-us/articles/208437105-StructureTower#energy} * * @type {number} */ energy: 0, /** - * + * @see {@link http://support.screeps.com/hc/en-us/articles/208437105-StructureTower#energyCapacity} * * @type {number} */ @@ -28,6 +31,8 @@ StructureTower.prototype = /** * Remotely attack any creep in the room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208437105-StructureTower#attack} + * * @type {function} * * @param {Creep} target The target creep. @@ -40,6 +45,8 @@ StructureTower.prototype = /** * Remotely heal any creep in the room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208437105-StructureTower#heal} + * * @type {function} * * @param {Creep} target The target creep. @@ -52,6 +59,8 @@ StructureTower.prototype = /** * Remotely repair any structure in the room. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208437105-StructureTower#repair} + * * @type {function} * * @param {Spawn|Structure} target The target structure. @@ -67,6 +76,8 @@ StructureTower.prototype = * Transfer energy from the structure to a creep. * You can transfer resources to your creeps from hostile structures as well. * + * @see {@link http://support.screeps.com/hc/en-us/articles/208437105-StructureTower#transferEnergy} + * * @type {function} * * @param {Creep} target The creep object which energy should be transferred to. diff --git a/Structures/StructureWall.js b/Structures/StructureWall.js index 50aaf67..3b31c98 100644 --- a/Structures/StructureWall.js +++ b/Structures/StructureWall.js @@ -3,6 +3,8 @@ * * @class * @extends {Structure} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208437125-StructureWall} */ StructureWall = function() { }; @@ -11,6 +13,8 @@ StructureWall.prototype = /** * The amount of game ticks when the wall will disappear (only for automatically placed border walls at the start of the game). * + * @see {@link http://support.screeps.com/hc/en-us/articles/208437125-StructureWall#ticksToLive} + * * @type {number} */ ticksToLive: 0 From 515e3304336850e32549560ba103285b4c9f648d Mon Sep 17 00:00:00 2001 From: greenfrogs Date: Thu, 29 Dec 2016 18:48:49 +0000 Subject: [PATCH 19/63] Visual Studio Instructions More Indepth Made the visual studio instructions less confusing and added a link to a video --- Readme.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Readme.md b/Readme.md index c87a048..7c7465c 100644 --- a/Readme.md +++ b/Readme.md @@ -27,9 +27,11 @@ Instead of copying the `ScreepsAutocomplete` folder to each and every project fo Webstorm should automatically detect the library and add it to the autocompletion. #### Visual Studio -Copy the `ScreepsAutcompete` folder in to your project, then create a file called `_references.js`. Right click your newly -created and empty file, and then select `Update JavaScript References`. The file should now be populated autocomplete should -be available. +1. Create a new empty web site (File -> New -> Web Site -> ASP.NET Empty Web Site) and set the location to the location of your program. +2. Copy the `ScreepsAutocomplete` folder into your project and create a new file called `_references.js` (right click in solution explorer -> Add New Item -> `_references.js`). +3. Right click within the empty file and select `Update JavaScript References` which will populate the file and make autocomplete avaliable. + +[Video](https://youtu.be/XgCBdF1BBdE?t=48s) #### Sublime Text There are two ways to enable Autocomplete in Sublime Text, both of them require installing a plugin through @@ -57,4 +59,4 @@ Integration with Atom is done through use of the [`atom-ternjs`](https://github. ] } ``` - * Restart and Enjoy \ No newline at end of file + * Restart and Enjoy From 78225eee39ad0f12275249fe4beafdfa973142f2 Mon Sep 17 00:00:00 2001 From: Jay French Date: Wed, 22 Mar 2017 17:19:31 -0500 Subject: [PATCH 20/63] Added Modules.js with definitions for module and require --- Modules.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Modules.js diff --git a/Modules.js b/Modules.js new file mode 100644 index 0000000..50d855c --- /dev/null +++ b/Modules.js @@ -0,0 +1,22 @@ +/** + * The entry point for a Screeps module. Set the exports property to an object + * containing any methods/properties you want to export. + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016662-Organizing-scripts-using-modules} + */ +module = { + exports: {} +} + +/** + * Load a module with the given name. + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016662-Organizing-scripts-using-modules} + * + * @type {function} + * + * @param {string} name The script module name. + * + * @return {object} The export object from the specified module. + */ +function require(name) {} From 45e0a4c346bd5f9cd14371e5d9e73ca792f3ae5a Mon Sep 17 00:00:00 2001 From: Jay French Date: Thu, 23 Mar 2017 08:43:45 -0500 Subject: [PATCH 21/63] Don't need after all --- Modules.js | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 Modules.js diff --git a/Modules.js b/Modules.js deleted file mode 100644 index 50d855c..0000000 --- a/Modules.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * The entry point for a Screeps module. Set the exports property to an object - * containing any methods/properties you want to export. - * - * @see {@link http://support.screeps.com/hc/en-us/articles/203016662-Organizing-scripts-using-modules} - */ -module = { - exports: {} -} - -/** - * Load a module with the given name. - * - * @see {@link http://support.screeps.com/hc/en-us/articles/203016662-Organizing-scripts-using-modules} - * - * @type {function} - * - * @param {string} name The script module name. - * - * @return {object} The export object from the specified module. - */ -function require(name) {} From 0464522cabbd0806f6c284f522b75e5744aa6b7b Mon Sep 17 00:00:00 2001 From: Jay French Date: Thu, 23 Mar 2017 08:51:04 -0500 Subject: [PATCH 22/63] Added new constants from 2017-03-09 release --- Global/Constants.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Global/Constants.js b/Global/Constants.js index 4474a06..de04e57 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -1987,3 +1987,21 @@ const LOOK_NUKES = "nuke"; * @type {string} */ const LOOK_TERRAIN = "terrain"; + +/** + * @constant + * @type {string} + */ +const SYSTEM_USERNAME = 'Screeps'; + +/** + * @constant + * @type {string} + */ +const SIGN_NOVICE_AREA = 'A new Novice Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; + +/** + * @constant + * @type {string} + */ +const SIGN_RESPAWN_AREA = 'A new Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; From 2c36a6a550c2cc10f355a82d5f6440eaee784387 Mon Sep 17 00:00:00 2001 From: Sebastian Mahr Date: Sun, 16 Apr 2017 12:34:43 +0200 Subject: [PATCH 23/63] Fixed Flag Colors Type of flag Color and secondary Color is number not string http://support.screeps.com/hc/en-us/articles/203079181-Flag#color --- Flag.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flag.js b/Flag.js index 7e3330f..9ec4b53 100644 --- a/Flag.js +++ b/Flag.js @@ -17,7 +17,7 @@ Flag.prototype = * * @see {@link http://support.screeps.com/hc/en-us/articles/203079181-Flag#color} * - * @type {string} + * @type {number} */ color: "", @@ -47,7 +47,7 @@ Flag.prototype = * * @see {@link http://support.screeps.com/hc/en-us/articles/203079181-Flag#secondaryColor} * - * @type {string} + * @type {number} */ secondaryColor: "", From 7e8dd192e332ea0b34888b35d1b1b991c626fca5 Mon Sep 17 00:00:00 2001 From: Gareth Parker Date: Tue, 18 Apr 2017 12:49:53 +0100 Subject: [PATCH 24/63] Updating --- Game.js | 431 ++++++++++++++++++-------------------------- Global/Constants.js | 18 ++ Order.js | 66 +++++++ TODO.md | 4 + 4 files changed, 262 insertions(+), 257 deletions(-) create mode 100644 Order.js create mode 100644 TODO.md diff --git a/Game.js b/Game.js index 61e4fea..720c101 100644 --- a/Game.js +++ b/Game.js @@ -5,15 +5,21 @@ * * @class */ -Game = -{ +Game = { + /** + * A hash containing all your construction sites with their id as hash keys. + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#constructionSites} + * @type {Array} + */ + constructionSites: {}, + /** * An object containing information about your CPU usage * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#cpu} */ - cpu: - { + cpu: { /** * Your CPU limit depending on your Global Control Level. * @@ -34,36 +40,19 @@ Game = * * @type {number} */ - bucket: 0, - - /** - * Get amount of CPU time used from the beginning of the current game tick. - * Always returns 0 in the Simulation mode. - * - * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#cpu.getUsed} - * - * @type {function} - * - * @return {number} - */ - getUsed: function() { } + bucket: 0 }, - /** - * A hash containing all your construction sites with their id as hash keys. - * - * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#constructionSites} - * - * @type {Array} - */ - constructionSites: {}, /** * A hash containing all your creeps with creep names as hash keys. * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#creeps} - * * @type {Array} + * @example + * for(var i in Game.creeps) { + * Game.creeps[i].moveTo(flag); + * } */ creeps: {}, @@ -71,18 +60,19 @@ Game = * A hash containing all your flags with flag names as hash keys. * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#flags} - * * @type {Array} + * @example + * creep.moveTo(Game.flags.Flag1); */ flags: {}, /** * Your Global Control Level * + * @see {@link http://docs.screeps.com/control.html} * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#gcl} */ - gcl: - { + gcl: { /** * The current level. * @@ -108,45 +98,45 @@ Game = /** * A global object representing world map. * - * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#map} * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map} - * + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#map} */ - map: - { + map: { /** * List all exits available from the room with the given name. * - * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#describeExits} - * - * @type {function} - * * @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 - } + { + "1": "W8N4", // TOP + "3": "W7N3", // RIGHT + "5": "W8N2", // BOTTOM + "7": "W9N3" // LEFT + } + * + * @type {function} + * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#describeExits} + * @example + * var exits = Game.map.describeExits('W8N3'); */ - describeExits: function(roomName) { }, + describeExits: function (roomName) { + }, /** * Find the exit direction from the given room en route to another room. * - * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#findExit} - * - * @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. See findRoute. * - * @return {FIND_EXIT_TOP|FIND_EXIT_RIGHT|FIND_EXIT_BOTTOM|FIND_EXIT_LEFT|number|ERR_NO_PATH|ERR_INVALID_ARGS} + * @return {number|FIND_EXIT_TOP|FIND_EXIT_RIGHT|FIND_EXIT_BOTTOM|FIND_EXIT_LEFT|ERR_NO_PATH|ERR_INVALID_ARGS} + * @type {function} + * + * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#findExit} */ - findExit: function(fromRoom, toRoom, opts) { }, + findExit: function (fromRoom, toRoom, opts) { + }, /** * Find route from the given room to another room. @@ -161,12 +151,13 @@ Game = * @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' } - ] + [ + { exit: FIND_EXIT_RIGHT, room: 'arena21' }, + { exit: FIND_EXIT_BOTTOM, room: 'arena22' } + ] */ - findRoute: function(fromRoom, toRoom, opts) { }, + findRoute: function (fromRoom, toRoom, opts) { + }, /** * Get the linear distance (in rooms) between two rooms. @@ -178,10 +169,12 @@ Game = * * @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) { }, + getRoomLinearDistance: function (roomName1, roomName2, continuous) { + }, /** * Get terrain type at the specified room position. @@ -200,7 +193,8 @@ Game = * * @return {"plain"|"swamp"|"wall"} */ - getTerrainAt: function(x, y, roomName) { }, + getTerrainAt: function (x, y, roomName) { + }, /** * Check if the room with the given name is available to move into @@ -213,21 +207,8 @@ Game = * * @return {boolean} */ - isRoomAvailable: function(roomName) { }, - - /** - * Check if the room with the given name is protected by temporary "newbie" walls. - * This method has been deprecated in favor of isRoomAvailable - * - * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#isRoomProtected} - * - * @type {function} - * - * @param {string} roomName The room name. - * - * @return {boolean} - */ - isRoomProtected: function(roomName) { } + isRoomAvailable: function (roomName) { + } }, /** @@ -235,27 +216,34 @@ Game = * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#market} * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market} + * @see {@link http://docs.screeps.com/market.html} */ - market: - { + market: { + /** + * Your current credits balance. + * + * @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 - } - }] + 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 http://support.screeps.com/hc/en-us/articles/207928635-Market#incomingTransactions} * * @type {Array} @@ -265,22 +253,21 @@ Game = /** * 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 - } - }] - + 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 http://support.screeps.com/hc/en-us/articles/207928635-Market#outgoingTransactions} * * @type {Array} @@ -288,72 +275,47 @@ Game = outgoingTransactions: [], /** - * This property is still under development. - * An array of your active and inactive buy/sell orders on the market, in the following format: - [ - { - id : "55c34a6b5be41a0a6e80c68b", - active : true, - type : "sell" - resourceType : "OH", - roomName : "W1N1", - amount : 15821, - price : 2.95 - }, { - id : "55c34a6b52411a0a6e80693a", - active : true, - type : "buy" - resourceType : "energy", - roomName : "W1N1", - amount : 94000, - price : 0.45 - }, { - id : "55c34a6b5be41a0a6e80c123", - active : true, - type : "sell" - resourceType : "token", - amount : 3, - price : 50000 - } - ] - - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#myOrders} - * - * @type {Array} - */ - myOrders: [], - - /** - * This property is still under development. - * An array of all available buy/sell orders on the market. - * Only active orders are visible. - [ - { - id : "55c34a6b5be41a0a6e80c68b", - type : "sell" - resourceType : "OH", - roomName : "W1N1", - amount : 15821, - price : 2.95 - }, { - id : "55c34a6b52411a0a6e80693a", - type : "buy" - resourceType : "energy", - roomName : "W1N1", - amount : 94000, - price : 0.45 - }, { - id : "55c34a6b5be41a0a6e80c123", - type : "sell" - resourceType : "token", - amount : 3, - price : 50000 - } - ] - + *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 http://support.screeps.com/hc/en-us/articles/207928635-Market#orders} * - * @type {Array} + * @type {Array} */ orders: [], @@ -371,7 +333,8 @@ Game = * * @return {number} The amount of energy required to perform the transaction. */ - calcTransactionCost: function(amount, roomName1, roomName2) { }, + calcTransactionCost: function (amount, roomName1, roomName2) { + }, /** * This method is still under development. @@ -387,64 +350,60 @@ Game = * * @return {number|OK|ERR_INVALID_ARGS} */ - cancelOrder: function(orderId) { }, + cancelOrder: function (orderId) { + }, /** - * This method is still under development. - * Create a buy order in your terminal. - * You will be charged price*amount*0.05 credits when the order is placed, and the price*amount credits will be reserved. - * The maximum buy orders count is 50 per player. - * You can cancel an order to refund the reserved credits amount. - * - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#createBuyOrder} - * - * @type {function} - * - * @param {string} resourceType Either one of the RESOURCE_* constants or GAMETIME_TOKEN. - * @param {number} price The price for one resource unit in credits. Can be a decimal number. - * @param {number} totalAmount The amount of resources to be bought in total. - * @param {string} [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. + * Change the price of an existing order. + * If newPrice is greater than old price, you will be charged (newPrice-oldPrice) * remainingAmount * 0.05 credits. * - * @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS} + * @param {string} orderId The order ID as provided in Game.market.orders. + * @param {number} newPrice The new order price. + * @return {OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_ARGS} */ - createBuyOrder: function(resourceType, price, totalAmount, roomName) { }, + changeOrderPrice: function (orderId, newPrice) { + }, /** - * This method is still under development. - * Create a sell order in your terminal. - * You will be charged price*amount*0.05 credits when the order is placed. - * The maximum sell orders count is 50 per player. + * 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 50 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 http://support.screeps.com/hc/en-us/articles/207928635-Market#createSellOrder} + * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#createBuyOrder} * * @type {function} * - * @param {string} resourceType Either one of the RESOURCE_* constants or GAMETIME_TOKEN. If your Terminal doesn't have the specified resource, the order will be temporary inactive. + * @param {string|ORDER_SELL|ORDER_BUY} type The order type, either ORDER_SELL or ORDER_BUY. + * @param {string} resourceType Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN. * @param {number} price The price for one resource unit in credits. Can be a decimal number. - * @param {number} totalAmount The amount of resources to be sold in total. The Terminal doesn't have to contain all the given amount at the same time. If Infinity is provided, the order will remain active until the Terminal contains the specified resource. + * @param {number} totalAmount The amount of resources to be traded in total. * @param {string} [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_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS} */ - createSellOrder: function(resourceType, price, totalAmount, roomName) { }, + createOrder: function (type, resourceType, price, totalAmount, roomName) { + }, /** - * This method is still under development. - * Execute a trade deal from your Terminal to another player's Terminal using the specified buy/sell order. - * Your Terminal will be charged amount*linearDistanceBetweenRooms*0.1 energy units of transfer cost regardless of the order resource type. - * You can use Game.map.getRoomLinearDistance method to estimate it. + * 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 http://support.screeps.com/hc/en-us/articles/207928635-Market#deal} * * @type {function} * - * @param {string} orderId The order ID as provided in Game.market.orders. - * @param {string} targetRoomName The name of your room which has to contain an active Terminal with enough amount of energy. + * @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 equals to SUBSCRIPTION_TOKEN. * - * @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_ARGS} + * @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS} */ - deal: function(orderId, targetRoomName, amount) { }, + deal: function (orderId, amount, yourRoomName) { + }, /** * This method is still under development. @@ -460,7 +419,8 @@ Game = * * @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_ARGS} */ - extendOrder: function(orderId, addAmount) { }, + extendOrder: function (orderId, addAmount) { + }, /** * This method is still under development. @@ -472,46 +432,10 @@ Game = * * @param {object|function} [filter] An object or function that will filter the resulting list using the lodash.filter method. * - * @return {Array} An orders array in the following form: - - id - The unique order ID. - created - The order creation time in game ticks. - type - Either ORDER_SELL or ORDER_BUY. - resourceType - Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN. - roomName - The room where this order is placed. - amount - Currently available amount to trade. - remainingAmount - How many resources are left to trade via this order. When it becomes equal to zero, the order is removed. - price - The price per unit of the resourceType - - [{ - id : "55c34a6b5be41a0a6e80c68b", - created : 13131117, - type : "sell" - resourceType : "OH", - roomName : "W1N1", - amount : 15821, - remainingAmount : 30000, - price : 2.95 - }, { - id : "55c34a6b52411a0a6e80693a", - created : 13134122, - type : "buy" - resourceType : "energy", - roomName : "W1N1", - amount : 94000, - remainingAmount : 94000, - price : 0.45 - }, { - id : "55c34a6b5be41a0a6e80c123", - created : 13105123, - type : "sell" - resourceType : "token", - amount : 3, - remainingAmount : 10, - price : 50000 - }] + * @return {Array} An array of Orders */ - getAllOrders: function(filter) { }, + getAllOrders: function (filter) { + }, /** * This method is still under development. @@ -523,19 +447,10 @@ Game = * * @param {string} id The order ID * - * @return {object} An object with the order info in the following form: - { - id : "55c34a6b5be41a0a6e80c68b", - created : 13131117, - type : "sell" - resourceType : "OH", - roomName : "W1N1", - amount : 15821, - remainingAmount : 30000, - price : 2.95 - } + * @return {Order} An order */ - getOrderById: function(id) { } + getOrderById: function (id) { + } }, /** @@ -587,7 +502,8 @@ Game = * * @return {object|null} */ - getObjectById: function(id) { }, + getObjectById: function (id) { + }, /** * Send a custom message at your profile email. @@ -602,5 +518,6 @@ Game = * * @return {void} */ - notify: function(message, groupInterval) { } + notify: function (message, groupInterval) { + } }; diff --git a/Global/Constants.js b/Global/Constants.js index de04e57..f93ab4b 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -549,6 +549,12 @@ const STRUCTURE_NUKER = "nuker"; /** RESOURCE CONSTANTS **/ +/** + * @constant + * @type {string} + */ +const SUBSCRIPTION_TOKEN = 'token'; + /** * @constant * @type {string} @@ -1504,6 +1510,18 @@ const NUKE_DAMAGE = { */ const PORTAL_DECAY = 30000; +/** + * @constant + * @type {string} + */ +const ORDER_SELL = 'sell'; + +/** + * @constant + * @type {string} + */ +const ORDER_BUY = 'buy'; + /** * @constant * @type {number} diff --git a/Order.js b/Order.js new file mode 100644 index 0000000..9af9518 --- /dev/null +++ b/Order.js @@ -0,0 +1,66 @@ +Order = { + /** + * The unique order ID. + * + * @type {string} + */ + id: "", + + /** + * The order creation time in game ticks. + * + * @type {number} + */ + created: 0, + + /** + * Whether this order is active and visible to other players. An order can become non-active when the terminal doesn't have enough resources to sell or you are out of credits to buy.Whether this order is active and visible to other players. An order can become non-active when the terminal doesn't have enough resources to sell or you are out of credits to buy. + * + * @type {boolean} + */ + active: true, + + /** + * Either ORDER_SELL or ORDER_BUY + * + * @type {ORDER_SELL|ORDER_BUY} + */ + type: 'sell', + + /** + * Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN + * + * @type {string|SUBSCRIPTION_TOKEN} + */ + resourceType: "", + + /** + * The room where this order is placed. + * @type {string} + */ + roomName: "", + + /** + * Currently available amount to trade. + * @type {number} + */ + amount: 0, + + /** + * How many resources are left to trade via this order. + * @type {number} + */ + remainingAmount: 0, + + /** + * Initial order amount. + * @type {number} + */ + totalAmount: 0, + + /** + * Price + * @type {number} + */ + price: 0 +}; \ No newline at end of file diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..7105526 --- /dev/null +++ b/TODO.md @@ -0,0 +1,4 @@ +## TODO + * Continue updating Documentation + * Progress so far: Game.Market + * Find a way to auto-generate constants \ No newline at end of file From a1dd6dfb98f48b424e8404d8e3e43b2ca0fc2ab2 Mon Sep 17 00:00:00 2001 From: Gareth Parker Date: Tue, 18 Apr 2017 12:56:38 +0100 Subject: [PATCH 25/63] Updating --- Game.js | 21 +++++++++++++++++++-- TODO.md | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Game.js b/Game.js index 720c101..3603360 100644 --- a/Game.js +++ b/Game.js @@ -40,7 +40,15 @@ Game = { * * @type {number} */ - bucket: 0 + bucket: 0, + + /** + * Get amount of CPU time used from the beginning of the current game tick. Always returns 0 in the Simulation mode. + * + * @return {number} Returns the currently used CPU time as a float number + */ + getUsed: function () { + } }, @@ -453,6 +461,15 @@ Game = { } }, + /** + * An object with your global resources that are bound to the account, like subscription tokens. + * Each object key is a resource constant, values are resources amounts. + * + * @type {Array} + * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#resources} + */ + resources: {}, + /** * A hash containing all the rooms available to you with room names as hash keys. * @@ -467,7 +484,7 @@ Game = { * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#spawns} * - * @type {Array} + * @type {Array} */ spawns: {}, diff --git a/TODO.md b/TODO.md index 7105526..14fecf9 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,4 @@ ## TODO * Continue updating Documentation - * Progress so far: Game.Market + * Progress so far: Completed Game.js * Find a way to auto-generate constants \ No newline at end of file From ba88d3626e2cb2f1ac70755ca5dfc79079fd4683 Mon Sep 17 00:00:00 2001 From: greenfrogs Date: Sun, 4 Jun 2017 23:32:47 +0100 Subject: [PATCH 26/63] Added Storage Cooldown to Structure Terminal Added the storage cooldown feature from the 2017-05-11 changelog. --- Structures/StructureTerminal.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Structures/StructureTerminal.js b/Structures/StructureTerminal.js index cf0590c..e8f1c7f 100644 --- a/Structures/StructureTerminal.js +++ b/Structures/StructureTerminal.js @@ -35,6 +35,15 @@ StructureTerminal.prototype = * @type {number} */ storeCapacity: 0, + + /** + * The remaining amount of ticks while this terminal cannot be used to make StructureTerminal.send or Game.market.deal calls. + * + * @see {@link http://docs.screeps.com/api/#StructureTerminal.store} + * + * @type {number} + */ + cooldown: 0, /** * Sends resource to a Terminal in another room with the specified name. From d74fd546805db82832dc3740551b48a03d913506 Mon Sep 17 00:00:00 2001 From: greenfrogs Date: Sun, 4 Jun 2017 23:39:44 +0100 Subject: [PATCH 27/63] Terminal Cooldown Constant Added to Constants From the 2017-05-11 changelog --- Global/Constants.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Global/Constants.js b/Global/Constants.js index f93ab4b..4ce2dd2 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -2023,3 +2023,9 @@ const SIGN_NOVICE_AREA = 'A new Novice Area is being planned somewhere in this s * @type {string} */ const SIGN_RESPAWN_AREA = 'A new Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; + +/** + * @constant + * @type {number} + */ +const TERMINAL_COOLDOWN = 10; From 14e4676bbc74c6bc0ad0d5c412706e9bef5ca4ca Mon Sep 17 00:00:00 2001 From: Nick Garvey Date: Thu, 22 Jun 2017 21:59:56 -0700 Subject: [PATCH 28/63] Add line and poly of RoomVisual --- Room.js | 10 +++++++- RoomVisual.js | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 RoomVisual.js diff --git a/Room.js b/Room.js index 884aa19..72aea17 100644 --- a/Room.js +++ b/Room.js @@ -110,6 +110,14 @@ Room.prototype = */ terminal: null, + /** + * A RoomVisual object for this room. You can use this object to draw simple shapes (lines, circles, text labels) in the room. + * @see {@link http://docs.screeps.com/api/#Room.visual} + * + * @type {RoomVisual} + */ + visual: null, + /** * Create new ConstructionSite at the specified location. * @@ -376,5 +384,5 @@ Room.prototype = } } */ - lookForAtArea: function(type, top, left, bottom, right, asArray) { } + lookForAtArea: function(type, top, left, bottom, right, asArray) { }, }; diff --git a/RoomVisual.js b/RoomVisual.js new file mode 100644 index 0000000..d710602 --- /dev/null +++ b/RoomVisual.js @@ -0,0 +1,64 @@ +/** + * 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. + * Every existing Room object already contains the visual property, but you also can create new RoomVisual objects for any room (even without visibility) using the constructor. + * + * Room visuals are not stored in the database, their only purpose is to display something in your browser. + * All drawings will persist for one tick and will disappear if not updated. + * All RoomVisual API calls have no added CPU cost (their cost is natural and mostly related to simple JSON.serialize calls). + * However, there is a usage limit: you cannot post more than 500 KB of serialized data per one room (see getSize method). + * + * All draw coordinates are measured in game coordinates and centered to tile centers, i.e. (10,10) will point to the center of the creep at x:10; y:10 position. + * Fractional coordinates are allowed. + * + * @param {string} roomName + * + * @class + * @constructor + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488525-Nuke} + */ +RoomVisual = function(roomName) { }; + +RoomVisual.prototype = + { + /** + * The name of the room. + * + * @see {@link http://docs.screeps.com/api/#RoomVisual.roomName} + * + * @type {string} + */ + roomName: "", + + /** + * Draw a line. + * + * @see {@link http://docs.screeps.com/api/#RoomVisual.line} + * + * @type {function} + * + * @param {number} x1 The start X coordinate. + * @param {number} y1 The start Y coordinate. + * @param {number} x2 The finish X coordinate. + * @param {number} y2 The finish Y coordinate. + * @param {Object} [style] Style object + * + * @return {RoomVisual} + */ + line: function(x1, y1, x2, y2, style) { }, + + /** + * Draw a line. + * + * @see {@link http://docs.screeps.com/api/#RoomVisual.poly} + * + * @type {function} + * + * @param {Array>|Array} points An array of points. Every item should be either an array with 2 numbers (i.e. [10,15]), or a RoomPosition object. + * @param {Object} [style] Style object + * + * @return {RoomVisual} + */ + poly: function(points, style) { }, + }; From ba0e74782a1e6ed15a3a44ec03aae40843f7b218 Mon Sep 17 00:00:00 2001 From: shibdib Date: Sun, 25 Jun 2017 04:03:39 -0400 Subject: [PATCH 29/63] add signController --- Creep.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Creep.js b/Creep.js index 8b4263f..f3f31af 100644 --- a/Creep.js +++ b/Creep.js @@ -473,6 +473,23 @@ Creep.prototype = * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY} */ say: function(message, public) { }, + + /** + * Sign a controller with an arbitrary 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. + * + * @see {@link http://docs.screeps.com/api/#Creep.signController} + * + * @type {function} + * + * @param {StructureController} The target controller object to be signed. + * @param {string} The sign text. The string is cut off after 100 characters.. + * + * @return {number|OK|ERR_INVALID_TARGET|ERR_BUSY|ERR_NOT_IN_RANGE} + */ + signController: function(target, text) { }, /** * Kill the creep immediately. From 9a5414e19144661125803d2b351252fccbd0aa22 Mon Sep 17 00:00:00 2001 From: Craig Tongue Date: Tue, 13 Feb 2018 15:29:52 +0000 Subject: [PATCH 30/63] Add spawnCreep createCreep is deprecated and has been replaced with spawnCreep --- Structures/StructureSpawn.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Structures/StructureSpawn.js b/Structures/StructureSpawn.js index 21cb3c6..472eb57 100644 --- a/Structures/StructureSpawn.js +++ b/Structures/StructureSpawn.js @@ -99,7 +99,22 @@ StructureSpawn.prototype = * @return {string|number|ERR_NOT_OWNER|ERR_NAME_EXISTS|ERR_BUSY|ERR_NOT_ENOUGH_ENERGY|ERR_INVALID_ARGS|ERR_RCL_NOT_ENOUGH} */ createCreep: function(body, name, memory) { }, - + + /** + * Start the creep spawning process. The required energy amount can be withdrawn from all spawns and extensions in the room. + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn.spawnCreep} + * + * @type {function} + * + * @param {Array} body An array describing the new creep’s body. Should contain 1 to 50 elements. + * @param {string} [name] The name of a new creep. It must be a unique creep name, i.e. the Game.creeps object should not contain another creep with the same name (hash key). + * @param {*} [memory] The memory of a new creep. If provided, it will be immediately stored into Memory.creeps[name]. + * + * @return {string|number|ERR_NOT_OWNER|ERR_NAME_EXISTS|ERR_BUSY|ERR_NOT_ENOUGH_ENERGY|ERR_INVALID_ARGS|ERR_RCL_NOT_ENOUGH} + */ + spawnCreep: function(body, name, memory) { }, + /** * 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. From a6740897ef1016ba6f8b995dcd602d9b8725dc8f Mon Sep 17 00:00:00 2001 From: alexlarex Date: Mon, 12 Mar 2018 08:08:01 +0300 Subject: [PATCH 31/63] Added StructureSpawn.Spawning docs Info was taken from http://docs.screeps.com/api/ --- Structures/StructureSpawn.js | 81 ++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/Structures/StructureSpawn.js b/Structures/StructureSpawn.js index 472eb57..501c755 100644 --- a/Structures/StructureSpawn.js +++ b/Structures/StructureSpawn.js @@ -163,3 +163,84 @@ StructureSpawn.prototype = */ transferEnergy: function(target, amount) { } }; + +/** + * Details of the creep being spawned currently that can be addressed by the StructureSpawn.spawning property. + * + * @class + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn-Spawning} + */ +StructureSpawn.Spawning = function () { }; + +StructureSpawn.Spawning.prototype = { + + /** + * An array with the spawn directions + * + * @see (@Link http://docs.screeps.com/api/#StructureSpawn.Spawning.directions) + * + * @type {Array} + */ + directions: [], + + /** + * The name of a new creep. + * + * @see (@Link http://docs.screeps.com/api/#StructureSpawn.Spawning.name) + * + * @type (string) + */ + name: "", + + /** + * Time in ticks needed in total to complete the spawning. + * + * @see (@Link http://docs.screeps.com/api/#StructureSpawn.Spawning.needTime) + * + * @type (number) + */ + needTime: 0, + + /** + * Remaining time to go. + * + * @see (@Link http://docs.screeps.com/api/#StructureSpawn.Spawning.remainingTime) + * + * @type (number) + */ + remainingTime: 0, + + /** + * A link to the spawn. + * + * @see (@Link http://docs.screeps.com/api/#StructureSpawn.Spawning.spawn) + * + * @type (StructureSpawn) + */ + spawn: {}, + + /** + * Cancel spawning immediately. Energy spent on spawning is not returned. + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.cancel} + * + * @type {function} + * + * @return {number|OK|ERR_NOT_OWNER} + */ + cancel: function() { }, + + /** + * Set desired directions where the creep should move when spawned. + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.setDirections} + * + * @type {function} + * + * @param {array} {directions} An array with the direction constants: TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT + * + * @return {number|OK|ERR_NOT_OWNER|ERR_INVALID_ARGS} + */ + setDirections: function(directions) { } +}; From 635ded1d546dc3e0afa54a38e9dc673f7c37517d Mon Sep 17 00:00:00 2001 From: alexlarex Date: Mon, 12 Mar 2018 08:13:54 +0300 Subject: [PATCH 32/63] Typo Fix --- Structures/StructureSpawn.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Structures/StructureSpawn.js b/Structures/StructureSpawn.js index 501c755..8f175c7 100644 --- a/Structures/StructureSpawn.js +++ b/Structures/StructureSpawn.js @@ -178,7 +178,7 @@ StructureSpawn.Spawning.prototype = { /** * An array with the spawn directions * - * @see (@Link http://docs.screeps.com/api/#StructureSpawn.Spawning.directions) + * @see (@link http://docs.screeps.com/api/#StructureSpawn.Spawning.directions) * * @type {Array} */ @@ -187,7 +187,7 @@ StructureSpawn.Spawning.prototype = { /** * The name of a new creep. * - * @see (@Link http://docs.screeps.com/api/#StructureSpawn.Spawning.name) + * @see (@link http://docs.screeps.com/api/#StructureSpawn.Spawning.name) * * @type (string) */ @@ -196,7 +196,7 @@ StructureSpawn.Spawning.prototype = { /** * Time in ticks needed in total to complete the spawning. * - * @see (@Link http://docs.screeps.com/api/#StructureSpawn.Spawning.needTime) + * @see (@link http://docs.screeps.com/api/#StructureSpawn.Spawning.needTime) * * @type (number) */ @@ -205,7 +205,7 @@ StructureSpawn.Spawning.prototype = { /** * Remaining time to go. * - * @see (@Link http://docs.screeps.com/api/#StructureSpawn.Spawning.remainingTime) + * @see (@link http://docs.screeps.com/api/#StructureSpawn.Spawning.remainingTime) * * @type (number) */ @@ -214,7 +214,7 @@ StructureSpawn.Spawning.prototype = { /** * A link to the spawn. * - * @see (@Link http://docs.screeps.com/api/#StructureSpawn.Spawning.spawn) + * @see (@link http://docs.screeps.com/api/#StructureSpawn.Spawning.spawn) * * @type (StructureSpawn) */ From 209bf66649a22032cc329445b89c485a02790627 Mon Sep 17 00:00:00 2001 From: alexlarex Date: Mon, 12 Mar 2018 08:18:37 +0300 Subject: [PATCH 33/63] More typos --- Structures/StructureSpawn.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Structures/StructureSpawn.js b/Structures/StructureSpawn.js index 8f175c7..433cedf 100644 --- a/Structures/StructureSpawn.js +++ b/Structures/StructureSpawn.js @@ -178,7 +178,7 @@ StructureSpawn.Spawning.prototype = { /** * An array with the spawn directions * - * @see (@link http://docs.screeps.com/api/#StructureSpawn.Spawning.directions) + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.directions} * * @type {Array} */ @@ -187,36 +187,36 @@ StructureSpawn.Spawning.prototype = { /** * The name of a new creep. * - * @see (@link http://docs.screeps.com/api/#StructureSpawn.Spawning.name) + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.name} * - * @type (string) + * @type {string} */ name: "", /** * Time in ticks needed in total to complete the spawning. * - * @see (@link http://docs.screeps.com/api/#StructureSpawn.Spawning.needTime) + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.needTime} * - * @type (number) + * @type {number} */ needTime: 0, /** * Remaining time to go. * - * @see (@link http://docs.screeps.com/api/#StructureSpawn.Spawning.remainingTime) + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.remainingTime} * - * @type (number) + * @type {number} */ remainingTime: 0, /** * A link to the spawn. * - * @see (@link http://docs.screeps.com/api/#StructureSpawn.Spawning.spawn) + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.spawn} * - * @type (StructureSpawn) + * @type {StructureSpawn} */ spawn: {}, @@ -238,7 +238,7 @@ StructureSpawn.Spawning.prototype = { * * @type {function} * - * @param {array} {directions} An array with the direction constants: TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT + * @param {Array} {directions} An array with the direction constants: TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT * * @return {number|OK|ERR_NOT_OWNER|ERR_INVALID_ARGS} */ From df4f0c65402f9a5985660edceb9f4393e6c8cead Mon Sep 17 00:00:00 2001 From: Leo Friedrichs Date: Wed, 28 Mar 2018 16:45:05 +0200 Subject: [PATCH 34/63] Fix StructureSpawn.spawnCreep --- Structures/StructureSpawn.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Structures/StructureSpawn.js b/Structures/StructureSpawn.js index 433cedf..2325c31 100644 --- a/Structures/StructureSpawn.js +++ b/Structures/StructureSpawn.js @@ -108,10 +108,14 @@ StructureSpawn.prototype = * @type {function} * * @param {Array} body An array describing the new creep’s body. Should contain 1 to 50 elements. - * @param {string} [name] The name of a new creep. It must be a unique creep name, i.e. the Game.creeps object should not contain another creep with the same name (hash key). - * @param {*} [memory] The memory of a new creep. If provided, it will be immediately stored into Memory.creeps[name]. - * - * @return {string|number|ERR_NOT_OWNER|ERR_NAME_EXISTS|ERR_BUSY|ERR_NOT_ENOUGH_ENERGY|ERR_INVALID_ARGS|ERR_RCL_NOT_ENOUGH} + * @param {string} name The name of a new creep. It must be a unique creep name, i.e. the Game.creeps object should not contain another creep with the same name (hash key). + * @param {Object} [opts] An object with additional options for the spawning process. + * @param {*} [opts.memory] Memory of the new creep. If provided, it will be immediately stored into Memory.creeps[name]. + * @param {Array} [opts.energyStructures] Array of spawns/extensions from which to draw energy for the spawning process. Structures will be used according to the array order. + * @param {boolean} [opts.dryRun] If dryRun is true, the operation will only check if it is possible to create a creep. + * @param {Array} [opts.directions] Set desired directions where the creep should move when spawned. + * + * @return {OK|number|ERR_NOT_OWNER|ERR_NAME_EXISTS|ERR_BUSY|ERR_NOT_ENOUGH_ENERGY|ERR_INVALID_ARGS|ERR_RCL_NOT_ENOUGH} */ spawnCreep: function(body, name, memory) { }, From aff6afbf965dd136f7f66b07e267dad5bdb76706 Mon Sep 17 00:00:00 2001 From: Poma Date: Sun, 17 Jun 2018 20:19:24 +0300 Subject: [PATCH 35/63] Tombstones --- Global/Constants.js | 18 ++++++++++++++ Tombstone.js | 57 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 Tombstone.js diff --git a/Global/Constants.js b/Global/Constants.js index 4ce2dd2..620c644 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -405,6 +405,12 @@ const FIND_MINERALS = 116; */ const FIND_NUKES = 117; +/** + * @constant + * @type {number} + */ +const FIND_TOMBSTONES = 118; + /** GAME MODE CONSTANTS **/ /** @@ -1510,6 +1516,12 @@ const NUKE_DAMAGE = { */ const PORTAL_DECAY = 30000; +/** + * @constant + * @type {number} + */ +const TOMBSTONE_DECAY_PER_PART = 5; + /** * @constant * @type {string} @@ -2006,6 +2018,12 @@ const LOOK_NUKES = "nuke"; */ const LOOK_TERRAIN = "terrain"; +/** + * @constant + * @type {string} + */ +const LOOK_TOMBSTONES = "tombstone"; + /** * @constant * @type {string} diff --git a/Tombstone.js b/Tombstone.js new file mode 100644 index 0000000..e663573 --- /dev/null +++ b/Tombstone.js @@ -0,0 +1,57 @@ +/** + * A remnant of dead creeps. This is a walkable object. + * + * @class + * @extends {RoomObject} + * + * @see {@link https://docs.screeps.com/api/#Tombstone} + */ +Tombstone = function() { }; + +Tombstone.prototype = +{ + /** + * An object containing the deceased creep. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.creep} + * + * @type {Creep} + */ + creep: { }, + + /** + * Time of death. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.deathTime} + * + * @type {number} + */ + deathTime: 0, + + /** + * A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.id} + * + * @type {string} + */ + id: "", + + /** + * An object with the tombstone contents. Each object key is one of the RESOURCE_* constants, values are resources amounts. RESOURCE_ENERGY is always defined and equals to 0 when empty, other resources are undefined when empty. You can use lodash.sum to get the total amount of contents. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.store} + * + * @type {object} + */ + store: { }, + + /** + * The amount of game ticks before this tombstone decays. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.ticksToDecay} + * + * @type {number} + */ + ticksToDecay: 0, +}; \ No newline at end of file From 75e993b3b069561d521fffee6415e9f7997ff4aa Mon Sep 17 00:00:00 2001 From: Jacudibu Date: Sat, 22 Sep 2018 11:42:53 +0200 Subject: [PATCH 36/63] Updated ScreepsAutocomplete to inclode the recent changes specified here: https://blog.screeps.com/2018/09/changelog-2018-09-22/ --- Creep.js | 2 +- Game.js | 33 ++++++++++------ Global/Constants.js | 8 ++++ Room.js | 80 +++++++++++++++++++++++++++++++++++++- Structures/StructureLab.js | 15 +++++++ 5 files changed, 124 insertions(+), 14 deletions(-) diff --git a/Creep.js b/Creep.js index f3f31af..75574cf 100644 --- a/Creep.js +++ b/Creep.js @@ -192,7 +192,7 @@ Creep.prototype = * * @param {ConstructionSite} target The target construction site to be built. * - * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_NOT_IN_RANGE|ERR_NO_BODYPART|ERR_RCL_NOT_ENOUGH} + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_NOT_IN_RANGE|ERR_NO_BODYPART} */ build: function(target) { }, diff --git a/Game.js b/Game.js index 3603360..b4e014e 100644 --- a/Game.js +++ b/Game.js @@ -128,8 +128,7 @@ Game = { * @example * var exits = Game.map.describeExits('W8N3'); */ - describeExits: function (roomName) { - }, + describeExits: function (roomName) {}, /** * Find the exit direction from the given room en route to another room. @@ -143,8 +142,7 @@ Game = { * * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#findExit} */ - findExit: function (fromRoom, toRoom, opts) { - }, + findExit: function (fromRoom, toRoom, opts) {}, /** * Find route from the given room to another room. @@ -164,8 +162,7 @@ Game = { { exit: FIND_EXIT_BOTTOM, room: 'arena22' } ] */ - findRoute: function (fromRoom, toRoom, opts) { - }, + findRoute: function (fromRoom, toRoom, opts) {}, /** * Get the linear distance (in rooms) between two rooms. @@ -181,13 +178,27 @@ Game = { * * @return {number} A number of rooms between the given two rooms. */ - getRoomLinearDistance: function (roomName1, roomName2, continuous) { - }, + 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 http://support.screeps.com/hc/en-us/articles/203079191-Map#getTerrainAt} * * @type {function} @@ -201,8 +212,7 @@ Game = { * * @return {"plain"|"swamp"|"wall"} */ - getTerrainAt: function (x, y, roomName) { - }, + getTerrainAt: function (x, y, roomName) {}, /** * Check if the room with the given name is available to move into @@ -215,8 +225,7 @@ Game = { * * @return {boolean} */ - isRoomAvailable: function (roomName) { - } + isRoomAvailable: function (roomName) {} }, /** diff --git a/Global/Constants.js b/Global/Constants.js index 620c644..8e7c1ff 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -2032,16 +2032,24 @@ const SYSTEM_USERNAME = 'Screeps'; /** * @constant + * @deprecated use SIGN_PLANNED_AREA instead. * @type {string} */ const SIGN_NOVICE_AREA = 'A new Novice Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; /** * @constant + * @deprecated use SIGN_PLANNED_AREA instead. * @type {string} */ const SIGN_RESPAWN_AREA = 'A new Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; +/** + * @constant + * @type {string} + */ +const SIGN_PLANNED_AREA = 'A new Novice or Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; + /** * @constant * @type {number} diff --git a/Room.js b/Room.js index 72aea17..ffba87c 100644 --- a/Room.js +++ b/Room.js @@ -32,7 +32,7 @@ Room = { * * return {Array} A path array. */ - deserializePath: function(path) { } + deserializePath: function(path) { }, }; Room.prototype = @@ -216,6 +216,24 @@ Room.prototype = */ findPath: function(fromPos, toPos, opts) { }, + /** + * Returns an array of events happened on the previous tick in this room. + * + * @see {@link https://docs.screeps.com/api/#Room.getEventLog} + * + * @type {function} + * + * @param {raw} [raw] 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. + * + * @return An array of events. Each event represents some game action in the following format: + { + event: EVENT_ATTACK, + objectId: '54bff72ab32a10f73a57d017', + data: { ... } + } + */ + getEventLog: function(raw) { }, + /** * Creates a RoomPosition object at the specified location. * @@ -230,6 +248,17 @@ Room.prototype = */ getPositionAt: function(x, y) { }, + /** + * 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/#Room.getTerrain} + * + * @type {function} + * + * @return {Room.Terrain} Returns new Room.Terrain object. + */ + getTerrain: function() {}, + /** * Get the list of objects at the specified room position. * @@ -386,3 +415,52 @@ Room.prototype = */ lookForAtArea: function(type, top, left, bottom, right, asArray) { }, }; + +/** + * 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. + * + * @param {string} roomName The room name. + * + * @class + * @constructor + * + * @see {@link https://docs.screeps.com/api/#Room-Terrain} + */ +Room.Terrain = function(roomName) {}, + +Room.Terrain.prototype = { + /** + * 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). + * + * @see {@link https://docs.screeps.com/api/#Room.Terrain.get} + * + * @type {function} + * + * @param {number} x X position in the room. + * @param {number} y Y position in the room. + * + * @return {0|TERRAIN_MASK_WALL|TERRAIN_MASK_SWAMP} An integer value. 0 if Plain. + */ + get: function(x, y) {}, + + /** + * Get copy of underlying static terrain buffer. Current underlying representation is Uint8Array. + * + * @note WARNING: this method relies on underlying representation of terrain data. This is the fastest way to obtain terrain data of the whole room (2500 tiles), but users should keep in mind that it can be marked as deprecated anytime in the future, or return value type can be changed due to underlying data representation changing. + * + * @see {@link https://docs.screeps.com/api/#Room.Terrain.getRawBuffer} + * + * @type {function} + * + * @param {Array} [destinationArray] A typed array view in which terrain will be copied to. + * + * @return {Array|ERR_INVALID_ARGS} Copy of underlying room terrain representations as a new Uint8Array typed array of size 2500. + + Each element is an integer number, terrain type can be obtained by applying bitwise AND (&) operator with appropriate TERRAIN_MASK_* constant. Room tiles are stored row by row. + + If destinationArray is specified, function returns reference to this filled destinationArray if coping succeeded, or error code otherwise: + */ + getRawBuffer: function(destinationArray) {}, +}; \ No newline at end of file diff --git a/Structures/StructureLab.js b/Structures/StructureLab.js index 25dde51..b2fffdc 100644 --- a/Structures/StructureLab.js +++ b/Structures/StructureLab.js @@ -79,6 +79,21 @@ StructureLab.prototype = */ boostCreep: function(creep, bodyPartsCount) { }, + /** + * 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. + * + * @see {@link https://docs.screeps.com/api/#StructureLab.unboostCreep} + * + * @type {function} + * + * @param {Creep} creep The target creep. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_NOT_FOUND|ERR_INVALID_TARGET|ERR_NOT_IN_RANGE|ERR_TIRED} + */ + unboostCreep: function(creep) { }, + + /** * Produce mineral compounds using reagents from two another labs. * The same input labs can be used by many output labs. From a85e8110118b584ee2e380bdabccbe37b5e58b89 Mon Sep 17 00:00:00 2001 From: Jacudibu Date: Wed, 10 Oct 2018 18:19:52 +0200 Subject: [PATCH 37/63] Added Missing return values to PathFinder.search --- PathFinder.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PathFinder.js b/PathFinder.js index 36e82ac..4b29aa7 100644 --- a/PathFinder.js +++ b/PathFinder.js @@ -33,7 +33,7 @@ PathFinder = * @param {number} [opts.maxRooms] The maximum allowed rooms to search. The default (and maximum) is 16. * @param {number} [opts.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. * - * @return {{path:Array,opts:number}} An object containing: path - An array of RoomPosition objects; ops - Total number of operations performed before this path was calculated. + * @return {{path:Array,opts:number,cost:number,incomplete:boolean}} An object containing: path - An array of RoomPosition objects; ops - Total number of operations performed before this path was calculated; cost - The total cost of the path as derived from plainCost, swampCost and any given CostMatrix instances; incomplete - If the pathfinder fails to find a complete path, this will be true. Note that path will still be populated with a partial path which represents the closest path it could find given the search parameters. */ search: function(origin, goal, opts) { }, @@ -41,7 +41,7 @@ PathFinder = * Specify whether to use this new experimental pathfinder in game objects methods. * This method should be invoked every tick. * @static - * + * @deprecated * @note It affects the following methods behavior: Room.findPath, RoomPosition.findPathTo, RoomPosition.findClosestByPath, Creep.moveTo. * * @see {@link http://support.screeps.com/hc/en-us/articles/207023879-PathFinder#use} From bee0ec79b18d89ef9a6b321720d90389603cfab3 Mon Sep 17 00:00:00 2001 From: Jacudibu Date: Wed, 10 Oct 2018 18:31:54 +0200 Subject: [PATCH 38/63] Added missing values to Game.cpu --- Game.js | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/Game.js b/Game.js index b4e014e..631191a 100644 --- a/Game.js +++ b/Game.js @@ -42,13 +42,49 @@ Game = { */ 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} + */ + shardLimits: {}, + + /** + * 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. + * + * @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. * * @return {number} Returns the currently used CPU time as a float number */ - getUsed: function () { - } + getUsed: 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. + * @param {object} limits An object with CPU values for each shard in the same format as Game.cpu.shardLimits. + * + * @return {OK|ERR_BUSY|ERR_INVALID_ARGS} + */ + setShardLimits: function(limits) {}, }, From 99a284d7822192e74c82d23093052559143c8830 Mon Sep 17 00:00:00 2001 From: Jacudibu Date: Wed, 10 Oct 2018 18:35:30 +0200 Subject: [PATCH 39/63] Added Game.shard --- Game.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Game.js b/Game.js index 631191a..eb2c575 100644 --- a/Game.js +++ b/Game.js @@ -524,6 +524,13 @@ Game = { */ rooms: {}, + /** + * An object describing the world shard where your script is currently being executed in. + * + * @return {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. * From becf4d8c881e8cf971cd4d17a2790b98f14a9c04 Mon Sep 17 00:00:00 2001 From: Jacudibu Date: Wed, 10 Oct 2018 23:27:48 +0200 Subject: [PATCH 40/63] Added REACTION_TIME constant --- Global/Constants.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Global/Constants.js b/Global/Constants.js index 8e7c1ff..b6e7827 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -1158,6 +1158,43 @@ const COLORS_ALL = [ COLOR_WHITE ]; +const REACTION_TIME = { + OH: 20, + ZK: 5, + UL: 5, + G: 5, + UH: 10, + UH2O: 5, + XUH2O: 60, + UO: 10, + UHO2: 5, + XUHO2: 60, + KH: 10, + KH2O: 5, + XKH2O: 60, + KO: 10, + KHO2: 5, + XKHO2: 60, + LH: 15, + LH2O: 10, + XLH2O: 65, + LO: 10, + LHO2: 5, + XLHO2: 60, + ZH: 20, + ZH2O: 40, + XZH2O: 160, + ZO: 10, + ZHO2: 5, + XZHO2: 60, + GH: 10, + GH2O: 15, + XGH2O: 80, + GO: 10, + GHO2: 30, + XGHO2: 150, +}; + /** * @constant * @type {object} From 5ada0111716171c26864118ca7cf20dc0ad6f8cb Mon Sep 17 00:00:00 2001 From: Jacudibu Date: Mon, 29 Oct 2018 20:30:26 +0100 Subject: [PATCH 41/63] Fixed values for CONTROLLER_DOWNGRADE --- Global/Constants.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Global/Constants.js b/Global/Constants.js index b6e7827..06bdb04 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -1714,13 +1714,13 @@ const CONTROLLER_STRUCTURES = { */ const CONTROLLER_DOWNGRADE = { 1: 20000, - 2: 50000, - 3: 50000, - 4: 50000, - 5: 50000, - 6: 50000, - 7: 50000, - 8: 50000 + 2: 5000, + 3: 10000, + 4: 20000, + 5: 40000, + 6: 60000, + 7: 100000, + 8: 150000 }; /** From cbd21a3d4ba1652ea0f8ea1460227bc8850e76a5 Mon Sep 17 00:00:00 2001 From: Jacudibu Date: Mon, 29 Oct 2018 20:35:09 +0100 Subject: [PATCH 42/63] Added missing Controller constants --- Global/Constants.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Global/Constants.js b/Global/Constants.js index 06bdb04..09bb86e 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -1723,6 +1723,18 @@ const CONTROLLER_DOWNGRADE = { 8: 150000 }; +/** + * @constant + * @type {number} + */ +const CONTROLLER_DOWNGRADE_RESTORE = 100; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_DOWNGRADE_SAFEMODE_THRESHOLD = 5000; + /** * @constant * @type {number} From 7dac6d51ab753ba7db4a14fadd68eee387067d78 Mon Sep 17 00:00:00 2001 From: Jacudibu Date: Thu, 1 Nov 2018 15:27:45 +0100 Subject: [PATCH 43/63] Added the newly added Creep.pull --- Creep.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Creep.js b/Creep.js index 75574cf..43c1ac7 100644 --- a/Creep.js +++ b/Creep.js @@ -382,6 +382,21 @@ Creep.prototype = */ pickup: function(target) { }, + /** + * Help another creep to follow this creep. + * The fatigue generated for the target's move will be added to the creep instead of the target. Requires the MOVE body part. + * The target has to be at adjacent square to the creep. The creep must move elsewhere, and the target must move towards the creep. + * + * @see {@link https://docs.screeps.com/api/#Creep.pull} + * + * @type {function} + * + * @param {Creep} target The target creep. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_INVALID_TARGET|ERR_TIRED|ERR_NOT_IN_RANGE|ERR_NO_BODYPART} + */ + pull: function(target) { }, + /** * A ranged attack against another creep or structure. * Requires the RANGED_ATTACK body part. @@ -484,8 +499,8 @@ Creep.prototype = * * @type {function} * - * @param {StructureController} The target controller object to be signed. - * @param {string} The sign text. The string is cut off after 100 characters.. + * @param {StructureController} target The target controller object to be signed. + * @param {string} text The sign text. The string is cut off after 100 characters.. * * @return {number|OK|ERR_INVALID_TARGET|ERR_BUSY|ERR_NOT_IN_RANGE} */ From 0eb20b3337ba65773db50290449b3954c40b1fae Mon Sep 17 00:00:00 2001 From: Jacudibu Date: Mon, 10 Dec 2018 19:49:03 +0100 Subject: [PATCH 44/63] Added latest changes from ptr (2018-12-10) --- Game.js | 6 ++++++ PathFinder.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Game.js b/Game.js index eb2c575..053af21 100644 --- a/Game.js +++ b/Game.js @@ -78,6 +78,12 @@ Game = { */ 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. + */ + 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. * @param {object} limits An object with CPU values for each shard in the same format as Game.cpu.shardLimits. diff --git a/PathFinder.js b/PathFinder.js index 4b29aa7..6d07504 100644 --- a/PathFinder.js +++ b/PathFinder.js @@ -30,7 +30,7 @@ PathFinder = * @param {number} [opts.swampCost] Cost for walking on swamp positions. The default is 5. * @param {boolean} [opts.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. * @param {number} [opts.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. - * @param {number} [opts.maxRooms] The maximum allowed rooms to search. The default (and maximum) is 16. + * @param {number} [opts.maxRooms] The maximum allowed rooms to search. The default is 16, maximum is 64. * @param {number} [opts.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. * * @return {{path:Array,opts:number,cost:number,incomplete:boolean}} An object containing: path - An array of RoomPosition objects; ops - Total number of operations performed before this path was calculated; cost - The total cost of the path as derived from plainCost, swampCost and any given CostMatrix instances; incomplete - If the pathfinder fails to find a complete path, this will be true. Note that path will still be populated with a partial path which represents the closest path it could find given the search parameters. From 75d01937c3fd002e67f057c4450d92af0c2ba519 Mon Sep 17 00:00:00 2001 From: Kevin Yen Date: Mon, 4 Feb 2019 17:47:42 -0800 Subject: [PATCH 45/63] Fix Mineral#mineralType type --- Mineral.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mineral.js b/Mineral.js index d1a1ff3..c4b51ba 100644 --- a/Mineral.js +++ b/Mineral.js @@ -25,9 +25,9 @@ Mineral.prototype = * * @see {@link http://support.screeps.com/hc/en-us/articles/207218579-Mineral#mineralType} * - * @type {number} + * @type {string} */ - mineralType: 0, + mineralType: "", /** * A unique object identificator. From d451901c8521927a952e8fb0c84adfc1491912f9 Mon Sep 17 00:00:00 2001 From: shibdib Date: Mon, 6 May 2019 05:14:53 -0400 Subject: [PATCH 46/63] Bring it up to date (power creeps, etc...) --- Creep.js | 34 ++- Game.js | 132 ++++++++- Global/Constants.js | 443 +++++++++++++++++++++++++++- Mineral.js | 4 +- PathFinder.js | 6 +- PowerCreep.js | 468 ++++++++++++++++++++++++++++++ Room.js | 80 ++++- RoomObject.js | 8 + Structures/StructureController.js | 9 + Structures/StructureLab.js | 15 + Structures/StructureSpawn.js | 102 ++++++- Tombstone.js | 57 ++++ 12 files changed, 1325 insertions(+), 33 deletions(-) create mode 100644 PowerCreep.js create mode 100644 Tombstone.js diff --git a/Creep.js b/Creep.js index 8b4263f..43c1ac7 100644 --- a/Creep.js +++ b/Creep.js @@ -192,7 +192,7 @@ Creep.prototype = * * @param {ConstructionSite} target The target construction site to be built. * - * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_NOT_IN_RANGE|ERR_NO_BODYPART|ERR_RCL_NOT_ENOUGH} + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_NOT_IN_RANGE|ERR_NO_BODYPART} */ build: function(target) { }, @@ -382,6 +382,21 @@ Creep.prototype = */ pickup: function(target) { }, + /** + * Help another creep to follow this creep. + * The fatigue generated for the target's move will be added to the creep instead of the target. Requires the MOVE body part. + * The target has to be at adjacent square to the creep. The creep must move elsewhere, and the target must move towards the creep. + * + * @see {@link https://docs.screeps.com/api/#Creep.pull} + * + * @type {function} + * + * @param {Creep} target The target creep. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_INVALID_TARGET|ERR_TIRED|ERR_NOT_IN_RANGE|ERR_NO_BODYPART} + */ + pull: function(target) { }, + /** * A ranged attack against another creep or structure. * Requires the RANGED_ATTACK body part. @@ -473,6 +488,23 @@ Creep.prototype = * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY} */ say: function(message, public) { }, + + /** + * Sign a controller with an arbitrary 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. + * + * @see {@link http://docs.screeps.com/api/#Creep.signController} + * + * @type {function} + * + * @param {StructureController} target The target controller object to be signed. + * @param {string} text The sign text. The string is cut off after 100 characters.. + * + * @return {number|OK|ERR_INVALID_TARGET|ERR_BUSY|ERR_NOT_IN_RANGE} + */ + signController: function(target, text) { }, /** * Kill the creep immediately. diff --git a/Game.js b/Game.js index 3603360..56c8a61 100644 --- a/Game.js +++ b/Game.js @@ -42,13 +42,55 @@ Game = { */ 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} + */ + shardLimits: {}, + + /** + * 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. + * + * @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. * * @return {number} Returns the currently used CPU time as a float number */ - getUsed: function () { - } + 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. + */ + 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. + * @param {object} limits An object with CPU values for each shard in the same format as Game.cpu.shardLimits. + * + * @return {OK|ERR_BUSY|ERR_INVALID_ARGS} + */ + setShardLimits: function(limits) {}, }, @@ -56,7 +98,7 @@ Game = { * A hash containing all your creeps with creep names as hash keys. * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#creeps} - * @type {Array} + * @type {object} * @example * for(var i in Game.creeps) { * Game.creeps[i].moveTo(flag); @@ -64,11 +106,24 @@ Game = { */ 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} + * @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 http://support.screeps.com/hc/en-us/articles/203016382-Game#flags} - * @type {Array} + * @type {object} * @example * creep.moveTo(Game.flags.Flag1); */ @@ -103,6 +158,35 @@ Game = { progressTotal: 0 }, + /** + * Your Global Power Level, an object with the following properties : + * + * @see {@link http://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. * @@ -128,8 +212,7 @@ Game = { * @example * var exits = Game.map.describeExits('W8N3'); */ - describeExits: function (roomName) { - }, + describeExits: function (roomName) {}, /** * Find the exit direction from the given room en route to another room. @@ -143,8 +226,7 @@ Game = { * * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#findExit} */ - findExit: function (fromRoom, toRoom, opts) { - }, + findExit: function (fromRoom, toRoom, opts) {}, /** * Find route from the given room to another room. @@ -164,8 +246,7 @@ Game = { { exit: FIND_EXIT_BOTTOM, room: 'arena22' } ] */ - findRoute: function (fromRoom, toRoom, opts) { - }, + findRoute: function (fromRoom, toRoom, opts) {}, /** * Get the linear distance (in rooms) between two rooms. @@ -181,13 +262,27 @@ Game = { * * @return {number} A number of rooms between the given two rooms. */ - getRoomLinearDistance: function (roomName1, roomName2, continuous) { - }, + 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 http://support.screeps.com/hc/en-us/articles/203079191-Map#getTerrainAt} * * @type {function} @@ -201,8 +296,7 @@ Game = { * * @return {"plain"|"swamp"|"wall"} */ - getTerrainAt: function (x, y, roomName) { - }, + getTerrainAt: function (x, y, roomName) {}, /** * Check if the room with the given name is available to move into @@ -215,8 +309,7 @@ Game = { * * @return {boolean} */ - isRoomAvailable: function (roomName) { - } + isRoomAvailable: function (roomName) {} }, /** @@ -479,6 +572,13 @@ Game = { */ rooms: {}, + /** + * An object describing the world shard where your script is currently being executed in. + * + * @return {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. * diff --git a/Global/Constants.js b/Global/Constants.js index 4ce2dd2..44017d5 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -405,6 +405,30 @@ const FIND_MINERALS = 116; */ const FIND_NUKES = 117; +/** + * @constant + * @type {number} + */ +const FIND_TOMBSTONES = 118; + +/** + * @constant + * @type {number} + */ +const FIND_POWER_CREEPS = 119; + +/** + * @constant + * @type {number} + */ +const FIND_MY_POWER_CREEPS = 120; + +/** + * @constant + * @type {number} + */ +const FIND_HOSTILE_POWER_CREEPS = 121; + /** GAME MODE CONSTANTS **/ /** @@ -566,7 +590,6 @@ const RESOURCE_ENERGY = "energy"; * @type {string} */ const RESOURCE_POWER = "power"; - /** * @constant * @type {string} @@ -609,6 +632,12 @@ const RESOURCE_ZYNTHIUM = "Z"; */ const RESOURCE_CATALYST = "X"; +/** + * @constant + * @type {string} + */ +const RESOURCE_OPS = "ops"; + /** * @constant * @type {string} @@ -1117,7 +1146,8 @@ const RESOURCES_ALL = [ RESOURCE_CATALYZED_ZYNTHIUM_ACID, RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE, RESOURCE_CATALYZED_GHODIUM_ACID, - RESOURCE_CATALYZED_GHODIUM_ALKALIDE + RESOURCE_CATALYZED_GHODIUM_ALKALIDE, + RESOURCE_OPS ]; /** @@ -1152,6 +1182,43 @@ const COLORS_ALL = [ COLOR_WHITE ]; +const REACTION_TIME = { + OH: 20, + ZK: 5, + UL: 5, + G: 5, + UH: 10, + UH2O: 5, + XUH2O: 60, + UO: 10, + UHO2: 5, + XUHO2: 60, + KH: 10, + KH2O: 5, + XKH2O: 60, + KO: 10, + KHO2: 5, + XKHO2: 60, + LH: 15, + LH2O: 10, + XLH2O: 65, + LO: 10, + LHO2: 5, + XLHO2: 60, + ZH: 20, + ZH2O: 40, + XZH2O: 160, + ZO: 10, + ZHO2: 5, + XZHO2: 60, + GH: 10, + GH2O: 15, + XGH2O: 80, + GO: 10, + GHO2: 30, + XGHO2: 150, +}; + /** * @constant * @type {object} @@ -1510,6 +1577,12 @@ const NUKE_DAMAGE = { */ const PORTAL_DECAY = 30000; +/** + * @constant + * @type {number} + */ +const TOMBSTONE_DECAY_PER_PART = 5; + /** * @constant * @type {string} @@ -1665,15 +1738,27 @@ const CONTROLLER_STRUCTURES = { */ const CONTROLLER_DOWNGRADE = { 1: 20000, - 2: 50000, - 3: 50000, - 4: 50000, - 5: 50000, - 6: 50000, - 7: 50000, - 8: 50000 + 2: 5000, + 3: 10000, + 4: 20000, + 5: 40000, + 6: 60000, + 7: 100000, + 8: 150000 }; +/** + * @constant + * @type {number} + */ +const CONTROLLER_DOWNGRADE_RESTORE = 100; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_DOWNGRADE_SAFEMODE_THRESHOLD = 5000; + /** * @constant * @type {number} @@ -2006,6 +2091,12 @@ const LOOK_NUKES = "nuke"; */ const LOOK_TERRAIN = "terrain"; +/** + * @constant + * @type {string} + */ +const LOOK_TOMBSTONES = "tombstone"; + /** * @constant * @type {string} @@ -2014,18 +2105,352 @@ const SYSTEM_USERNAME = 'Screeps'; /** * @constant + * @deprecated use SIGN_PLANNED_AREA instead. * @type {string} */ const SIGN_NOVICE_AREA = 'A new Novice Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; /** * @constant + * @deprecated use SIGN_PLANNED_AREA instead. * @type {string} */ const SIGN_RESPAWN_AREA = 'A new Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; +/** + * @constant + * @type {string} + */ +const SIGN_PLANNED_AREA = 'A new Novice or Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; + /** * @constant * @type {number} */ const TERMINAL_COOLDOWN = 10; + +/** + * @constant + * @type {number} + */ +const POWER_LEVEL_MULTIPLY = 1000; + +/** + * @constant + * @type {number} + */ +const POWER_LEVEL_POW = 2; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_SPAWN_COOLDOWN = 8*3600*1000; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_DELETE_COOLDOWN = 24*3600*1000; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_MAX_LEVEL = 25; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_LIFE_TIME = 5000; + +/** + * @constant + * @type {object} + */ +const POWER_CLASS = { + OPERATOR: 'operator' + }, + +/** + * @constant + * @type {number} + */ +const PWR_GENERATE_OPS = 1; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_SPAWN = 2; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_TOWER = 3; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_STORAGE = 4; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_LAB = 5; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_EXTENSION = 6; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_OBSERVER = 7; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_TERMINAL = 8; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_SPAWN = 9; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_TOWER = 10; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_SOURCE = 11; + +/** + * @constant + * @type {number} + */ +const PWR_SHIELD = 12; + +/** + * @constant + * @type {number} + */ +const PWR_REGEN_SOURCE = 13; + +/** + * @constant + * @type {number} + */ +const PWR_REGEN_MINERAL = 14; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_TERMINAL = 15; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_POWER = 16; + +/** + * @constant + * @type {number} + */ +const PWR_FORTIFY = 17; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_CONTROLLER = 18; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_FACTORY = 19; + +/** + * @constant + * @type {object} + */ +const POWER_INFO = { + [exports.PWR_GENERATE_OPS]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 50, + effect: [1, 2, 4, 6, 8] + }, + [exports.PWR_OPERATE_SPAWN]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 300, + duration: 1000, + range: 3, + ops: 100, + effect: [0.9, 0.7, 0.5, 0.35, 0.2] + }, + [exports.PWR_OPERATE_TOWER]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 10, + duration: 100, + range: 3, + ops: 10, + effect: [1.1, 1.2, 1.3, 1.4, 1.5] + }, + [exports.PWR_OPERATE_STORAGE]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 800, + duration: 1000, + range: 3, + ops: 100, + effect: [500000,1000000,2000000,4000000,7000000] + }, + [exports.PWR_OPERATE_LAB]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 50, + duration: 1000, + range: 3, + ops: 10, + effect: [2,4,6,8,10] + }, + [exports.PWR_OPERATE_EXTENSION]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 50, + range: 3, + ops: 2, + effect: [0.2, 0.4, 0.6, 0.8, 1.0] + }, + [exports.PWR_OPERATE_OBSERVER]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 400, + duration: [200,400,600,800,1000], + range: 3, + ops: 10, + }, + [exports.PWR_OPERATE_TERMINAL]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 500, + duration: 1000, + range: 3, + ops: 100, + effect: [0.9, 0.8, 0.7, 0.6, 0.5] + }, + [exports.PWR_DISRUPT_SPAWN]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 5, + range: 20, + ops: 10, + duration: [1,2,3,4,5] + }, + [exports.PWR_DISRUPT_TOWER]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 0, + duration: 5, + range: 3, + ops: 10, + effect: [0.9, 0.8, 0.7, 0.6, 0.5], + }, + [exports.PWR_DISRUPT_SOURCE]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 100, + range: 3, + ops: 100, + duration: [100, 200, 300, 400, 500] + }, + [exports.PWR_SHIELD]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + effect: [5000, 10000, 15000, 20000, 25000], + duration: 50, + cooldown: 20, + energy: 100, + }, + [exports.PWR_REGEN_SOURCE]: { + className: exports.POWER_CLASS.OPERATOR, + level: [10, 11, 12, 14, 22], + cooldown: 100, + duration: 300, + range: 3, + effect: [50,100,150,200,250], + period: 15 + }, + [exports.PWR_REGEN_MINERAL]: { + className: exports.POWER_CLASS.OPERATOR, + level: [10, 11, 12, 14, 22], + cooldown: 100, + duration: 100, + range: 3, + effect: [2,4,6,8,10], + period: 10 + }, + [exports.PWR_DISRUPT_TERMINAL]: { + className: exports.POWER_CLASS.OPERATOR, + level: [20, 21, 22, 23, 24], + cooldown: 8, + duration: 10, + range: 50, + ops: [50,40,30,20,10] + + }, + [exports.PWR_FORTIFY]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 5, + range: 3, + ops: 5, + duration: [1, 2, 3, 4, 5] + }, + [exports.PWR_OPERATE_POWER]: { + className: exports.POWER_CLASS.OPERATOR, + level: [10, 11, 12, 14, 22], + cooldown: 1000, + range: 3, + duration: 800, + ops: 200, + effect: [1, 2, 3, 4, 5] + }, + [exports.PWR_OPERATE_CONTROLLER]: { + className: exports.POWER_CLASS.OPERATOR, + level: [20, 21, 22, 23, 24], + cooldown: 1000, + range: 3, + duration: 800, + ops: 200, + effect: [10, 20, 30, 40, 50] + }, + [exports.PWR_OPERATE_FACTORY]: { + className: exports.POWER_CLASS.OPERATOR, + level: [0, 2, 7, 14, 22], + cooldown: 1000, + range: 3, + duration: 800, + ops: 100 + }, + }; diff --git a/Mineral.js b/Mineral.js index d1a1ff3..c4b51ba 100644 --- a/Mineral.js +++ b/Mineral.js @@ -25,9 +25,9 @@ Mineral.prototype = * * @see {@link http://support.screeps.com/hc/en-us/articles/207218579-Mineral#mineralType} * - * @type {number} + * @type {string} */ - mineralType: 0, + mineralType: "", /** * A unique object identificator. diff --git a/PathFinder.js b/PathFinder.js index 36e82ac..6d07504 100644 --- a/PathFinder.js +++ b/PathFinder.js @@ -30,10 +30,10 @@ PathFinder = * @param {number} [opts.swampCost] Cost for walking on swamp positions. The default is 5. * @param {boolean} [opts.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. * @param {number} [opts.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. - * @param {number} [opts.maxRooms] The maximum allowed rooms to search. The default (and maximum) is 16. + * @param {number} [opts.maxRooms] The maximum allowed rooms to search. The default is 16, maximum is 64. * @param {number} [opts.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. * - * @return {{path:Array,opts:number}} An object containing: path - An array of RoomPosition objects; ops - Total number of operations performed before this path was calculated. + * @return {{path:Array,opts:number,cost:number,incomplete:boolean}} An object containing: path - An array of RoomPosition objects; ops - Total number of operations performed before this path was calculated; cost - The total cost of the path as derived from plainCost, swampCost and any given CostMatrix instances; incomplete - If the pathfinder fails to find a complete path, this will be true. Note that path will still be populated with a partial path which represents the closest path it could find given the search parameters. */ search: function(origin, goal, opts) { }, @@ -41,7 +41,7 @@ PathFinder = * Specify whether to use this new experimental pathfinder in game objects methods. * This method should be invoked every tick. * @static - * + * @deprecated * @note It affects the following methods behavior: Room.findPath, RoomPosition.findPathTo, RoomPosition.findClosestByPath, Creep.moveTo. * * @see {@link http://support.screeps.com/hc/en-us/articles/207023879-PathFinder#use} diff --git a/PowerCreep.js b/PowerCreep.js new file mode 100644 index 0000000..dc22bb7 --- /dev/null +++ b/PowerCreep.js @@ -0,0 +1,468 @@ +/** + * + * @class + * @extends {RoomObject} + * + * @see {@link https://docs.screeps.com/power.html#Power-Creeps} + */ +PowerCreep = function() { }; + +PowerCreep.prototype = +{ + + + /** + * 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. + * You need one free Power Level in your account to perform this action. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.PowerCreep-create} + * + * @type {function} + * + * @param {string} The name of the new power creep. + * + * @param {string} The class of the new power creep, one of the POWER_CLASS constants. + * + * @return {number|OK|ERR_NAME_EXISTS|ERR_NOT_ENOUGH_RESOURCES} + */ + create: function(name, className) { }, + + /** + * An object with the PowerCreep's cargo contents. + * Each object key is one of the RESOURCE_* constants, values are resources amounts. + * Use _.sum(creep.carry) to get the total amount of contents. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.carry} + * + * @type {object} + */ + carry: {}, + + /** + * The total amount of resources the PowerCreep can carry. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.carryCapacity} + * + * @type {number} + */ + carryCapacity: 0, + + /** + * The power creep's class, one of the POWER_CLASS constants. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.className} + * + * @type {string} + */ + className: "", + + + /** + * A timestamp when this creep is marked to be permanently deleted from the account, or undefined otherwise. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.deleteTime} + * + * @type {number} + */ + deleteTime: 0, + + /** + * The current amount of hit points of the PowerCreep. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.hits} + * + * @type {number} + */ + hits: 0, + + /** + * The maximum amount of hit points of the PowerCreep. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.hitsMax} + * + * @type {number} + */ + hitsMax: 0, + + /** + * A unique object identificator. + * You can use Game.getObjectById method to retrieve an object instance by its id. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.id} + * + * @type {string} + */ + id: "", + + /** + * The PowerCreep's level. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.level} + * + * @type {number} + */ + level: 0, + + /** + * A shorthand to Memory.creeps[creep.name]. + * You can use it for quick access the creep’s specific memory data object. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.memory} + * + * @type {*} + */ + memory: {}, + + /** + * Whether it is your creep or foe. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.my} + * + * @type {boolean} + */ + my: true, + + /** + * 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. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.name} + * + * @type {string} + */ + name: "", + + /** + * The text message that the creep was saying at the last tick. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.saying} + * + * @type {string} + */ + saying: "", + + /** + * An object with the creep’s owner info + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.owner} + * + * @type {{username:string}} + */ + owner: + { + username: "" + }, + + /** + * Available powers, an object with power ID as a key, and the following properties: + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.powers} + * + * @type {object} + */ + powers: + { + level: "", + cooldown: "" + }, + + /** + * The name of the shard where the power creep is spawned, or undefined. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.shard} + * + * @type {string} + */ + shard: "", + + /** + * The timestamp when spawning or deleting this creep will become available. Undefined if the power creep is spawned in the world. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.spawnCooldownTime} + * + * @type {number} + */ + spawnCooldownTime: 0, + + /** + * TheThe remaining amount of game ticks after which the creep will die and become unspawned. Undefined if the creep is not spawned in the world. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.ticksToLive} + * + * @type {number} + */ + ticksToLive: 0, + + /** + * Cancel the order given during the current game tick. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.cancelOrder} + * + * @type {function} + * + * @param {string} methodName The name of a creep's method to be cancelled. + * + * @return {number|OK|ERR_NOT_FOUND} + */ + cancelOrder: function(methodName) { }, + + /** + * 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). + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.delete} + * + * @type {function} + * + * @param {boolean} Set this to true to cancel previously scheduled deletion. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY} + */ + delete: function([cancel]) { }, + + /** + * Drop this resource on the ground. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.drop} + * + * @type {function} + * + * @param {string} resourceType One of the RESOURCE_* constants. + * @param {number} [amount] The amount of resource units to be dropped. If omitted, all the available carried amount is used. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES} + */ + drop: function(resourceType, amount) { }, + + /** + * Enable powers usage in this room. The room controller should be at adjacent tile. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.enableRoom} + * + * @type {function} + * + * @param {StructureController} The room controller. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_INVALID_TARGET|ERR_NOT_IN_RANGE} + */ + enableRoom: function(controller) { }, + + /** + * Move the creep one square in the specified direction. + * Requires the MOVE body part. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.move} + * + * @type {function} + * + * @param {number} direction One of the following constants: TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_TIRED|ERR_NO_BODYPART} + */ + move: function(direction) { }, + + /** + * Move the creep using the specified predefined path. + * Requires the MOVE body part. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.moveByPath} + * + * @type {function} + * + * @param {Array|string} path A path value as returned from Room.findPath or RoomPosition.findPathTo methods. Both array form and serialized string form are accepted. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_FOUND|ERR_INVALID_ARGS|ERR_TIRED|ERR_NO_BODYPART} + */ + moveByPath: function(path) { }, + + /** + * Find the optimal path to the target within the same room and move to it. + * A shorthand to consequent calls of pos.findPathTo() and move() methods. + * If the target is in another room, then the corresponding exit will be used as a target. + * Requires the MOVE body part. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.moveTo} + * + * @type {function} + * + * @param {number} x X position of the target in the same room. + * @param {number} [y] Y position of the target in the same room. + * @param {object} [opts] An object containing additional options + * @param {number} [opts.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. + * @param {boolean} [opts.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. + * @param {boolean} [opts.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. + * @note opts also supports any method from the Room.findPath options. + * + * @alias moveTo(target, [opts]) + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_TIRED|ERR_NO_BODYPART|ERR_INVALID_TARGET|ERR_NO_PATH} + */ + moveTo: function(x, y, opts) { }, + + /** + * Toggle auto notification when the creep is under attack. + * The notification will be sent to your account email. + * Turned on by default. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.notifyWhenAttacked} + * + * @type {function} + * + * @param {boolean} enabled Whether to enable notification or disable. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_INVALID_ARGS} + */ + notifyWhenAttacked: function(enabled) { }, + + /** + * 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. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.pickup} + * + * @type {function} + * + * @param {Resource} target The target object to be picked up. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE} + */ + pickup: function(target) { }, + + /** + * Rename the power creep. It must not be spawned in the world. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.rename} + * + * @type {function} + * + * @param {string} The new name of the power creep. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_NAME_EXISTS|ERR_BUSY} + */ + rename: function(name) { }, + + /** + * Instantly restore time to live to the maximum using a Power Spawn or a Power Bank nearby. It has to be at adjacent tile. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.renew} + * + * @type {function} + * + * @param {StructurePowerBank|StructurePowerSpawn} The target structure. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_INVALID_TARGET|ERR_NOT_IN_RANGE} + */ + renew: function(target) { }, + + /** + * 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. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.say} + * + * @type {function} + * + * @param {string} message The message to be displayed. Maximum length is 10 characters. + * @param {boolean} [public] Set to true to allow other players to see this message. Default is false. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY} + */ + say: function(message, public) { }, + + /** + * Sign a controller with an arbitrary 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. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.spawn} + * + * @type {function} + * + * @param {StructurePowerSpawn} Your Power Spawn structure. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_INVALID_TARGET|ERR_TIRED|ERR_RCL_NOT_ENOUGH} + */ + spawn: function(powerSpawn) { }, + + /** + * Kill the creep immediately. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.suicide} + * + * @type {function} + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY} + */ + suicide: function() { }, + + /** + * Transfer resource from the creep to another object. + * The target has to be at adjacent square to the creep. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.transfer} + * + * @type {function} + * + * @param {Creep|Spawn|Structure} target The target object. + * @param {string} resourceType One of the RESOURCE_* constants. + * @param {number|undefined|null} [amount] The amount of resources to be transferred. If omitted, all the available carried amount is used. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE|ERR_INVALID_ARGS} + */ + transfer: function(target, resourceType, amount) { }, + + /** + * 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. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.upgrade} + * + * @type {function} + * + * @param {number} The power ability to upgrade, one of the PWR_* constants. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS} + */ + upgrade: function(power) { }, + + /** + * 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. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.usePower} + * + * @type {function} + * + * @param {number} The power ability to use, one of the PWR_* constants. + * @param {RoomObject} A target object in the room. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE|ERR_INVALID_ARGS|ERR_TIRED|ERR_NO_BODYPART} + */ + usePower: function(power, [target]) { }, + + /** + * 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. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.withdraw} + * + * @type {function} + * + * @param {Structure} target The target object. + * @param {string} resourceType One of the RESOURCE_* constants. + * @param {number|undefined|null} [amount] The amount of resources to be transferred. If omitted, all the available carried amount is used. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE|ERR_INVALID_ARGS} + */ + withdraw: function(target, resourceType, amount) { } +}; \ No newline at end of file diff --git a/Room.js b/Room.js index 72aea17..ffba87c 100644 --- a/Room.js +++ b/Room.js @@ -32,7 +32,7 @@ Room = { * * return {Array} A path array. */ - deserializePath: function(path) { } + deserializePath: function(path) { }, }; Room.prototype = @@ -216,6 +216,24 @@ Room.prototype = */ findPath: function(fromPos, toPos, opts) { }, + /** + * Returns an array of events happened on the previous tick in this room. + * + * @see {@link https://docs.screeps.com/api/#Room.getEventLog} + * + * @type {function} + * + * @param {raw} [raw] 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. + * + * @return An array of events. Each event represents some game action in the following format: + { + event: EVENT_ATTACK, + objectId: '54bff72ab32a10f73a57d017', + data: { ... } + } + */ + getEventLog: function(raw) { }, + /** * Creates a RoomPosition object at the specified location. * @@ -230,6 +248,17 @@ Room.prototype = */ getPositionAt: function(x, y) { }, + /** + * 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/#Room.getTerrain} + * + * @type {function} + * + * @return {Room.Terrain} Returns new Room.Terrain object. + */ + getTerrain: function() {}, + /** * Get the list of objects at the specified room position. * @@ -386,3 +415,52 @@ Room.prototype = */ lookForAtArea: function(type, top, left, bottom, right, asArray) { }, }; + +/** + * 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. + * + * @param {string} roomName The room name. + * + * @class + * @constructor + * + * @see {@link https://docs.screeps.com/api/#Room-Terrain} + */ +Room.Terrain = function(roomName) {}, + +Room.Terrain.prototype = { + /** + * 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). + * + * @see {@link https://docs.screeps.com/api/#Room.Terrain.get} + * + * @type {function} + * + * @param {number} x X position in the room. + * @param {number} y Y position in the room. + * + * @return {0|TERRAIN_MASK_WALL|TERRAIN_MASK_SWAMP} An integer value. 0 if Plain. + */ + get: function(x, y) {}, + + /** + * Get copy of underlying static terrain buffer. Current underlying representation is Uint8Array. + * + * @note WARNING: this method relies on underlying representation of terrain data. This is the fastest way to obtain terrain data of the whole room (2500 tiles), but users should keep in mind that it can be marked as deprecated anytime in the future, or return value type can be changed due to underlying data representation changing. + * + * @see {@link https://docs.screeps.com/api/#Room.Terrain.getRawBuffer} + * + * @type {function} + * + * @param {Array} [destinationArray] A typed array view in which terrain will be copied to. + * + * @return {Array|ERR_INVALID_ARGS} Copy of underlying room terrain representations as a new Uint8Array typed array of size 2500. + + Each element is an integer number, terrain type can be obtained by applying bitwise AND (&) operator with appropriate TERRAIN_MASK_* constant. Room tiles are stored row by row. + + If destinationArray is specified, function returns reference to this filled destinationArray if coping succeeded, or error code otherwise: + */ + getRawBuffer: function(destinationArray) {}, +}; \ No newline at end of file diff --git a/RoomObject.js b/RoomObject.js index ad0d76a..08cf757 100644 --- a/RoomObject.js +++ b/RoomObject.js @@ -9,6 +9,14 @@ RoomObject = function() { }; RoomObject.prototype = { + /** + * Applied effects, an array of objects with the following properties: + * + * @see {@link https://docs.screeps.com/api/#RoomObject.effects} + * + * @type {array} + */ + effects: null, /** * An object representing the position of this object in the room. * diff --git a/Structures/StructureController.js b/Structures/StructureController.js index 09a08c8..9756b45 100644 --- a/Structures/StructureController.js +++ b/Structures/StructureController.js @@ -51,6 +51,15 @@ StructureController.prototype = */ activateSafeMode: function() {}, + /** + * Whether using power is enabled in this room. Use PowerCreep.enableRoom to turn powers on. + * + * @see {@link https://docs.screeps.com/api/#StructureController.isPowerEnabled} + * + * @type {boolean} + */ + level: false, + /** * Current controller level, from 0 to 8. * diff --git a/Structures/StructureLab.js b/Structures/StructureLab.js index 25dde51..b2fffdc 100644 --- a/Structures/StructureLab.js +++ b/Structures/StructureLab.js @@ -79,6 +79,21 @@ StructureLab.prototype = */ boostCreep: function(creep, bodyPartsCount) { }, + /** + * 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. + * + * @see {@link https://docs.screeps.com/api/#StructureLab.unboostCreep} + * + * @type {function} + * + * @param {Creep} creep The target creep. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_NOT_FOUND|ERR_INVALID_TARGET|ERR_NOT_IN_RANGE|ERR_TIRED} + */ + unboostCreep: function(creep) { }, + + /** * Produce mineral compounds using reagents from two another labs. * The same input labs can be used by many output labs. diff --git a/Structures/StructureSpawn.js b/Structures/StructureSpawn.js index 21cb3c6..2325c31 100644 --- a/Structures/StructureSpawn.js +++ b/Structures/StructureSpawn.js @@ -99,7 +99,26 @@ StructureSpawn.prototype = * @return {string|number|ERR_NOT_OWNER|ERR_NAME_EXISTS|ERR_BUSY|ERR_NOT_ENOUGH_ENERGY|ERR_INVALID_ARGS|ERR_RCL_NOT_ENOUGH} */ createCreep: function(body, name, memory) { }, - + + /** + * Start the creep spawning process. The required energy amount can be withdrawn from all spawns and extensions in the room. + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn.spawnCreep} + * + * @type {function} + * + * @param {Array} body An array describing the new creep’s body. Should contain 1 to 50 elements. + * @param {string} name The name of a new creep. It must be a unique creep name, i.e. the Game.creeps object should not contain another creep with the same name (hash key). + * @param {Object} [opts] An object with additional options for the spawning process. + * @param {*} [opts.memory] Memory of the new creep. If provided, it will be immediately stored into Memory.creeps[name]. + * @param {Array} [opts.energyStructures] Array of spawns/extensions from which to draw energy for the spawning process. Structures will be used according to the array order. + * @param {boolean} [opts.dryRun] If dryRun is true, the operation will only check if it is possible to create a creep. + * @param {Array} [opts.directions] Set desired directions where the creep should move when spawned. + * + * @return {OK|number|ERR_NOT_OWNER|ERR_NAME_EXISTS|ERR_BUSY|ERR_NOT_ENOUGH_ENERGY|ERR_INVALID_ARGS|ERR_RCL_NOT_ENOUGH} + */ + spawnCreep: function(body, name, memory) { }, + /** * 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. @@ -148,3 +167,84 @@ StructureSpawn.prototype = */ transferEnergy: function(target, amount) { } }; + +/** + * Details of the creep being spawned currently that can be addressed by the StructureSpawn.spawning property. + * + * @class + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn-Spawning} + */ +StructureSpawn.Spawning = function () { }; + +StructureSpawn.Spawning.prototype = { + + /** + * An array with the spawn directions + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.directions} + * + * @type {Array} + */ + directions: [], + + /** + * The name of a new creep. + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.name} + * + * @type {string} + */ + name: "", + + /** + * Time in ticks needed in total to complete the spawning. + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.needTime} + * + * @type {number} + */ + needTime: 0, + + /** + * Remaining time to go. + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.remainingTime} + * + * @type {number} + */ + remainingTime: 0, + + /** + * A link to the spawn. + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.spawn} + * + * @type {StructureSpawn} + */ + spawn: {}, + + /** + * Cancel spawning immediately. Energy spent on spawning is not returned. + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.cancel} + * + * @type {function} + * + * @return {number|OK|ERR_NOT_OWNER} + */ + cancel: function() { }, + + /** + * Set desired directions where the creep should move when spawned. + * + * @see {@link http://docs.screeps.com/api/#StructureSpawn.Spawning.setDirections} + * + * @type {function} + * + * @param {Array} {directions} An array with the direction constants: TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT + * + * @return {number|OK|ERR_NOT_OWNER|ERR_INVALID_ARGS} + */ + setDirections: function(directions) { } +}; diff --git a/Tombstone.js b/Tombstone.js new file mode 100644 index 0000000..e663573 --- /dev/null +++ b/Tombstone.js @@ -0,0 +1,57 @@ +/** + * A remnant of dead creeps. This is a walkable object. + * + * @class + * @extends {RoomObject} + * + * @see {@link https://docs.screeps.com/api/#Tombstone} + */ +Tombstone = function() { }; + +Tombstone.prototype = +{ + /** + * An object containing the deceased creep. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.creep} + * + * @type {Creep} + */ + creep: { }, + + /** + * Time of death. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.deathTime} + * + * @type {number} + */ + deathTime: 0, + + /** + * A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.id} + * + * @type {string} + */ + id: "", + + /** + * An object with the tombstone contents. Each object key is one of the RESOURCE_* constants, values are resources amounts. RESOURCE_ENERGY is always defined and equals to 0 when empty, other resources are undefined when empty. You can use lodash.sum to get the total amount of contents. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.store} + * + * @type {object} + */ + store: { }, + + /** + * The amount of game ticks before this tombstone decays. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.ticksToDecay} + * + * @type {number} + */ + ticksToDecay: 0, +}; \ No newline at end of file From 5da6b4a0e877713ca796ecd1c52d7ec5897977e7 Mon Sep 17 00:00:00 2001 From: shibdib Date: Mon, 6 May 2019 05:17:00 -0400 Subject: [PATCH 47/63] remove github markup --- Global/Constants.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Global/Constants.js b/Global/Constants.js index ed953ab..40cfd59 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -411,7 +411,6 @@ const FIND_NUKES = 117; */ const FIND_TOMBSTONES = 118; -<<<<<<< HEAD /** * @constant * @type {number} @@ -430,10 +429,6 @@ const FIND_MY_POWER_CREEPS = 120; */ const FIND_HOSTILE_POWER_CREEPS = 121; -======= ->>>>>>> refs/remotes/Garethp/master -/** GAME MODE CONSTANTS **/ - /** * @constant * @type {string} From 62bbe2cf8fde7180e09e4d1fa0f143504eefbcd6 Mon Sep 17 00:00:00 2001 From: Bob Sardinia Date: Mon, 6 May 2019 05:19:11 -0400 Subject: [PATCH 48/63] Update StructureController.js --- Structures/StructureController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Structures/StructureController.js b/Structures/StructureController.js index 9756b45..eb0fe29 100644 --- a/Structures/StructureController.js +++ b/Structures/StructureController.js @@ -58,7 +58,7 @@ StructureController.prototype = * * @type {boolean} */ - level: false, + isPowerEnabled: false, /** * Current controller level, from 0 to 8. From 80b78c77077c22570c4242070b75e5d3789e25b9 Mon Sep 17 00:00:00 2001 From: Bob Sardinia Date: Mon, 6 May 2019 06:00:16 -0400 Subject: [PATCH 49/63] Update Constants.js --- Global/Constants.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/Global/Constants.js b/Global/Constants.js index 40cfd59..065b7ee 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -1270,23 +1270,7 @@ const CREEP_CORPSE_RATE = 0.2; * @constant * @type {string[]} */ -const OBSTACLE_OBJECT_TYPES = [ - 'spawn', - 'creep', - 'wall', - 'source', - 'constructedWall', - 'extension', - 'link', - 'storage', - 'tower', - 'observer', - 'powerSpawn', - 'powerBank', - 'lab', - 'terminal', - 'nuker' -]; +const OBSTACLE_OBJECT_TYPES = ["spawn", "creep", "powerCreep", "source", "mineral", "controller", "constructedWall", "extension", "link", "storage", "tower", "observer", "powerSpawn", "powerBank", "lab", "terminal","nuker"]; /** * @constant From 2455cdb31b2ca073db6fb4fd737ba7e49f7f6069 Mon Sep 17 00:00:00 2001 From: Justin Fletcher Date: Tue, 21 May 2019 11:44:19 +0930 Subject: [PATCH 50/63] Added missing functions from WebVisual. --- RoomVisual.js | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/RoomVisual.js b/RoomVisual.js index d710602..cd20bf3 100644 --- a/RoomVisual.js +++ b/RoomVisual.js @@ -48,6 +48,42 @@ RoomVisual.prototype = */ line: function(x1, y1, x2, y2, style) { }, + /** + * Draw a circle. + * + * @see {@link https://docs.screeps.com/api/#RoomVisual.circle} + * + * @type {function} + * + * @param {number} x The X coordinate of the center. + * @param {number} [y] The Y coordinate of the center. + * @param {Object} [style] Style object + * + * @alias circle(pos, [style]) + * + * @return {RoomVisual} + */ + circle: function(x, y, style) { }, + + /** + * Draw a rectangle. + * + * @see {@link https://docs.screeps.com/api/#RoomVisual.rect} + * + * @type {function} + * + * @param {number} x The X coordinate of the top-left corner. + * @param {number} y The Y coordinate 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 + * + * @alias rect(topLeftPos, width, height, [style]) + * + * @return {RoomVisual} + */ + rect(x, y, width, height, style) { }, + /** * Draw a line. * @@ -61,4 +97,42 @@ RoomVisual.prototype = * @return {RoomVisual} */ poly: function(points, style) { }, + + /** + * Draw a text label. You can use any valid Unicode characters, including emoji. + * + * @see {@link https://docs.screeps.com/api/#RoomVisual.text} + * + * @type {function} + * + * @param {string} text The text message. + * @param {number} x The X coordinate of the label baseline point. + * @param {number} y The Y coordinate of the label baseline point. + * @param {object} [style] Style object + * + * @alias text(text, pos, [style]) + * + * @return {RoomVisual} + */ + text: function(text, x, y, style) { }, + + /** + * Remove all visuals from the room. + * + * @see {@link https://docs.screeps.com/api/#RoomVisual.clear} + * + * @type {function} + * + * @return {RoomVisual} + */ + clear: function() { }, + + /** + * Get the stored size of all visuals added in the room in the current tick. It must not exceed 512,000 (500 KB). + * + * @see {@link https://docs.screeps.com/api/#RoomVisual.getSize} + * + * @return {number} The size of the visuals in bytes. + */ + getSize: function() { }, }; From f8a5b6c1bb7ebe6794dd54dde42eaf4beb7e65ec Mon Sep 17 00:00:00 2001 From: Justin Fletcher Date: Tue, 21 May 2019 12:36:33 +0930 Subject: [PATCH 51/63] Added missing functions from RawMemory. --- RawMemory.js | 108 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 104 insertions(+), 4 deletions(-) diff --git a/RawMemory.js b/RawMemory.js index e64b469..c9e89bc 100644 --- a/RawMemory.js +++ b/RawMemory.js @@ -5,10 +5,47 @@ * * @see {@link http://support.screeps.com/hc/en-us/articles/205619121-RawMemory} */ -RawMemory = function() { }; +RawMemory = { + /** + * An object with asynchronous memory segments available on this tick. + * Each object key is the segment ID with data in string values. + * Use setActiveSegments to fetch segments on the next tick. + * Segments data is saved automatically in the end of the tick. + * The maximum size per segment is 100 KB. + * + * @see {@link https://docs.screeps.com/api/#RawMemory.segments} + * + * @type {object} + */ + segments: {}, + + /** + * An object with a memory segment of another player available on this tick. + * Use setActiveForeignSegment to fetch segments on the next tick. + * + * @see {@link https://docs.screeps.com/api/#RawMemory.foreignSegment} + * + * @type {object} + */ + foreignSegment: {}, + + /** + * A string with a shared memory segment available on every world shard. Maximum string length is 100 KB. + * + * Warning: this segment is not safe for concurrent usage! + * All shards have shared access to the same instance of data. + * When the segment contents is changed by two shards simultaneously, + * you may lose some data, since the segment string value is written all at once atomically. + * You must implement your own system to determine when each shard is allowed to rewrite the inter-shard memory, e.g. based on mutual exclusions. + * + * @deprecated use InterShardMemory instead. + * + * @see {@link https://docs.screeps.com/api/#RawMemory.interShardSegment} + * + * @type {string} + */ + interShardSegment: "", -RawMemory.prototype = -{ /** * Get a raw string representation of the Memory object. * @@ -31,5 +68,68 @@ RawMemory.prototype = * * @return {void} */ - set: function(value) { } + set: function(value) { }, + + /** + * Request memory segments using the list of their IDs. + * Memory segments will become available on the next tick in segments object. + * + * @see {@link https://docs.screeps.com/api/#RawMemory.setActiveSegments} + * + * @type {function} + * + * @param {array} ids An array of segment IDs. + * Each ID should be a number from 0 to 99. + * Maximum 10 segments can be active at the same time. + * Subsequent calls of setActiveSegments override previous ones. + * + * @return {void} + */ + setActiveSegments: function(ids) { }, + + /** + * 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. + * + * @see {@link https://docs.screeps.com/api/#RawMemory.setActiveForeignSegment} + * + * @type {function} + * + * @param {string|null} username The name of another user. Pass null to clear the foreign segment. + * @param {number} [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. + * + * @return {void} + */ + setActiveForeignSegment: function(username, id) { }, + + /** + * Set the specified segment as your default public segment. + * It will be returned if no id parameter is passed to setActiveForeignSegment by another user. + * + * @see {@link https://docs.screeps.com/api/#RawMemory.setDefaultPublicSegment} + * + * @type {function} + * + * @param {number|null} id The ID of the memory segment from 0 to 99. Pass null to remove your default public segment. + * + * @return {void} + */ + setDefaultPublicSegment: function(id) { }, + + /** + * Set specified segments as public. + * Other users will be able to request access to them using setActiveForeignSegment. + * + * @see {@link https://docs.screeps.com/api/#RawMemory.setPublicSegments} + * + * @type {function} + * + * @param {array} ids An array of segment IDs. Each ID should be a number from 0 to 99. Subsequent calls of setPublicSegments override previous ones. + * + * @return {void} + */ + setPublicSegments: function(ids) { }, }; From 88fe010cb96f49a5bac96258553031a6cfc1ca3a Mon Sep 17 00:00:00 2001 From: Marcel Behrmann Date: Sun, 13 Oct 2019 16:48:54 +0200 Subject: [PATCH 52/63] Fix jsdocs related to objects in Game.js --- Game.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Game.js b/Game.js index 56c8a61..d2c56fa 100644 --- a/Game.js +++ b/Game.js @@ -10,7 +10,7 @@ Game = { * A hash containing all your construction sites with their id as hash keys. * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#constructionSites} - * @type {Array} + * @type {Object.} */ constructionSites: {}, @@ -45,7 +45,7 @@ Game = { /** * An object with limits for each shard with shard names as keys. You can use setShardLimits method to re-assign them. * - * @type {object} + * @type {Object.} */ shardLimits: {}, @@ -98,7 +98,7 @@ Game = { * A hash containing all your creeps with creep names as hash keys. * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#creeps} - * @type {object} + * @type {Object.} * @example * for(var i in Game.creeps) { * Game.creeps[i].moveTo(flag); @@ -111,7 +111,7 @@ Game = { * 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} + * @type {Object.} * @example * for(var i in Game.powerCreeps) { * Game.powerCreeps[i].moveTo(flag); @@ -123,7 +123,7 @@ Game = { * A hash containing all your flags with flag names as hash keys. * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#flags} - * @type {object} + * @type {Object.} * @example * creep.moveTo(Game.flags.Flag1); */ @@ -558,7 +558,7 @@ Game = { * An object with your global resources that are bound to the account, like subscription tokens. * Each object key is a resource constant, values are resources amounts. * - * @type {Array} + * @type {Object.} * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#resources} */ resources: {}, @@ -568,7 +568,7 @@ Game = { * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#rooms} * - * @type {Array} + * @type {Object.} */ rooms: {}, @@ -584,7 +584,7 @@ Game = { * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#spawns} * - * @type {Array} + * @type {Object.} */ spawns: {}, @@ -593,7 +593,7 @@ Game = { * * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#structures} * - * @type {Array} + * @type {Object.} */ structures: {}, From 9f026e5b11e5ec852fffefb97243d45c2ebc02c1 Mon Sep 17 00:00:00 2001 From: CrystallDEV Date: Thu, 17 Oct 2019 14:29:24 +0200 Subject: [PATCH 53/63] Screeps Update 4.x: FIND_DROPPED_ENERGY got removed --- Global/Constants.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Global/Constants.js b/Global/Constants.js index 065b7ee..bfcfcc3 100644 --- a/Global/Constants.js +++ b/Global/Constants.js @@ -327,12 +327,6 @@ const FIND_SOURCES_ACTIVE = 104; */ const FIND_SOURCES = 105; -/** - * @constant - * @type {number} - */ -const FIND_DROPPED_ENERGY = 106; - /** * @constant * @type {number} @@ -2151,9 +2145,7 @@ const POWER_CREEP_LIFE_TIME = 5000; * @constant * @type {object} */ -const POWER_CLASS = { - OPERATOR: 'operator' - }, +const POWER_CLASS = { OPERATOR: 'operator' }; /** * @constant From ed0552128aaa57fc4de3af30f718a3beb74600af Mon Sep 17 00:00:00 2001 From: CrystallDEV Date: Thu, 17 Oct 2019 14:32:48 +0200 Subject: [PATCH 54/63] Screeps Update 4.x: Structure*.transfer got removed, was replaced long ago by creep.withdraw --- Structures/StructureContainer.js | 17 ----------------- Structures/StructureLab.js | 18 ------------------ Structures/StructureStorage.js | 18 ------------------ Structures/StructureTerminal.js | 18 ------------------ 4 files changed, 71 deletions(-) diff --git a/Structures/StructureContainer.js b/Structures/StructureContainer.js index 85aee1b..2db5ff0 100644 --- a/Structures/StructureContainer.js +++ b/Structures/StructureContainer.js @@ -34,21 +34,4 @@ StructureContainer.prototype = */ storeCapacity: 0, - /** - * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. - * - * Transfer resource from this structure to a creep. - * The target has to be at adjacent square. - * - * @see {@link http://support.screeps.com/hc/en-us/articles/208435885-StructureContainer#transfer} - * - * @type {function} - * - * @param {Creep} target The target object. - * @param {string} resourceType One of the RESOURCE_* constants. - * @param {number|undefined|null} [amount] The amount of resources to be transferred. If omitted, all the available amount is used. - * - * @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE|ERR_INVALID_ARGS} - */ - transfer: function(target, resourceType, amount) { } }; diff --git a/Structures/StructureLab.js b/Structures/StructureLab.js index b2fffdc..3133b88 100644 --- a/Structures/StructureLab.js +++ b/Structures/StructureLab.js @@ -109,22 +109,4 @@ StructureLab.prototype = */ runReaction: function(lab1, lab2) { }, - /** - * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. - * - * Transfer resource from this structure to a creep. - * The target has to be at adjacent square. - * You can transfer resources to your creeps from hostile structures as well. - * - * @see {@link http://support.screeps.com/hc/en-us/articles/208436195-StructureLab#transfer} - * - * @type {function} - * - * @param {Creep} target The target object. - * @param {string} resourceType One of the RESOURCE_* constants. - * @param {number|undefined|null} [amount] The amount of resources to be transferred. If omitted, all the available amount is used. - * - * @return {number|OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE|ERR_INVALID_ARGS} - */ - transfer: function(target, resourceType, amount) { } }; diff --git a/Structures/StructureStorage.js b/Structures/StructureStorage.js index dc9eb7e..410fdb7 100644 --- a/Structures/StructureStorage.js +++ b/Structures/StructureStorage.js @@ -31,22 +31,4 @@ StructureStorage.prototype = */ storeCapacity: 0, - /** - * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. - * - * Transfer resource from this storage to a creep. - * The target has to be at adjacent square. - * You can transfer resources to your creeps from hostile structures as well. - * - * @see {@link http://support.screeps.com/hc/en-us/articles/208436805-StructureStorage#transfer} - * - * @type {function} - * - * @param {Creep} target The target object. - * @param {string} resourceType One of the RESOURCE_* constants. - * @param {number|undefined|null} [amount] The amount of resources to be transferred. If omitted, all the available amount is used. - * - * @return {number|OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE|ERR_INVALID_ARGS} - */ - transfer: function(target, resourceType, amount) { } }; diff --git a/Structures/StructureTerminal.js b/Structures/StructureTerminal.js index e8f1c7f..4da85a2 100644 --- a/Structures/StructureTerminal.js +++ b/Structures/StructureTerminal.js @@ -61,22 +61,4 @@ StructureTerminal.prototype = */ send: function(resourceType, amount, destination, description) { }, - /** - * @deprecated Since version 2016-07-11, replaced by `Creep.withdraw()`. - * - * Transfer resource from this terminal to a creep. - * The target has to be at adjacent square. - * You can transfer resources to your creeps from hostile structures as well. - * - * @see {@link http://support.screeps.com/hc/en-us/articles/207713399-StructureTerminal#transfer} - * - * @type {function} - * - * @param {Creep} target The target object. - * @param {string} resourceType One of the RESOURCE_* constants. - * @param {number|undefined|null} [amount] The amount of resources to be transferred. If omitted, all the available amount is used. - * - * @return {number|OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE|ERR_INVALID_ARGS} - */ - transfer: function(target, resourceType, amount) { } }; From df15050eaa80149a2e686ca1445ed52344e76139 Mon Sep 17 00:00:00 2001 From: CrystallDEV Date: Thu, 17 Oct 2019 14:44:17 +0200 Subject: [PATCH 55/63] Screeps Update 4.x.x: Updated TODO list --- TODO.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 14fecf9..72301f2 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,62 @@ ## TODO * Continue updating Documentation * Progress so far: Completed Game.js - * Find a way to auto-generate constants \ No newline at end of file + * Find a way to auto-generate constants + + +## Screeps 4.x.x +Screeps got updated on 10/14/2019 to 4.x.x +(see https://screeps.com/forum/topic/2814/factories-new-resources-npc-strongholds). + +The following could cause some problems / need to be updated in the autocomplete + +### API Changes +* POSSIBLY BREAKING CHANGE: Implemented new global Store prototype. All structures and creeps now use this prototype as +their store property. Old style properties are now considered deprecated. See documentation for more details, and also +this previous discussion. + + If you have any troubles because of this change, it most likely falls into one of these categories: + + You're checking for structure.store presence to distinguish storages and containers from spawns and extensions. Use + structure.structureType check instead, or structure.store.getCapacity(RESOURCE_ENERGY) !== null. + + You're comparing .store[resource] === undefined. Now all absent resources are equal to 0. + + You're trying to redefine store property, which is now non-configurable. + +* POSSIBLY BREAKING CHANGE: Removed FIND_DROPPED_ENERGY constant, which was deprecated long ago. Use +FIND_DROPPED_RESOURCES instead. + +* POSSIBLY BREAKING CHANGE: Removed all Structure*.transfer methods which were deprecated long ago. Use Creep.withdraw +instead. + +* New prototypes: StructureFactory, StructureInvaderCore, Deposit, Ruin. + +* A lot of new constants. + +* PWR_OPERATE_FACTORY power is now operational. + +* RoomObject.effects elements now have effect property instead of power. Property power remains for backward +compatibility, but is not documented and will be removed in the future. + +* Added new method Game.market.getHistory, which contains historical price data for all resources. + +* Increased per-player market orders limit from 50 to 300. + +* Added expiration period to market orders. An order expires in 30 days after its creation, and the remaining market fee +is returned. Extending the order doesn't update its expiration time. + +* Game.market.createOrder now accepts parameters in an object notation in order to minimize mistakes caused by wrong +order of parameters: + + ``` + Game.market.createOrder({ + type: ORDER_BUY, + resourceType: RESOURCE_ENERGY, + price: 0.01, + totalAmount: 100000, + roomName: 'W1N1' + }); + ``` + +* Removed minimal limit for StructureTerminal.send. From c0d3a75b084b475d9c1417cb5331d74c00b75755 Mon Sep 17 00:00:00 2001 From: CrystallDEV Date: Thu, 17 Oct 2019 15:04:14 +0200 Subject: [PATCH 56/63] Screeps Update 4.x.x: Added new Structure: StructureFactory --- Structures/StructureFactory.js | 63 ++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Structures/StructureFactory.js diff --git a/Structures/StructureFactory.js b/Structures/StructureFactory.js new file mode 100644 index 0000000..bf86d0d --- /dev/null +++ b/Structures/StructureFactory.js @@ -0,0 +1,63 @@ +/** + * Produces trade commodities from base minerals and other commodities. + * + * @class + * @extends {OwnedStructure} + * + * @see {@link https://docs.screeps.com/api/#StructureFactory} + */ +StructureFactory = function () { +}; + +StructureFactory.prototype = { + /** + * The amount of game ticks the factory has to wait until the next production is possible. + * + * @see {@link https://docs.screeps.com/api/#StructureFactory.cooldown} + * + * @return number + */ + cooldown: 0, + + /** + * 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. + * + * @see {@link https://docs.screeps.com/api/#StructureFactory.level} + * + * @return {number} + */ + level: 0, + + /** + * A Store object that contains cargo of this structure. + * + * @see {@link https://docs.screeps.com/api/#StructureFactory.store} + * + * @return {Object} + */ + store: {}, + + /** + * @deprecated An alias for .store.getCapacity(). + * + * @see {@link https://docs.screeps.com/api/#StructureFactory.storeCapacity} + * + * @return {number} + */ + storeCapacity: 0, + + /** + * Produces the specified commodity. All ingredients should be available in the factory store. + * + * @see {@link https://docs.screeps.com/api/#StructureFactory.produce} + * + * @type {function} + * + * @param {string} resourceType One of the Resource_* constants + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_FULL|ERR_INVALID_ARGS|ERR_TIRED|ERR_RCL_NOT_ENOUGH} + */ + produce: function (resourceType) { + } +}; From bf4c65c2097244ef8b8f1aa3a25f35dec8a774db Mon Sep 17 00:00:00 2001 From: CrystallDEV Date: Thu, 17 Oct 2019 15:10:26 +0200 Subject: [PATCH 57/63] Screeps Update 4.x.x: Added new Structure: StructureInvaderCore --- Structures/StructureInvaderCore.js | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Structures/StructureInvaderCore.js diff --git a/Structures/StructureInvaderCore.js b/Structures/StructureInvaderCore.js new file mode 100644 index 0000000..22e8fc3 --- /dev/null +++ b/Structures/StructureInvaderCore.js @@ -0,0 +1,35 @@ +/** + * This NPC structure is a control center of NPC Strongholds, and also rules all invaders in the sector. It spawns NPC + * defenders of the stronghold, refill towers, repairs structures. While it's alive, it will spawn invaders in all rooms + * in the same sector. It also contains some valuable resources inside, which you can loot from its ruin if you destroy + * the structure. + * + * @class + * @extends {OwnedStructure} + * + * @see {@link https://docs.screeps.com/api/#StructureInvaderCore} + */ +StructureInvaderCore = function () { +}; + +StructureInvaderCore.prototype = { + + /** + * The level of the stronghold. The amount and quality of the loot depends on the level + * + * @see {@link https://docs.screeps.com/api/#StructureInvaderCore.level} + * + * @return {number} + */ + level: 0, + + /** + * Shows the timer for a not yet deployed stronghold, undefined otherwise + * + * @see {@link https://docs.screeps.com/api/#StructureInvaderCore.ticksToDeploy} + * + * @return {number|undefined} + */ + ticksToDeploy: 0 + +}; \ No newline at end of file From f3a8833b0306567ad367c553bb7b668ac7dd03b7 Mon Sep 17 00:00:00 2001 From: CrystallDEV Date: Thu, 17 Oct 2019 15:18:54 +0200 Subject: [PATCH 58/63] Screeps Update 4.x.x: Added new Prototype: Deposit, Updated TODO --- Deposit.js | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ TODO.md | 8 -------- 2 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 Deposit.js diff --git a/Deposit.js b/Deposit.js new file mode 100644 index 0000000..41892fd --- /dev/null +++ b/Deposit.js @@ -0,0 +1,51 @@ +/** + * A rare resource deposit needed for producing commodities. Can be harvested by creeps with a WORK body part. Each + * harvest operation triggers a cooldown period, which becomes longer and longer over time. + * + * @class + * @extends {RoomObject} + * + * @see {@link https://docs.screeps.com/api/#Deposit.depositType} + */ +Deposit = function () { +}; + +Deposit.prototype = { + + /** + * The amount of game ticks until the next harvest action is possible. + * + * @see {@link https://docs.screeps.com/api/#Deposit.cooldown} + * + * @return {number} + */ + cooldown: 0, + + /** + * The deposit type + * @see {@link https://docs.screeps.com/api/#Deposit.depositType} + * + * @return {string|RESOURCE_MIST|RESOURCE_BIOMASS|RESOURCE_METAL|RESOURCE_SILICON} + */ + depositType: "", + + /** + * The cooldown of the last harvest operation on this deposit. + * + * @see {@link https://docs.screeps.com/api/#Deposit.lastCooldown} + * + * @return {number} + */ + lastCooldown: 0, + + /** + * The amount of game ticks when this deposit will disappear. + * + * @see {@link https://docs.screeps.com/api/#Deposit.ticksToDecay} + * + * @return {number} + */ + ticksToDecay: 0, + + +}; diff --git a/TODO.md b/TODO.md index 72301f2..178267e 100644 --- a/TODO.md +++ b/TODO.md @@ -24,14 +24,6 @@ this previous discussion. You're trying to redefine store property, which is now non-configurable. -* POSSIBLY BREAKING CHANGE: Removed FIND_DROPPED_ENERGY constant, which was deprecated long ago. Use -FIND_DROPPED_RESOURCES instead. - -* POSSIBLY BREAKING CHANGE: Removed all Structure*.transfer methods which were deprecated long ago. Use Creep.withdraw -instead. - -* New prototypes: StructureFactory, StructureInvaderCore, Deposit, Ruin. - * A lot of new constants. * PWR_OPERATE_FACTORY power is now operational. From 621089142c82b6e371f46e829a26de150cfa71fb Mon Sep 17 00:00:00 2001 From: CrystallDEV Date: Thu, 17 Oct 2019 15:26:14 +0200 Subject: [PATCH 59/63] Screeps Update 4.x.x: Added new Prototype: Ruin --- Deposit.js | 2 +- Ruin.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 Ruin.js diff --git a/Deposit.js b/Deposit.js index 41892fd..9df59a7 100644 --- a/Deposit.js +++ b/Deposit.js @@ -5,7 +5,7 @@ * @class * @extends {RoomObject} * - * @see {@link https://docs.screeps.com/api/#Deposit.depositType} + * @see {@link https://docs.screeps.com/api/#Deposit} */ Deposit = function () { }; diff --git a/Ruin.js b/Ruin.js new file mode 100644 index 0000000..bb32f11 --- /dev/null +++ b/Ruin.js @@ -0,0 +1,58 @@ +/** + * A destroyed structure. This is a walkable object. + * + * @class + * @extends {RoomObject} + * + * @see {@link https://docs.screeps.com/api/#Ruin} + */ +Ruin = function () { +}; + +Ruin.prototype = { + + /** + * The time when the structure has been destroyed. + * + * @see {@link https://docs.screeps.com/api/#Ruin.destroyTime} + * + * @return {number} + */ + destroyTime: 0, + + /** + * A unique object identificator. You can use {@link Game.getObjectById()} method to retrieve an object instance by its id. + * + * @see {@link https://docs.screeps.com/api/#Ruin.id} + * + * @return {string} + */ + id: "", + + /** + * A Store object that contains resources of this structure. + * + * @see {@link https://docs.screeps.com/api/#Ruin.store} + * + * @return {Object} + */ + store: {}, + + /** + * An object containing basic data of the destroyed structure. + * + * @see {@link https://docs.screeps.com/api/#Ruin.structure} + * + * @return {Structure|OwnedStructure} + */ + structure: {}, + + /** + * The amount of game ticks before this ruin decays. + * + * @see {@link https://docs.screeps.com/api/#Ruin.ticksToDecay} + * + * @return {number} + */ + ticksToDecay: 0 +}; From 5039afee2644a43f3eda9e0ca281df12c3fc01ac Mon Sep 17 00:00:00 2001 From: CrystallDEV Date: Sat, 19 Oct 2019 23:42:17 +0200 Subject: [PATCH 60/63] Screeps Update 4.x.x: Updated Game.market with missing function and new parameters, updated TODO list --- Game.js | 141 ++++++++++++++++++++++++++++++++++---------------------- TODO.md | 27 ----------- 2 files changed, 86 insertions(+), 82 deletions(-) diff --git a/Game.js b/Game.js index d2c56fa..fa91e5e 100644 --- a/Game.js +++ b/Game.js @@ -69,20 +69,23 @@ Game = { "externally_allocated_size": 38430000 } */ - getHeapStatistics: function() {}, + getHeapStatistics: function () { + }, /** * Get amount of CPU time used from the beginning of the current game tick. Always returns 0 in the Simulation mode. * * @return {number} Returns the currently used CPU time as a float number */ - getUsed: function () {}, + 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. */ - halt: function() {}, + 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. @@ -90,7 +93,8 @@ Game = { * * @return {OK|ERR_BUSY|ERR_INVALID_ARGS} */ - setShardLimits: function(limits) {}, + setShardLimits: function (limits) { + }, }, @@ -200,7 +204,7 @@ Game = { * @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 @@ -212,7 +216,8 @@ Game = { * @example * var exits = Game.map.describeExits('W8N3'); */ - describeExits: function (roomName) {}, + describeExits: function (roomName) { + }, /** * Find the exit direction from the given room en route to another room. @@ -226,7 +231,8 @@ Game = { * * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#findExit} */ - findExit: function (fromRoom, toRoom, opts) {}, + findExit: function (fromRoom, toRoom, opts) { + }, /** * Find route from the given room to another room. @@ -241,12 +247,13 @@ Game = { * @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' } - ] + [ + { exit: FIND_EXIT_RIGHT, room: 'arena21' }, + { exit: FIND_EXIT_BOTTOM, room: 'arena22' } + ] */ - findRoute: function (fromRoom, toRoom, opts) {}, + findRoute: function (fromRoom, toRoom, opts) { + }, /** * Get the linear distance (in rooms) between two rooms. @@ -262,7 +269,8 @@ Game = { * * @return {number} A number of rooms between the given two rooms. */ - getRoomLinearDistance: function (roomName1, roomName2, continuous) {}, + 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. @@ -275,7 +283,8 @@ Game = { * * @return {Room.Terrain} Returns new Room.Terrain object. */ - getRoomTerrain: function(roomName) {}, + getRoomTerrain: function (roomName) { + }, /** * Get terrain type at the specified room position. @@ -296,7 +305,8 @@ Game = { * * @return {"plain"|"swamp"|"wall"} */ - getTerrainAt: function (x, y, roomName) {}, + getTerrainAt: function (x, y, roomName) { + }, /** * Check if the room with the given name is available to move into @@ -309,20 +319,21 @@ Game = { * * @return {boolean} */ - isRoomAvailable: function (roomName) {} + isRoomAvailable: function (roomName) { + } }, /** * A global object representing the in-game market. * - * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#market} - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market} - * @see {@link http://docs.screeps.com/market.html} + * @see {@link https://docs.screeps.com/api/#Game.market} */ market: { /** * Your current credits balance. * + * @see {@link https://docs.screeps.com/api/#Game.market.credits} + * * @type {number} */ credits: 0, @@ -345,7 +356,7 @@ Game = { price : 2.95 } }] - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#incomingTransactions} + * @see {@link https://docs.screeps.com/api/#Game.market.incomingTransactions} * * @type {Array} */ @@ -369,7 +380,7 @@ Game = { price : 2.95 } }] - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#outgoingTransactions} + * @see {@link https://docs.screeps.com/api/#Game.market.outgoingTransactions} * * @type {Array} */ @@ -414,7 +425,7 @@ Game = { price : 50000 } } - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#orders} + * @see {@link https://docs.screeps.com/api/#Game.market.orders} * * @type {Array} */ @@ -424,7 +435,7 @@ Game = { * 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) ) * - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#calcTransactionCost} + * @see {@link https://docs.screeps.com/api/#Game.market.calcTransactionCost} * * @type {function} * @@ -438,12 +449,9 @@ Game = { }, /** - * This method is still under development. - * Cancel a previously created order. - * If a buy order provided, then the reserved credits amount will be refunded in full. - * The 5% fee is not returned. + * Cancel a previously created order. The 5% fee is not returned * - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#cancelOrder} + * @see {@link https://docs.screeps.com/api/#Game.market.cancelOrder} * * @type {function} * @@ -469,37 +477,41 @@ Game = { * 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 50 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. + * 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 http://support.screeps.com/hc/en-us/articles/207928635-Market#createBuyOrder} + * @see {@link https://docs.screeps.com/api/#Game.market.createOrder} * * @type {function} - * - * @param {string|ORDER_SELL|ORDER_BUY} type The order type, either ORDER_SELL or ORDER_BUY. - * @param {string} resourceType Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN. - * @param {number} price The price for one resource unit in credits. Can be a decimal number. - * @param {number} totalAmount The amount of resources to be traded in total. - * @param {string} [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_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS} - */ - createOrder: function (type, resourceType, price, totalAmount, roomName) { + *@param {Object} params An Object with the following parameters: + * {string|ORDER_SELL|ORDER_BUY} type The order type, either ORDER_SELL or ORDER_BUY. + * {string} resourceType Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN. + * {number} price The price for one resource unit in credits. Can be a decimal number. + * {number} totalAmount The amount of resources to be traded in total. + * (optional){string} [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. + * 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 http://support.screeps.com/hc/en-us/articles/207928635-Market#deal} + * @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 equals to SUBSCRIPTION_TOKEN. + * @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 equals to SUBSCRIPTION_TOKEN. * * @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS} */ @@ -507,11 +519,10 @@ Game = { }, /** - * This method is still under development. - * Add more capacity to an existing order. It will affect remainingAmount and totalAmount properties. You will - * be charged price*addAmount*0.05 credits. + * 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 http://support.screeps.com/hc/en-us/articles/207928635-Market#extendOrder} + * @see {@link https://docs.screeps.com/api/#Game.market.extendOrder} * * @type {function} * @@ -524,14 +535,13 @@ Game = { }, /** - * This method is still under development. * Get other players' orders currently active on the market. * * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#getAllOrders} * * @type {function} * - * @param {object|function} [filter] An object or function that will filter the resulting list using the lodash.filter method. + * @param {object|function} [filter] (optional) An object or function that will filter the resulting list using the lodash.filter method. * * @return {Array} An array of Orders */ @@ -539,10 +549,31 @@ Game = { }, /** - * This method is still under development. + * 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} with the following format: + * [{ + * "resourceType": "L", + * "date": "2019-06-24", + * "transactions": 4, + * "volume": 400, + * "avgPrice": 3.63, + * "stddevPrice": 0.27 + * }] + */ + getHistory: function (resourceType) { + }, + + /** * Retrieve info for specific market order. * - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#getOrderById} + * @see {@link https://docs.screeps.com/api/#Game.market.getOrderById} * * @type {function} * diff --git a/TODO.md b/TODO.md index 178267e..46ce143 100644 --- a/TODO.md +++ b/TODO.md @@ -11,23 +11,9 @@ Screeps got updated on 10/14/2019 to 4.x.x The following could cause some problems / need to be updated in the autocomplete ### API Changes -* POSSIBLY BREAKING CHANGE: Implemented new global Store prototype. All structures and creeps now use this prototype as -their store property. Old style properties are now considered deprecated. See documentation for more details, and also -this previous discussion. - - If you have any troubles because of this change, it most likely falls into one of these categories: - - You're checking for structure.store presence to distinguish storages and containers from spawns and extensions. Use - structure.structureType check instead, or structure.store.getCapacity(RESOURCE_ENERGY) !== null. - - You're comparing .store[resource] === undefined. Now all absent resources are equal to 0. - - You're trying to redefine store property, which is now non-configurable. * A lot of new constants. -* PWR_OPERATE_FACTORY power is now operational. - * RoomObject.effects elements now have effect property instead of power. Property power remains for backward compatibility, but is not documented and will be removed in the future. @@ -37,18 +23,5 @@ compatibility, but is not documented and will be removed in the future. * Added expiration period to market orders. An order expires in 30 days after its creation, and the remaining market fee is returned. Extending the order doesn't update its expiration time. - -* Game.market.createOrder now accepts parameters in an object notation in order to minimize mistakes caused by wrong -order of parameters: - - ``` - Game.market.createOrder({ - type: ORDER_BUY, - resourceType: RESOURCE_ENERGY, - price: 0.01, - totalAmount: 100000, - roomName: 'W1N1' - }); - ``` * Removed minimal limit for StructureTerminal.send. From a6afd17dc2a0a5b5b49ca4820c7d1a099e1dbbe1 Mon Sep 17 00:00:00 2001 From: CrystallDEV Date: Sat, 19 Oct 2019 23:49:00 +0200 Subject: [PATCH 61/63] Screeps Update 4.x.x: Removed minimum amount for StructureTerminal::send --- Structures/StructureTerminal.js | 2 +- TODO.md | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/Structures/StructureTerminal.js b/Structures/StructureTerminal.js index 4da85a2..068a5a3 100644 --- a/Structures/StructureTerminal.js +++ b/Structures/StructureTerminal.js @@ -53,7 +53,7 @@ StructureTerminal.prototype = * @type {function} * * @param {string} resourceType One of the RESOURCE_* constants. - * @param {number} amount The amount of resources to be sent. The minimum amount is 100. + * @param {number} amount The amount of resources to be sent. * @param {string|undefined|null} [destination] The name of the target room. You don't have to gain visibility in this room. * @param {string|undefined|null} [description] The description of the transaction. It is visible to the recipient. The maximum length is 100 characters. * diff --git a/TODO.md b/TODO.md index 46ce143..0ca8d2d 100644 --- a/TODO.md +++ b/TODO.md @@ -2,26 +2,8 @@ * Continue updating Documentation * Progress so far: Completed Game.js * Find a way to auto-generate constants - - -## Screeps 4.x.x -Screeps got updated on 10/14/2019 to 4.x.x -(see https://screeps.com/forum/topic/2814/factories-new-resources-npc-strongholds). - -The following could cause some problems / need to be updated in the autocomplete ### API Changes * A lot of new constants. -* RoomObject.effects elements now have effect property instead of power. Property power remains for backward -compatibility, but is not documented and will be removed in the future. - -* Added new method Game.market.getHistory, which contains historical price data for all resources. - -* Increased per-player market orders limit from 50 to 300. - -* Added expiration period to market orders. An order expires in 30 days after its creation, and the remaining market fee -is returned. Extending the order doesn't update its expiration time. - -* Removed minimal limit for StructureTerminal.send. From 0674d018ab5ea9841b81ebb2f06c3d5172014ffc Mon Sep 17 00:00:00 2001 From: CrystallDEV Date: Sun, 20 Oct 2019 00:23:13 +0200 Subject: [PATCH 62/63] Structured project properly and removed IDE dependant cfg --- .gitignore | 3 +-- Config/SublimeCodeIntel.json | 14 -------------- ConstructionSite.js => src/ConstructionSite.js | 0 Creep.js => src/Creep.js | 0 Deposit.js => src/Deposit.js | 0 Flag.js => src/Flag.js | 0 Game.js => src/Game.js | 0 Memory.js => src/Memory.js | 0 Mineral.js => src/Mineral.js | 0 Nuke.js => src/Nuke.js | 0 Order.js => src/Order.js | 0 OwnedStructure.js => src/OwnedStructure.js | 0 PathFinder.js => src/PathFinder.js | 0 PowerCreep.js => src/PowerCreep.js | 0 RawMemory.js => src/RawMemory.js | 0 Resource.js => src/Resource.js | 0 Room.js => src/Room.js | 0 RoomObject.js => src/RoomObject.js | 0 RoomPosition.js => src/RoomPosition.js | 0 RoomVisual.js => src/RoomVisual.js | 0 Ruin.js => src/Ruin.js | 0 Source.js => src/Source.js | 0 Structure.js => src/Structure.js | 0 .../Structures}/StructureContainer.js | 0 .../Structures}/StructureController.js | 0 .../Structures}/StructureExtension.js | 0 .../Structures}/StructureExtractor.js | 0 {Structures => src/Structures}/StructureFactory.js | 0 .../Structures}/StructureInvaderCore.js | 0 .../Structures}/StructureKeeperLair.js | 0 {Structures => src/Structures}/StructureLab.js | 0 {Structures => src/Structures}/StructureLink.js | 0 {Structures => src/Structures}/StructureNuker.js | 0 .../Structures}/StructureObserver.js | 0 {Structures => src/Structures}/StructurePortal.js | 0 .../Structures}/StructurePowerBank.js | 0 .../Structures}/StructurePowerSpawn.js | 0 {Structures => src/Structures}/StructureRampart.js | 0 {Structures => src/Structures}/StructureRoad.js | 0 {Structures => src/Structures}/StructureSpawn.js | 0 {Structures => src/Structures}/StructureStorage.js | 0 .../Structures}/StructureTerminal.js | 0 {Structures => src/Structures}/StructureTower.js | 0 {Structures => src/Structures}/StructureWall.js | 0 Tombstone.js => src/Tombstone.js | 0 45 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 Config/SublimeCodeIntel.json rename ConstructionSite.js => src/ConstructionSite.js (100%) rename Creep.js => src/Creep.js (100%) rename Deposit.js => src/Deposit.js (100%) rename Flag.js => src/Flag.js (100%) rename Game.js => src/Game.js (100%) rename Memory.js => src/Memory.js (100%) rename Mineral.js => src/Mineral.js (100%) rename Nuke.js => src/Nuke.js (100%) rename Order.js => src/Order.js (100%) rename OwnedStructure.js => src/OwnedStructure.js (100%) rename PathFinder.js => src/PathFinder.js (100%) rename PowerCreep.js => src/PowerCreep.js (100%) rename RawMemory.js => src/RawMemory.js (100%) rename Resource.js => src/Resource.js (100%) rename Room.js => src/Room.js (100%) rename RoomObject.js => src/RoomObject.js (100%) rename RoomPosition.js => src/RoomPosition.js (100%) rename RoomVisual.js => src/RoomVisual.js (100%) rename Ruin.js => src/Ruin.js (100%) rename Source.js => src/Source.js (100%) rename Structure.js => src/Structure.js (100%) rename {Structures => src/Structures}/StructureContainer.js (100%) rename {Structures => src/Structures}/StructureController.js (100%) rename {Structures => src/Structures}/StructureExtension.js (100%) rename {Structures => src/Structures}/StructureExtractor.js (100%) rename {Structures => src/Structures}/StructureFactory.js (100%) rename {Structures => src/Structures}/StructureInvaderCore.js (100%) rename {Structures => src/Structures}/StructureKeeperLair.js (100%) rename {Structures => src/Structures}/StructureLab.js (100%) rename {Structures => src/Structures}/StructureLink.js (100%) rename {Structures => src/Structures}/StructureNuker.js (100%) rename {Structures => src/Structures}/StructureObserver.js (100%) rename {Structures => src/Structures}/StructurePortal.js (100%) rename {Structures => src/Structures}/StructurePowerBank.js (100%) rename {Structures => src/Structures}/StructurePowerSpawn.js (100%) rename {Structures => src/Structures}/StructureRampart.js (100%) rename {Structures => src/Structures}/StructureRoad.js (100%) rename {Structures => src/Structures}/StructureSpawn.js (100%) rename {Structures => src/Structures}/StructureStorage.js (100%) rename {Structures => src/Structures}/StructureTerminal.js (100%) rename {Structures => src/Structures}/StructureTower.js (100%) rename {Structures => src/Structures}/StructureWall.js (100%) rename Tombstone.js => src/Tombstone.js (100%) diff --git a/.gitignore b/.gitignore index 817268f..57d4713 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ .idea/ -atlassian-ide-plugin.xml -.git/ \ No newline at end of file +atlassian-ide-plugin.xml \ No newline at end of file diff --git a/Config/SublimeCodeIntel.json b/Config/SublimeCodeIntel.json deleted file mode 100644 index 5cf6c62..0000000 --- a/Config/SublimeCodeIntel.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - /* - Defines a configuration for each language. - */ - "codeintel_language_settings": { - "JavaScript": { - "codeintel_scan_extra_dir": [], - "codeintel_scan_exclude_dir":["/build/", "/min/"], - "codeintel_scan_files_in_project": true, - "codeintel_max_recursive_dir_depth": 2, - "codeintel_selected_catalogs": ["jQuery"] - } - } -} diff --git a/ConstructionSite.js b/src/ConstructionSite.js similarity index 100% rename from ConstructionSite.js rename to src/ConstructionSite.js diff --git a/Creep.js b/src/Creep.js similarity index 100% rename from Creep.js rename to src/Creep.js diff --git a/Deposit.js b/src/Deposit.js similarity index 100% rename from Deposit.js rename to src/Deposit.js diff --git a/Flag.js b/src/Flag.js similarity index 100% rename from Flag.js rename to src/Flag.js diff --git a/Game.js b/src/Game.js similarity index 100% rename from Game.js rename to src/Game.js diff --git a/Memory.js b/src/Memory.js similarity index 100% rename from Memory.js rename to src/Memory.js diff --git a/Mineral.js b/src/Mineral.js similarity index 100% rename from Mineral.js rename to src/Mineral.js diff --git a/Nuke.js b/src/Nuke.js similarity index 100% rename from Nuke.js rename to src/Nuke.js diff --git a/Order.js b/src/Order.js similarity index 100% rename from Order.js rename to src/Order.js diff --git a/OwnedStructure.js b/src/OwnedStructure.js similarity index 100% rename from OwnedStructure.js rename to src/OwnedStructure.js diff --git a/PathFinder.js b/src/PathFinder.js similarity index 100% rename from PathFinder.js rename to src/PathFinder.js diff --git a/PowerCreep.js b/src/PowerCreep.js similarity index 100% rename from PowerCreep.js rename to src/PowerCreep.js diff --git a/RawMemory.js b/src/RawMemory.js similarity index 100% rename from RawMemory.js rename to src/RawMemory.js diff --git a/Resource.js b/src/Resource.js similarity index 100% rename from Resource.js rename to src/Resource.js diff --git a/Room.js b/src/Room.js similarity index 100% rename from Room.js rename to src/Room.js diff --git a/RoomObject.js b/src/RoomObject.js similarity index 100% rename from RoomObject.js rename to src/RoomObject.js diff --git a/RoomPosition.js b/src/RoomPosition.js similarity index 100% rename from RoomPosition.js rename to src/RoomPosition.js diff --git a/RoomVisual.js b/src/RoomVisual.js similarity index 100% rename from RoomVisual.js rename to src/RoomVisual.js diff --git a/Ruin.js b/src/Ruin.js similarity index 100% rename from Ruin.js rename to src/Ruin.js diff --git a/Source.js b/src/Source.js similarity index 100% rename from Source.js rename to src/Source.js diff --git a/Structure.js b/src/Structure.js similarity index 100% rename from Structure.js rename to src/Structure.js diff --git a/Structures/StructureContainer.js b/src/Structures/StructureContainer.js similarity index 100% rename from Structures/StructureContainer.js rename to src/Structures/StructureContainer.js diff --git a/Structures/StructureController.js b/src/Structures/StructureController.js similarity index 100% rename from Structures/StructureController.js rename to src/Structures/StructureController.js diff --git a/Structures/StructureExtension.js b/src/Structures/StructureExtension.js similarity index 100% rename from Structures/StructureExtension.js rename to src/Structures/StructureExtension.js diff --git a/Structures/StructureExtractor.js b/src/Structures/StructureExtractor.js similarity index 100% rename from Structures/StructureExtractor.js rename to src/Structures/StructureExtractor.js diff --git a/Structures/StructureFactory.js b/src/Structures/StructureFactory.js similarity index 100% rename from Structures/StructureFactory.js rename to src/Structures/StructureFactory.js diff --git a/Structures/StructureInvaderCore.js b/src/Structures/StructureInvaderCore.js similarity index 100% rename from Structures/StructureInvaderCore.js rename to src/Structures/StructureInvaderCore.js diff --git a/Structures/StructureKeeperLair.js b/src/Structures/StructureKeeperLair.js similarity index 100% rename from Structures/StructureKeeperLair.js rename to src/Structures/StructureKeeperLair.js diff --git a/Structures/StructureLab.js b/src/Structures/StructureLab.js similarity index 100% rename from Structures/StructureLab.js rename to src/Structures/StructureLab.js diff --git a/Structures/StructureLink.js b/src/Structures/StructureLink.js similarity index 100% rename from Structures/StructureLink.js rename to src/Structures/StructureLink.js diff --git a/Structures/StructureNuker.js b/src/Structures/StructureNuker.js similarity index 100% rename from Structures/StructureNuker.js rename to src/Structures/StructureNuker.js diff --git a/Structures/StructureObserver.js b/src/Structures/StructureObserver.js similarity index 100% rename from Structures/StructureObserver.js rename to src/Structures/StructureObserver.js diff --git a/Structures/StructurePortal.js b/src/Structures/StructurePortal.js similarity index 100% rename from Structures/StructurePortal.js rename to src/Structures/StructurePortal.js diff --git a/Structures/StructurePowerBank.js b/src/Structures/StructurePowerBank.js similarity index 100% rename from Structures/StructurePowerBank.js rename to src/Structures/StructurePowerBank.js diff --git a/Structures/StructurePowerSpawn.js b/src/Structures/StructurePowerSpawn.js similarity index 100% rename from Structures/StructurePowerSpawn.js rename to src/Structures/StructurePowerSpawn.js diff --git a/Structures/StructureRampart.js b/src/Structures/StructureRampart.js similarity index 100% rename from Structures/StructureRampart.js rename to src/Structures/StructureRampart.js diff --git a/Structures/StructureRoad.js b/src/Structures/StructureRoad.js similarity index 100% rename from Structures/StructureRoad.js rename to src/Structures/StructureRoad.js diff --git a/Structures/StructureSpawn.js b/src/Structures/StructureSpawn.js similarity index 100% rename from Structures/StructureSpawn.js rename to src/Structures/StructureSpawn.js diff --git a/Structures/StructureStorage.js b/src/Structures/StructureStorage.js similarity index 100% rename from Structures/StructureStorage.js rename to src/Structures/StructureStorage.js diff --git a/Structures/StructureTerminal.js b/src/Structures/StructureTerminal.js similarity index 100% rename from Structures/StructureTerminal.js rename to src/Structures/StructureTerminal.js diff --git a/Structures/StructureTower.js b/src/Structures/StructureTower.js similarity index 100% rename from Structures/StructureTower.js rename to src/Structures/StructureTower.js diff --git a/Structures/StructureWall.js b/src/Structures/StructureWall.js similarity index 100% rename from Structures/StructureWall.js rename to src/Structures/StructureWall.js diff --git a/Tombstone.js b/src/Tombstone.js similarity index 100% rename from Tombstone.js rename to src/Tombstone.js From 85ecc0e015cc3c35f62d7f1917f74750991cdd9f Mon Sep 17 00:00:00 2001 From: CrystallDEV Date: Sun, 20 Oct 2019 00:31:43 +0200 Subject: [PATCH 63/63] Added npm script to auto generate constants, generated new Constants.js, removed TODO file (all done) --- Global/Constants.js | 2430 ------------------------ TODO.md | 9 - generateConstants.js | 53 + package.json | 3 +- src/Global/Constants.js | 4013 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 4068 insertions(+), 2440 deletions(-) delete mode 100644 Global/Constants.js delete mode 100644 TODO.md create mode 100644 generateConstants.js create mode 100644 src/Global/Constants.js diff --git a/Global/Constants.js b/Global/Constants.js deleted file mode 100644 index bfcfcc3..0000000 --- a/Global/Constants.js +++ /dev/null @@ -1,2430 +0,0 @@ - -/** CREEP BODY PARTS **/ - -/** - * @constant - * @type {string} - */ -const MOVE = "move"; - -/** - * @constant - * @type {string} - */ -const WORK = "work"; - -/** - * @constant - * @type {string} - */ -const CARRY = "carry"; - -/** - * @constant - * @type {string} - */ -const ATTACK = "attack"; - -/** - * @constant - * @type {string} - */ -const RANGED_ATTACK = "ranged_attack"; - -/** - * @constant - * @type {string} - */ -const TOUGH = "tough"; - -/** - * @constant - * @type {string} - */ -const HEAL = "heal"; - -/** - * @constant - * @type {string} - */ -const CLAIM = "claim"; - -/** DIRECTION CONSTANTS **/ - -/** - * @constant - * @type {number} - */ -const TOP = 1; - -/** - * @constant - * @type {number} - */ -const TOP_RIGHT = 2; - -/** - * @constant - * @type {number} - */ -const RIGHT = 3; - -/** - * @constant - * @type {number} - */ -const BOTTOM_RIGHT = 4; - -/** - * @constant - * @type {number} - */ -const BOTTOM = 5; - -/** - * @constant - * @type {number} - */ -const BOTTOM_LEFT = 6; - -/** - * @constant - * @type {number} - */ -const LEFT = 7; - -/** - * @constant - * @type {number} - */ -const TOP_LEFT = 8; - -/** ERROR CONSTANTS **/ - -/** - * @constant - * @type {number} - */ -const OK = 0; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_OWNER = -1; - -/** - * @constant - * @type {number} - */ -const ERR_NO_PATH = -2; - -/** - * @constant - * @type {number} - */ -const ERR_NAME_EXISTS = -3; - -/** - * @constant - * @type {number} - */ -const ERR_BUSY = -4; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_FOUND = -5; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_ENOUGH_ENERGY = -6; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_ENOUGH_RESOURCES = -6; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_ENOUGH_EXTENSIONS = -6; - -/** - * @constant - * @type {number} - */ -const ERR_INVALID_TARGET = -7; - -/** - * @constant - * @type {number} - */ -const ERR_FULL = -8; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_IN_RANGE = -9; - -/** - * @constant - * @type {number} - */ -const ERR_INVALID_ARGS = -10; - -/** - * @constant - * @type {number} - */ -const ERR_TIRED = -11; - -/** - * @constant - * @type {number} - */ -const ERR_NO_BODYPART = -12; - -/** - * @constant - * @type {number} - */ -const ERR_RCL_NOT_ENOUGH = -14; - -/** - * @constant - * @type {number} - */ -const ERR_GCL_NOT_ENOUGH = -15; - -/** COLOR CONSTANTS **/ - -/** - * @constant - * @type {number} - */ -const COLOR_RED = 1; - -/** - * @constant - * @type {number} - */ -const COLOR_PURPLE = 2; - -/** - * @constant - * @type {number} - */ -const COLOR_BLUE = 3; - -/** - * @constant - * @type {number} - */ -const COLOR_CYAN = 4; - -/** - * @constant - * @type {number} - */ -const COLOR_GREEN = 5; - -/** - * @constant - * @type {number} - */ -const COLOR_YELLOW = 6; - -/** - * @constant - * @type {number} - */ -const COLOR_ORANGE = 7; - -/** - * @constant - * @type {number} - */ -const COLOR_BROWN = 8; - -/** - * @constant - * @type {number} - */ -const COLOR_GREY = 9; - -/** - * @constant - * @type {number} - */ -const COLOR_WHITE = 10; - -/** FIND CONSTANTS **/ - -/** - * @constant - * @type {number} - */ -const FIND_EXIT_TOP = 1; - -/** - * @constant - * @type {number} - */ -const FIND_EXIT_RIGHT = 3; - -/** - * @constant - * @type {number} - */ -const FIND_EXIT_BOTTOM = 5; - -/** - * @constant - * @type {number} - */ -const FIND_EXIT_LEFT = 7; - -/** - * @constant - * @type {number} - */ -const FIND_EXIT = 10; - -/** - * @constant - * @type {number} - */ -const FIND_CREEPS = 101; - -/** - * @constant - * @type {number} - */ -const FIND_MY_CREEPS = 102; - -/** - * @constant - * @type {number} - */ -const FIND_HOSTILE_CREEPS = 103; - -/** - * @constant - * @type {number} - */ -const FIND_SOURCES_ACTIVE = 104; - -/** - * @constant - * @type {number} - */ -const FIND_SOURCES = 105; - -/** - * @constant - * @type {number} - */ -const FIND_DROPPED_RESOURCES = 106; - -/** - * @constant - * @type {number} - */ -const FIND_STRUCTURES = 107; - -/** - * @constant - * @type {number} - */ -const FIND_MY_STRUCTURES = 108; - -/** - * @constant - * @type {number} - */ -const FIND_HOSTILE_STRUCTURES = 109; - -/** - * @constant - * @type {number} - */ -const FIND_FLAGS = 110; - -/** - * @constant - * @type {number} - */ -const FIND_CONSTRUCTION_SITES = 111; - -/** - * @constant - * @type {number} - */ -const FIND_MY_SPAWNS = 112; - -/** - * @constant - * @type {number} - */ -const FIND_HOSTILE_SPAWNS = 113; - -/** - * @constant - * @type {number} - */ -const FIND_MY_CONSTRUCTION_SITES = 114; - -/** - * @constant - * @type {number} - */ -const FIND_HOSTILE_CONSTRUCTION_SITES = 115; - -/** - * @constant - * @type {number} - */ -const FIND_MINERALS = 116; - -/** - * @constant - * @type {number} - */ -const FIND_NUKES = 117; - -/** - * @constant - * @type {number} - */ -const FIND_TOMBSTONES = 118; - -/** - * @constant - * @type {number} - */ -const FIND_POWER_CREEPS = 119; - -/** - * @constant - * @type {number} - */ -const FIND_MY_POWER_CREEPS = 120; - -/** - * @constant - * @type {number} - */ -const FIND_HOSTILE_POWER_CREEPS = 121; - -/** - * @constant - * @type {string} - */ -const MODE_SIMULATION = "simulation"; - -/** - * @constant - * @type {string} - */ -const MODE_SURVIVAL = "survival"; - -/** - * @constant - * @type {string} - */ -const MODE_WORLD = "world"; - -/** - * @constant - * @type {string} - */ -const MODE_ARENA = "arena"; - -/** STRUCTURE CONSTANTS **/ - -/** - * @constant - * @type {string} - */ -const STRUCTURE_EXTENSION = "extension"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_RAMPART = "rampart"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_ROAD = "road"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_SPAWN = "spawn"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_WALL = "constructedWall"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_LINK = "link"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_KEEPER_LAIR = "keeperLair"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_CONTROLLER = "controller"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_STORAGE = "storage"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_TOWER = "tower"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_OBSERVER = "observer"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_POWER_BANK = "powerBank"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_POWER_SPAWN = "powerSpawn"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_PORTAL = "portal"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_EXTRACTOR = "extractor"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_LAB = "lab"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_TERMINAL = "terminal"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_CONTAINER = "container"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_NUKER = "nuker"; - -/** RESOURCE CONSTANTS **/ - -/** - * @constant - * @type {string} - */ -const SUBSCRIPTION_TOKEN = 'token'; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ENERGY = "energy"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_POWER = "power"; -/** - * @constant - * @type {string} - */ -const RESOURCE_HYDROGEN = "H"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_OXYGEN = "O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM = "U"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_KEANIUM = "K"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_LEMERGIUM = "L"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM = "Z"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYST = "X"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_OPS = "ops"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_HYDROXIDE = "OH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM_KEANITE = "ZK"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM_LEMERGITE = "UL"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_GHODIUM = "G"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM_HYDRIDE = "UH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM_OXIDE = "UO"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_KEANIUM_HYDRIDE = "KH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_KEANIUM_OXIDE = "KO"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_LEMERGIUM_HYDRIDE = "LH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_LEMERGIUM_OXIDE = "LO"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM_HYDRIDE = "ZH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM_OXIDE = "ZO"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_GHODIUM_HYDRIDE = "GH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_GHODIUM_OXIDE = "GO"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM_ACID = "UH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM_ALKALIDE = "UHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_KEANIUM_ACID = "KH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_KEANIUM_ALKALIDE = "KHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_LEMERGIUM_ACID = "LH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_LEMERGIUM_ALKALIDE = "LHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM_ACID = "ZH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM_ALKALIDE = "ZHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_GHODIUM_ACID = "GH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_GHODIUM_ALKALIDE = "GHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_UTRIUM_ACID = "XUH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_UTRIUM_ALKALIDE = "XUHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_KEANIUM_ACID = "XKH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_KEANIUM_ALKALIDE = "XKHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_LEMERGIUM_ACID = "XLH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE = "XLHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_ZYNTHIUM_ACID = "XZH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE = "XZHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_GHODIUM_ACID = "XGH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_GHODIUM_ALKALIDE = "XGHO2"; - -/** - * @constant - * @type {object} - */ -const REACTIONS = { - H: { - O: "OH", - L: "LH", - K: "KH", - U: "UH", - Z: "ZH", - G: "GH" - }, - O: { - H: "OH", - L: "LO", - K: "KO", - U: "UO", - Z: "ZO", - G: "GO" - }, - Z: { - K: "ZK", - H: "ZH", - O: "ZO" - }, - L: { - U: "UL", - H: "LH", - O: "LO" - }, - K: { - Z: "ZK", - H: "KH", - O: "KO" - }, - G: { - H: "GH", - O: "GO" - }, - U: { - L: "UL", - H: "UH", - O: "UO" - }, - OH: { - UH: "UH2O", - UO: "UHO2", - ZH: "ZH2O", - ZO: "ZHO2", - KH: "KH2O", - KO: "KHO2", - LH: "LH2O", - LO: "LHO2", - GH: "GH2O", - GO: "GHO2" - }, - X: { - UH2O: "XUH2O", - UHO2: "XUHO2", - LH2O: "XLH2O", - LHO2: "XLHO2", - KH2O: "XKH2O", - KHO2: "XKHO2", - ZH2O: "XZH2O", - ZHO2: "XZHO2", - GH2O: "XGH2O", - GHO2: "XGHO2" - }, - ZK: { - UL: "G" - }, - UL: { - ZK: "G" - }, - LH: { - OH: "LH2O" - }, - ZH: { - OH: "ZH2O" - }, - GH: { - OH: "GH2O" - }, - KH: { - OH: "KH2O" - }, - UH: { - OH: "UH2O" - }, - LO: { - OH: "LHO2" - }, - ZO: { - OH: "ZHO2" - }, - KO: { - OH: "KHO2" - }, - UO: { - OH: "UHO2" - }, - GO: { - OH: "GHO2" - }, - LH2O: { - X: "XLH2O" - }, - KH2O: { - X: "XKH2O" - }, - ZH2O: { - X: "XZH2O" - }, - UH2O: { - X: "XUH2O" - }, - GH2O: { - X: "XGH2O" - }, - LHO2: { - X: "XLHO2" - }, - UHO2: { - X: "XUHO2" - }, - KHO2: { - X: "XKHO2" - }, - ZHO2: { - X: "XZHO2" - }, - GHO2: { - X: "XGHO2" - } -}; - -/** - * @constant - * @type {object} - */ -const BOOSTS = { - work: { - UO: { - harvest: 2 - }, - UHO2: { - harvest: 3 - }, - XUHO2: { - harvest: 4 - }, - LH: { - build: 1.3, - repair: 1.3 - }, - LH2O: { - build: 1.65, - repair: 1.65 - }, - XLH2O: { - build: 2, - repair: 2 - }, - ZH: { - dismantle: 2 - }, - ZH2O: { - dismantle: 3 - }, - XZH2O: { - dismantle: 4 - }, - GH: { - upgradeController: 1.3 - }, - GH2O: { - upgradeController: 1.65 - }, - XGH2O: { - upgradeController: 2 - } - }, - attack: { - UH: { - attack: 2 - }, - UH2O: { - attack: 3 - }, - XUH2O: { - attack: 4 - } - }, - ranged_attack: { - KO: { - rangedAttack: 2, - rangedMassAttack: 2 - }, - KHO2: { - rangedAttack: 3, - rangedMassAttack: 3 - }, - XKHO2: { - rangedAttack: 4, - rangedMassAttack: 4 - } - }, - heal: { - LO: { - heal: 2, - rangedHeal: 2 - }, - LHO2: { - heal: 3, - rangedHeal: 3 - }, - XLHO2: { - heal: 4, - rangedHeal: 4 - } - }, - carry: { - KH: { - capacity: 2 - }, - KH2O: { - capacity: 3 - }, - XKH2O: { - capacity: 4 - } - }, - move: { - ZO: { - fatigue: 2 - }, - ZHO2: { - fatigue: 3 - }, - XZHO2: { - fatigue: 4 - } - }, - tough: { - GO: { - damage: .7 - }, - GHO2: { - damage: .5 - }, - XGHO2: { - damage: .3 - } - } -}; - -/** - * @constant - * @type {string[]} - */ -const RESOURCES_ALL = [ - RESOURCE_ENERGY, - RESOURCE_POWER, - RESOURCE_HYDROGEN, - RESOURCE_OXYGEN, - RESOURCE_UTRIUM, - RESOURCE_KEANIUM, - RESOURCE_LEMERGIUM, - RESOURCE_ZYNTHIUM, - RESOURCE_CATALYST, - RESOURCE_GHODIUM, - RESOURCE_HYDROXIDE, - RESOURCE_ZYNTHIUM_KEANITE, - RESOURCE_UTRIUM_LEMERGITE, - RESOURCE_UTRIUM_HYDRIDE, - RESOURCE_UTRIUM_OXIDE, - RESOURCE_KEANIUM_HYDRIDE, - RESOURCE_KEANIUM_OXIDE, - RESOURCE_LEMERGIUM_HYDRIDE, - RESOURCE_LEMERGIUM_OXIDE, - RESOURCE_ZYNTHIUM_HYDRIDE, - RESOURCE_ZYNTHIUM_OXIDE, - RESOURCE_GHODIUM_HYDRIDE, - RESOURCE_GHODIUM_OXIDE, - RESOURCE_UTRIUM_ACID, - RESOURCE_UTRIUM_ALKALIDE, - RESOURCE_KEANIUM_ACID, - RESOURCE_KEANIUM_ALKALIDE, - RESOURCE_LEMERGIUM_ACID, - RESOURCE_LEMERGIUM_ALKALIDE, - RESOURCE_ZYNTHIUM_ACID, - RESOURCE_ZYNTHIUM_ALKALIDE, - RESOURCE_GHODIUM_ACID, - RESOURCE_GHODIUM_ALKALIDE, - RESOURCE_CATALYZED_UTRIUM_ACID, - RESOURCE_CATALYZED_UTRIUM_ALKALIDE, - RESOURCE_CATALYZED_KEANIUM_ACID, - RESOURCE_CATALYZED_KEANIUM_ALKALIDE, - RESOURCE_CATALYZED_LEMERGIUM_ACID, - RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE, - RESOURCE_CATALYZED_ZYNTHIUM_ACID, - RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE, - RESOURCE_CATALYZED_GHODIUM_ACID, - RESOURCE_CATALYZED_GHODIUM_ALKALIDE, - RESOURCE_OPS -]; - -/** - * @constant - * @type {string[]} - */ -const BODYPARTS_ALL = [ - MOVE, - WORK, - CARRY, - ATTACK, - RANGED_ATTACK, - TOUGH, - HEAL, - CLAIM -]; - -/** - * @constant - * @type {string[]} - */ -const COLORS_ALL = [ - COLOR_RED, - COLOR_PURPLE, - COLOR_BLUE, - COLOR_CYAN, - COLOR_GREEN, - COLOR_YELLOW, - COLOR_ORANGE, - COLOR_BROWN, - COLOR_GREY, - COLOR_WHITE -]; - -const REACTION_TIME = { - OH: 20, - ZK: 5, - UL: 5, - G: 5, - UH: 10, - UH2O: 5, - XUH2O: 60, - UO: 10, - UHO2: 5, - XUHO2: 60, - KH: 10, - KH2O: 5, - XKH2O: 60, - KO: 10, - KHO2: 5, - XKHO2: 60, - LH: 15, - LH2O: 10, - XLH2O: 65, - LO: 10, - LHO2: 5, - XLHO2: 60, - ZH: 20, - ZH2O: 40, - XZH2O: 160, - ZO: 10, - ZHO2: 5, - XZHO2: 60, - GH: 10, - GH2O: 15, - XGH2O: 80, - GO: 10, - GHO2: 30, - XGHO2: 150, -}; - -/** - * @constant - * @type {object} - */ -const BODYPART_COST = { - move: 50, - work: 100, - attack: 80, - carry: 50, - heal: 250, - ranged_attack: 150, - tough: 10, - claim: 600 -}; - -/** - * Spawn time per body part in ticks - * @constant - * @type {number} - */ -const CREEP_SPAWN_TIME = 3; - -/** - * @constant - * @type {number} - */ -const CREEP_RENEW_RATIO = 1.2; - -/** - * Lifetime of a creep - * @constant - * @type {number} - */ -const CREEP_LIFE_TIME = 1500; - -/** - * Lifetime of a creep with CLAIM body parts - * @constant - * @type {number} - */ -const CREEP_CLAIM_LIFE_TIME = 500; - -/** - * use unknown - * @constant - * @type {number} - */ -const CREEP_CORPSE_RATE = 0.2; - -/** - * @constant - * @type {string[]} - */ -const OBSTACLE_OBJECT_TYPES = ["spawn", "creep", "powerCreep", "source", "mineral", "controller", "constructedWall", "extension", "link", "storage", "tower", "observer", "powerSpawn", "powerBank", "lab", "terminal","nuker"]; - -/** - * @constant - * @type {number} - */ -const ENERGY_REGEN_TIME = 300; - -/** - * @constant - * @type {number} - */ -const ENERGY_DECAY = 1000; - -/** - * @constant - * @type {number} - */ -const MINERAL_REGEN_TIME = 50000; - -/** - * @constant - * @type {object} - */ -const MINERAL_MIN_AMOUNT = { - H: 140000, - O: 140000, - L: 70000, - K: 70000, - Z: 70000, - U: 70000, - X: 70000 -}; - -/** - * @constant - * @type {number} - */ -const MINERAL_RANDOM_FACTOR = 2; - -/** - * @constant - * @type {number} - */ -const REPAIR_COST = 0.01; - -/** - * @constant - * @type {number} - */ -const DISMANTLE_COST = 0.005; - -/** - * @constant - * @type {number} - */ -const RAMPART_DECAY_AMOUNT = 300; - -/** - * @constant - * @type {number} - */ -const RAMPART_DECAY_TIME = 100; - -/** - * @constant - * @type {number} - */ -const RAMPART_HITS = 1; - -/** - * @constant - * @type {object} - */ -const RAMPART_HITS_MAX = { - 2: 300000, - 3: 1000000, - 4: 3000000, - 5: 10000000, - 6: 30000000, - 7: 100000000, - 8: 300000000 -}; - -/** - * @constant - * @type {number} - */ -const SPAWN_HITS = 5000; - -/** - * @constant - * @type {number} - */ -const SPAWN_ENERGY_START = 300; - -/** - * @constant - * @type {number} - */ -const SPAWN_ENERGY_CAPACITY = 300; - -/** - * @constant - * @type {number} - */ -const SOURCE_ENERGY_CAPACITY = 3000; - -/** - * @constant - * @type {number} - */ -const SOURCE_ENERGY_NEUTRAL_CAPACITY = 1500; - -/** - * @constant - * @type {number} - */ -const SOURCE_ENERGY_KEEPER_CAPACITY = 4500; - -/** - * @constant - * @type {number} - */ -const ROAD_HITS = 5000; - -/** - * @constant - * @type {number} - */ -const WALL_HITS = 1; - -/** - * @constant - * @type {number} - */ -const WALL_HITS_MAX = 300000000; - -/** - * @constant - * @type {number} - */ -const EXTENSION_HITS = 1000; - -/** - * @constant - * @type {object} - */ -const EXTENSION_ENERGY_CAPACITY = { - 0: 50, - 1: 50, - 2: 50, - 3: 50, - 4: 50, - 5: 50, - 6: 50, - 7: 100, - 8: 200 -}; - -/** - * @constant - * @type {number} - */ -const ROAD_WEAROUT = 1; - -/** - * @constant - * @type {number} - */ -const ROAD_DECAY_AMOUNT = 100; - -/** - * @constant - * @type {number} - */ -const ROAD_DECAY_TIME = 1000; - -/** - * @constant - * @type {number} - */ -const LINK_HITS = 1000; - -/** - * @constant - * @type {number} - */ -const LINK_HITS_MAX = 1000; - -/** - * @constant - * @type {number} - */ -const LINK_CAPACITY = 800; - -/** - * @constant - * @type {number} - */ -const LINK_COOLDOWN = 1; - -/** - * @constant - * @type {number} - */ -const LINK_LOSS_RATIO = 0.03; - -/** - * @constant - * @type {number} - */ -const CONTAINER_HITS = 250000; - -/** - * @constant - * @type {number} - */ -const CONTAINER_CAPACITY = 2000; - -/** - * @constant - * @type {number} - */ -const CONTAINER_DECAY = 5000; - -/** - * @constant - * @type {number} - */ -const CONTAINER_DECAY_TIME = 100; - -/** - * @constant - * @type {number} - */ -const CONTAINER_DECAY_TIME_OWNED = 500; - -/** - * @constant - * @type {number} - */ -const NUKER_HITS = 1000; - -/** - * @constant - * @type {number} - */ -const NUKER_COOLDOWN = 100000; - -/** - * @constant - * @type {number} - */ -const NUKER_ENERGY_CAPACITY = 300000; - -/** - * @constant - * @type {number} - */ -const NUKER_GHODIUM_CAPACITY = 5000; - -/** - * @constant - * @type {number} - */ -const NUKE_LAND_TIME = 50000; - -/** - * @constant - * @type {number} - */ -const NUKE_RANGE = 10; - -/** - * @constant - * @type {object} - */ -const NUKE_DAMAGE = { - 0: 10000000, - 2: 5000000 -}; - -/** - * @constant - * @type {number} - */ -const PORTAL_DECAY = 30000; - -/** - * @constant - * @type {number} - */ -const TOMBSTONE_DECAY_PER_PART = 5; - -/** - * @constant - * @type {string} - */ -const ORDER_SELL = 'sell'; - -/** - * @constant - * @type {string} - */ -const ORDER_BUY = 'buy'; - -/** - * @constant - * @type {number} - */ -const STORAGE_CAPACITY = 1000000; - -/** - * @constant - * @type {number} - */ -const STORAGE_HITS = 10000; - -/** - * @constant - * @type {number} - */ -const CARRY_CAPACITY = 50; - -/** - * @constant - * @type {number} - */ -const HARVEST_POWER = 2; - -/** - * @constant - * @type {number} - */ -const HARVEST_MINERAL_POWER = 1; - -/** - * @constant - * @type {number} - */ -const REPAIR_POWER = 100; - -/** - * @constant - * @type {number} - */ -const DISMANTLE_POWER = 100; - -/** - * @constant - * @type {number} - */ -const BUILD_POWER = 5; - -/** - * @constant - * @type {number} - */ -const ATTACK_POWER = 30; - -/** - * @constant - * @type {number} - */ -const UPGRADE_CONTROLLER_POWER = 1; - -/** - * @constant - * @type {number} - */ -const RANGED_ATTACK_POWER = 10; - -/** - * @constant - * @type {number} - */ -const HEAL_POWER = 12; - -/** - * @constant - * @type {number} - */ -const RANGED_HEAL_POWER = 4; - -/** - * @constant - * @type {object} - */ -const CONSTRUCTION_COST = { - spawn: 15000, - extension: 3000, - road: 300, - constructedWall: 1, - rampart: 1, - link: 5000, - storage: 30000, - tower: 5000, - observer: 8000, - powerSpawn: 100000, - extractor: 5000, - lab: 50000, - terminal: 100000, - container: 5000, - nuker: 100000 -}; - -/** - * @constant - * @type {number} - */ -const CONSTRUCTION_COST_ROAD_SWAMP_RATIO = 5; - -/** - * @constant - * @type {object} - */ -const CONTROLLER_LEVELS = { - 1: 200, - 2: 45000, - 3: 135000, - 4: 405000, - 5: 1215000, - 6: 3645000, - 7: 10935000 -}; - -/** - * @constant - * @type {object} - */ -const CONTROLLER_STRUCTURES = { - spawn: { 0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 2, 8: 3 }, - extension: { 0: 0, 1: 0, 2: 5, 3: 10, 4: 20, 5: 30, 6: 40, 7: 50, 8: 60 }, - link: { 1: 0, 2: 0, 3: 0, 4: 0, 5: 2, 6: 3, 7: 4, 8: 6 }, - road: { 0: 2500, 1: 2500, 2: 2500, 3: 2500, 4: 2500, 5: 2500, 6: 2500, 7: 2500, 8: 2500 }, - constructedWall: { 1: 0, 2: 2500, 3: 2500, 4: 2500, 5: 2500, 6: 2500, 7: 2500, 8: 2500 }, - rampart: { 1: 0, 2: 2500, 3: 2500, 4: 2500, 5: 2500, 6: 2500, 7: 2500, 8: 2500 }, - storage: { 1: 0, 2: 0, 3: 0, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1 }, - tower: { 1: 0, 2: 0, 3: 1, 4: 1, 5: 1, 6: 2, 7: 2, 8: 4 }, - observer: { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 1 }, - powerSpawn: { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 1 } -}; - -/** - * @constant - * @type {object} - */ -const CONTROLLER_DOWNGRADE = { - 1: 20000, - 2: 5000, - 3: 10000, - 4: 20000, - 5: 40000, - 6: 60000, - 7: 100000, - 8: 150000 -}; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_DOWNGRADE_RESTORE = 100; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_DOWNGRADE_SAFEMODE_THRESHOLD = 5000; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_CLAIM_DOWNGRADE = 0.2; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_RESERVE = 1; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_RESERVE_MAX = 5000; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_MAX_UPGRADE_PER_TICK = 15; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_ATTACK_BLOCKED_UPGRADE = 1000; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_NUKE_BLOCKED_UPGRADE = 200; - -/** - * @constant - * @type {number} - */ -const TERMINAL_CAPACITY = 300000; - -/** - * @constant - * @type {number} - */ -const TERMINAL_HITS = 3000; - -/** - * @constant - * @type {number} - */ -const TERMINAL_SEND_COST = 0.1; - -/** - * @constant - * @type {number} - */ -const TERMINAL_MIN_SEND = 100; - -/** - * @constant - * @type {number} - */ -const TOWER_HITS = 3000; - -/** - * @constant - * @type {number} - */ -const TOWER_CAPACITY = 1000; - -/** - * @constant - * @type {number} - */ -const TOWER_ENERGY_COST = 10; - -/** - * @constant - * @type {number} - */ -const TOWER_POWER_ATTACK = 600; - -/** - * @constant - * @type {number} - */ -const TOWER_POWER_HEAL = 400; - -/** - * @constant - * @type {number} - */ -const TOWER_POWER_REPAIR = 800; - -/** - * @constant - * @type {number} - */ -const TOWER_OPTIMAL_RANGE = 5; - -/** - * @constant - * @type {number} - */ -const TOWER_FALLOFF_RANGE = 20; - -/** - * @constant - * @type {number} - */ -const TOWER_FALLOFF = 0.75; - -/** - * @constant - * @type {number} - */ -const OBSERVER_HITS = 500; - -/** - * @constant - * @type {number} - */ -const OBSERVER_RANGE = 10; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_HITS = 2000000; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_CAPACITY_MAX = 5000; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_CAPACITY_MIN = 500; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_CAPACITY_CRIT = 0.3; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_DECAY = 5000; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_HIT_BACK = 0.5; - -/** - * @constant - * @type {number} - */ -const POWER_SPAWN_HITS = 5000; - -/** - * @constant - * @type {number} - */ -const POWER_SPAWN_ENERGY_CAPACITY = 5000; - -/** - * @constant - * @type {number} - */ -const POWER_SPAWN_POWER_CAPACITY = 100; - -/** - * @constant - * @type {number} - */ -const POWER_SPAWN_ENERGY_RATIO = 50; - -/** - * @constant - * @type {number} - */ -const LAB_HITS = 500; - -/** - * @constant - * @type {number} - */ -const LAB_MINERAL_CAPACITY = 3000; - -/** - * @constant - * @type {number} - */ -const LAB_ENERGY_CAPACITY = 2000; - -/** - * @constant - * @type {number} - */ -const LAB_BOOST_ENERGY = 20; - -/** - * @constant - * @type {number} - */ -const LAB_BOOST_MINERAL = 30; - -/** - * @constant - * @type {number} - */ -const LAB_COOLDOWN = 10; - -/** - * @constant - * @type {number} - */ -const GCL_POW = 2.4; - -/** - * @constant - * @type {number} - */ -const GCL_MULTIPLY = 1000000; - -/** - * @constant - * @type {number} - */ -const GCL_NOVICE = 3; - -/** - * @constant - * @type {number} - */ -const TERRAIN_MASK_WALL = 1; - -/** - * @constant - * @type {number} - */ -const TERRAIN_MASK_SWAMP = 2; - -/** - * @constant - * @type {number} - */ -const TERRAIN_MASK_LAVA = 4; - -/** - * @constant - * @type {number} - */ -const MAX_CONSTRUCTION_SITES = 100; - -/** - * @constant - * @type {number} - */ -const MAX_CREEP_SIZE = 50; - -/** LOOK CONSTANTS **/ - -/** - * @constant - * @type {string} - */ -const LOOK_CREEPS = "creep"; - -/** - * @constant - * @type {string} - */ -const LOOK_ENERGY = "energy"; - -/** - * @constant - * @type {string} - */ -const LOOK_RESOURCES = "resource"; - -/** - * @constant - * @type {string} - */ -const LOOK_SOURCES = "source"; - -/** - * @constant - * @type {string} - */ -const LOOK_MINERALS = "mineral"; - -/** - * @constant - * @type {string} - */ -const LOOK_STRUCTURES = "structure"; - -/** - * @constant - * @type {string} - */ -const LOOK_FLAGS = "flag"; - -/** - * @constant - * @type {string} - */ -const LOOK_CONSTRUCTION_SITES = "constructionSite"; - -/** - * @constant - * @type {string} - */ -const LOOK_NUKES = "nuke"; - -/** - * @constant - * @type {string} - */ -const LOOK_TERRAIN = "terrain"; - -/** - * @constant - * @type {string} - */ -const LOOK_TOMBSTONES = "tombstone"; - -/** - * @constant - * @type {string} - */ -const SYSTEM_USERNAME = 'Screeps'; - -/** - * @constant - * @deprecated use SIGN_PLANNED_AREA instead. - * @type {string} - */ -const SIGN_NOVICE_AREA = 'A new Novice Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; - -/** - * @constant - * @deprecated use SIGN_PLANNED_AREA instead. - * @type {string} - */ -const SIGN_RESPAWN_AREA = 'A new Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; - -/** - * @constant - * @type {string} - */ -const SIGN_PLANNED_AREA = 'A new Novice or Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; - -/** - * @constant - * @type {number} - */ -const TERMINAL_COOLDOWN = 10; - -/** - * @constant - * @type {number} - */ -const POWER_LEVEL_MULTIPLY = 1000; - -/** - * @constant - * @type {number} - */ -const POWER_LEVEL_POW = 2; - -/** - * @constant - * @type {number} - */ -const POWER_CREEP_SPAWN_COOLDOWN = 8*3600*1000; - -/** - * @constant - * @type {number} - */ -const POWER_CREEP_DELETE_COOLDOWN = 24*3600*1000; - -/** - * @constant - * @type {number} - */ -const POWER_CREEP_MAX_LEVEL = 25; - -/** - * @constant - * @type {number} - */ -const POWER_CREEP_LIFE_TIME = 5000; - -/** - * @constant - * @type {object} - */ -const POWER_CLASS = { OPERATOR: 'operator' }; - -/** - * @constant - * @type {number} - */ -const PWR_GENERATE_OPS = 1; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_SPAWN = 2; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_TOWER = 3; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_STORAGE = 4; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_LAB = 5; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_EXTENSION = 6; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_OBSERVER = 7; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_TERMINAL = 8; - -/** - * @constant - * @type {number} - */ -const PWR_DISRUPT_SPAWN = 9; - -/** - * @constant - * @type {number} - */ -const PWR_DISRUPT_TOWER = 10; - -/** - * @constant - * @type {number} - */ -const PWR_DISRUPT_SOURCE = 11; - -/** - * @constant - * @type {number} - */ -const PWR_SHIELD = 12; - -/** - * @constant - * @type {number} - */ -const PWR_REGEN_SOURCE = 13; - -/** - * @constant - * @type {number} - */ -const PWR_REGEN_MINERAL = 14; - -/** - * @constant - * @type {number} - */ -const PWR_DISRUPT_TERMINAL = 15; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_POWER = 16; - -/** - * @constant - * @type {number} - */ -const PWR_FORTIFY = 17; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_CONTROLLER = 18; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_FACTORY = 19; - -/** - * @constant - * @type {object} - */ -const POWER_INFO = { - [exports.PWR_GENERATE_OPS]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 50, - effect: [1, 2, 4, 6, 8] - }, - [exports.PWR_OPERATE_SPAWN]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 300, - duration: 1000, - range: 3, - ops: 100, - effect: [0.9, 0.7, 0.5, 0.35, 0.2] - }, - [exports.PWR_OPERATE_TOWER]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 10, - duration: 100, - range: 3, - ops: 10, - effect: [1.1, 1.2, 1.3, 1.4, 1.5] - }, - [exports.PWR_OPERATE_STORAGE]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 800, - duration: 1000, - range: 3, - ops: 100, - effect: [500000,1000000,2000000,4000000,7000000] - }, - [exports.PWR_OPERATE_LAB]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 50, - duration: 1000, - range: 3, - ops: 10, - effect: [2,4,6,8,10] - }, - [exports.PWR_OPERATE_EXTENSION]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 50, - range: 3, - ops: 2, - effect: [0.2, 0.4, 0.6, 0.8, 1.0] - }, - [exports.PWR_OPERATE_OBSERVER]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 400, - duration: [200,400,600,800,1000], - range: 3, - ops: 10, - }, - [exports.PWR_OPERATE_TERMINAL]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 500, - duration: 1000, - range: 3, - ops: 100, - effect: [0.9, 0.8, 0.7, 0.6, 0.5] - }, - [exports.PWR_DISRUPT_SPAWN]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 5, - range: 20, - ops: 10, - duration: [1,2,3,4,5] - }, - [exports.PWR_DISRUPT_TOWER]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 0, - duration: 5, - range: 3, - ops: 10, - effect: [0.9, 0.8, 0.7, 0.6, 0.5], - }, - [exports.PWR_DISRUPT_SOURCE]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 100, - range: 3, - ops: 100, - duration: [100, 200, 300, 400, 500] - }, - [exports.PWR_SHIELD]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - effect: [5000, 10000, 15000, 20000, 25000], - duration: 50, - cooldown: 20, - energy: 100, - }, - [exports.PWR_REGEN_SOURCE]: { - className: exports.POWER_CLASS.OPERATOR, - level: [10, 11, 12, 14, 22], - cooldown: 100, - duration: 300, - range: 3, - effect: [50,100,150,200,250], - period: 15 - }, - [exports.PWR_REGEN_MINERAL]: { - className: exports.POWER_CLASS.OPERATOR, - level: [10, 11, 12, 14, 22], - cooldown: 100, - duration: 100, - range: 3, - effect: [2,4,6,8,10], - period: 10 - }, - [exports.PWR_DISRUPT_TERMINAL]: { - className: exports.POWER_CLASS.OPERATOR, - level: [20, 21, 22, 23, 24], - cooldown: 8, - duration: 10, - range: 50, - ops: [50,40,30,20,10] - - }, - [exports.PWR_FORTIFY]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 5, - range: 3, - ops: 5, - duration: [1, 2, 3, 4, 5] - }, - [exports.PWR_OPERATE_POWER]: { - className: exports.POWER_CLASS.OPERATOR, - level: [10, 11, 12, 14, 22], - cooldown: 1000, - range: 3, - duration: 800, - ops: 200, - effect: [1, 2, 3, 4, 5] - }, - [exports.PWR_OPERATE_CONTROLLER]: { - className: exports.POWER_CLASS.OPERATOR, - level: [20, 21, 22, 23, 24], - cooldown: 1000, - range: 3, - duration: 800, - ops: 200, - effect: [10, 20, 30, 40, 50] - }, - [exports.PWR_OPERATE_FACTORY]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 1000, - range: 3, - duration: 800, - ops: 100 - }, - }; diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 0ca8d2d..0000000 --- a/TODO.md +++ /dev/null @@ -1,9 +0,0 @@ -## TODO - * Continue updating Documentation - * Progress so far: Completed Game.js - * Find a way to auto-generate constants - -### API Changes - -* A lot of new constants. - diff --git a/generateConstants.js b/generateConstants.js new file mode 100644 index 0000000..053d610 --- /dev/null +++ b/generateConstants.js @@ -0,0 +1,53 @@ +#!/usr/bin/env node + +const https = require("https"); +const url = "https://raw.githubusercontent.com/screeps/common/master/lib/constants.js"; + +/** + * Fetches the constants library file from the master branch of the Screeps git repository, parses it, then generates + * and prints to stdout a file suitable for use as an autocomplete definition. + * + * USAGE: + * To dump the file contents to stdout: + * node generateConstantsFile.js + * + * @author jd0yle , + * @author CrystallDEV + */ +https.get(url, function (res) { + let body = ""; + + res.setEncoding("utf8"); + + res.on("data", data => { + body += data; + }); + + res.on("end", function () { + let fs = require("fs"); + let tmpFileName = "constants.tmp.js"; + + fs.writeFile(tmpFileName, body, function (err) { + let constants, autocompleteContent = ""; + + if (err) { + throw(err); + } + + constants = require(`./${tmpFileName}`); + + Object.keys(constants).forEach(function (key) { + autocompleteContent = `${autocompleteContent}\n\n/**\n * @constant\n * @type {${typeof constants[key]}}\n */`; + autocompleteContent = `${autocompleteContent}\nconst ${key} = ${JSON.stringify(constants[key], null, 4)};`; + }); + + console.log(autocompleteContent); + + fs.unlink(`./${tmpFileName}`, function (err) { + if (err) { + throw(err); + } + }); + }); + }); +}); \ No newline at end of file diff --git a/package.json b/package.json index 7d7b525..f3180fc 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ }, "devDependencies": {}, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "generateConstants": "node ./generateConstants.js> ./src/Global/Constants.js" }, "repository": { "type": "git", diff --git a/src/Global/Constants.js b/src/Global/Constants.js new file mode 100644 index 0000000..7ba51e5 --- /dev/null +++ b/src/Global/Constants.js @@ -0,0 +1,4013 @@ + + +/** + * @constant + * @type {number} + */ +const OK = 0; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_OWNER = -1; + +/** + * @constant + * @type {number} + */ +const ERR_NO_PATH = -2; + +/** + * @constant + * @type {number} + */ +const ERR_NAME_EXISTS = -3; + +/** + * @constant + * @type {number} + */ +const ERR_BUSY = -4; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_FOUND = -5; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_ENOUGH_ENERGY = -6; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_ENOUGH_RESOURCES = -6; + +/** + * @constant + * @type {number} + */ +const ERR_INVALID_TARGET = -7; + +/** + * @constant + * @type {number} + */ +const ERR_FULL = -8; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_IN_RANGE = -9; + +/** + * @constant + * @type {number} + */ +const ERR_INVALID_ARGS = -10; + +/** + * @constant + * @type {number} + */ +const ERR_TIRED = -11; + +/** + * @constant + * @type {number} + */ +const ERR_NO_BODYPART = -12; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_ENOUGH_EXTENSIONS = -6; + +/** + * @constant + * @type {number} + */ +const ERR_RCL_NOT_ENOUGH = -14; + +/** + * @constant + * @type {number} + */ +const ERR_GCL_NOT_ENOUGH = -15; + +/** + * @constant + * @type {number} + */ +const FIND_EXIT_TOP = 1; + +/** + * @constant + * @type {number} + */ +const FIND_EXIT_RIGHT = 3; + +/** + * @constant + * @type {number} + */ +const FIND_EXIT_BOTTOM = 5; + +/** + * @constant + * @type {number} + */ +const FIND_EXIT_LEFT = 7; + +/** + * @constant + * @type {number} + */ +const FIND_EXIT = 10; + +/** + * @constant + * @type {number} + */ +const FIND_CREEPS = 101; + +/** + * @constant + * @type {number} + */ +const FIND_MY_CREEPS = 102; + +/** + * @constant + * @type {number} + */ +const FIND_HOSTILE_CREEPS = 103; + +/** + * @constant + * @type {number} + */ +const FIND_SOURCES_ACTIVE = 104; + +/** + * @constant + * @type {number} + */ +const FIND_SOURCES = 105; + +/** + * @constant + * @type {number} + */ +const FIND_DROPPED_RESOURCES = 106; + +/** + * @constant + * @type {number} + */ +const FIND_STRUCTURES = 107; + +/** + * @constant + * @type {number} + */ +const FIND_MY_STRUCTURES = 108; + +/** + * @constant + * @type {number} + */ +const FIND_HOSTILE_STRUCTURES = 109; + +/** + * @constant + * @type {number} + */ +const FIND_FLAGS = 110; + +/** + * @constant + * @type {number} + */ +const FIND_CONSTRUCTION_SITES = 111; + +/** + * @constant + * @type {number} + */ +const FIND_MY_SPAWNS = 112; + +/** + * @constant + * @type {number} + */ +const FIND_HOSTILE_SPAWNS = 113; + +/** + * @constant + * @type {number} + */ +const FIND_MY_CONSTRUCTION_SITES = 114; + +/** + * @constant + * @type {number} + */ +const FIND_HOSTILE_CONSTRUCTION_SITES = 115; + +/** + * @constant + * @type {number} + */ +const FIND_MINERALS = 116; + +/** + * @constant + * @type {number} + */ +const FIND_NUKES = 117; + +/** + * @constant + * @type {number} + */ +const FIND_TOMBSTONES = 118; + +/** + * @constant + * @type {number} + */ +const FIND_POWER_CREEPS = 119; + +/** + * @constant + * @type {number} + */ +const FIND_MY_POWER_CREEPS = 120; + +/** + * @constant + * @type {number} + */ +const FIND_HOSTILE_POWER_CREEPS = 121; + +/** + * @constant + * @type {number} + */ +const FIND_DEPOSITS = 122; + +/** + * @constant + * @type {number} + */ +const FIND_RUINS = 123; + +/** + * @constant + * @type {number} + */ +const TOP = 1; + +/** + * @constant + * @type {number} + */ +const TOP_RIGHT = 2; + +/** + * @constant + * @type {number} + */ +const RIGHT = 3; + +/** + * @constant + * @type {number} + */ +const BOTTOM_RIGHT = 4; + +/** + * @constant + * @type {number} + */ +const BOTTOM = 5; + +/** + * @constant + * @type {number} + */ +const BOTTOM_LEFT = 6; + +/** + * @constant + * @type {number} + */ +const LEFT = 7; + +/** + * @constant + * @type {number} + */ +const TOP_LEFT = 8; + +/** + * @constant + * @type {number} + */ +const COLOR_RED = 1; + +/** + * @constant + * @type {number} + */ +const COLOR_PURPLE = 2; + +/** + * @constant + * @type {number} + */ +const COLOR_BLUE = 3; + +/** + * @constant + * @type {number} + */ +const COLOR_CYAN = 4; + +/** + * @constant + * @type {number} + */ +const COLOR_GREEN = 5; + +/** + * @constant + * @type {number} + */ +const COLOR_YELLOW = 6; + +/** + * @constant + * @type {number} + */ +const COLOR_ORANGE = 7; + +/** + * @constant + * @type {number} + */ +const COLOR_BROWN = 8; + +/** + * @constant + * @type {number} + */ +const COLOR_GREY = 9; + +/** + * @constant + * @type {number} + */ +const COLOR_WHITE = 10; + +/** + * @constant + * @type {string} + */ +const LOOK_CREEPS = "creep"; + +/** + * @constant + * @type {string} + */ +const LOOK_ENERGY = "energy"; + +/** + * @constant + * @type {string} + */ +const LOOK_RESOURCES = "resource"; + +/** + * @constant + * @type {string} + */ +const LOOK_SOURCES = "source"; + +/** + * @constant + * @type {string} + */ +const LOOK_MINERALS = "mineral"; + +/** + * @constant + * @type {string} + */ +const LOOK_DEPOSITS = "deposit"; + +/** + * @constant + * @type {string} + */ +const LOOK_STRUCTURES = "structure"; + +/** + * @constant + * @type {string} + */ +const LOOK_FLAGS = "flag"; + +/** + * @constant + * @type {string} + */ +const LOOK_CONSTRUCTION_SITES = "constructionSite"; + +/** + * @constant + * @type {string} + */ +const LOOK_NUKES = "nuke"; + +/** + * @constant + * @type {string} + */ +const LOOK_TERRAIN = "terrain"; + +/** + * @constant + * @type {string} + */ +const LOOK_TOMBSTONES = "tombstone"; + +/** + * @constant + * @type {string} + */ +const LOOK_POWER_CREEPS = "powerCreep"; + +/** + * @constant + * @type {string} + */ +const LOOK_RUINS = "ruin"; + +/** + * @constant + * @type {object} + */ +const OBSTACLE_OBJECT_TYPES = [ + "spawn", + "creep", + "powerCreep", + "source", + "mineral", + "deposit", + "controller", + "constructedWall", + "extension", + "link", + "storage", + "tower", + "observer", + "powerSpawn", + "powerBank", + "lab", + "terminal", + "nuker", + "factory", + "invaderCore" +]; + +/** + * @constant + * @type {string} + */ +const MOVE = "move"; + +/** + * @constant + * @type {string} + */ +const WORK = "work"; + +/** + * @constant + * @type {string} + */ +const CARRY = "carry"; + +/** + * @constant + * @type {string} + */ +const ATTACK = "attack"; + +/** + * @constant + * @type {string} + */ +const RANGED_ATTACK = "ranged_attack"; + +/** + * @constant + * @type {string} + */ +const TOUGH = "tough"; + +/** + * @constant + * @type {string} + */ +const HEAL = "heal"; + +/** + * @constant + * @type {string} + */ +const CLAIM = "claim"; + +/** + * @constant + * @type {object} + */ +const BODYPART_COST = { + "move": 50, + "work": 100, + "attack": 80, + "carry": 50, + "heal": 250, + "ranged_attack": 150, + "tough": 10, + "claim": 600 +}; + +/** + * @constant + * @type {number} + */ +const WORLD_WIDTH = 202; + +/** + * @constant + * @type {number} + */ +const WORLD_HEIGHT = 202; + +/** + * @constant + * @type {number} + */ +const CREEP_LIFE_TIME = 1500; + +/** + * @constant + * @type {number} + */ +const CREEP_CLAIM_LIFE_TIME = 600; + +/** + * @constant + * @type {number} + */ +const CREEP_CORPSE_RATE = 0.2; + +/** + * @constant + * @type {number} + */ +const CREEP_PART_MAX_ENERGY = 125; + +/** + * @constant + * @type {number} + */ +const CARRY_CAPACITY = 50; + +/** + * @constant + * @type {number} + */ +const HARVEST_POWER = 2; + +/** + * @constant + * @type {number} + */ +const HARVEST_MINERAL_POWER = 1; + +/** + * @constant + * @type {number} + */ +const HARVEST_DEPOSIT_POWER = 1; + +/** + * @constant + * @type {number} + */ +const REPAIR_POWER = 100; + +/** + * @constant + * @type {number} + */ +const DISMANTLE_POWER = 50; + +/** + * @constant + * @type {number} + */ +const BUILD_POWER = 5; + +/** + * @constant + * @type {number} + */ +const ATTACK_POWER = 30; + +/** + * @constant + * @type {number} + */ +const UPGRADE_CONTROLLER_POWER = 1; + +/** + * @constant + * @type {number} + */ +const RANGED_ATTACK_POWER = 10; + +/** + * @constant + * @type {number} + */ +const HEAL_POWER = 12; + +/** + * @constant + * @type {number} + */ +const RANGED_HEAL_POWER = 4; + +/** + * @constant + * @type {number} + */ +const REPAIR_COST = 0.01; + +/** + * @constant + * @type {number} + */ +const DISMANTLE_COST = 0.005; + +/** + * @constant + * @type {number} + */ +const RAMPART_DECAY_AMOUNT = 300; + +/** + * @constant + * @type {number} + */ +const RAMPART_DECAY_TIME = 100; + +/** + * @constant + * @type {number} + */ +const RAMPART_HITS = 1; + +/** + * @constant + * @type {object} + */ +const RAMPART_HITS_MAX = { + "2": 300000, + "3": 1000000, + "4": 3000000, + "5": 10000000, + "6": 30000000, + "7": 100000000, + "8": 300000000 +}; + +/** + * @constant + * @type {number} + */ +const ENERGY_REGEN_TIME = 300; + +/** + * @constant + * @type {number} + */ +const ENERGY_DECAY = 1000; + +/** + * @constant + * @type {number} + */ +const SPAWN_HITS = 5000; + +/** + * @constant + * @type {number} + */ +const SPAWN_ENERGY_START = 300; + +/** + * @constant + * @type {number} + */ +const SPAWN_ENERGY_CAPACITY = 300; + +/** + * @constant + * @type {number} + */ +const CREEP_SPAWN_TIME = 3; + +/** + * @constant + * @type {number} + */ +const SPAWN_RENEW_RATIO = 1.2; + +/** + * @constant + * @type {number} + */ +const SOURCE_ENERGY_CAPACITY = 3000; + +/** + * @constant + * @type {number} + */ +const SOURCE_ENERGY_NEUTRAL_CAPACITY = 1500; + +/** + * @constant + * @type {number} + */ +const SOURCE_ENERGY_KEEPER_CAPACITY = 4000; + +/** + * @constant + * @type {number} + */ +const WALL_HITS = 1; + +/** + * @constant + * @type {number} + */ +const WALL_HITS_MAX = 300000000; + +/** + * @constant + * @type {number} + */ +const EXTENSION_HITS = 1000; + +/** + * @constant + * @type {object} + */ +const EXTENSION_ENERGY_CAPACITY = { + "0": 50, + "1": 50, + "2": 50, + "3": 50, + "4": 50, + "5": 50, + "6": 50, + "7": 100, + "8": 200 +}; + +/** + * @constant + * @type {number} + */ +const ROAD_HITS = 5000; + +/** + * @constant + * @type {number} + */ +const ROAD_WEAROUT = 1; + +/** + * @constant + * @type {number} + */ +const ROAD_WEAROUT_POWER_CREEP = 100; + +/** + * @constant + * @type {number} + */ +const ROAD_DECAY_AMOUNT = 100; + +/** + * @constant + * @type {number} + */ +const ROAD_DECAY_TIME = 1000; + +/** + * @constant + * @type {number} + */ +const LINK_HITS = 1000; + +/** + * @constant + * @type {number} + */ +const LINK_HITS_MAX = 1000; + +/** + * @constant + * @type {number} + */ +const LINK_CAPACITY = 800; + +/** + * @constant + * @type {number} + */ +const LINK_COOLDOWN = 1; + +/** + * @constant + * @type {number} + */ +const LINK_LOSS_RATIO = 0.03; + +/** + * @constant + * @type {number} + */ +const STORAGE_CAPACITY = 1000000; + +/** + * @constant + * @type {number} + */ +const STORAGE_HITS = 10000; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_SPAWN = "spawn"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_EXTENSION = "extension"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_ROAD = "road"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_WALL = "constructedWall"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_RAMPART = "rampart"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_KEEPER_LAIR = "keeperLair"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_PORTAL = "portal"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_CONTROLLER = "controller"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_LINK = "link"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_STORAGE = "storage"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_TOWER = "tower"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_OBSERVER = "observer"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_POWER_BANK = "powerBank"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_POWER_SPAWN = "powerSpawn"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_EXTRACTOR = "extractor"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_LAB = "lab"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_TERMINAL = "terminal"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_CONTAINER = "container"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_NUKER = "nuker"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_FACTORY = "factory"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_INVADER_CORE = "invaderCore"; + +/** + * @constant + * @type {object} + */ +const CONSTRUCTION_COST = { + "spawn": 15000, + "extension": 3000, + "road": 300, + "constructedWall": 1, + "rampart": 1, + "link": 5000, + "storage": 30000, + "tower": 5000, + "observer": 8000, + "powerSpawn": 100000, + "extractor": 5000, + "lab": 50000, + "terminal": 100000, + "container": 5000, + "nuker": 100000, + "factory": 100000 +}; + +/** + * @constant + * @type {number} + */ +const CONSTRUCTION_COST_ROAD_SWAMP_RATIO = 5; + +/** + * @constant + * @type {number} + */ +const CONSTRUCTION_COST_ROAD_WALL_RATIO = 150; + +/** + * @constant + * @type {object} + */ +const CONTROLLER_LEVELS = { + "1": 200, + "2": 45000, + "3": 135000, + "4": 405000, + "5": 1215000, + "6": 3645000, + "7": 10935000 +}; + +/** + * @constant + * @type {object} + */ +const CONTROLLER_STRUCTURES = { + "spawn": { + "0": 0, + "1": 1, + "2": 1, + "3": 1, + "4": 1, + "5": 1, + "6": 1, + "7": 2, + "8": 3 + }, + "extension": { + "0": 0, + "1": 0, + "2": 5, + "3": 10, + "4": 20, + "5": 30, + "6": 40, + "7": 50, + "8": 60 + }, + "link": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 2, + "6": 3, + "7": 4, + "8": 6 + }, + "road": { + "0": 2500, + "1": 2500, + "2": 2500, + "3": 2500, + "4": 2500, + "5": 2500, + "6": 2500, + "7": 2500, + "8": 2500 + }, + "constructedWall": { + "1": 0, + "2": 2500, + "3": 2500, + "4": 2500, + "5": 2500, + "6": 2500, + "7": 2500, + "8": 2500 + }, + "rampart": { + "1": 0, + "2": 2500, + "3": 2500, + "4": 2500, + "5": 2500, + "6": 2500, + "7": 2500, + "8": 2500 + }, + "storage": { + "1": 0, + "2": 0, + "3": 0, + "4": 1, + "5": 1, + "6": 1, + "7": 1, + "8": 1 + }, + "tower": { + "1": 0, + "2": 0, + "3": 1, + "4": 1, + "5": 2, + "6": 2, + "7": 3, + "8": 6 + }, + "observer": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 1 + }, + "powerSpawn": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 1 + }, + "extractor": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 1, + "7": 1, + "8": 1 + }, + "terminal": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 1, + "7": 1, + "8": 1 + }, + "lab": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 3, + "7": 6, + "8": 10 + }, + "container": { + "0": 5, + "1": 5, + "2": 5, + "3": 5, + "4": 5, + "5": 5, + "6": 5, + "7": 5, + "8": 5 + }, + "nuker": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 1 + }, + "factory": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 1, + "8": 1 + } +}; + +/** + * @constant + * @type {object} + */ +const CONTROLLER_DOWNGRADE = { + "1": 20000, + "2": 10000, + "3": 20000, + "4": 40000, + "5": 80000, + "6": 120000, + "7": 150000, + "8": 200000 +}; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_DOWNGRADE_RESTORE = 100; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_DOWNGRADE_SAFEMODE_THRESHOLD = 5000; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_CLAIM_DOWNGRADE = 300; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_RESERVE = 1; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_RESERVE_MAX = 5000; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_MAX_UPGRADE_PER_TICK = 15; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_ATTACK_BLOCKED_UPGRADE = 1000; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_NUKE_BLOCKED_UPGRADE = 200; + +/** + * @constant + * @type {number} + */ +const SAFE_MODE_DURATION = 20000; + +/** + * @constant + * @type {number} + */ +const SAFE_MODE_COOLDOWN = 50000; + +/** + * @constant + * @type {number} + */ +const SAFE_MODE_COST = 1000; + +/** + * @constant + * @type {number} + */ +const TOWER_HITS = 3000; + +/** + * @constant + * @type {number} + */ +const TOWER_CAPACITY = 1000; + +/** + * @constant + * @type {number} + */ +const TOWER_ENERGY_COST = 10; + +/** + * @constant + * @type {number} + */ +const TOWER_POWER_ATTACK = 600; + +/** + * @constant + * @type {number} + */ +const TOWER_POWER_HEAL = 400; + +/** + * @constant + * @type {number} + */ +const TOWER_POWER_REPAIR = 800; + +/** + * @constant + * @type {number} + */ +const TOWER_OPTIMAL_RANGE = 5; + +/** + * @constant + * @type {number} + */ +const TOWER_FALLOFF_RANGE = 20; + +/** + * @constant + * @type {number} + */ +const TOWER_FALLOFF = 0.75; + +/** + * @constant + * @type {number} + */ +const OBSERVER_HITS = 500; + +/** + * @constant + * @type {number} + */ +const OBSERVER_RANGE = 10; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_HITS = 2000000; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_CAPACITY_MAX = 5000; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_CAPACITY_MIN = 500; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_CAPACITY_CRIT = 0.3; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_DECAY = 5000; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_HIT_BACK = 0.5; + +/** + * @constant + * @type {number} + */ +const POWER_SPAWN_HITS = 5000; + +/** + * @constant + * @type {number} + */ +const POWER_SPAWN_ENERGY_CAPACITY = 5000; + +/** + * @constant + * @type {number} + */ +const POWER_SPAWN_POWER_CAPACITY = 100; + +/** + * @constant + * @type {number} + */ +const POWER_SPAWN_ENERGY_RATIO = 50; + +/** + * @constant + * @type {number} + */ +const EXTRACTOR_HITS = 500; + +/** + * @constant + * @type {number} + */ +const EXTRACTOR_COOLDOWN = 5; + +/** + * @constant + * @type {number} + */ +const LAB_HITS = 500; + +/** + * @constant + * @type {number} + */ +const LAB_MINERAL_CAPACITY = 3000; + +/** + * @constant + * @type {number} + */ +const LAB_ENERGY_CAPACITY = 2000; + +/** + * @constant + * @type {number} + */ +const LAB_BOOST_ENERGY = 20; + +/** + * @constant + * @type {number} + */ +const LAB_BOOST_MINERAL = 30; + +/** + * @constant + * @type {number} + */ +const LAB_COOLDOWN = 10; + +/** + * @constant + * @type {number} + */ +const LAB_REACTION_AMOUNT = 5; + +/** + * @constant + * @type {number} + */ +const LAB_UNBOOST_ENERGY = 0; + +/** + * @constant + * @type {number} + */ +const LAB_UNBOOST_MINERAL = 15; + +/** + * @constant + * @type {number} + */ +const GCL_POW = 2.4; + +/** + * @constant + * @type {number} + */ +const GCL_MULTIPLY = 1000000; + +/** + * @constant + * @type {number} + */ +const GCL_NOVICE = 3; + +/** + * @constant + * @type {object} + */ +const MODE_SIMULATION = null; + +/** + * @constant + * @type {object} + */ +const MODE_WORLD = null; + +/** + * @constant + * @type {number} + */ +const TERRAIN_MASK_WALL = 1; + +/** + * @constant + * @type {number} + */ +const TERRAIN_MASK_SWAMP = 2; + +/** + * @constant + * @type {number} + */ +const TERRAIN_MASK_LAVA = 4; + +/** + * @constant + * @type {number} + */ +const MAX_CONSTRUCTION_SITES = 100; + +/** + * @constant + * @type {number} + */ +const MAX_CREEP_SIZE = 50; + +/** + * @constant + * @type {number} + */ +const MINERAL_REGEN_TIME = 50000; + +/** + * @constant + * @type {object} + */ +const MINERAL_MIN_AMOUNT = { + "H": 35000, + "O": 35000, + "L": 35000, + "K": 35000, + "Z": 35000, + "U": 35000, + "X": 35000 +}; + +/** + * @constant + * @type {number} + */ +const MINERAL_RANDOM_FACTOR = 2; + +/** + * @constant + * @type {object} + */ +const MINERAL_DENSITY = { + "1": 15000, + "2": 35000, + "3": 70000, + "4": 100000 +}; + +/** + * @constant + * @type {object} + */ +const MINERAL_DENSITY_PROBABILITY = { + "1": 0.1, + "2": 0.5, + "3": 0.9, + "4": 1 +}; + +/** + * @constant + * @type {number} + */ +const MINERAL_DENSITY_CHANGE = 0.05; + +/** + * @constant + * @type {number} + */ +const DENSITY_LOW = 1; + +/** + * @constant + * @type {number} + */ +const DENSITY_MODERATE = 2; + +/** + * @constant + * @type {number} + */ +const DENSITY_HIGH = 3; + +/** + * @constant + * @type {number} + */ +const DENSITY_ULTRA = 4; + +/** + * @constant + * @type {number} + */ +const DEPOSIT_EXHAUST_MULTIPLY = 0.001; + +/** + * @constant + * @type {number} + */ +const DEPOSIT_EXHAUST_POW = 1.2; + +/** + * @constant + * @type {number} + */ +const DEPOSIT_DECAY_TIME = 50000; + +/** + * @constant + * @type {number} + */ +const TERMINAL_CAPACITY = 300000; + +/** + * @constant + * @type {number} + */ +const TERMINAL_HITS = 3000; + +/** + * @constant + * @type {number} + */ +const TERMINAL_SEND_COST = 0.1; + +/** + * @constant + * @type {number} + */ +const TERMINAL_MIN_SEND = 100; + +/** + * @constant + * @type {number} + */ +const TERMINAL_COOLDOWN = 10; + +/** + * @constant + * @type {number} + */ +const CONTAINER_HITS = 250000; + +/** + * @constant + * @type {number} + */ +const CONTAINER_CAPACITY = 2000; + +/** + * @constant + * @type {number} + */ +const CONTAINER_DECAY = 5000; + +/** + * @constant + * @type {number} + */ +const CONTAINER_DECAY_TIME = 100; + +/** + * @constant + * @type {number} + */ +const CONTAINER_DECAY_TIME_OWNED = 500; + +/** + * @constant + * @type {number} + */ +const NUKER_HITS = 1000; + +/** + * @constant + * @type {number} + */ +const NUKER_COOLDOWN = 100000; + +/** + * @constant + * @type {number} + */ +const NUKER_ENERGY_CAPACITY = 300000; + +/** + * @constant + * @type {number} + */ +const NUKER_GHODIUM_CAPACITY = 5000; + +/** + * @constant + * @type {number} + */ +const NUKE_LAND_TIME = 50000; + +/** + * @constant + * @type {number} + */ +const NUKE_RANGE = 10; + +/** + * @constant + * @type {object} + */ +const NUKE_DAMAGE = { + "0": 10000000, + "2": 5000000 +}; + +/** + * @constant + * @type {number} + */ +const FACTORY_HITS = 1000; + +/** + * @constant + * @type {number} + */ +const FACTORY_CAPACITY = 50000; + +/** + * @constant + * @type {number} + */ +const TOMBSTONE_DECAY_PER_PART = 5; + +/** + * @constant + * @type {number} + */ +const TOMBSTONE_DECAY_POWER_CREEP = 500; + +/** + * @constant + * @type {number} + */ +const RUIN_DECAY = 500; + +/** + * @constant + * @type {object} + */ +const RUIN_DECAY_STRUCTURES = { + "powerBank": 10 +}; + +/** + * @constant + * @type {number} + */ +const PORTAL_DECAY = 30000; + +/** + * @constant + * @type {string} + */ +const ORDER_SELL = "sell"; + +/** + * @constant + * @type {string} + */ +const ORDER_BUY = "buy"; + +/** + * @constant + * @type {number} + */ +const MARKET_FEE = 0.05; + +/** + * @constant + * @type {number} + */ +const MARKET_MAX_ORDERS = 300; + +/** + * @constant + * @type {number} + */ +const MARKET_ORDER_LIFE_TIME = 2592000000; + +/** + * @constant + * @type {number} + */ +const FLAGS_LIMIT = 10000; + +/** + * @constant + * @type {string} + */ +const SUBSCRIPTION_TOKEN = "token"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ENERGY = "energy"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_POWER = "power"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_HYDROGEN = "H"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_OXYGEN = "O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM = "U"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM = "L"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM = "K"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM = "Z"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYST = "X"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM = "G"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_SILICON = "silicon"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_METAL = "metal"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_BIOMASS = "biomass"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_MIST = "mist"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_HYDROXIDE = "OH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_KEANITE = "ZK"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_LEMERGITE = "UL"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_HYDRIDE = "UH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_OXIDE = "UO"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM_HYDRIDE = "KH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM_OXIDE = "KO"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM_HYDRIDE = "LH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM_OXIDE = "LO"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_HYDRIDE = "ZH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_OXIDE = "ZO"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM_HYDRIDE = "GH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM_OXIDE = "GO"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_ACID = "UH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_ALKALIDE = "UHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM_ACID = "KH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM_ALKALIDE = "KHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM_ACID = "LH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM_ALKALIDE = "LHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_ACID = "ZH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_ALKALIDE = "ZHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM_ACID = "GH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM_ALKALIDE = "GHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_UTRIUM_ACID = "XUH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_UTRIUM_ALKALIDE = "XUHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_KEANIUM_ACID = "XKH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_KEANIUM_ALKALIDE = "XKHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_LEMERGIUM_ACID = "XLH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE = "XLHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_ZYNTHIUM_ACID = "XZH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE = "XZHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_GHODIUM_ACID = "XGH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_GHODIUM_ALKALIDE = "XGHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_OPS = "ops"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_BAR = "utrium_bar"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM_BAR = "lemergium_bar"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_BAR = "zynthium_bar"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM_BAR = "keanium_bar"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM_MELT = "ghodium_melt"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_OXIDANT = "oxidant"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_REDUCTANT = "reductant"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_PURIFIER = "purifier"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_BATTERY = "battery"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_COMPOSITE = "composite"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CRYSTAL = "crystal"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LIQUID = "liquid"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_WIRE = "wire"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_SWITCH = "switch"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_TRANSISTOR = "transistor"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_MICROCHIP = "microchip"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CIRCUIT = "circuit"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_DEVICE = "device"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CELL = "cell"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_PHLEGM = "phlegm"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_TISSUE = "tissue"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_MUSCLE = "muscle"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ORGANOID = "organoid"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ORGANISM = "organism"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ALLOY = "alloy"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_TUBE = "tube"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_FIXTURES = "fixtures"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_FRAME = "frame"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_HYDRAULICS = "hydraulics"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_MACHINE = "machine"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CONDENSATE = "condensate"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CONCENTRATE = "concentrate"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_EXTRACT = "extract"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_SPIRIT = "spirit"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_EMANATION = "emanation"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ESSENCE = "essence"; + +/** + * @constant + * @type {object} + */ +const REACTIONS = { + "H": { + "O": "OH", + "L": "LH", + "K": "KH", + "U": "UH", + "Z": "ZH", + "G": "GH" + }, + "O": { + "H": "OH", + "L": "LO", + "K": "KO", + "U": "UO", + "Z": "ZO", + "G": "GO" + }, + "Z": { + "K": "ZK", + "H": "ZH", + "O": "ZO" + }, + "L": { + "U": "UL", + "H": "LH", + "O": "LO" + }, + "K": { + "Z": "ZK", + "H": "KH", + "O": "KO" + }, + "G": { + "H": "GH", + "O": "GO" + }, + "U": { + "L": "UL", + "H": "UH", + "O": "UO" + }, + "OH": { + "UH": "UH2O", + "UO": "UHO2", + "ZH": "ZH2O", + "ZO": "ZHO2", + "KH": "KH2O", + "KO": "KHO2", + "LH": "LH2O", + "LO": "LHO2", + "GH": "GH2O", + "GO": "GHO2" + }, + "X": { + "UH2O": "XUH2O", + "UHO2": "XUHO2", + "LH2O": "XLH2O", + "LHO2": "XLHO2", + "KH2O": "XKH2O", + "KHO2": "XKHO2", + "ZH2O": "XZH2O", + "ZHO2": "XZHO2", + "GH2O": "XGH2O", + "GHO2": "XGHO2" + }, + "ZK": { + "UL": "G" + }, + "UL": { + "ZK": "G" + }, + "LH": { + "OH": "LH2O" + }, + "ZH": { + "OH": "ZH2O" + }, + "GH": { + "OH": "GH2O" + }, + "KH": { + "OH": "KH2O" + }, + "UH": { + "OH": "UH2O" + }, + "LO": { + "OH": "LHO2" + }, + "ZO": { + "OH": "ZHO2" + }, + "KO": { + "OH": "KHO2" + }, + "UO": { + "OH": "UHO2" + }, + "GO": { + "OH": "GHO2" + }, + "LH2O": { + "X": "XLH2O" + }, + "KH2O": { + "X": "XKH2O" + }, + "ZH2O": { + "X": "XZH2O" + }, + "UH2O": { + "X": "XUH2O" + }, + "GH2O": { + "X": "XGH2O" + }, + "LHO2": { + "X": "XLHO2" + }, + "UHO2": { + "X": "XUHO2" + }, + "KHO2": { + "X": "XKHO2" + }, + "ZHO2": { + "X": "XZHO2" + }, + "GHO2": { + "X": "XGHO2" + } +}; + +/** + * @constant + * @type {object} + */ +const BOOSTS = { + "work": { + "UO": { + "harvest": 3 + }, + "UHO2": { + "harvest": 5 + }, + "XUHO2": { + "harvest": 7 + }, + "LH": { + "build": 1.5, + "repair": 1.5 + }, + "LH2O": { + "build": 1.8, + "repair": 1.8 + }, + "XLH2O": { + "build": 2, + "repair": 2 + }, + "ZH": { + "dismantle": 2 + }, + "ZH2O": { + "dismantle": 3 + }, + "XZH2O": { + "dismantle": 4 + }, + "GH": { + "upgradeController": 1.5 + }, + "GH2O": { + "upgradeController": 1.8 + }, + "XGH2O": { + "upgradeController": 2 + } + }, + "attack": { + "UH": { + "attack": 2 + }, + "UH2O": { + "attack": 3 + }, + "XUH2O": { + "attack": 4 + } + }, + "ranged_attack": { + "KO": { + "rangedAttack": 2, + "rangedMassAttack": 2 + }, + "KHO2": { + "rangedAttack": 3, + "rangedMassAttack": 3 + }, + "XKHO2": { + "rangedAttack": 4, + "rangedMassAttack": 4 + } + }, + "heal": { + "LO": { + "heal": 2, + "rangedHeal": 2 + }, + "LHO2": { + "heal": 3, + "rangedHeal": 3 + }, + "XLHO2": { + "heal": 4, + "rangedHeal": 4 + } + }, + "carry": { + "KH": { + "capacity": 2 + }, + "KH2O": { + "capacity": 3 + }, + "XKH2O": { + "capacity": 4 + } + }, + "move": { + "ZO": { + "fatigue": 2 + }, + "ZHO2": { + "fatigue": 3 + }, + "XZHO2": { + "fatigue": 4 + } + }, + "tough": { + "GO": { + "damage": 0.7 + }, + "GHO2": { + "damage": 0.5 + }, + "XGHO2": { + "damage": 0.3 + } + } +}; + +/** + * @constant + * @type {object} + */ +const REACTION_TIME = { + "OH": 20, + "ZK": 5, + "UL": 5, + "G": 5, + "UH": 10, + "UH2O": 5, + "XUH2O": 60, + "UO": 10, + "UHO2": 5, + "XUHO2": 60, + "KH": 10, + "KH2O": 5, + "XKH2O": 60, + "KO": 10, + "KHO2": 5, + "XKHO2": 60, + "LH": 15, + "LH2O": 10, + "XLH2O": 65, + "LO": 10, + "LHO2": 5, + "XLHO2": 60, + "ZH": 20, + "ZH2O": 40, + "XZH2O": 160, + "ZO": 10, + "ZHO2": 5, + "XZHO2": 60, + "GH": 10, + "GH2O": 15, + "XGH2O": 80, + "GO": 10, + "GHO2": 30, + "XGHO2": 150 +}; + +/** + * @constant + * @type {number} + */ +const PORTAL_UNSTABLE = 864000000; + +/** + * @constant + * @type {number} + */ +const PORTAL_MIN_TIMEOUT = 1036800000; + +/** + * @constant + * @type {number} + */ +const PORTAL_MAX_TIMEOUT = 1900800000; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_RESPAWN_TIME = 50000; + +/** + * @constant + * @type {number} + */ +const INVADERS_ENERGY_GOAL = 100000; + +/** + * @constant + * @type {string} + */ +const SYSTEM_USERNAME = "Screeps"; + +/** + * @constant + * @type {string} + */ +const SIGN_NOVICE_AREA = "A new Novice or Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved."; + +/** + * @constant + * @type {string} + */ +const SIGN_RESPAWN_AREA = "A new Novice or Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved."; + +/** + * @constant + * @type {string} + */ +const SIGN_PLANNED_AREA = "A new Novice or Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved."; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK = 1; + +/** + * @constant + * @type {number} + */ +const EVENT_OBJECT_DESTROYED = 2; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_CONTROLLER = 3; + +/** + * @constant + * @type {number} + */ +const EVENT_BUILD = 4; + +/** + * @constant + * @type {number} + */ +const EVENT_HARVEST = 5; + +/** + * @constant + * @type {number} + */ +const EVENT_HEAL = 6; + +/** + * @constant + * @type {number} + */ +const EVENT_REPAIR = 7; + +/** + * @constant + * @type {number} + */ +const EVENT_RESERVE_CONTROLLER = 8; + +/** + * @constant + * @type {number} + */ +const EVENT_UPGRADE_CONTROLLER = 9; + +/** + * @constant + * @type {number} + */ +const EVENT_EXIT = 10; + +/** + * @constant + * @type {number} + */ +const EVENT_POWER = 11; + +/** + * @constant + * @type {number} + */ +const EVENT_TRANSFER = 12; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_MELEE = 1; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_RANGED = 2; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_RANGED_MASS = 3; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_DISMANTLE = 4; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_HIT_BACK = 5; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_NUKE = 6; + +/** + * @constant + * @type {number} + */ +const EVENT_HEAL_TYPE_MELEE = 1; + +/** + * @constant + * @type {number} + */ +const EVENT_HEAL_TYPE_RANGED = 2; + +/** + * @constant + * @type {number} + */ +const POWER_LEVEL_MULTIPLY = 1000; + +/** + * @constant + * @type {number} + */ +const POWER_LEVEL_POW = 2; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_SPAWN_COOLDOWN = 28800000; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_DELETE_COOLDOWN = 86400000; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_MAX_LEVEL = 25; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_LIFE_TIME = 5000; + +/** + * @constant + * @type {object} + */ +const POWER_CLASS = { + "OPERATOR": "operator" +}; + +/** + * @constant + * @type {number} + */ +const PWR_GENERATE_OPS = 1; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_SPAWN = 2; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_TOWER = 3; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_STORAGE = 4; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_LAB = 5; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_EXTENSION = 6; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_OBSERVER = 7; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_TERMINAL = 8; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_SPAWN = 9; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_TOWER = 10; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_SOURCE = 11; + +/** + * @constant + * @type {number} + */ +const PWR_SHIELD = 12; + +/** + * @constant + * @type {number} + */ +const PWR_REGEN_SOURCE = 13; + +/** + * @constant + * @type {number} + */ +const PWR_REGEN_MINERAL = 14; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_TERMINAL = 15; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_POWER = 16; + +/** + * @constant + * @type {number} + */ +const PWR_FORTIFY = 17; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_CONTROLLER = 18; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_FACTORY = 19; + +/** + * @constant + * @type {number} + */ +const EFFECT_INVULNERABILITY = 1001; + +/** + * @constant + * @type {number} + */ +const EFFECT_COLLAPSE_TIMER = 1002; + +/** + * @constant + * @type {number} + */ +const INVADER_CORE_HITS = 100000; + +/** + * @constant + * @type {object} + */ +const INVADER_CORE_CREEP_SPAWN_TIME = { + "0": 0, + "1": 0, + "2": 6, + "3": 3, + "4": 2, + "5": 1 +}; + +/** + * @constant + * @type {object} + */ +const INVADER_CORE_EXPAND_TIME = { + "1": 4000, + "2": 3500, + "3": 3000, + "4": 2500, + "5": 2000 +}; + +/** + * @constant + * @type {number} + */ +const INVADER_CORE_CONTROLLER_POWER = 2; + +/** + * @constant + * @type {number} + */ +const INVADER_CORE_CONTROLLER_DOWNGRADE = 5000; + +/** + * @constant + * @type {object} + */ +const STRONGHOLD_RAMPART_HITS = { + "0": 0, + "1": 50000, + "2": 200000, + "3": 500000, + "4": 1000000, + "5": 2000000 +}; + +/** + * @constant + * @type {number} + */ +const STRONGHOLD_DECAY_TICKS = 75000; + +/** + * @constant + * @type {object} + */ +const POWER_INFO = { + "1": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 50, + "effect": [ + 1, + 2, + 4, + 6, + 8 + ] + }, + "2": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 300, + "duration": 1000, + "range": 3, + "ops": 100, + "effect": [ + 0.9, + 0.7, + 0.5, + 0.35, + 0.2 + ] + }, + "3": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 10, + "duration": 100, + "range": 3, + "ops": 10, + "effect": [ + 1.1, + 1.2, + 1.3, + 1.4, + 1.5 + ] + }, + "4": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 800, + "duration": 1000, + "range": 3, + "ops": 100, + "effect": [ + 500000, + 1000000, + 2000000, + 4000000, + 7000000 + ] + }, + "5": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 50, + "duration": 1000, + "range": 3, + "ops": 10, + "effect": [ + 2, + 4, + 6, + 8, + 10 + ] + }, + "6": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 50, + "range": 3, + "ops": 2, + "effect": [ + 0.2, + 0.4, + 0.6, + 0.8, + 1 + ] + }, + "7": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 400, + "duration": [ + 200, + 400, + 600, + 800, + 1000 + ], + "range": 3, + "ops": 10 + }, + "8": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 500, + "duration": 1000, + "range": 3, + "ops": 100, + "effect": [ + 0.9, + 0.8, + 0.7, + 0.6, + 0.5 + ] + }, + "9": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 5, + "range": 20, + "ops": 10, + "duration": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + "10": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 0, + "duration": 5, + "range": 50, + "ops": 10, + "effect": [ + 0.9, + 0.8, + 0.7, + 0.6, + 0.5 + ] + }, + "11": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 100, + "range": 3, + "ops": 100, + "duration": [ + 100, + 200, + 300, + 400, + 500 + ] + }, + "12": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "effect": [ + 5000, + 10000, + 15000, + 20000, + 25000 + ], + "duration": 50, + "cooldown": 20, + "energy": 100 + }, + "13": { + "className": "operator", + "level": [ + 10, + 11, + 12, + 14, + 22 + ], + "cooldown": 100, + "duration": 300, + "range": 3, + "effect": [ + 50, + 100, + 150, + 200, + 250 + ], + "period": 15 + }, + "14": { + "className": "operator", + "level": [ + 10, + 11, + 12, + 14, + 22 + ], + "cooldown": 100, + "duration": 100, + "range": 3, + "effect": [ + 2, + 4, + 6, + 8, + 10 + ], + "period": 10 + }, + "15": { + "className": "operator", + "level": [ + 20, + 21, + 22, + 23, + 24 + ], + "cooldown": 8, + "duration": 10, + "range": 50, + "ops": [ + 50, + 40, + 30, + 20, + 10 + ] + }, + "16": { + "className": "operator", + "level": [ + 10, + 11, + 12, + 14, + 22 + ], + "cooldown": 800, + "range": 3, + "duration": 1000, + "ops": 200, + "effect": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + "17": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 5, + "range": 3, + "ops": 5, + "duration": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + "18": { + "className": "operator", + "level": [ + 20, + 21, + 22, + 23, + 24 + ], + "cooldown": 800, + "range": 3, + "duration": 1000, + "ops": 200, + "effect": [ + 10, + 20, + 30, + 40, + 50 + ] + }, + "19": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 800, + "range": 3, + "duration": 1000, + "ops": 100 + } +}; + +/** + * @constant + * @type {object} + */ +const BODYPARTS_ALL = [ + "move", + "work", + "carry", + "attack", + "ranged_attack", + "tough", + "heal", + "claim" +]; + +/** + * @constant + * @type {object} + */ +const RESOURCES_ALL = [ + "energy", + "power", + "H", + "O", + "U", + "K", + "L", + "Z", + "X", + "G", + "OH", + "ZK", + "UL", + "UH", + "UO", + "KH", + "KO", + "LH", + "LO", + "ZH", + "ZO", + "GH", + "GO", + "UH2O", + "UHO2", + "KH2O", + "KHO2", + "LH2O", + "LHO2", + "ZH2O", + "ZHO2", + "GH2O", + "GHO2", + "XUH2O", + "XUHO2", + "XKH2O", + "XKHO2", + "XLH2O", + "XLHO2", + "XZH2O", + "XZHO2", + "XGH2O", + "XGHO2", + "ops", + "silicon", + "metal", + "biomass", + "mist", + "utrium_bar", + "lemergium_bar", + "zynthium_bar", + "keanium_bar", + "ghodium_melt", + "oxidant", + "reductant", + "purifier", + "battery", + "composite", + "crystal", + "liquid", + "wire", + "switch", + "transistor", + "microchip", + "circuit", + "device", + "cell", + "phlegm", + "tissue", + "muscle", + "organoid", + "organism", + "alloy", + "tube", + "fixtures", + "frame", + "hydraulics", + "machine", + "condensate", + "concentrate", + "extract", + "spirit", + "emanation", + "essence" +]; + +/** + * @constant + * @type {object} + */ +const COLORS_ALL = [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 +]; + +/** + * @constant + * @type {object} + */ +const INTERSHARD_RESOURCES = [ + "token" +]; + +/** + * @constant + * @type {object} + */ +const COMMODITIES = { + "utrium_bar": { + "amount": 100, + "cooldown": 20, + "components": { + "U": 500, + "energy": 200 + } + }, + "U": { + "amount": 500, + "cooldown": 20, + "components": { + "utrium_bar": 100, + "energy": 200 + } + }, + "lemergium_bar": { + "amount": 100, + "cooldown": 20, + "components": { + "L": 500, + "energy": 200 + } + }, + "L": { + "amount": 500, + "cooldown": 20, + "components": { + "lemergium_bar": 100, + "energy": 200 + } + }, + "zynthium_bar": { + "amount": 100, + "cooldown": 20, + "components": { + "Z": 500, + "energy": 200 + } + }, + "Z": { + "amount": 500, + "cooldown": 20, + "components": { + "zynthium_bar": 100, + "energy": 200 + } + }, + "keanium_bar": { + "amount": 100, + "cooldown": 20, + "components": { + "K": 500, + "energy": 200 + } + }, + "K": { + "amount": 500, + "cooldown": 20, + "components": { + "keanium_bar": 100, + "energy": 200 + } + }, + "ghodium_melt": { + "amount": 100, + "cooldown": 20, + "components": { + "G": 500, + "energy": 200 + } + }, + "G": { + "amount": 500, + "cooldown": 20, + "components": { + "ghodium_melt": 100, + "energy": 200 + } + }, + "oxidant": { + "amount": 100, + "cooldown": 20, + "components": { + "O": 500, + "energy": 200 + } + }, + "O": { + "amount": 500, + "cooldown": 20, + "components": { + "oxidant": 100, + "energy": 200 + } + }, + "reductant": { + "amount": 100, + "cooldown": 20, + "components": { + "H": 500, + "energy": 200 + } + }, + "H": { + "amount": 500, + "cooldown": 20, + "components": { + "reductant": 100, + "energy": 200 + } + }, + "purifier": { + "amount": 100, + "cooldown": 20, + "components": { + "X": 500, + "energy": 200 + } + }, + "X": { + "amount": 500, + "cooldown": 20, + "components": { + "purifier": 100, + "energy": 200 + } + }, + "battery": { + "amount": 50, + "cooldown": 10, + "components": { + "energy": 600 + } + }, + "energy": { + "amount": 500, + "cooldown": 10, + "components": { + "battery": 50 + } + }, + "composite": { + "level": 1, + "amount": 20, + "cooldown": 50, + "components": { + "utrium_bar": 20, + "zynthium_bar": 20, + "energy": 20 + } + }, + "crystal": { + "level": 2, + "amount": 6, + "cooldown": 21, + "components": { + "lemergium_bar": 6, + "keanium_bar": 6, + "purifier": 6, + "energy": 45 + } + }, + "liquid": { + "level": 3, + "amount": 12, + "cooldown": 60, + "components": { + "oxidant": 12, + "reductant": 12, + "ghodium_melt": 12, + "energy": 90 + } + }, + "wire": { + "amount": 20, + "cooldown": 8, + "components": { + "utrium_bar": 20, + "silicon": 100, + "energy": 40 + } + }, + "switch": { + "level": 1, + "amount": 5, + "cooldown": 70, + "components": { + "wire": 40, + "oxidant": 95, + "utrium_bar": 35, + "energy": 20 + } + }, + "transistor": { + "level": 2, + "amount": 1, + "cooldown": 59, + "components": { + "switch": 4, + "wire": 15, + "reductant": 85, + "energy": 8 + } + }, + "microchip": { + "level": 3, + "amount": 1, + "cooldown": 250, + "components": { + "transistor": 2, + "composite": 50, + "wire": 117, + "purifier": 25, + "energy": 16 + } + }, + "circuit": { + "level": 4, + "amount": 1, + "cooldown": 800, + "components": { + "microchip": 1, + "transistor": 5, + "switch": 4, + "oxidant": 115, + "energy": 32 + } + }, + "device": { + "level": 5, + "amount": 1, + "cooldown": 600, + "components": { + "circuit": 1, + "microchip": 3, + "crystal": 110, + "ghodium_melt": 150, + "energy": 64 + } + }, + "cell": { + "amount": 20, + "cooldown": 8, + "components": { + "lemergium_bar": 20, + "biomass": 100, + "energy": 40 + } + }, + "phlegm": { + "level": 1, + "amount": 2, + "cooldown": 35, + "components": { + "cell": 20, + "oxidant": 36, + "lemergium_bar": 16, + "energy": 8 + } + }, + "tissue": { + "level": 2, + "amount": 2, + "cooldown": 164, + "components": { + "phlegm": 10, + "cell": 10, + "reductant": 110, + "energy": 16 + } + }, + "muscle": { + "level": 3, + "amount": 1, + "cooldown": 250, + "components": { + "tissue": 3, + "phlegm": 3, + "zynthium_bar": 50, + "reductant": 50, + "energy": 16 + } + }, + "organoid": { + "level": 4, + "amount": 1, + "cooldown": 800, + "components": { + "muscle": 1, + "tissue": 5, + "purifier": 208, + "oxidant": 256, + "energy": 32 + } + }, + "organism": { + "level": 5, + "amount": 1, + "cooldown": 600, + "components": { + "organoid": 1, + "liquid": 150, + "tissue": 6, + "cell": 310, + "energy": 64 + } + }, + "alloy": { + "amount": 20, + "cooldown": 8, + "components": { + "zynthium_bar": 20, + "metal": 100, + "energy": 40 + } + }, + "tube": { + "level": 1, + "amount": 2, + "cooldown": 45, + "components": { + "alloy": 40, + "zynthium_bar": 16, + "energy": 8 + } + }, + "fixtures": { + "level": 2, + "amount": 1, + "cooldown": 115, + "components": { + "composite": 20, + "alloy": 41, + "oxidant": 161, + "energy": 8 + } + }, + "frame": { + "level": 3, + "amount": 1, + "cooldown": 125, + "components": { + "fixtures": 2, + "tube": 4, + "reductant": 330, + "zynthium_bar": 31, + "energy": 16 + } + }, + "hydraulics": { + "level": 4, + "amount": 1, + "cooldown": 800, + "components": { + "liquid": 150, + "fixtures": 3, + "tube": 15, + "purifier": 208, + "energy": 32 + } + }, + "machine": { + "level": 5, + "amount": 1, + "cooldown": 600, + "components": { + "hydraulics": 1, + "frame": 2, + "fixtures": 3, + "tube": 12, + "energy": 64 + } + }, + "condensate": { + "amount": 20, + "cooldown": 8, + "components": { + "keanium_bar": 20, + "mist": 100, + "energy": 40 + } + }, + "concentrate": { + "level": 1, + "amount": 3, + "cooldown": 41, + "components": { + "condensate": 30, + "keanium_bar": 15, + "reductant": 54, + "energy": 12 + } + }, + "extract": { + "level": 2, + "amount": 2, + "cooldown": 128, + "components": { + "concentrate": 10, + "condensate": 30, + "oxidant": 60, + "energy": 16 + } + }, + "spirit": { + "level": 3, + "amount": 1, + "cooldown": 200, + "components": { + "extract": 2, + "concentrate": 6, + "reductant": 90, + "purifier": 20, + "energy": 16 + } + }, + "emanation": { + "level": 4, + "amount": 1, + "cooldown": 800, + "components": { + "spirit": 2, + "extract": 2, + "concentrate": 3, + "keanium_bar": 112, + "energy": 32 + } + }, + "essence": { + "level": 5, + "amount": 1, + "cooldown": 600, + "components": { + "emanation": 1, + "spirit": 3, + "crystal": 110, + "ghodium_melt": 150, + "energy": 64 + } + } +};