Simplyfied the code. Ready to rebuild on top of.

This commit is contained in:
unknown
2023-08-20 16:31:21 +02:00
parent 15c86d3c14
commit ae3812aa83
10 changed files with 71 additions and 137 deletions

View File

@@ -1,24 +1,26 @@
/**
* Basis of the entire system. Everything will be managed from here on out.
*/
const rooms = require("_roomsHandler")
const spawns = require("_spawnsHandler")
const creeps = require("_creepsHandler")
const commands = require("_commandHandler")
const creepClass = require("Creep");
const roomClass = require("Room");
const spawnClass = require("Spawn");
// ########################################
// ########## SYSTEM ##########
// ########################################
module.exports = {
// Gets called when recompiling and when Restart command is called.
start: function () {
rooms.start();
spawns.start();
creeps.start();
commands.start();
setup: function () {
creepClass.setup();
roomClass.setup();
spawnClass.setup();
},
// Gets called every tick.
update: function () {
rooms.update();
spawns.update();
creeps.update();
begin: function () {
Object.values(Game.rooms).forEach(room => room.begin());
Object.values(Game.creeps).forEach(creep => creep.begin());
},
tick: function () {
Object.values(Game.rooms).forEach(room => room.tick());
Object.values(Game.creeps).forEach(creep => creep.tick());
}
}
}