UNPKG

@screeps/engine

Version:

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

33 lines (26 loc) 1.5 kB
'use strict'; var _ = require('lodash'); var priorities = { rangedHeal: ['heal'], attackController: ['rangedHeal', 'heal'], dismantle: ['attackController', 'rangedHeal', 'heal'], repair: ['dismantle', 'attackController', 'rangedHeal', 'heal'], build: ['repair', 'dismantle', 'attackController', 'rangedHeal', 'heal'], attack: ['build', 'repair', 'dismantle', 'attackController', 'rangedHeal', 'heal'], harvest: ['attack', 'build', 'repair', 'dismantle', 'attackController', 'rangedHeal', 'heal'], rangedMassAttack: ['build', 'repair', 'rangedHeal'], rangedAttack: ['rangedMassAttack', 'build', 'repair', 'rangedHeal'] }; var creepActions = ['drop', 'transfer', 'withdraw', 'pickup', 'heal', 'rangedHeal', 'dismantle', 'attack', 'harvest', 'move', 'repair', 'build', 'rangedMassAttack', 'rangedAttack', 'say', 'suicide', 'claimController', 'upgradeController', 'reserveController', 'attackController', 'generateSafeMode', 'signController', 'pull']; var modules = require('bulk-require')(__dirname, ['*.js']); function checkPriorities(intents, name) { return intents[name] && (!priorities[name] || !_.any(priorities[name], i => !!intents[i])); } module.exports = function (object, objectIntents, scope) { creepActions.forEach(name => { if (checkPriorities(objectIntents, name)) { modules[name](object, objectIntents[name], scope); } }); }; //# sourceMappingURL=../../../sourcemaps/processor/intents/creeps/intents.js.map