add submodule of autocomplete
This commit is contained in:
parent
efcc50a27b
commit
4086340c91
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "ScreepsAutocomplete"]
|
||||||
|
path = ScreepsAutocomplete
|
||||||
|
url = git@github.com:Garethp/ScreepsAutocomplete.git
|
1
ScreepsAutocomplete
Submodule
1
ScreepsAutocomplete
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 3c6f92884f7547d2c87ae2a52b5c84b086219e37
|
8
main.js
8
main.js
@ -19,14 +19,14 @@ var creepsConfig = {
|
|||||||
minimumCreeps: 2,
|
minimumCreeps: 2,
|
||||||
role: roleUpgrader
|
role: roleUpgrader
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
module.exports.loop = function(){
|
module.exports.loop = function(){
|
||||||
// Cleanup Creeps
|
// Cleanup Creeps
|
||||||
for (var name in Memory.creeps){
|
for (var name in Memory.creeps){
|
||||||
if (!Game.creeps[name]){
|
if (!Game.creeps[name]){
|
||||||
delete Memory.creeps[name];
|
delete Memory.creeps[name];
|
||||||
console.log("Clearning non-existing creep memory: ", name);
|
console.log("Cleaning non-existing creep memory: ", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ module.exports.loop = function(){
|
|||||||
for (var i in creepRolePriority){
|
for (var i in creepRolePriority){
|
||||||
var roleName = creepRolePriority[i];
|
var roleName = creepRolePriority[i];
|
||||||
var defaults = creepsConfig[roleName];
|
var defaults = creepsConfig[roleName];
|
||||||
var creepsOfKind = _.filter(Game.creeps, (creep) => creep.memory.role == roleName);
|
var creepsOfKind = _.filter(Game.creeps, (creep) => {return creep.memory.role == roleName});
|
||||||
if (creepsOfKind.length < creepsConfig[roleName].minimumCreeps){
|
if (creepsOfKind.length < creepsConfig[roleName].minimumCreeps){
|
||||||
var newName = Game.spawns.Spawn1.createCreep(creepsConfig[roleName].bodyParts,
|
var newName = Game.spawns.Spawn1.createCreep(creepsConfig[roleName].bodyParts,
|
||||||
undefined,
|
undefined,
|
||||||
@ -51,4 +51,4 @@ module.exports.loop = function(){
|
|||||||
creepsConfig[role].role.run(creep);
|
creepsConfig[role].role.run(creep);
|
||||||
}
|
}
|
||||||
console.log("tick");
|
console.log("tick");
|
||||||
}
|
};
|
Loading…
Reference in New Issue
Block a user