-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspawner.js
More file actions
23 lines (22 loc) · 716 Bytes
/
spawner.js
File metadata and controls
23 lines (22 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var spawner = {
run: function (roles, counts) {
for(var role in roles)
{
if(counts[roles[role]].limit>0)
{
var spawnVal = spawner.spawn(counts[roles[role]].module, {role: roles[role], sourceId: '5836b6748b8b9619519eeb72'});
if(spawnVal!=-4 && spawnVal!=-6) {
return true;
}
return false;
}
}
return false;
},
spawn: function (module, memory) {
var newName = Game.spawns.Spawn1.createCreep(module, undefined, memory);
console.log('Spawning new ' + memory.role + ' ' + newName);
return newName;
}
};
module.exports = spawner;