Skip to content

Commit 45e85ef

Browse files
committed
Use RANGE_* constants
1 parent a27e4b3 commit 45e85ef

29 files changed

+55
-55
lines changed

src/game/creeps.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
310310
if(!target.energy) {
311311
return C.ERR_NOT_ENOUGH_RESOURCES;
312312
}
313-
if(!target.pos.isNearTo(this.pos)) {
313+
if(!target.pos.inRangeTo(this.pos, C.RANGE_HARVEST_SOURCE)) {
314314
return C.ERR_NOT_IN_RANGE;
315315
}
316316
if(this.room.controller && (
@@ -325,7 +325,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
325325
if(!target.mineralAmount) {
326326
return C.ERR_NOT_ENOUGH_RESOURCES;
327327
}
328-
if(!target.pos.isNearTo(this.pos)) {
328+
if(!target.pos.inRangeTo(this.pos, C.RANGE_HARVEST_MINERAL)) {
329329
return C.ERR_NOT_IN_RANGE;
330330
}
331331
var extractor = _.find(target.pos.lookFor('structure'), {structureType: C.STRUCTURE_EXTRACTOR});
@@ -433,7 +433,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
433433
}
434434
}
435435

436-
if(!target.pos.isNearTo(this.pos)) {
436+
if(!target.pos.inRangeTo(this.pos, C.RANGE_TRANSFER)) {
437437
return C.ERR_NOT_IN_RANGE;
438438
}
439439
if(!data(this.id)[resourceType]) {
@@ -574,7 +574,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
574574
}
575575
}
576576

577-
if(!target.pos.isNearTo(this.pos)) {
577+
if(!target.pos.inRangeTo(this.pos, C.RANGE_WITHDRAW)) {
578578
return C.ERR_NOT_IN_RANGE;
579579
}
580580

@@ -646,7 +646,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
646646
if(utils.calcResources(this.carry) >= this.carryCapacity) {
647647
return C.ERR_FULL;
648648
}
649-
if(!target.pos.isNearTo(this.pos)) {
649+
if(!target.pos.inRangeTo(this.pos, C.RANGE_PICKUP)) {
650650
return C.ERR_NOT_IN_RANGE;
651651
}
652652

@@ -678,7 +678,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
678678
register.assertTargetObject(target);
679679
return C.ERR_INVALID_TARGET;
680680
}
681-
if(!target.pos.isNearTo(this.pos)) {
681+
if(!target.pos.inRangeTo(this.pos, C.RANGE_ATTACK)) {
682682
return C.ERR_NOT_IN_RANGE;
683683
}
684684

@@ -706,7 +706,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
706706
register.assertTargetObject(target);
707707
return C.ERR_INVALID_TARGET;
708708
}
709-
if(!this.pos.inRangeTo(target, 3)) {
709+
if(!this.pos.inRangeTo(target, C.RANGE_RANGED_ATTACK)) {
710710
return C.ERR_NOT_IN_RANGE;
711711
}
712712

@@ -750,7 +750,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
750750
register.assertTargetObject(target);
751751
return C.ERR_INVALID_TARGET;
752752
}
753-
if(!target.pos.isNearTo(this.pos)) {
753+
if(!target.pos.inRangeTo(this.pos, C.RANGE_HEAL)) {
754754
return C.ERR_NOT_IN_RANGE;
755755
}
756756
if(this.room.controller && !this.room.controller.my && this.room.controller.safeMode) {
@@ -805,7 +805,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
805805
register.assertTargetObject(target);
806806
return C.ERR_INVALID_TARGET;
807807
}
808-
if(!this.pos.inRangeTo(target, 3)) {
808+
if(!this.pos.inRangeTo(target, C.RANGE_REPAIR)) {
809809
return C.ERR_NOT_IN_RANGE;
810810
}
811811

@@ -832,7 +832,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
832832
register.assertTargetObject(target);
833833
return C.ERR_INVALID_TARGET;
834834
}
835-
if(!this.pos.inRangeTo(target, 3)) {
835+
if(!this.pos.inRangeTo(target, C.RANGE_BUILD)) {
836836
return C.ERR_NOT_IN_RANGE;
837837
}
838838
if(_.contains(['spawn','extension','constructedWall'], target.structureType) &&
@@ -903,7 +903,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
903903
if(this.getActiveBodyparts(C.CLAIM) == 0) {
904904
return C.ERR_NO_BODYPART;
905905
}
906-
if(!target.pos.isNearTo(this.pos)) {
906+
if(!target.pos.inRangeTo(this.pos, C.RANGE_CLAIM_CONTROLLER)) {
907907
return C.ERR_NOT_IN_RANGE;
908908
}
909909
if(target.structureType != 'controller') {
@@ -939,7 +939,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
939939
if(this.getActiveBodyparts(C.CLAIM) < 5) {
940940
return C.ERR_NO_BODYPART;
941941
}
942-
if(!target.pos.isNearTo(this.pos)) {
942+
if(!target.pos.inRangeTo(this.pos, C.RANGE_ATTACK_CONTROLLER)) {
943943
return C.ERR_NOT_IN_RANGE;
944944
}
945945
if(!target.owner && !target.reservation) {
@@ -974,7 +974,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
974974
if(target.upgradeBlocked && target.upgradeBlocked > 0) {
975975
return C.ERR_INVALID_TARGET;
976976
}
977-
if(!target.pos.inRangeTo(this.pos, 3)) {
977+
if(!target.pos.inRangeTo(this.pos, C.RANGE_UPGRADE_CONTROLLER)) {
978978
return C.ERR_NOT_IN_RANGE;
979979
}
980980
if(!target.my) {
@@ -1001,7 +1001,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
10011001
register.assertTargetObject(target);
10021002
return C.ERR_INVALID_TARGET;
10031003
}
1004-
if(!target.pos.isNearTo(this.pos)) {
1004+
if(!target.pos.inRangeTo(this.pos, C.RANGE_RESERVE_CONTROLLER)) {
10051005
return C.ERR_NOT_IN_RANGE;
10061006
}
10071007
if(target.structureType != 'controller') {
@@ -1067,7 +1067,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
10671067
register.assertTargetObject(target);
10681068
return C.ERR_INVALID_TARGET;
10691069
}
1070-
if(!target.pos.isNearTo(this.pos)) {
1070+
if(!target.pos.inRangeTo(this.pos, C.RANGE_DISMANTLE)) {
10711071
return C.ERR_NOT_IN_RANGE;
10721072
}
10731073
if(this.room.controller && !this.room.controller.my && this.room.controller.safeMode) {
@@ -1093,7 +1093,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
10931093
register.assertTargetObject(target);
10941094
return C.ERR_INVALID_TARGET;
10951095
}
1096-
if(!target.pos.isNearTo(this.pos)) {
1096+
if(!target.pos.inRangeTo(this.pos, C.RANGE_GENERATE_SAFEMODE)) {
10971097
return C.ERR_NOT_IN_RANGE;
10981098
}
10991099

@@ -1111,7 +1111,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
11111111
register.assertTargetObject(target);
11121112
return C.ERR_INVALID_TARGET;
11131113
}
1114-
if(!target.pos.isNearTo(this.pos)) {
1114+
if(!target.pos.inRangeTo(this.pos, C.RANGE_SIGN_CONTROLLER)) {
11151115
return C.ERR_NOT_IN_RANGE;
11161116
}
11171117
if(target.structureType != 'controller') {

src/game/structures.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function _transfer(target, resourceType, amount) {
5252
if (data(target.id).energyCapacity && (!amount || utils.calcResources(data(target.id)) + amount > data(target.id).energyCapacity)) {
5353
return C.ERR_FULL;
5454
}
55-
if (!target.pos.isNearTo(this.pos)) {
55+
if (!target.pos.inRangeTo(this.pos, C.RANGE_TRANSFER)) {
5656
return C.ERR_NOT_IN_RANGE;
5757
}
5858

@@ -89,7 +89,7 @@ function _transferEnergy(target, amount) {
8989
if(data(target.id).energyCapacity && (!amount || utils.calcResources(data(target.id)) + amount > data(target.id).energyCapacity)) {
9090
return C.ERR_FULL;
9191
}
92-
if(!target.pos.isNearTo(this.pos)) {
92+
if(!target.pos.inRangeTo(this.pos, C.RANGE_TRANSFER)) {
9393
return C.ERR_NOT_IN_RANGE;
9494
}
9595

@@ -403,7 +403,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
403403
if (data(target.id).energyCapacity && (!amount || utils.calcResources(data(target.id)) + amount > data(target.id).energyCapacity)) {
404404
return C.ERR_FULL;
405405
}
406-
if (!target.pos.isNearTo(this.pos)) {
406+
if (!target.pos.inRangeTo(this.pos, C.RANGE_TRANSFER)) {
407407
return C.ERR_NOT_IN_RANGE;
408408
}
409409

@@ -431,7 +431,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
431431
register.assertTargetObject(lab2);
432432
return C.ERR_INVALID_TARGET;
433433
}
434-
if(this.pos.getRangeTo(lab1) > 2 || this.pos.getRangeTo(lab2) > 2) {
434+
if(this.pos.getRangeTo(lab1) > C.RANGE_RUN_REACTION || this.pos.getRangeTo(lab2) > C.RANGE_RUN_REACTION) {
435435
return C.ERR_NOT_IN_RANGE;
436436
}
437437
if(this.mineralAmount > this.mineralCapacity - C.LAB_REACTION_AMOUNT) {
@@ -460,7 +460,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
460460
register.assertTargetObject(target);
461461
return C.ERR_INVALID_TARGET;
462462
}
463-
if(!this.pos.isNearTo(target)) {
463+
if(!this.pos.inRangeTo(target, C.RANGE_BOOST_CREEP)) {
464464
return C.ERR_NOT_IN_RANGE;
465465
}
466466
if(data(this.id).energy < C.LAB_BOOST_ENERGY) {
@@ -531,7 +531,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
531531
return C.ERR_RCL_NOT_ENOUGH;
532532
}
533533
}
534-
if ((target instanceof globals.Creep) && !this.pos.isNearTo(target)) {
534+
if ((target instanceof globals.Creep) && !this.pos.inRangeTo(target, C.RANGE_TRANSFER)) {
535535
return C.ERR_NOT_IN_RANGE;
536536
}
537537
if (!data(this.id).energy) {
@@ -1092,7 +1092,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
10921092
if(data(target.id).energy == data(target.id).energyCapacity) {
10931093
return C.ERR_FULL;
10941094
}
1095-
if(!target.pos.isNearTo(this.pos)) {
1095+
if(!target.pos.inRangeTo(this.pos, C.RANGE_TRANSFER)) {
10961096
return C.ERR_NOT_IN_RANGE;
10971097
}
10981098

@@ -1144,7 +1144,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
11441144
if(!target.my) {
11451145
return C.ERR_NOT_OWNER;
11461146
}
1147-
if(!target.pos.isNearTo(this.pos)) {
1147+
if(!target.pos.inRangeTo(this.pos, C.RANGE_RENEW_CREEP)) {
11481148
return C.ERR_NOT_IN_RANGE;
11491149
}
11501150
if(this.spawning) {
@@ -1176,7 +1176,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
11761176
if(!target.my) {
11771177
return C.ERR_NOT_OWNER;
11781178
}
1179-
if(!target.pos.isNearTo(this.pos)) {
1179+
if(!target.pos.inRangeTo(this.pos, C.RANGE_RECYCLE_CREEP)) {
11801180
return C.ERR_NOT_IN_RANGE;
11811181
}
11821182

src/processor/intents/creeps/attack.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1616
if(!target || target == object) {
1717
return;
1818
}
19-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
19+
if(Math.abs(target.x - object.x) > C.RANGE_ATTACK || Math.abs(target.y - object.y) > C.RANGE_ATTACK) {
2020
return;
2121
}
2222
if(target.type == 'creep' && target.spawning) {

src/processor/intents/creeps/attackController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1616
if(!target || target.type != 'controller') {
1717
return;
1818
}
19-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
19+
if(Math.abs(target.x - object.x) > C.RANGE_ATTACK_CONTROLLER || Math.abs(target.y - object.y) > C.RANGE_ATTACK_CONTROLLER) {
2020
return;
2121
}
2222
if(!target.user && !target.reservation) {

src/processor/intents/creeps/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
2020
!C.CONSTRUCTION_COST[target.structureType]) {
2121
return;
2222
}
23-
if(Math.abs(target.x - object.x) > 3 || Math.abs(target.y - object.y) > 3) {
23+
if(Math.abs(target.x - object.x) > C.RANGE_BUILD || Math.abs(target.y - object.y) > C.RANGE_BUILD) {
2424
return;
2525
}
2626
if(_.any(roomObjects, {x: target.x, y: target.y, type: target.structureType})) {

src/processor/intents/creeps/claimController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1616
if(!target || target.type != 'controller') {
1717
return;
1818
}
19-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
19+
if(Math.abs(target.x - object.x) > C.RANGE_CLAIM_CONTROLLER || Math.abs(target.y - object.y) > C.RANGE_CLAIM_CONTROLLER) {
2020
return;
2121
}
2222
if(target.bindUser && object.user != target.bindUser) {

src/processor/intents/creeps/dismantle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1616
if(!target || !C.CONSTRUCTION_COST[target.type]) {
1717
return;
1818
}
19-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
19+
if(Math.abs(target.x - object.x) > C.RANGE_DISMANTLE || Math.abs(target.y - object.y) > C.RANGE_DISMANTLE) {
2020
return;
2121
}
2222
if(roomController && roomController.user != object.user && roomController.safeMode > gameTime) {

src/processor/intents/creeps/generateSafeMode.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1313
if(!target || target.type != 'controller') {
1414
return;
1515
}
16-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
16+
if(Math.abs(target.x - object.x) > C.RANGE_GENERATE_SAFEMODE || Math.abs(target.y - object.y) > C.RANGE_GENERATE_SAFEMODE) {
1717
return;
1818
}
1919
if(!(object[C.RESOURCE_GHODIUM] >= C.SAFE_MODE_COST)) {

src/processor/intents/creeps/harvest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1616
if(!target) {
1717
return;
1818
}
19-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
19+
if(Math.abs(target.x - object.x) > C.RANGE_HARVEST || Math.abs(target.y - object.y) > C.RANGE_HARVEST) {
2020
return;
2121
}
2222

src/processor/intents/creeps/heal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1616
if(!target || target.type != 'creep' || target.spawning || target.hits >= target.hitsMax) {
1717
return;
1818
}
19-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
19+
if(Math.abs(target.x - object.x) > C.RANGE_HEAL || Math.abs(target.y - object.y) > C.RANGE_HEAL) {
2020
return;
2121
}
2222
if(roomController && roomController.user != object.user && roomController.safeMode > gameTime) {

src/processor/intents/creeps/pickup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk) {
1919
if(!target || target.type != 'energy') {
2020
return;
2121
}
22-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
22+
if(Math.abs(target.x - object.x) > C.RANGE_PICKUP || Math.abs(target.y - object.y) > C.RANGE_PICKUP) {
2323
return;
2424
}
2525

src/processor/intents/creeps/rangedAttack.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1616
if(!target || target == object) {
1717
return;
1818
}
19-
if(Math.abs(target.x - object.x) > 3 || Math.abs(target.y - object.y) > 3) {
19+
if(Math.abs(target.x - object.x) > C.RANGE_RANGED_ATTACK || Math.abs(target.y - object.y) > C.RANGE_RANGED_ATTACK) {
2020
return;
2121
}
2222
if(target.type == 'creep' && target.spawning) {

src/processor/intents/creeps/rangedHeal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1616
if(!target || target.type != 'creep' || target.spawning || target.hits >= target.hitsMax) {
1717
return;
1818
}
19-
if(Math.abs(target.x - object.x) > 3 || Math.abs(target.y - object.y) > 3) {
19+
if(Math.abs(target.x - object.x) > C.RANGE_RANGED_HEAL || Math.abs(target.y - object.y) > C.RANGE_RANGED_HEAL) {
2020
return;
2121
}
2222
if(roomController && roomController.user != object.user && roomController.safeMode > gameTime) {

src/processor/intents/creeps/rangedMassAttack.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
2323

2424
var targets = _.filter(roomObjects, (i) => {
2525
return (!_.isUndefined(i.user) || i.type == 'powerBank') && i.user != object.user &&
26-
i.x >= object.x - 3 && i.x <= object.x + 3 &&
27-
i.y >= object.y - 3 && i.y <= object.y + 3;
26+
i.x >= object.x - C.RANGE_RANGED_MASS_ATTACK && i.x <= object.x + C.RANGE_RANGED_MASS_ATTACK &&
27+
i.y >= object.y - C.RANGE_RANGED_MASS_ATTACK && i.y <= object.y + C.RANGE_RANGED_MASS_ATTACK;
2828
});
2929

3030
var distanceRate = {1: 1, 2: 0.4, 3: 0.1};

src/processor/intents/creeps/repair.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1616
if(!target || !C.CONSTRUCTION_COST[target.type] || target.hits >= target.hitsMax) {
1717
return;
1818
}
19-
if(Math.abs(target.x - object.x) > 3 || Math.abs(target.y - object.y) > 3) {
19+
if(Math.abs(target.x - object.x) > C.RANGE_REPAIR || Math.abs(target.y - object.y) > C.RANGE_REPAIR) {
2020
return;
2121
}
2222
if(!target.hitsMax) {

src/processor/intents/creeps/reserveController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1616
if(!target || target.type != 'controller') {
1717
return;
1818
}
19-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
19+
if(Math.abs(target.x - object.x) > C.RANGE_RESERVE_CONTROLLER || Math.abs(target.y - object.y) > C.RANGE_RESERVE_CONTROLLER) {
2020
return;
2121
}
2222
if(target.user || target.reservation && target.reservation.user != object.user) {

src/processor/intents/creeps/signController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1616
if(!target || target.type != 'controller') {
1717
return;
1818
}
19-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
19+
if(Math.abs(target.x - object.x) > C.RANGE_SIGN_CONTROLLER || Math.abs(target.y - object.y) > C.RANGE_SIGN_CONTROLLER) {
2020
return;
2121
}
2222

src/processor/intents/creeps/transfer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1919
if(!target) {
2020
return;
2121
}
22-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
22+
if(Math.abs(target.x - object.x) > C.RANGE_TRANSFER || Math.abs(target.y - object.y) > C.RANGE_TRANSFER) {
2323
return;
2424
}
2525

src/processor/intents/creeps/upgradeController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
1717
if(!target || target.type != 'controller') {
1818
return;
1919
}
20-
if(Math.abs(target.x - object.x) > 3 || Math.abs(target.y - object.y) > 3) {
20+
if(Math.abs(target.x - object.x) > C.RANGE_UPGRADE_CONTROLLER || Math.abs(target.y - object.y) > C.RANGE_UPGRADE_CONTROLLER) {
2121
return;
2222
}
2323
if(target.level == 0 || target.user != object.user) {

src/processor/intents/creeps/withdraw.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = function(object, intent, roomObjects, roomTerrain, bulk, bulkUs
2626
if(object.user != target.user && _.any(roomObjects, i => i.type == C.STRUCTURE_RAMPART && i.user != object.user && !i.isPublic && i.x == target.x && i.y == target.y)) {
2727
return;
2828
}
29-
if(Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) {
29+
if(Math.abs(target.x - object.x) > C.RANGE_WITHDRAW || Math.abs(target.y - object.y) > C.RANGE_WITHDRAW) {
3030
return;
3131
}
3232

0 commit comments

Comments
 (0)