Improved harvester behaviour, reworked the job register system and added auto roadbuilding.

This commit is contained in:
Douwe Ravers
2023-08-25 17:30:27 +02:00
parent 8c3528419a
commit 76650e22ac
11 changed files with 113 additions and 111 deletions

View File

@@ -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);
}
}