@screeps/engine
Version:
This is a module for Screeps standalone server. See [main repository](https://github.com/screeps/screeps) for more info.
32 lines (25 loc) • 803 B
JavaScript
;
var _ = require('lodash'),
utils = require('../../../utils'),
driver = utils.getDriver(),
C = driver.constants;
module.exports = function (intent, userId, 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, function (i) {
return _.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: x,
y: y,
type: 'energy',
energy: 300,
room: intent.roomName
});
};
//# sourceMappingURL=../../../sourcemaps/processor/intents/room/gen-energy.js.map