Fix typechecks
This commit is contained in:
parent
6895b94279
commit
0176c85df4
11 changed files with 35 additions and 16 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
|
@ -1,6 +1,6 @@
|
|||
[submodule "deps/Traveler"]
|
||||
path = deps/Traveler
|
||||
url = https://github.com/UndefinedCpp/Traveler.git
|
||||
url = https://github.com/screepers/Traveler.git
|
||||
[submodule "deps/screeps-packrat"]
|
||||
path = deps/screeps-packrat
|
||||
url = https://github.com/NekoKetsu/screeps-packrat.git
|
||||
|
|
|
|||
2
deps/Traveler
vendored
2
deps/Traveler
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit c65bb420704cf027161405d7edfbc06f7298494e
|
||||
Subproject commit 2fd1c0ce32ec214b93871ad4d780fd3952c8bbff
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "npx rspack build",
|
||||
"lint": "npx eslint src/",
|
||||
"lint": "npx tsc --noEmit && npx eslint src/",
|
||||
"test": "jest --passWithNoTests",
|
||||
"push": "yarn build && node ./upload.js"
|
||||
},
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
"@swc/core": "^1.15.5",
|
||||
"@swc/jest": "^0.2.39",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/lodash": "3.10.2",
|
||||
"@types/node": "^25.0.3",
|
||||
"@types/screeps-profiler": "^1.2.6",
|
||||
"@typescript-eslint/eslint-plugin": "^8.50.0",
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ export default profiler.registerFN(function (room: Room) {
|
|||
for (let i = 0; i < path.length; i++) {
|
||||
const pos = path[i];
|
||||
structures[getCoord(pos.x, pos.y)]
|
||||
= (i === path.length - 1 && "energy" in target)
|
||||
= (i === path.length - 1 && "ticksToRegeneration" in target)
|
||||
? STRUCTURE_CONTAINER
|
||||
: STRUCTURE_ROAD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ export const runRepair = profiler.registerFN(
|
|||
return TaskStatus.DONE;
|
||||
}
|
||||
|
||||
if (target != null && target.hits >= target.hitsMax) {
|
||||
return TaskStatus.DONE;
|
||||
}
|
||||
|
||||
if (target == null
|
||||
|| creep.repair(target) === ERR_NOT_IN_RANGE) {
|
||||
creep.travelTo(task.targetPos);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@ const assignTask = (creep: Creep) => {
|
|||
}
|
||||
if (creep.room.controller != null) {
|
||||
if (creep.room.controller.ticksToDowngrade > 1000) {
|
||||
const urgentRepair = creep.pos.findClosestByRange(FIND_MY_STRUCTURES, {
|
||||
filter: s => s.hits < s.hitsMax * 0.3,
|
||||
const urgentRepair = creep.pos.findClosestByRange(FIND_STRUCTURES, {
|
||||
filter: s => s.hits < s.hitsMax * 0.3 && ("my" in s
|
||||
? s.my
|
||||
: s.structureType === STRUCTURE_CONTAINER),
|
||||
});
|
||||
if (urgentRepair != null) {
|
||||
return Tasks.Repair(urgentRepair);
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ const assignTask = (creep: Creep) => {
|
|||
}
|
||||
else {
|
||||
const urgentRepair = creep.pos.findClosestByRange(FIND_STRUCTURES, {
|
||||
filter: s => "my" in s
|
||||
filter: s => ("my" in s
|
||||
? s.my
|
||||
: s.structureType === STRUCTURE_CONTAINER
|
||||
&& s.hits < s.hitsMax * 0.3,
|
||||
: s.structureType === STRUCTURE_CONTAINER)
|
||||
&& s.hits < s.hitsMax * 0.3,
|
||||
});
|
||||
if (urgentRepair != null) {
|
||||
return Tasks.Repair(urgentRepair);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
import "../deps/Traveler/Traveler.js";
|
||||
import "../deps/Traveler/index.d.ts";
|
||||
import "./Proto";
|
||||
import profiler from "screeps-profiler";
|
||||
|
||||
import { Clerk } from "./Workers/Clerk";
|
||||
import { Constructor } from "./Workers/Constructor";
|
||||
import { Miner } from "./Workers/Miner";
|
||||
import { Upgrader } from "./Workers/Upgrader";
|
||||
import { runWorkers, spawnWorkers } from "./Workers/worker";
|
||||
import "../deps/Traveler/Traveler";
|
||||
import profiler from "screeps-profiler";
|
||||
import "./Proto";
|
||||
import RoomPlanner from "./RoomPlanner";
|
||||
|
||||
const runTowers = profiler.registerFN((spawn: StructureSpawn) => {
|
||||
|
|
|
|||
3
src/types.d.ts
vendored
Normal file
3
src/types.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import lodash from "lodash";
|
||||
|
||||
declare const _ = typeof lodash;
|
||||
|
|
@ -23,10 +23,12 @@
|
|||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx"
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
"node_modules",
|
||||
"deps",
|
||||
"dist",
|
||||
]
|
||||
}
|
||||
|
|
@ -1447,6 +1447,11 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
|
||||
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
|
||||
|
||||
"@types/lodash@3.10.2":
|
||||
version "3.10.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-3.10.2.tgz#c1fbda1562ef5603c8192fe1fe65b017849d5873"
|
||||
integrity sha512-TmlYodTNhMzVzv3CK/9sXGzh31jWsRKHE3faczhVgYFCdXIRQRCOPD+0NDlR+SvJlCj914yP3q3aAupt53p2Ug==
|
||||
|
||||
"@types/mime@^1":
|
||||
version "1.3.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue