From 0474990ae3c1b3745cc7bd6dd83f69c2f574f4de Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Mon, 29 Apr 2024 13:03:37 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20dprint=20fmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/screeps-arena/arena/index.d.ts | 1 - .../capture_the_flag/advanced.d.ts | 2 +- .../advanced/prototypes/body-part.d.ts | 3 +- .../advanced/prototypes/flag.d.ts | 4 +- .../season_alpha/capture_the_flag/basic.d.ts | 2 +- .../basic/prototypes/body-part.d.ts | 3 +- .../basic/prototypes/flag.d.ts | 4 +- .../season_alpha/capture_the_flag/index.d.ts | 2 +- .../collect_and_control/advanced.d.ts | 2 +- .../advanced/constants.d.ts | 12 +- .../advanced/prototypes/area-effect.d.ts | 13 +- .../advanced/prototypes/score-collector.d.ts | 2 +- .../collect_and_control/basic.d.ts | 2 +- .../collect_and_control/basic/constants.d.ts | 8 +- .../basic/prototypes/area-effect.d.ts | 12 +- .../basic/prototypes/score-collector.d.ts | 2 +- .../arena/season_alpha/index.d.ts | 1 - types/screeps-arena/game/constants.d.ts | 38 +- types/screeps-arena/game/index.d.ts | 2 - types/screeps-arena/game/path-finder.d.ts | 2 +- .../screeps-arena/game/prototypes/creep.d.ts | 182 ++++----- .../game/prototypes/game-object.d.ts | 4 +- .../screeps-arena/game/prototypes/index.d.ts | 1 - .../game/prototypes/owned-structure.d.ts | 1 - .../screeps-arena/game/prototypes/spawn.d.ts | 11 +- .../game/prototypes/structure.d.ts | 2 +- .../screeps-arena/game/prototypes/tower.d.ts | 26 +- types/screeps-arena/game/utils.d.ts | 357 +++++++++--------- types/screeps-arena/game/visual.d.ts | 3 +- types/screeps-arena/package.json | 2 +- .../screeps-arena/test/screeps-arena-tests.ts | 14 +- 31 files changed, 366 insertions(+), 354 deletions(-) diff --git a/types/screeps-arena/arena/index.d.ts b/types/screeps-arena/arena/index.d.ts index 4d366c23897139..2a0395f73d5827 100644 --- a/types/screeps-arena/arena/index.d.ts +++ b/types/screeps-arena/arena/index.d.ts @@ -1,5 +1,4 @@ /// declare module "arena" { - } diff --git a/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced.d.ts b/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced.d.ts index e4f8a49c209723..5e5e3638e408af 100644 --- a/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced.d.ts +++ b/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced.d.ts @@ -4,4 +4,4 @@ declare module "arena/season_alpha/capture_the_flag/advanced" { export * from "arena/season_alpha/capture_the_flag/advanced/prototypes"; // export * from "arena/season_alpha/capture_the_flag/advanced/constants"; // missing too -} \ No newline at end of file +} diff --git a/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced/prototypes/body-part.d.ts b/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced/prototypes/body-part.d.ts index 9ed75885b566ca..62607fa7cfae2a 100644 --- a/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced/prototypes/body-part.d.ts +++ b/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced/prototypes/body-part.d.ts @@ -2,11 +2,10 @@ /// declare module "arena/season_alpha/capture_the_flag/advanced/prototypes" { - import {BodyPartType, GameObject} from "game/prototypes"; + import { BodyPartType, GameObject } from "game/prototypes"; /** A separate part of creep body */ export class BodyPart extends GameObject { - /** The type of the body part */ type: BodyPartType; diff --git a/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced/prototypes/flag.d.ts b/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced/prototypes/flag.d.ts index 69efba33d4e571..d7c787cf5913bb 100644 --- a/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced/prototypes/flag.d.ts +++ b/types/screeps-arena/arena/season_alpha/capture_the_flag/advanced/prototypes/flag.d.ts @@ -1,11 +1,11 @@ /// declare module "arena/season_alpha/capture_the_flag/advanced/prototypes" { - import {GameObject} from "game/prototypes"; + import { GameObject } from "game/prototypes"; /** A flag is a key game object for this arena. Capture all flags to win the game */ export class Flag extends GameObject { /** Equals to true or false if the flag is owned. Returns undefined if it is neutral */ - readonly my?: boolean + readonly my?: boolean; } } diff --git a/types/screeps-arena/arena/season_alpha/capture_the_flag/basic.d.ts b/types/screeps-arena/arena/season_alpha/capture_the_flag/basic.d.ts index 83c6bca9263669..9bacbb4de1869c 100644 --- a/types/screeps-arena/arena/season_alpha/capture_the_flag/basic.d.ts +++ b/types/screeps-arena/arena/season_alpha/capture_the_flag/basic.d.ts @@ -4,4 +4,4 @@ declare module "arena/season_alpha/capture_the_flag/basic" { export * from "arena/season_alpha/capture_the_flag/basic/prototypes"; // export * from "arena/season_alpha/capture_the_flag/basic/constants"; // looks like file's missing -} \ No newline at end of file +} diff --git a/types/screeps-arena/arena/season_alpha/capture_the_flag/basic/prototypes/body-part.d.ts b/types/screeps-arena/arena/season_alpha/capture_the_flag/basic/prototypes/body-part.d.ts index 88e61631010a63..ce884a48695d6b 100644 --- a/types/screeps-arena/arena/season_alpha/capture_the_flag/basic/prototypes/body-part.d.ts +++ b/types/screeps-arena/arena/season_alpha/capture_the_flag/basic/prototypes/body-part.d.ts @@ -2,11 +2,10 @@ /// declare module "arena/season_alpha/capture_the_flag/basic/prototypes" { - import {BodyPartType, GameObject} from "game/prototypes"; + import { BodyPartType, GameObject } from "game/prototypes"; /** A separate part of creep body */ export class BodyPart extends GameObject { - /** The type of the body part */ readonly type: BodyPartType; diff --git a/types/screeps-arena/arena/season_alpha/capture_the_flag/basic/prototypes/flag.d.ts b/types/screeps-arena/arena/season_alpha/capture_the_flag/basic/prototypes/flag.d.ts index a9b91dd013155f..e912861ccf1f5c 100644 --- a/types/screeps-arena/arena/season_alpha/capture_the_flag/basic/prototypes/flag.d.ts +++ b/types/screeps-arena/arena/season_alpha/capture_the_flag/basic/prototypes/flag.d.ts @@ -1,11 +1,11 @@ /// declare module "arena/season_alpha/capture_the_flag/basic/prototypes" { - import {GameObject} from "game/prototypes"; + import { GameObject } from "game/prototypes"; /** A flag is a key game object for this arena. Capture all flags to win the game */ export class Flag extends GameObject { /** Equals to true or false if the flag is owned. Returns undefined if it is neutral */ - readonly my?: boolean + readonly my?: boolean; } } diff --git a/types/screeps-arena/arena/season_alpha/capture_the_flag/index.d.ts b/types/screeps-arena/arena/season_alpha/capture_the_flag/index.d.ts index 5f70086a634d6e..851409911f3756 100644 --- a/types/screeps-arena/arena/season_alpha/capture_the_flag/index.d.ts +++ b/types/screeps-arena/arena/season_alpha/capture_the_flag/index.d.ts @@ -1,2 +1,2 @@ /// -/// \ No newline at end of file +/// diff --git a/types/screeps-arena/arena/season_alpha/collect_and_control/advanced.d.ts b/types/screeps-arena/arena/season_alpha/collect_and_control/advanced.d.ts index a1f77bcf4419b4..5a02b73923eadd 100644 --- a/types/screeps-arena/arena/season_alpha/collect_and_control/advanced.d.ts +++ b/types/screeps-arena/arena/season_alpha/collect_and_control/advanced.d.ts @@ -5,4 +5,4 @@ declare module "arena/season_alpha/collect_and_control/advanced" { export * from "arena/season_alpha/collect_and_control/advanced/prototypes"; export * from "arena/season_alpha/collect_and_control/advanced/constants"; -} \ No newline at end of file +} diff --git a/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/constants.d.ts b/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/constants.d.ts index f1998955a6c8d0..b8058280505b01 100644 --- a/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/constants.d.ts +++ b/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/constants.d.ts @@ -1,8 +1,8 @@ declare module "arena/season_alpha/collect_and_control/advanced/constants" { - export const RESOURCE_SCORE_X = 'score_x'; - export const RESOURCE_SCORE_Y = 'score_y'; - export const RESOURCE_SCORE_Z = 'score_z'; - export const EFFECT_FREEZE = 'freeze'; - export const EFFECT_HEAL = 'heal'; - export const EFFECT_DAMAGE = 'damage'; + export const RESOURCE_SCORE_X = "score_x"; + export const RESOURCE_SCORE_Y = "score_y"; + export const RESOURCE_SCORE_Z = "score_z"; + export const EFFECT_FREEZE = "freeze"; + export const EFFECT_HEAL = "heal"; + export const EFFECT_DAMAGE = "damage"; } diff --git a/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/prototypes/area-effect.d.ts b/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/prototypes/area-effect.d.ts index 9bed9ea6776284..e507943cfdd3f1 100644 --- a/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/prototypes/area-effect.d.ts +++ b/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/prototypes/area-effect.d.ts @@ -1,15 +1,18 @@ /// /// - declare module "arena/season_alpha/collect_and_control/advanced/prototypes" { import { GameObject } from "game/prototypes"; - import { EFFECT_FREEZE, EFFECT_DAMAGE, EFFECT_HEAL } from "arena/season_alpha/collect_and_control/advanced/constants"; + import { + EFFECT_DAMAGE, + EFFECT_FREEZE, + EFFECT_HEAL, + } from "arena/season_alpha/collect_and_control/advanced/constants"; type AreaEffectType = - typeof EFFECT_FREEZE | - typeof EFFECT_DAMAGE | - typeof EFFECT_HEAL; + | typeof EFFECT_FREEZE + | typeof EFFECT_DAMAGE + | typeof EFFECT_HEAL; /** An object that applies an effect of the specified type to all creeps at the same time */ export class AreaEffect extends GameObject { diff --git a/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/prototypes/score-collector.d.ts b/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/prototypes/score-collector.d.ts index cf8d86c8304392..a54567c8c29e5b 100644 --- a/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/prototypes/score-collector.d.ts +++ b/types/screeps-arena/arena/season_alpha/collect_and_control/advanced/prototypes/score-collector.d.ts @@ -2,7 +2,7 @@ /// declare module "arena/season_alpha/collect_and_control/advanced/prototypes" { - import {GameObject, ResourceType} from "game/prototypes"; + import { GameObject, ResourceType } from "game/prototypes"; /** Key game object for this arena. Transfer the corresponding resource to the collector to win the game */ export class ScoreCollector extends GameObject { diff --git a/types/screeps-arena/arena/season_alpha/collect_and_control/basic.d.ts b/types/screeps-arena/arena/season_alpha/collect_and_control/basic.d.ts index 27977adbcab45c..b50eb1646eb966 100644 --- a/types/screeps-arena/arena/season_alpha/collect_and_control/basic.d.ts +++ b/types/screeps-arena/arena/season_alpha/collect_and_control/basic.d.ts @@ -5,4 +5,4 @@ declare module "arena/season_alpha/collect_and_control/basic" { export * from "arena/season_alpha/collect_and_control/basic/prototypes"; export * from "arena/season_alpha/collect_and_control/basic/constants"; -} \ No newline at end of file +} diff --git a/types/screeps-arena/arena/season_alpha/collect_and_control/basic/constants.d.ts b/types/screeps-arena/arena/season_alpha/collect_and_control/basic/constants.d.ts index 8f9eaf836ce499..45aa21489cddef 100644 --- a/types/screeps-arena/arena/season_alpha/collect_and_control/basic/constants.d.ts +++ b/types/screeps-arena/arena/season_alpha/collect_and_control/basic/constants.d.ts @@ -1,6 +1,6 @@ declare module "arena/season_alpha/collect_and_control/basic/constants" { - export const RESOURCE_SCORE = 'score'; - export const EFFECT_FREEZE = 'freeze'; - export const EFFECT_HEAL = 'heal'; - export const EFFECT_DAMAGE = 'damage'; + export const RESOURCE_SCORE = "score"; + export const EFFECT_FREEZE = "freeze"; + export const EFFECT_HEAL = "heal"; + export const EFFECT_DAMAGE = "damage"; } diff --git a/types/screeps-arena/arena/season_alpha/collect_and_control/basic/prototypes/area-effect.d.ts b/types/screeps-arena/arena/season_alpha/collect_and_control/basic/prototypes/area-effect.d.ts index 9f3f3df296f427..8d3e44658e8d3a 100644 --- a/types/screeps-arena/arena/season_alpha/collect_and_control/basic/prototypes/area-effect.d.ts +++ b/types/screeps-arena/arena/season_alpha/collect_and_control/basic/prototypes/area-effect.d.ts @@ -2,12 +2,16 @@ declare module "arena/season_alpha/collect_and_control/basic/prototypes" { import { GameObject } from "game/prototypes"; - import { EFFECT_FREEZE, EFFECT_DAMAGE, EFFECT_HEAL } from "arena/season_alpha/collect_and_control/advanced/constants"; // doesn't seem right + import { + EFFECT_DAMAGE, + EFFECT_FREEZE, + EFFECT_HEAL, + } from "arena/season_alpha/collect_and_control/advanced/constants"; // doesn't seem right type AreaEffectType = - typeof EFFECT_FREEZE | - typeof EFFECT_DAMAGE | - typeof EFFECT_HEAL; + | typeof EFFECT_FREEZE + | typeof EFFECT_DAMAGE + | typeof EFFECT_HEAL; /** An object that applies an effect of the specified type to all creeps at the same time */ export class AreaEffect extends GameObject { diff --git a/types/screeps-arena/arena/season_alpha/collect_and_control/basic/prototypes/score-collector.d.ts b/types/screeps-arena/arena/season_alpha/collect_and_control/basic/prototypes/score-collector.d.ts index fb71eb93a36594..4d90d0bd99955f 100644 --- a/types/screeps-arena/arena/season_alpha/collect_and_control/basic/prototypes/score-collector.d.ts +++ b/types/screeps-arena/arena/season_alpha/collect_and_control/basic/prototypes/score-collector.d.ts @@ -2,7 +2,7 @@ /// declare module "arena/season_alpha/collect_and_control/basic/prototypes" { - import {GameObject, ResourceType} from "game/prototypes"; + import { GameObject, ResourceType } from "game/prototypes"; /** Key game object for this arena. Transfer the corresponding resource to the collector to win the game */ export class ScoreCollector extends GameObject { diff --git a/types/screeps-arena/arena/season_alpha/index.d.ts b/types/screeps-arena/arena/season_alpha/index.d.ts index a809df4dfac028..c7901daaa96c67 100644 --- a/types/screeps-arena/arena/season_alpha/index.d.ts +++ b/types/screeps-arena/arena/season_alpha/index.d.ts @@ -2,5 +2,4 @@ /// declare module "arena/season-alpha" { - } diff --git a/types/screeps-arena/game/constants.d.ts b/types/screeps-arena/game/constants.d.ts index 547b653053e9fc..fd854391359f48 100644 --- a/types/screeps-arena/game/constants.d.ts +++ b/types/screeps-arena/game/constants.d.ts @@ -15,13 +15,13 @@ declare module "game/constants" { export const ERR_NO_BODYPART = -12; export const ERR_NOT_ENOUGH_EXTENSIONS = -6; - export const MOVE = 'move'; - export const RANGED_ATTACK = 'ranged_attack'; - export const HEAL = 'heal'; - export const ATTACK = 'attack'; - export const CARRY = 'carry'; - export const TOUGH = 'tough'; - export const WORK = 'work'; + export const MOVE = "move"; + export const RANGED_ATTACK = "ranged_attack"; + export const HEAL = "heal"; + export const ATTACK = "attack"; + export const CARRY = "carry"; + export const TOUGH = "tough"; + export const WORK = "work"; export const TOP = 1; export const TOP_RIGHT = 2; @@ -40,10 +40,10 @@ declare module "game/constants" { export const RANGED_ATTACK_POWER = 10; export const RANGED_ATTACK_DISTANCE_RATE: { - 0: 1, - 1: 1, - 2: 0.4, - 3: 0.1 + 0: 1; + 1: 1; + 2: 0.4; + 3: 0.1; }; export const ATTACK_POWER = 30; export const HEAL_POWER = 12; @@ -56,7 +56,7 @@ declare module "game/constants" { export const HARVEST_POWER = 2; export const BUILD_POWER = 5; - export const OBSTACLE_OBJECT_TYPES: ['creep', 'tower', 'constructedWall' ,'spawn' ,'extension' ,'link']; + export const OBSTACLE_OBJECT_TYPES: ["creep", "tower", "constructedWall", "spawn", "extension", "link"]; export const TOWER_ENERGY_COST = 10; export const TOWER_RANGE = 50; @@ -71,13 +71,13 @@ declare module "game/constants" { export const TOWER_COOLDOWN = 10; export const BODYPART_COST: { - work: 100, - move: 50, - carry: 50, - attack: 80, - ranged_attack: 150, - heal: 250, - tough: 10 + work: 100; + move: 50; + carry: 50; + attack: 80; + ranged_attack: 150; + heal: 250; + tough: 10; }; export const MAX_CREEP_SIZE = 50; diff --git a/types/screeps-arena/game/index.d.ts b/types/screeps-arena/game/index.d.ts index e636ec3b01f77b..ef68c6122965e0 100644 --- a/types/screeps-arena/game/index.d.ts +++ b/types/screeps-arena/game/index.d.ts @@ -4,7 +4,5 @@ /// /// - declare module "game" { - } diff --git a/types/screeps-arena/game/path-finder.d.ts b/types/screeps-arena/game/path-finder.d.ts index fb6a7fe44613d0..2bf4b28d10401d 100644 --- a/types/screeps-arena/game/path-finder.d.ts +++ b/types/screeps-arena/game/path-finder.d.ts @@ -74,7 +74,7 @@ declare module "game/path-finder" { clone(): CostMatrix; } - export type Goal = Position | {pos: Position, range: number}; + export type Goal = Position | { pos: Position; range: number }; /** * Find an optimal path between origin and goal. diff --git a/types/screeps-arena/game/prototypes/creep.d.ts b/types/screeps-arena/game/prototypes/creep.d.ts index 4a9f760d050651..6abb351e532ba2 100644 --- a/types/screeps-arena/game/prototypes/creep.d.ts +++ b/types/screeps-arena/game/prototypes/creep.d.ts @@ -1,128 +1,134 @@ declare module "game/prototypes" { - import { Direction, FindPathOptions, findPath } from "game/utils"; + import { Direction, findPath, FindPathOptions } from "game/utils"; import { - OK, - ERR_NOT_OWNER, - ERR_NOT_ENOUGH_RESOURCES, - ERR_INVALID_TARGET, + ATTACK, + CARRY, ERR_FULL, - ERR_NOT_IN_RANGE, ERR_INVALID_ARGS, - ERR_TIRED, + ERR_INVALID_TARGET, ERR_NO_BODYPART, - ATTACK, CARRY, HEAL, MOVE, RANGED_ATTACK, TOUGH, WORK + ERR_NOT_ENOUGH_RESOURCES, + ERR_NOT_IN_RANGE, + ERR_NOT_OWNER, + ERR_TIRED, + HEAL, + MOVE, + OK, + RANGED_ATTACK, + TOUGH, + WORK, } from "game/constants"; type BodyPartType = - typeof ATTACK | - typeof CARRY | - typeof HEAL | - typeof MOVE | - typeof RANGED_ATTACK | - typeof TOUGH | - typeof WORK; + | typeof ATTACK + | typeof CARRY + | typeof HEAL + | typeof MOVE + | typeof RANGED_ATTACK + | typeof TOUGH + | typeof WORK; type CreepAttackResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_NO_BODYPART | - typeof ERR_INVALID_TARGET | - typeof ERR_NOT_IN_RANGE; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_NO_BODYPART + | typeof ERR_INVALID_TARGET + | typeof ERR_NOT_IN_RANGE; type CreepBuildResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_NO_BODYPART | - typeof ERR_NOT_ENOUGH_RESOURCES | - typeof ERR_INVALID_TARGET | - typeof ERR_NOT_IN_RANGE; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_NO_BODYPART + | typeof ERR_NOT_ENOUGH_RESOURCES + | typeof ERR_INVALID_TARGET + | typeof ERR_NOT_IN_RANGE; type CreepDropResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_INVALID_ARGS | - typeof ERR_NOT_ENOUGH_RESOURCES; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_INVALID_ARGS + | typeof ERR_NOT_ENOUGH_RESOURCES; type CreepHarvestResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_NO_BODYPART | - typeof ERR_INVALID_TARGET | - typeof ERR_NOT_ENOUGH_RESOURCES | - typeof ERR_NOT_IN_RANGE; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_NO_BODYPART + | typeof ERR_INVALID_TARGET + | typeof ERR_NOT_ENOUGH_RESOURCES + | typeof ERR_NOT_IN_RANGE; type CreepHealResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_NO_BODYPART | - typeof ERR_INVALID_TARGET | - typeof ERR_NOT_IN_RANGE; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_NO_BODYPART + | typeof ERR_INVALID_TARGET + | typeof ERR_NOT_IN_RANGE; type CreepMoveResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_NO_BODYPART | - typeof ERR_TIRED | - typeof ERR_INVALID_ARGS; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_NO_BODYPART + | typeof ERR_TIRED + | typeof ERR_INVALID_ARGS; type CreepPickupResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_INVALID_TARGET | - typeof ERR_FULL | - typeof ERR_NOT_IN_RANGE; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_INVALID_TARGET + | typeof ERR_FULL + | typeof ERR_NOT_IN_RANGE; type CreepPullResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_NO_BODYPART | - typeof ERR_TIRED | - typeof ERR_INVALID_TARGET| - typeof ERR_NOT_IN_RANGE; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_NO_BODYPART + | typeof ERR_TIRED + | typeof ERR_INVALID_TARGET + | typeof ERR_NOT_IN_RANGE; type CreepRangedAttackResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_NO_BODYPART | - typeof ERR_INVALID_TARGET | - typeof ERR_NOT_IN_RANGE; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_NO_BODYPART + | typeof ERR_INVALID_TARGET + | typeof ERR_NOT_IN_RANGE; type CreepRangedHealResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_NO_BODYPART | - typeof ERR_INVALID_TARGET | - typeof ERR_NOT_IN_RANGE; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_NO_BODYPART + | typeof ERR_INVALID_TARGET + | typeof ERR_NOT_IN_RANGE; type CreepRangedMassAttackResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_NO_BODYPART; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_NO_BODYPART; type CreepTransferResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_INVALID_ARGS | - typeof ERR_INVALID_TARGET | - typeof ERR_NOT_IN_RANGE | - typeof ERR_FULL | - typeof ERR_NOT_ENOUGH_RESOURCES; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_INVALID_ARGS + | typeof ERR_INVALID_TARGET + | typeof ERR_NOT_IN_RANGE + | typeof ERR_FULL + | typeof ERR_NOT_ENOUGH_RESOURCES; type CreepWithdrawResult = - typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_INVALID_ARGS | - typeof ERR_INVALID_TARGET | - typeof ERR_NOT_IN_RANGE | - typeof ERR_FULL | - typeof ERR_NOT_ENOUGH_RESOURCES; + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_INVALID_ARGS + | typeof ERR_INVALID_TARGET + | typeof ERR_NOT_IN_RANGE + | typeof ERR_FULL + | typeof ERR_NOT_ENOUGH_RESOURCES; /** * Creeps are units that can move, harvest energy, construct structures, attack another creeps, and perform other actions. */ export class Creep extends GameObject { /** An array describing the creep’s body */ - body: Array<{type: BodyPartType, hits: number}>; + body: Array<{ type: BodyPartType; hits: number }>; /** The movement fatigue indicator. If it is greater than zero, the creep cannot move */ fatigue: number; @@ -147,7 +153,7 @@ declare module "game/prototypes" { * @param target The target object * @returns Either {@link OK} or one of ERR_* error codes */ - attack(target: Creep|Structure): CreepAttackResult; + attack(target: Creep | Structure): CreepAttackResult; /** * Build a structure at the target construction site using carried energy. @@ -213,7 +219,7 @@ declare module "game/prototypes" { * @param target The target object to be attacked * @returns Either {@link OK} or one of ERR_* error codes */ - rangedAttack(target: Creep|Structure): CreepRangedAttackResult; + rangedAttack(target: Creep | Structure): CreepRangedAttackResult; /** * Heal another creep at a distance. Requires the {@link HEAL} body part @@ -234,7 +240,7 @@ declare module "game/prototypes" { * @param resource One of the RESOURCE_* constants * @param amount The amount of resources to be transferred. If omitted, all the available carried amount is used */ - transfer(target: Structure|Creep, resource: ResourceType, amount?: number): CreepTransferResult; + transfer(target: Structure | Creep, resource: ResourceType, amount?: number): CreepTransferResult; /** * Withdraw resources from a structure diff --git a/types/screeps-arena/game/prototypes/game-object.d.ts b/types/screeps-arena/game/prototypes/game-object.d.ts index bafdcca96dd7c3..ea7afad2168409 100644 --- a/types/screeps-arena/game/prototypes/game-object.d.ts +++ b/types/screeps-arena/game/prototypes/game-object.d.ts @@ -1,5 +1,5 @@ declare module "game/prototypes" { - import { getObjectById, FindPathOptions, findPath } from "game/utils"; + import { findPath, FindPathOptions, getObjectById } from "game/utils"; /** Position of object in the room */ export interface Position { @@ -19,7 +19,7 @@ declare module "game/prototypes" { exists: boolean; /** The unique ID of this object that you can use in {@link getObjectById} */ - id: number|string; + id: number | string; /** If defined, then this object will disappear after this number of ticks*/ ticksToDecay?: number; diff --git a/types/screeps-arena/game/prototypes/index.d.ts b/types/screeps-arena/game/prototypes/index.d.ts index 1810061e77983f..5abbdf146bd1a0 100644 --- a/types/screeps-arena/game/prototypes/index.d.ts +++ b/types/screeps-arena/game/prototypes/index.d.ts @@ -15,5 +15,4 @@ /// declare module "game/prototypes" { - } diff --git a/types/screeps-arena/game/prototypes/owned-structure.d.ts b/types/screeps-arena/game/prototypes/owned-structure.d.ts index 431383dd59e123..3f762101f92651 100644 --- a/types/screeps-arena/game/prototypes/owned-structure.d.ts +++ b/types/screeps-arena/game/prototypes/owned-structure.d.ts @@ -1,7 +1,6 @@ declare module "game/prototypes" { /** The base prototype for a structure that has an owner */ export abstract class OwnedStructure extends Structure { - /** true for your structure, false for a hostile structure, undefined for a neutral structure */ readonly my?: boolean; } diff --git a/types/screeps-arena/game/prototypes/spawn.d.ts b/types/screeps-arena/game/prototypes/spawn.d.ts index 7bb6f32f7d8789..a8f11351681972 100644 --- a/types/screeps-arena/game/prototypes/spawn.d.ts +++ b/types/screeps-arena/game/prototypes/spawn.d.ts @@ -1,7 +1,5 @@ declare module "game/prototypes" { - import { - OK, ERR_NOT_OWNER, ERR_BUSY, ERR_INVALID_ARGS, ERR_NOT_ENOUGH_ENERGY - } from "game/constants"; + import { ERR_BUSY, ERR_INVALID_ARGS, ERR_NOT_ENOUGH_ENERGY, ERR_NOT_OWNER, OK } from "game/constants"; /** {@link createConstructionSite} call result*/ export interface SpawnCreepResult { @@ -9,7 +7,12 @@ declare module "game/prototypes" { object?: Creep | undefined; /** the error code */ - error?: typeof ERR_NOT_OWNER | typeof ERR_INVALID_ARGS | typeof ERR_NOT_ENOUGH_ENERGY | typeof ERR_BUSY | undefined; + error?: + | typeof ERR_NOT_OWNER + | typeof ERR_INVALID_ARGS + | typeof ERR_NOT_ENOUGH_ENERGY + | typeof ERR_BUSY + | undefined; } /** Details of the creep being spawned currently */ diff --git a/types/screeps-arena/game/prototypes/structure.d.ts b/types/screeps-arena/game/prototypes/structure.d.ts index adb2b172e36f86..1028179af5090e 100644 --- a/types/screeps-arena/game/prototypes/structure.d.ts +++ b/types/screeps-arena/game/prototypes/structure.d.ts @@ -7,4 +7,4 @@ declare module "game/prototypes" { /** The maximum amount of hit points of the structure */ readonly hitsMax?: number; } -} \ No newline at end of file +} diff --git a/types/screeps-arena/game/prototypes/tower.d.ts b/types/screeps-arena/game/prototypes/tower.d.ts index 0b2ca02fa4807b..54ec3c476a5f80 100644 --- a/types/screeps-arena/game/prototypes/tower.d.ts +++ b/types/screeps-arena/game/prototypes/tower.d.ts @@ -1,15 +1,17 @@ declare module "game/prototypes" { - import { OK, ERR_NOT_OWNER, ERR_TIRED, ERR_INVALID_TARGET, ERR_NOT_ENOUGH_ENERGY } from "game/constants"; - type TowerAttackResult = typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_TIRED | - typeof ERR_INVALID_TARGET | - typeof ERR_NOT_ENOUGH_ENERGY; - type TowerHealResult = typeof OK | - typeof ERR_NOT_OWNER | - typeof ERR_TIRED | - typeof ERR_INVALID_TARGET | - typeof ERR_NOT_ENOUGH_ENERGY; + import { ERR_INVALID_TARGET, ERR_NOT_ENOUGH_ENERGY, ERR_NOT_OWNER, ERR_TIRED, OK } from "game/constants"; + type TowerAttackResult = + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_TIRED + | typeof ERR_INVALID_TARGET + | typeof ERR_NOT_ENOUGH_ENERGY; + type TowerHealResult = + | typeof OK + | typeof ERR_NOT_OWNER + | typeof ERR_TIRED + | typeof ERR_INVALID_TARGET + | typeof ERR_NOT_ENOUGH_ENERGY; /** Remotely attacks game objects or heals creeps within its range */ export class StructureTower extends OwnedStructure { @@ -23,7 +25,7 @@ declare module "game/prototypes" { * Remotely attack any creep or structure in range * @param target The target object */ - attack(target: Creep|Structure): TowerAttackResult; + attack(target: Creep | Structure): TowerAttackResult; /** * Remotely heal any creep in range diff --git a/types/screeps-arena/game/utils.d.ts b/types/screeps-arena/game/utils.d.ts index fba794703aa8de..cdd9751daf00ea 100644 --- a/types/screeps-arena/game/utils.d.ts +++ b/types/screeps-arena/game/utils.d.ts @@ -1,176 +1,185 @@ declare module "game/utils" { - import { - BOTTOM, BOTTOM_LEFT, - BOTTOM_RIGHT, - ERR_FULL, - ERR_INVALID_ARGS, ERR_INVALID_TARGET, - LEFT, - RIGHT, - TERRAIN_PLAIN, - TERRAIN_SWAMP, - TERRAIN_WALL, - TOP, - TOP_LEFT, - TOP_RIGHT - } from "game/constants"; - import { SearchPathOptions, searchPath } from "game/path-finder"; - import { ConstructionSite, GameObject, Position, Structure } from "game/prototypes"; - - export type Direction = - typeof TOP | - typeof TOP_RIGHT | - typeof RIGHT | - typeof BOTTOM_RIGHT | - typeof BOTTOM | - typeof BOTTOM_LEFT | - typeof LEFT | - typeof TOP_LEFT; - export type Terrain = - typeof TERRAIN_WALL | - typeof TERRAIN_SWAMP | - typeof TERRAIN_PLAIN; - - export type DoesZapCodeSpaceFlag = 0 | 1; - export interface HeapInfo { - total_heap_size: number; - total_heap_size_executable: number; - total_physical_size: number; - total_available_size: number; - used_heap_size: number; - heap_size_limit: number; - malloced_memory: number; - peak_malloced_memory: number; - does_zap_garbage: DoesZapCodeSpaceFlag; - number_of_native_contexts: number; - number_of_detached_contexts: number; - externally_allocated_size: number; - } - - export type FindPathOptions = SearchPathOptions & { ignore?: GameObject[] }; - - /** {@link createConstructionSite} call result*/ - export interface CreateConstructionSiteResult { - /** the instance of {@link ConstructionSite} created by this call */ - object?: ConstructionSite | undefined; - - /** the error code */ - error?: typeof ERR_INVALID_ARGS | typeof ERR_INVALID_TARGET | typeof ERR_FULL | undefined; - } - - /** - * Create new {@link ConstructionSite} at the specified location. - * @param pos The location as an object with x and y properties. - * @param structurePrototype A prototype that extends {@link GameObject} - * @returns a {@link CreateConstructionSiteResult} object with the call result - */ - // eslint-disable-next-line @definitelytyped/no-unnecessary-generics - export function createConstructionSite(pos: Position, structurePrototype: { new(): T }): CreateConstructionSiteResult; - - /** - * Find a position with the shortest path from the given position - * @param fromPos The position to search from. May be {@link GameObject} or any object containing x and y properties - * @param positions The positions to search among. An array of {@link GameObject} or any objects containing x and y properties - * @param options An object containing additional pathfinding flags - * @param options.costMatrix Custom navigation cost data - * @param options.plainCost Cost for walking on plain positions. The default is 2 - * @param options.swampCost Cost for walking on swamp positions. The default is 10 - * @param options.flee Instead of searching for a path to the goals this will search for a path away from the goals. The default is false - * @param options.maxOps The maximum allowed pathfinding operations. The default value is 50000 - * @param options.maxCost The maximum allowed cost of the path returned. The default is Infinity - * @param options.heuristicWeight Weight from 1 to 9 to apply to the heuristic in the A* formula F = G + weight * H. The default value is 1.2 - * @param options.ignore objects which should not be treated as obstacles during the search - * @returns the closest object from {@link positions}, or null if there was no valid positions - */ - export function findClosestByPath(fromPos: Position, positions: T[], options?: FindPathOptions): T; - - /** - * Find a position with the shortest linear distance from the given position - * @param fromPos The position to search from. May be {@link GameObject} or any object containing x and y properties - * @param positions The positions to search among. An array of {@link GameObject} or any objects containing x and y properties - * @returns the closest object from {@link positions} - */ - export function findClosestByRange(fromPos: Position, positions: T[]): T; - - /** - * Find all objects in the specified linear range - * @param fromPos The origin position. May be {@link GameObject} or any object containing x and y properties - * @param positions The positions to search. An array of {@link GameObject} or any objects containing x and y properties - * @param range The range distance - * @returns an array with the objects found - */ - export function findInRange(fromPos: Position, positions: T[], range: number): T[]; - - /** - * Find an optimal path between fromPos and toPos. - * Unlike {@link searchPath}, findPath avoid all obstacles by default (unless costMatrix is specified). - * @param fromPos The start position. May be {@link GameObject} or any object containing x and y properties. - * @param toPos The target position. May be {@link GameObject} or any object containing x and y properties. - * @param options An object containing additional pathfinding flags - * @param options.costMatrix Custom navigation cost data - * @param options.plainCost Cost for walking on plain positions. The default is 2 - * @param options.swampCost Cost for walking on swamp positions. The default is 10 - * @param options.flee Instead of searching for a path to the goals this will search for a path away from the goals. The default is false - * @param options.maxOps The maximum allowed pathfinding operations. The default value is 50000 - * @param options.maxCost The maximum allowed cost of the path returned. The default is Infinity - * @param options.heuristicWeight Weight from 1 to 9 to apply to the heuristic in the A* formula F = G + weight * H. The default value is 1.2 - * @param options.ignore objects which should not be treated as obstacles during the search - * @returns the path found as an array of objects containing x and y properties - */ - export function findPath(fromPos: Position, toPos: Position, options?: FindPathOptions): Position[]; - - /** - * @returns CPU wall time elapsed in the current tick in nanoseconds - */ - export function getCpuTime(): number; - - /** - * Get linear direction by differences of x and y. - * @param dx The difference of X coordinate. - * @param dy The difference of Y coordinate. - * @returns a number representing one of the direction constants. - */ - export function getDirection(dx: number, dy: number): Direction; - - /** - * Use this method to get heap statistics for your virtual machine. - */ - export function getHeapStatistics(): HeapInfo; - - /** - * Get an object with the specified unique ID - * @param id The id property of the needed object. See {@link GameObject} prototype. - */ - export function getObjectById(id: string): GameObject; - - /** - * Get all game objects in the game - */ - export function getObjects(): GameObject[]; - - /** - * Get all objects in the game with the specified prototype, for example, all creeps - * @param prototype A prototype that extends {@link GameObject} - * @returns Array of objects with the specified prototype - */ - export function getObjectsByPrototype(prototype: { new(): T }): T[]; - - /** - * Get linear range between two objects. a and b may be {@link GameObject} or any object containing x and y properties - * @param a The first of two objects. May be {@link GameObject} or any object containing x and y properties. - * @param b The second of two objects. May be {@link GameObject} or any object containing x and y properties. - * @returns a number of squares between two objects - */ - export function getRange(a: Position, b: Position): number; - - /** - * Get an integer representation of the terrain at the given position. - * @param pos The position as an object containing x and y properties. - * @returns either {@link TERRAIN_PLAIN}, {@link TERRAIN_WALL}, or {@link TERRAIN_SWAMP} - */ - export function getTerrainAt(pos: Position): Terrain; - - /** - * @returns the number of ticks passed from the start of the current game. - */ - export function getTicks(): number; + import { + BOTTOM, + BOTTOM_LEFT, + BOTTOM_RIGHT, + ERR_FULL, + ERR_INVALID_ARGS, + ERR_INVALID_TARGET, + LEFT, + RIGHT, + TERRAIN_PLAIN, + TERRAIN_SWAMP, + TERRAIN_WALL, + TOP, + TOP_LEFT, + TOP_RIGHT, + } from "game/constants"; + import { searchPath, SearchPathOptions } from "game/path-finder"; + import { ConstructionSite, GameObject, Position, Structure } from "game/prototypes"; + + export type Direction = + | typeof TOP + | typeof TOP_RIGHT + | typeof RIGHT + | typeof BOTTOM_RIGHT + | typeof BOTTOM + | typeof BOTTOM_LEFT + | typeof LEFT + | typeof TOP_LEFT; + export type Terrain = + | typeof TERRAIN_WALL + | typeof TERRAIN_SWAMP + | typeof TERRAIN_PLAIN; + + export type DoesZapCodeSpaceFlag = 0 | 1; + export interface HeapInfo { + total_heap_size: number; + total_heap_size_executable: number; + total_physical_size: number; + total_available_size: number; + used_heap_size: number; + heap_size_limit: number; + malloced_memory: number; + peak_malloced_memory: number; + does_zap_garbage: DoesZapCodeSpaceFlag; + number_of_native_contexts: number; + number_of_detached_contexts: number; + externally_allocated_size: number; + } + + export type FindPathOptions = SearchPathOptions & { ignore?: GameObject[] }; + + /** {@link createConstructionSite} call result*/ + export interface CreateConstructionSiteResult { + /** the instance of {@link ConstructionSite} created by this call */ + object?: ConstructionSite | undefined; + + /** the error code */ + error?: typeof ERR_INVALID_ARGS | typeof ERR_INVALID_TARGET | typeof ERR_FULL | undefined; + } + + /** + * Create new {@link ConstructionSite} at the specified location. + * @param pos The location as an object with x and y properties. + * @param structurePrototype A prototype that extends {@link GameObject} + * @returns a {@link CreateConstructionSiteResult} object with the call result + */ + // eslint-disable-next-line @definitelytyped/no-unnecessary-generics + export function createConstructionSite( + pos: Position, + structurePrototype: { new(): T }, + ): CreateConstructionSiteResult; + + /** + * Find a position with the shortest path from the given position + * @param fromPos The position to search from. May be {@link GameObject} or any object containing x and y properties + * @param positions The positions to search among. An array of {@link GameObject} or any objects containing x and y properties + * @param options An object containing additional pathfinding flags + * @param options.costMatrix Custom navigation cost data + * @param options.plainCost Cost for walking on plain positions. The default is 2 + * @param options.swampCost Cost for walking on swamp positions. The default is 10 + * @param options.flee Instead of searching for a path to the goals this will search for a path away from the goals. The default is false + * @param options.maxOps The maximum allowed pathfinding operations. The default value is 50000 + * @param options.maxCost The maximum allowed cost of the path returned. The default is Infinity + * @param options.heuristicWeight Weight from 1 to 9 to apply to the heuristic in the A* formula F = G + weight * H. The default value is 1.2 + * @param options.ignore objects which should not be treated as obstacles during the search + * @returns the closest object from {@link positions}, or null if there was no valid positions + */ + export function findClosestByPath( + fromPos: Position, + positions: T[], + options?: FindPathOptions, + ): T; + + /** + * Find a position with the shortest linear distance from the given position + * @param fromPos The position to search from. May be {@link GameObject} or any object containing x and y properties + * @param positions The positions to search among. An array of {@link GameObject} or any objects containing x and y properties + * @returns the closest object from {@link positions} + */ + export function findClosestByRange(fromPos: Position, positions: T[]): T; + + /** + * Find all objects in the specified linear range + * @param fromPos The origin position. May be {@link GameObject} or any object containing x and y properties + * @param positions The positions to search. An array of {@link GameObject} or any objects containing x and y properties + * @param range The range distance + * @returns an array with the objects found + */ + export function findInRange(fromPos: Position, positions: T[], range: number): T[]; + + /** + * Find an optimal path between fromPos and toPos. + * Unlike {@link searchPath}, findPath avoid all obstacles by default (unless costMatrix is specified). + * @param fromPos The start position. May be {@link GameObject} or any object containing x and y properties. + * @param toPos The target position. May be {@link GameObject} or any object containing x and y properties. + * @param options An object containing additional pathfinding flags + * @param options.costMatrix Custom navigation cost data + * @param options.plainCost Cost for walking on plain positions. The default is 2 + * @param options.swampCost Cost for walking on swamp positions. The default is 10 + * @param options.flee Instead of searching for a path to the goals this will search for a path away from the goals. The default is false + * @param options.maxOps The maximum allowed pathfinding operations. The default value is 50000 + * @param options.maxCost The maximum allowed cost of the path returned. The default is Infinity + * @param options.heuristicWeight Weight from 1 to 9 to apply to the heuristic in the A* formula F = G + weight * H. The default value is 1.2 + * @param options.ignore objects which should not be treated as obstacles during the search + * @returns the path found as an array of objects containing x and y properties + */ + export function findPath(fromPos: Position, toPos: Position, options?: FindPathOptions): Position[]; + + /** + * @returns CPU wall time elapsed in the current tick in nanoseconds + */ + export function getCpuTime(): number; + + /** + * Get linear direction by differences of x and y. + * @param dx The difference of X coordinate. + * @param dy The difference of Y coordinate. + * @returns a number representing one of the direction constants. + */ + export function getDirection(dx: number, dy: number): Direction; + + /** + * Use this method to get heap statistics for your virtual machine. + */ + export function getHeapStatistics(): HeapInfo; + + /** + * Get an object with the specified unique ID + * @param id The id property of the needed object. See {@link GameObject} prototype. + */ + export function getObjectById(id: string): GameObject; + + /** + * Get all game objects in the game + */ + export function getObjects(): GameObject[]; + + /** + * Get all objects in the game with the specified prototype, for example, all creeps + * @param prototype A prototype that extends {@link GameObject} + * @returns Array of objects with the specified prototype + */ + export function getObjectsByPrototype(prototype: { new(): T }): T[]; + + /** + * Get linear range between two objects. a and b may be {@link GameObject} or any object containing x and y properties + * @param a The first of two objects. May be {@link GameObject} or any object containing x and y properties. + * @param b The second of two objects. May be {@link GameObject} or any object containing x and y properties. + * @returns a number of squares between two objects + */ + export function getRange(a: Position, b: Position): number; + + /** + * Get an integer representation of the terrain at the given position. + * @param pos The position as an object containing x and y properties. + * @returns either {@link TERRAIN_PLAIN}, {@link TERRAIN_WALL}, or {@link TERRAIN_SWAMP} + */ + export function getTerrainAt(pos: Position): Terrain; + + /** + * @returns the number of ticks passed from the start of the current game. + */ + export function getTicks(): number; } diff --git a/types/screeps-arena/game/visual.d.ts b/types/screeps-arena/game/visual.d.ts index 608b73d270d8bc..55a74ba72bf169 100644 --- a/types/screeps-arena/game/visual.d.ts +++ b/types/screeps-arena/game/visual.d.ts @@ -1,6 +1,6 @@ // test declare module "game/visual" { - import { Position, GameObject } from "game/prototypes"; // eslint-disable-line @typescript-eslint/no-unused-vars + import { GameObject, Position } from "game/prototypes"; // eslint-disable-line @typescript-eslint/no-unused-vars export type Color = string; export type LineStyle = undefined | "dashed" | "dotted"; @@ -202,4 +202,3 @@ declare module "game/visual" { text(text: string, pos: Position, style?: TextVisualStyle): Visual; } } - diff --git a/types/screeps-arena/package.json b/types/screeps-arena/package.json index 329a59a1c66abc..e8925125ff1f9a 100644 --- a/types/screeps-arena/package.json +++ b/types/screeps-arena/package.json @@ -24,4 +24,4 @@ "githubUsername": "AutumnSaury" } ] -} \ No newline at end of file +} diff --git a/types/screeps-arena/test/screeps-arena-tests.ts b/types/screeps-arena/test/screeps-arena-tests.ts index 199dfb93b80abd..b50cf157ff037f 100644 --- a/types/screeps-arena/test/screeps-arena-tests.ts +++ b/types/screeps-arena/test/screeps-arena-tests.ts @@ -2,13 +2,7 @@ import { Flag } from "arena/season_alpha/capture_the_flag/advanced"; import { ATTACK, RESOURCE_ENERGY } from "game/constants"; import { CostMatrix } from "game/path-finder"; import { Creep, Structure, StructureRampart, StructureTower } from "game/prototypes"; -import { - createConstructionSite, - findClosestByPath, - findInRange, - findPath, - getObjectsByPrototype -} from "game/utils"; +import { createConstructionSite, findClosestByPath, findInRange, findPath, getObjectsByPrototype } from "game/utils"; import { Visual } from "game/visual"; export function loop(): void { @@ -78,13 +72,13 @@ export function loop(): void { } // build a rampart - createConstructionSite({x: 10, y: 10}, StructureRampart); + createConstructionSite({ x: 10, y: 10 }, StructureRampart); // TODO: verify all buildable structure types // TODO: cSites .structure property. // TODO: test utils findXXX methods, theese methods are used by other metods. // draw a circle around the rampart - const visual = new Visual() - visual.circle({x: 10, y: 10}) // $ExpectType Visual + const visual = new Visual(); + visual.circle({ x: 10, y: 10 }); // $ExpectType Visual }