Remove 2 job & refactor tower spec
This commit is contained in:
10
src/prototype.tower.js
vendored
10
src/prototype.tower.js
vendored
@@ -1,15 +1,15 @@
|
||||
StructureTower.prototype.defend =
|
||||
function () {
|
||||
// find closes hostile creep
|
||||
|
||||
// Defend Base
|
||||
var target = this.pos.findClosestByRange(FIND_HOSTILE_CREEPS);
|
||||
// if one is found...
|
||||
if (target != undefined) {
|
||||
// ...FIRE!
|
||||
this.attack(target);
|
||||
}
|
||||
|
||||
|
||||
// Repair structure & only first 100k of wall
|
||||
var closestDamagedStructure = this.pos.findClosestByRange(FIND_STRUCTURES, {
|
||||
filter: (structure) => structure.hits < structure.hitsMax
|
||||
filter: (structure) => structure.hits < structure.hitsMax && (structure.structureType != STRUCTURE_WALL || structure.hits < 100000)
|
||||
});
|
||||
|
||||
if(closestDamagedStructure) {
|
||||
|
||||
Reference in New Issue
Block a user