Minor improvements

This commit is contained in:
uwap 2022-12-22 07:37:25 +01:00
parent 5e6618edca
commit 57c4ac1688
3 changed files with 10 additions and 1 deletions

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -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();