Skip to content

Commit 582d50e

Browse files
committed
Allow passing notifyWhenAttacked as an option to spawnCreep
1 parent c7e854f commit 582d50e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/game/structures.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,8 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
11011101
}
11021102
}
11031103

1104+
const notifyWhenAttacked = options.notifyWhenAttacked === undefined ? true : !!options.notifyWhenAttacked;
1105+
11041106
if(!this.my) {
11051107
return C.ERR_NOT_OWNER;
11061108
}
@@ -1224,7 +1226,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
12241226
}
12251227
});
12261228

1227-
intents.set(this.id, 'createCreep', {name, body, energyStructures, directions});
1229+
intents.set(this.id, 'createCreep', {name, body, energyStructures, directions, notifyWhenAttacked});
12281230

12291231
return C.OK;
12301232
});

src/processor/intents/spawns/create-creep.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ module.exports = function(spawn, intent, scope) {
3333
}
3434
}
3535

36+
const notifyWhenAttacked = intent.notifyWhenAttacked === undefined ? true : !!intent.notifyWhenAttacked;
37+
3638
intent.body = intent.body.slice(0, C.MAX_CREEP_SIZE);
3739

3840
var cost = utils.calcCreepCost(intent.body);
@@ -90,7 +92,7 @@ module.exports = function(spawn, intent, scope) {
9092
hitsMax: body.length * 100,
9193
spawning: true,
9294
fatigue: 0,
93-
notifyWhenAttacked: true
95+
notifyWhenAttacked,
9496
};
9597

9698
if(spawn.tutorial) {

0 commit comments

Comments
 (0)