Simplyfied the code. Ready to rebuild on top of.
This commit is contained in:
40
system.js
40
system.js
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user