Skip to content

Commit 617c978

Browse files
committed
after claiming, turn claimer to a reserver or a scout, instead of kill it.
1 parent fc4768f commit 617c978

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/role_claimer.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,21 @@ roles.claimer.settings = {
1515
};
1616

1717
roles.claimer.action = function(creep) {
18-
creep.creepLog('New claimer, in room, claiming');
19-
// TODO just added the targetId to the creep, I hope it works
20-
// const returnCodeMove = creep.moveTo(creep.room.controller.pos);
21-
// console.log(`Move returnCode ${returnCodeMove}`);
22-
const returnCode = creep.claimController(creep.room.controller);
23-
if (returnCode === OK) {
24-
creep.creepLog('New claimer, in room, claimed');
25-
creep.suicide();
18+
let claimerActionCompleted = creep.memory.claimerActionCompleted;
19+
if (!claimerActionCompleted) {
20+
creep.creepLog('New claimer, in room, claiming');
21+
// TODO just added the targetId to the creep, I hope it works
22+
// const returnCodeMove = creep.moveTo(creep.room.controller.pos);
23+
// console.log(`Move returnCode ${returnCodeMove}`);
24+
const returnCode = creep.claimController(creep.room.controller);
25+
if (returnCode === OK) {
26+
creep.creepLog('New claimer, in room, claimed');
27+
creep.memory.claimerActionCompleted = claimerActionCompleted = true;
28+
}
29+
}
30+
if (claimerActionCompleted) {
31+
creep.memory.role = 'scout';
32+
return roles.scout.action(creep);
2633
}
2734
return true;
2835
};

0 commit comments

Comments
 (0)