-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprototype.spawn.js
More file actions
29 lines (29 loc) · 989 Bytes
/
prototype.spawn.js
File metadata and controls
29 lines (29 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module.exports = function() {
StructureSpawn.prototype.spawnBalancedCreep =
function(energy, name, spawnid, roleName){
var numberOfParts = Math.floor(energy / 200);
var body = [];
for (let i = 0; i < numberOfParts; i++){
body.push(WORK);
}
for (let i = 0; i < numberOfParts; i++){
body.push(CARRY);
}
for (let i = 0; i < numberOfParts; i++){
body.push(MOVE);
}
return this.createCreep(body, undefined, { role: roleName, working: false, spawn: spawnid})
};
StructureSpawn.prototype.spawnMule =
function(energy, name, spawnid){
var numberOfParts = Math.floor(energy / 100);
var body = [];
for (let i = 0; i < numberOfParts; i++){
body.push(CARRY);
}
for (let i = 0; i < numberOfParts; i++){
body.push(MOVE);
}
return this.createCreep(body, name, { role: 'mule', working: false, spawn: spawnid})
};
};