summaryrefslogtreecommitdiff
path: root/src/role.offender.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/role.offender.js')
-rw-r--r--src/role.offender.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/role.offender.js b/src/role.offender.js
new file mode 100644
index 0000000..37854f2
--- /dev/null
+++ b/src/role.offender.js
@@ -0,0 +1,10 @@
+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) {
+ creep.moveTo(hostiles[0]);
+ }
+ }
+ }
+};