UNPKG

@screeps/engine

Version:

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

35 lines (29 loc) 1.1 kB
'use strict'; var _ = require('lodash'), utils = require('../../../utils'), driver = utils.getDriver(), C = driver.constants; module.exports = function (object, roomObjects, roomTerrain, bulk, bulkUsers, roomController, gameTime) { if (!object || object.type != 'rampart') return; if (roomController) { var hitsMax = C.RAMPART_HITS_MAX[roomController.level] || 0; if (hitsMax != object.hitsMax) { bulk.update(object, { hitsMax: hitsMax }); } } if (!object.nextDecayTime || gameTime >= object.nextDecayTime - 1) { object.hits = object.hits || 0; object.hits -= C.RAMPART_DECAY_AMOUNT; if (object.hits <= 0) { bulk.remove(object._id); delete roomObjects[object._id]; } else { object.nextDecayTime = gameTime + C.RAMPART_DECAY_TIME; bulk.update(object, { hits: object.hits, nextDecayTime: object.nextDecayTime }); } } }; //# sourceMappingURL=../../../sourcemaps/processor/intents/ramparts/tick.js.map