Improved harvester behaviour, reworked the job register system and added auto roadbuilding.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
const jobHarvester = require("JobHarvester");
|
||||
|
||||
module.exports = {
|
||||
setup: function () {
|
||||
Creep.prototype = _Creep.prototype;
|
||||
@@ -9,8 +11,23 @@ const Role = {
|
||||
HARVESTER: 0
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setup: function () { Creep.prototype = _Creep.prototype; }
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
class _Creep extends Creep {}
|
||||
if(this.ticksToLive == 10)
|
||||
this.room.memory.jobs.push(this.memory.job);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user