Skip to content

Commit

Permalink
after claiming, turn claimer to a reserver or a scout, instead of kil…
Browse files Browse the repository at this point in the history
…l it.
  • Loading branch information
XenoAmess committed Sep 8, 2022
1 parent fc4768f commit 9700015
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/role_claimer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ roles.claimer.settings = {
};

roles.claimer.action = function(creep) {
creep.creepLog('New claimer, in room, claiming');
// TODO just added the targetId to the creep, I hope it works
// const returnCodeMove = creep.moveTo(creep.room.controller.pos);
// console.log(`Move returnCode ${returnCodeMove}`);
const returnCode = creep.claimController(creep.room.controller);
if (returnCode === OK) {
creep.creepLog('New claimer, in room, claimed');
creep.suicide();
let claimerActionCompleted = creep.memory.claimerActionCompleted;
if (!claimerActionCompleted) {
creep.creepLog('New claimer, in room, claiming');
// TODO just added the targetId to the creep, I hope it works
// const returnCodeMove = creep.moveTo(creep.room.controller.pos);
// console.log(`Move returnCode ${returnCodeMove}`);
const returnCode = creep.claimController(creep.room.controller);
if (returnCode === OK) {
creep.creepLog('New claimer, in room, claimed');
creep.memory.claimerActionCompleted = claimerActionCompleted = true;
}
}
if (claimerActionCompleted) {
creep.memory.role = 'scout';
}
return true;
};

0 comments on commit 9700015

Please sign in to comment.