Add ESLint, Add worker utils
This commit is contained in:
parent
a64f40b6cc
commit
c026087af1
29 changed files with 3042 additions and 1734 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue