@@ -358,7 +358,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
358358 if ( ! target . energy ) {
359359 return C . ERR_NOT_ENOUGH_RESOURCES ;
360360 }
361- if ( ! target . pos . isNearTo ( this . pos ) ) {
361+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_HARVEST_SOURCE ) ) {
362362 return C . ERR_NOT_IN_RANGE ;
363363 }
364364 if ( this . room . controller && (
@@ -373,7 +373,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
373373 if ( ! target . mineralAmount ) {
374374 return C . ERR_NOT_ENOUGH_RESOURCES ;
375375 }
376- if ( ! target . pos . isNearTo ( this . pos ) ) {
376+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_HARVEST_MINERAL ) ) {
377377 return C . ERR_NOT_IN_RANGE ;
378378 }
379379 var extractor = _ . find ( target . pos . lookFor ( 'structure' ) , { structureType : C . STRUCTURE_EXTRACTOR } ) ;
@@ -481,7 +481,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
481481 }
482482 }
483483
484- if ( ! target . pos . isNearTo ( this . pos ) ) {
484+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_TRANSFER ) ) {
485485 return C . ERR_NOT_IN_RANGE ;
486486 }
487487 if ( ! data ( this . id ) [ resourceType ] ) {
@@ -629,7 +629,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
629629 }
630630 }
631631
632- if ( ! target . pos . isNearTo ( this . pos ) ) {
632+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_WITHDRAW ) ) {
633633 return C . ERR_NOT_IN_RANGE ;
634634 }
635635
@@ -701,7 +701,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
701701 if ( utils . calcResources ( this . carry ) >= this . carryCapacity ) {
702702 return C . ERR_FULL ;
703703 }
704- if ( ! target . pos . isNearTo ( this . pos ) ) {
704+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_PICKUP ) ) {
705705 return C . ERR_NOT_IN_RANGE ;
706706 }
707707
@@ -739,7 +739,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
739739 return C . ERR_INVALID_TARGET ;
740740 }
741741
742- if ( ! target . pos . isNearTo ( this . pos ) ) {
742+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_ATTACK ) ) {
743743 return C . ERR_NOT_IN_RANGE ;
744744 }
745745
@@ -767,7 +767,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
767767 register . assertTargetObject ( target ) ;
768768 return C . ERR_INVALID_TARGET ;
769769 }
770- if ( ! this . pos . inRangeTo ( target , 3 ) ) {
770+ if ( ! this . pos . inRangeTo ( target , C . RANGE_RANGED_ATTACK ) ) {
771771 return C . ERR_NOT_IN_RANGE ;
772772 }
773773
@@ -816,7 +816,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
816816 register . assertTargetObject ( target ) ;
817817 return C . ERR_INVALID_TARGET ;
818818 }
819- if ( ! target . pos . isNearTo ( this . pos ) ) {
819+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_HEAL ) ) {
820820 return C . ERR_NOT_IN_RANGE ;
821821 }
822822 if ( this . room . controller && ! this . room . controller . my && this . room . controller . safeMode ) {
@@ -875,7 +875,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
875875 register . assertTargetObject ( target ) ;
876876 return C . ERR_INVALID_TARGET ;
877877 }
878- if ( ! this . pos . inRangeTo ( target , 3 ) ) {
878+ if ( ! this . pos . inRangeTo ( target , C . RANGE_REPAIR ) ) {
879879 return C . ERR_NOT_IN_RANGE ;
880880 }
881881
@@ -902,7 +902,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
902902 register . assertTargetObject ( target ) ;
903903 return C . ERR_INVALID_TARGET ;
904904 }
905- if ( ! this . pos . inRangeTo ( target , 3 ) ) {
905+ if ( ! this . pos . inRangeTo ( target , C . RANGE_BUILD ) ) {
906906 return C . ERR_NOT_IN_RANGE ;
907907 }
908908
@@ -985,7 +985,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
985985 if ( ! _hasActiveBodypart ( this . body , C . CLAIM ) ) {
986986 return C . ERR_NO_BODYPART ;
987987 }
988- if ( ! target . pos . isNearTo ( this . pos ) ) {
988+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_CLAIM_CONTROLLER ) ) {
989989 return C . ERR_NOT_IN_RANGE ;
990990 }
991991 if ( target . structureType != 'controller' ) {
@@ -1021,7 +1021,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
10211021 if ( ! _getActiveBodyparts ( this . body , C . CLAIM ) ) {
10221022 return C . ERR_NO_BODYPART ;
10231023 }
1024- if ( ! target . pos . isNearTo ( this . pos ) ) {
1024+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_ATTACK_CONTROLLER ) ) {
10251025 return C . ERR_NOT_IN_RANGE ;
10261026 }
10271027 if ( ! target . owner && ! target . reservation ) {
@@ -1059,7 +1059,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
10591059 if ( target . upgradeBlocked && target . upgradeBlocked > 0 ) {
10601060 return C . ERR_INVALID_TARGET ;
10611061 }
1062- if ( ! target . pos . inRangeTo ( this . pos , 3 ) ) {
1062+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_UPGRADE_CONTROLLER ) ) {
10631063 return C . ERR_NOT_IN_RANGE ;
10641064 }
10651065 if ( ! target . my ) {
@@ -1086,7 +1086,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
10861086 register . assertTargetObject ( target ) ;
10871087 return C . ERR_INVALID_TARGET ;
10881088 }
1089- if ( ! target . pos . isNearTo ( this . pos ) ) {
1089+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_RESERVE_CONTROLLER ) ) {
10901090 return C . ERR_NOT_IN_RANGE ;
10911091 }
10921092 if ( target . structureType != 'controller' ) {
@@ -1152,7 +1152,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
11521152 register . assertTargetObject ( target ) ;
11531153 return C . ERR_INVALID_TARGET ;
11541154 }
1155- if ( ! target . pos . isNearTo ( this . pos ) ) {
1155+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_DISMANTLE ) ) {
11561156 return C . ERR_NOT_IN_RANGE ;
11571157 }
11581158 if ( this . room . controller && ! this . room . controller . my && this . room . controller . safeMode ) {
@@ -1183,7 +1183,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
11831183 register . assertTargetObject ( target ) ;
11841184 return C . ERR_INVALID_TARGET ;
11851185 }
1186- if ( ! target . pos . isNearTo ( this . pos ) ) {
1186+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_GENERATE_SAFEMODE ) ) {
11871187 return C . ERR_NOT_IN_RANGE ;
11881188 }
11891189
@@ -1201,7 +1201,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
12011201 register . assertTargetObject ( target ) ;
12021202 return C . ERR_INVALID_TARGET ;
12031203 }
1204- if ( ! target . pos . isNearTo ( this . pos ) ) {
1204+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_SIGN_CONTROLLER ) ) {
12051205 return C . ERR_NOT_IN_RANGE ;
12061206 }
12071207 if ( target . structureType != 'controller' ) {
0 commit comments