Worker abstraction

This commit is contained in:
uwap 2022-12-22 09:51:22 +01:00
parent 57c4ac1688
commit e2e93947b5
5 changed files with 75 additions and 22 deletions

View file

@ -0,0 +1,12 @@
export const buildContainers = (room: Room) => {
if ((room.controller?.level ?? 0) < 2) {
return;
}
const sources = room.find(FIND_SOURCES);
for (const source of sources) {
room.createConstructionSite(source.pos.x - 2, source.pos.y, STRUCTURE_CONTAINER);
room.createConstructionSite(source.pos.x + 2, source.pos.y, STRUCTURE_CONTAINER);
room.createConstructionSite(source.pos.x, source.pos.y - 2, STRUCTURE_CONTAINER);
room.createConstructionSite(source.pos.x, source.pos.y + 2, STRUCTURE_CONTAINER);
}
}