34 lines
728 B
JavaScript
34 lines
728 B
JavaScript
const jobHarvester = require("JobHarvester");
|
|
|
|
module.exports = {
|
|
setup: function () {
|
|
Creep.prototype = _Creep.prototype;
|
|
global.Role = Role;
|
|
}
|
|
}
|
|
|
|
const Role = {
|
|
HARVESTER: 0
|
|
}
|
|
|
|
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;
|
|
}
|
|
this.memory.init = true;
|
|
}
|
|
|
|
tick(){
|
|
if(!this.memory.init) this.begin();
|
|
switch (this.memory.job.role) {
|
|
case Role.HARVESTER: jobHarvester.tick(this); break;
|
|
}
|
|
|
|
if(this.ticksToLive == 10)
|
|
this.room.memory.jobs.push(this.memory.job);
|
|
}
|
|
|
|
}
|