summaryrefslogtreecommitdiff
path: root/src/offender.js
blob: 8cb95ac9bbf84117fbccfbe36775e66f28bb9a65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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]);
      }
    }
  }
};