-
-
Save ho0ber/fdee980686035c696d0ebef08bf755ce to your computer and use it in GitHub Desktop.
Battle whitelist for screeps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment