old source files of 2018-2020.

This commit is contained in:
Douwe Ravers
2022-04-15 14:29:07 +02:00
parent 0985358150
commit 85215ebd97
20 changed files with 676 additions and 795 deletions

42
main.js
View File

@@ -1,35 +1,21 @@
/* ######################
# Screeps 2022 #
######################*/
const spawns = require("spawns");
const creeps = require("creeps");
const towers = require("towers");
const ai_main = require("ai_main");
const system = require("system");
var controller_spawns = require("controller_spawns");
var controller_creeps = require("controller_creeps");
var controller_towers = require("controller_towers");
var ai_main = require("ai_main");
module.exports.loop = function () {
// New system
if (global.started == undefined) {
console.log("Recompiled...");
global.started = true;
system.start();
}
system.update();
// Old system
ai_main.run();
towers.run();
spawns.run();
if (Game.time % 60 == 0) {
clear_dead_creeps_from_memory();
}
ai_main.run_front();
controller_creeps.run();
controller_towers.run();
controller_spawns.run();
if (Game.time % 60 == 30) clear_dead_creeps_from_memory();
ai_main.run_back();
}
/*
GLOBAL FUNCTIONS
*/
function clear_dead_creeps_from_memory() {
for (var cr in Memory.creeps) {
@@ -37,4 +23,4 @@ function clear_dead_creeps_from_memory() {
delete (Memory.creeps[cr]);
}
}
}
}