18 lines
519 B
JavaScript
18 lines
519 B
JavaScript
|
// usernames are all lowercase, we compare with to lower
|
||
|
var USERNAME_WHITELIST = ['chrisinajar', 'ho0ber', 'fractaloop', 'n7-anthony', 'overra', 'tyrel', 'fervens'];
|
||
|
|
||
|
module.exports = {
|
||
|
findEnemy: findEnemy
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
var target = findEnemy(creep);
|
||
|
*/
|
||
|
function findEnemy (creep) {
|
||
|
var targets = creep.room.find(FIND_HOSTILE_CREEPS, {
|
||
|
filter: (c) => {
|
||
|
return (USERNAME_WHITELIST.indexOf(c.owner.username.toLowerCase()) === -1);
|
||
|
}
|
||
|
});
|
||
|
return creep.pos.findClosestByPath(targets);
|
||
|
}
|