Skip to content

Commit

Permalink
fix: use RANGE_UNBOOST_CREEP constant instead of magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
o4kapuk authored and RiftLurker committed Oct 27, 2020
1 parent 9170a0e commit 7f1fafc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/game/structures.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
if(!_.some(target.body, p => !!p.boost)) {
return C.ERR_NOT_FOUND;
}
if(!this.pos.isNearTo(target)) {
if(!this.pos.inRange(target, C.RANGE_UNBOOST_CREEP)) {
return C.ERR_NOT_IN_RANGE;
}

Expand Down
2 changes: 1 addition & 1 deletion src/processor/intents/labs/unboost-creep.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function(object, intent, scope) {
if(!utils.checkStructureAgainstController(object, roomObjects, roomController)) {
return;
}
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
if(Math.abs(target.x - object.x) > С.RANGE_UNBOOST_CREEP || Math.abs(target.y - object.y) > C.RANGE_UNBOOST_CREEP) {
return;
}
const boostedParts = _.mapValues(_.groupBy(_.filter(target.body,p=>!!p.boost), 'boost'), v=>v.length);
Expand Down

0 comments on commit 7f1fafc

Please sign in to comment.