UNPKG

@screeps/engine

Version:

This is a module for Screeps standalone server. See [main repository](https://github.com/screeps/screeps) for more info.

27 lines (21 loc) 801 B
'use strict'; const _ = require('lodash'), utils = require('../../../../utils'), driver = utils.getDriver(), C = driver.constants, fakeRuntime = require('../../../common/fake-runtime'); module.exports = function (creep, range, context) { const scope = context.scope, intents = context.intents, hostiles = context.hostiles; const nearCreeps = _.filter(hostiles, c => utils.dist(creep, c) < range); if (_.some(nearCreeps)) { const direction = fakeRuntime.flee(creep, nearCreeps, range, {}, scope); if (direction) { intents.set(creep._id, 'move', { direction }); return true; } } return false; }; //# sourceMappingURL=../../../../sourcemaps/processor/intents/creeps/invaders/flee.js.map