@@ -15,14 +15,21 @@ roles.claimer.settings = {
15
15
} ;
16
16
17
17
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 ) ;
26
33
}
27
34
return true ;
28
35
} ;
0 commit comments