From 57c4ac1688e21128a2b1158f29ee4deb6e16ecb7 Mon Sep 17 00:00:00 2001 From: uwap Date: Thu, 22 Dec 2022 07:37:25 +0100 Subject: [PATCH] Minor improvements --- src/RoomPlanner/Blueprints/Extensions.ts | 3 +++ src/RoomPlanner/Blueprints/Roads.ts | 3 +++ src/index.ts | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/RoomPlanner/Blueprints/Extensions.ts b/src/RoomPlanner/Blueprints/Extensions.ts index 025a295..4ce72ee 100644 --- a/src/RoomPlanner/Blueprints/Extensions.ts +++ b/src/RoomPlanner/Blueprints/Extensions.ts @@ -10,6 +10,9 @@ export const buildExtentions = (room: Room) => { 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'})) { + room.createConstructionSite(spawn.pos.x + x * 2 - 1, spawn.pos.y + y * 2 - 1, STRUCTURE_ROAD); + } room.createConstructionSite(spawn.pos.x + x * 2, spawn.pos.y + y * 2, STRUCTURE_EXTENSION); } } diff --git a/src/RoomPlanner/Blueprints/Roads.ts b/src/RoomPlanner/Blueprints/Roads.ts index 3350459..c9aa7d7 100644 --- a/src/RoomPlanner/Blueprints/Roads.ts +++ b/src/RoomPlanner/Blueprints/Roads.ts @@ -12,6 +12,9 @@ export const buildRoads = (room: Room) => { ignoreRoads: true }); for (const point of path) { + if ((point.x === source.pos.x && point.y === source.pos.y) || (point.x === source2.pos.x && point.y === source2.pos.y)) { + continue; + } room.visual.line(point.x, point.y, point.x - point.dx, point.y - point.dy); room.createConstructionSite(point.x, point.y, STRUCTURE_ROAD); } diff --git a/src/index.ts b/src/index.ts index 4c77da9..eea0273 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,6 +12,9 @@ export function loop() { if (!controller) { return; } + spawn.spawnCreep([WORK, CARRY, CARRY, MOVE], 'builder9'); + spawn.spawnCreep([WORK, CARRY, CARRY, MOVE], 'upgrader8'); + spawn.spawnCreep([WORK, CARRY, CARRY, MOVE], 'builder7'); spawn.spawnCreep([WORK, CARRY, CARRY, MOVE], 'builder6'); spawn.spawnCreep([WORK, CARRY, CARRY, MOVE], 'uprader5'); spawn.spawnCreep([WORK, CARRY, CARRY, MOVE], 'builder4'); @@ -35,7 +38,7 @@ export function loop() { buildRoads(spawn.room); } if (Game.time % 100 === 50) { - buildExtentions(spawn.room) + buildExtentions(spawn.room); } if (Game.cpu.bucket === 10000) { Game.cpu.generatePixel();