const jobHarvester = require("JobHarvester"); const jobMiner = require("JobMiner"); module.exports = { setup: function () { Creep.prototype = _Creep.prototype; global.Role = Role; } } const Role = { HARVESTER: 0, MINER: 1, SUPPLIER: 2, UPGRADER: 3, BUILDER: 4 } class _Creep extends Creep { begin(){ if(!this.memory.job) this.memory.job = { role: Role.HARVESTER }; switch (this.memory.job.role) { case Role.HARVESTER: jobHarvester.begin(this); break; case Role.MINER: jobMiner.begin(this); break; } this.memory.init = true; } tick(){ if(!this.memory.init) this.begin(); switch (this.memory.job.role) { case Role.HARVESTER: jobHarvester.tick(this); break; case Role.MINER: jobMiner.tick(this); break; } } }