Allow Repairs and overhaul blueprints and creeps
This commit is contained in:
parent
f7f39bc90a
commit
365fd17b01
7 changed files with 39 additions and 8 deletions
|
|
@ -6,13 +6,18 @@ export const buildExtentions = (room: Room) => {
|
|||
const spawns = room.find(FIND_MY_SPAWNS);
|
||||
if (spawns.length < 1) return;
|
||||
const spawn = spawns[0];
|
||||
const exts = extentionsAvailable(room.controller?.level ?? 0)
|
||||
const exts = extentionsAvailable(room.controller?.level ?? 0);
|
||||
const terrain = room.getTerrain();
|
||||
for (let x = -Math.floor(Math.sqrt(exts) / 2); x < Math.sqrt(exts) / 2; x++) {
|
||||
for (let y = -Math.floor(Math.sqrt(exts) / 2); y < Math.sqrt(exts) / 2; y++) {
|
||||
room.visual.circle(spawn.pos.x + x * 2, spawn.pos.y + y * 2);
|
||||
if (!room.lookAt(spawn.pos.x + x * 2 - 1, spawn.pos.y + y * 2 - 1).includes({ type: 'terrain', terrain: 'wall'})) {
|
||||
if (terrain.get(spawn.pos.x + x * 2 - 1, spawn.pos.y + y * 2 - 1) !== TERRAIN_MASK_WALL) {
|
||||
room.createConstructionSite(spawn.pos.x + x * 2 - 1, spawn.pos.y + y * 2 - 1, STRUCTURE_ROAD);
|
||||
}
|
||||
if (terrain.get(spawn.pos.x + x * 2, spawn.pos.y + y * 2 - 1) !== TERRAIN_MASK_WALL) {
|
||||
room.createConstructionSite(spawn.pos.x + x * 2, spawn.pos.y + y * 2 - 1, STRUCTURE_ROAD);
|
||||
}
|
||||
if (terrain.get(spawn.pos.x + x * 2 - 1, spawn.pos.y + y * 2) !== TERRAIN_MASK_WALL) {
|
||||
room.createConstructionSite(spawn.pos.x + x * 2 - 1, spawn.pos.y + y * 2, STRUCTURE_ROAD);
|
||||
}
|
||||
room.createConstructionSite(spawn.pos.x + x * 2, spawn.pos.y + y * 2, STRUCTURE_EXTENSION);
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ export const buildRoads = (room: Room) => {
|
|||
}
|
||||
const sources: _HasRoomPosition[] = room.find(FIND_SOURCES);
|
||||
const sourcesAndSpawns = sources.concat(room.find(FIND_MY_SPAWNS));
|
||||
const sourcesAndMinerals = sources.concat(room.find(FIND_MINERALS));
|
||||
room.visual.clear();
|
||||
for (const source of sourcesAndSpawns) {
|
||||
for (const source2 of sources) {
|
||||
for (const source2 of (room.controller?.level ?? 0) > 4 ? sourcesAndMinerals : sources) {
|
||||
const path = source.pos.findPathTo(source2, {
|
||||
ignoreCreeps: true,
|
||||
ignoreRoads: true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue