UNPKG

@screeps/engine

Version:

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

30 lines (23 loc) 769 B
'use strict'; var _ = require('lodash'), utils = require('../../../utils'), driver = utils.getDriver(), C = driver.constants; module.exports = function (userId, intent, { roomObjects, roomTerrain, bulk }) { if (userId != '3') { return; } var x, y; do { x = Math.floor(Math.random() * 48) + 1; y = Math.floor(Math.random() * 48) + 1; } while (_.any(roomObjects, i => _.contains(C.OBSTACLE_OBJECT_TYPES, i.type) && i.x == x && i.y == y) || utils.checkTerrain(roomTerrain, x, y, C.TERRAIN_MASK_WALL)); bulk.insert({ x, y, type: 'energy', energy: 300, room: intent.roomName }); }; //# sourceMappingURL=../../../sourcemaps/processor/intents/room/gen-energy.js.map