Add ESLint, Add worker utils

This commit is contained in:
uwap 2025-12-21 09:48:53 +01:00
parent a64f40b6cc
commit c026087af1
29 changed files with 3042 additions and 1734 deletions

View file

@ -1,23 +1,24 @@
import { createAction, Fail, InProgress, Success } from "./Action";
import { moveTo } from "./moveTo";
export const buildConstructionSite = () => createAction('buildConstructionSite', (creep: Creep) => {
export const buildConstructionSite = () =>
createAction("buildConstructionSite", (creep: Creep) => {
const cs = creep.pos.findClosestByRange(FIND_CONSTRUCTION_SITES);
if (!cs) {
return Fail;
return Fail;
}
switch (creep.build(cs)) {
case OK: {
return InProgress;
}
case ERR_NOT_ENOUGH_RESOURCES: {
return Success;
}
case ERR_NOT_IN_RANGE: {
return moveTo(cs);
}
default: {
return Fail;
}
case OK: {
return InProgress;
}
case ERR_NOT_ENOUGH_RESOURCES: {
return Success;
}
case ERR_NOT_IN_RANGE: {
return moveTo(cs);
}
default: {
return Fail;
}
}
})
});