@@ -310,7 +310,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
310
310
if ( ! target . energy ) {
311
311
return C . ERR_NOT_ENOUGH_RESOURCES ;
312
312
}
313
- if ( ! target . pos . isNearTo ( this . pos ) ) {
313
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_HARVEST_SOURCE ) ) {
314
314
return C . ERR_NOT_IN_RANGE ;
315
315
}
316
316
if ( this . room . controller && (
@@ -325,7 +325,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
325
325
if ( ! target . mineralAmount ) {
326
326
return C . ERR_NOT_ENOUGH_RESOURCES ;
327
327
}
328
- if ( ! target . pos . isNearTo ( this . pos ) ) {
328
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_HARVEST_MINERAL ) ) {
329
329
return C . ERR_NOT_IN_RANGE ;
330
330
}
331
331
var extractor = _ . find ( target . pos . lookFor ( 'structure' ) , { structureType : C . STRUCTURE_EXTRACTOR } ) ;
@@ -433,7 +433,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
433
433
}
434
434
}
435
435
436
- if ( ! target . pos . isNearTo ( this . pos ) ) {
436
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_TRANSFER ) ) {
437
437
return C . ERR_NOT_IN_RANGE ;
438
438
}
439
439
if ( ! data ( this . id ) [ resourceType ] ) {
@@ -574,7 +574,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
574
574
}
575
575
}
576
576
577
- if ( ! target . pos . isNearTo ( this . pos ) ) {
577
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_WITHDRAW ) ) {
578
578
return C . ERR_NOT_IN_RANGE ;
579
579
}
580
580
@@ -646,7 +646,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
646
646
if ( utils . calcResources ( this . carry ) >= this . carryCapacity ) {
647
647
return C . ERR_FULL ;
648
648
}
649
- if ( ! target . pos . isNearTo ( this . pos ) ) {
649
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_PICKUP ) ) {
650
650
return C . ERR_NOT_IN_RANGE ;
651
651
}
652
652
@@ -678,7 +678,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
678
678
register . assertTargetObject ( target ) ;
679
679
return C . ERR_INVALID_TARGET ;
680
680
}
681
- if ( ! target . pos . isNearTo ( this . pos ) ) {
681
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_ATTACK ) ) {
682
682
return C . ERR_NOT_IN_RANGE ;
683
683
}
684
684
@@ -706,7 +706,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
706
706
register . assertTargetObject ( target ) ;
707
707
return C . ERR_INVALID_TARGET ;
708
708
}
709
- if ( ! this . pos . inRangeTo ( target , 3 ) ) {
709
+ if ( ! this . pos . inRangeTo ( target , C . RANGE_RANGED_ATTACK ) ) {
710
710
return C . ERR_NOT_IN_RANGE ;
711
711
}
712
712
@@ -750,7 +750,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
750
750
register . assertTargetObject ( target ) ;
751
751
return C . ERR_INVALID_TARGET ;
752
752
}
753
- if ( ! target . pos . isNearTo ( this . pos ) ) {
753
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_HEAL ) ) {
754
754
return C . ERR_NOT_IN_RANGE ;
755
755
}
756
756
if ( this . room . controller && ! this . room . controller . my && this . room . controller . safeMode ) {
@@ -805,7 +805,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
805
805
register . assertTargetObject ( target ) ;
806
806
return C . ERR_INVALID_TARGET ;
807
807
}
808
- if ( ! this . pos . inRangeTo ( target , 3 ) ) {
808
+ if ( ! this . pos . inRangeTo ( target , C . RANGE_REPAIR ) ) {
809
809
return C . ERR_NOT_IN_RANGE ;
810
810
}
811
811
@@ -832,7 +832,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
832
832
register . assertTargetObject ( target ) ;
833
833
return C . ERR_INVALID_TARGET ;
834
834
}
835
- if ( ! this . pos . inRangeTo ( target , 3 ) ) {
835
+ if ( ! this . pos . inRangeTo ( target , C . RANGE_BUILD ) ) {
836
836
return C . ERR_NOT_IN_RANGE ;
837
837
}
838
838
if ( _ . contains ( [ 'spawn' , 'extension' , 'constructedWall' ] , target . structureType ) &&
@@ -903,7 +903,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
903
903
if ( this . getActiveBodyparts ( C . CLAIM ) == 0 ) {
904
904
return C . ERR_NO_BODYPART ;
905
905
}
906
- if ( ! target . pos . isNearTo ( this . pos ) ) {
906
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_CLAIM_CONTROLLER ) ) {
907
907
return C . ERR_NOT_IN_RANGE ;
908
908
}
909
909
if ( target . structureType != 'controller' ) {
@@ -939,7 +939,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
939
939
if ( this . getActiveBodyparts ( C . CLAIM ) < 5 ) {
940
940
return C . ERR_NO_BODYPART ;
941
941
}
942
- if ( ! target . pos . isNearTo ( this . pos ) ) {
942
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_ATTACK_CONTROLLER ) ) {
943
943
return C . ERR_NOT_IN_RANGE ;
944
944
}
945
945
if ( ! target . owner && ! target . reservation ) {
@@ -974,7 +974,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
974
974
if ( target . upgradeBlocked && target . upgradeBlocked > 0 ) {
975
975
return C . ERR_INVALID_TARGET ;
976
976
}
977
- if ( ! target . pos . inRangeTo ( this . pos , 3 ) ) {
977
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_UPGRADE_CONTROLLER ) ) {
978
978
return C . ERR_NOT_IN_RANGE ;
979
979
}
980
980
if ( ! target . my ) {
@@ -1001,7 +1001,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
1001
1001
register . assertTargetObject ( target ) ;
1002
1002
return C . ERR_INVALID_TARGET ;
1003
1003
}
1004
- if ( ! target . pos . isNearTo ( this . pos ) ) {
1004
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_RESERVE_CONTROLLER ) ) {
1005
1005
return C . ERR_NOT_IN_RANGE ;
1006
1006
}
1007
1007
if ( target . structureType != 'controller' ) {
@@ -1067,7 +1067,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
1067
1067
register . assertTargetObject ( target ) ;
1068
1068
return C . ERR_INVALID_TARGET ;
1069
1069
}
1070
- if ( ! target . pos . isNearTo ( this . pos ) ) {
1070
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_DISMANTLE ) ) {
1071
1071
return C . ERR_NOT_IN_RANGE ;
1072
1072
}
1073
1073
if ( this . room . controller && ! this . room . controller . my && this . room . controller . safeMode ) {
@@ -1093,7 +1093,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
1093
1093
register . assertTargetObject ( target ) ;
1094
1094
return C . ERR_INVALID_TARGET ;
1095
1095
}
1096
- if ( ! target . pos . isNearTo ( this . pos ) ) {
1096
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_GENERATE_SAFEMODE ) ) {
1097
1097
return C . ERR_NOT_IN_RANGE ;
1098
1098
}
1099
1099
@@ -1111,7 +1111,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
1111
1111
register . assertTargetObject ( target ) ;
1112
1112
return C . ERR_INVALID_TARGET ;
1113
1113
}
1114
- if ( ! target . pos . isNearTo ( this . pos ) ) {
1114
+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_SIGN_CONTROLLER ) ) {
1115
1115
return C . ERR_NOT_IN_RANGE ;
1116
1116
}
1117
1117
if ( target . structureType != 'controller' ) {
0 commit comments