diff options
Diffstat (limited to 'src/offender.js')
| -rw-r--r-- | src/offender.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/offender.js b/src/offender.js new file mode 100644 index 0000000..8cb95ac --- /dev/null +++ b/src/offender.js @@ -0,0 +1,14 @@ +// vim: tw=80 ts=2 sw=2 et + +const util = require('creep'); + +module.exports = { + run: (creep) => { + const hostiles = creep.room.find(FIND_HOSTILE_CREEPS); + if (hostiles.length > 0) { + if (creep.attack(hostiles[0]) == ERR_NOT_IN_RANGE) { + util.move(creep, hostiles[0]); + } + } + } +}; |
