UNPKG

@screeps/engine

Version:

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

34 lines (27 loc) 1.66 kB
'use strict'; var _ = require('lodash'); var priorities = { 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', 'suicide', 'say', 'claimController', 'upgradeController', 'reserveController', 'attackController', 'generateSafeMode', 'signController']; var modules = require('bulk-require')(__dirname, ['*.js']); function checkPriorities(intents, name) { return intents[name] && (!priorities[name] || !_.any(priorities[name], function (i) { return !!intents[i]; })); } module.exports = function (object, objectIntents, roomObjects, roomTerrain, bulk, bulkUsers, roomController, stats, gameTime, roomInfo, users) { creepActions.forEach(function (name) { if (checkPriorities(objectIntents, name)) { modules[name](object, objectIntents[name], roomObjects, roomTerrain, bulk, bulkUsers, roomController, stats, gameTime, roomInfo, users); } }); }; //# sourceMappingURL=../../../sourcemaps/processor/intents/creeps/intents.js.map