@@ -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 ) {
@@ -808,7 +808,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
808808 register . assertTargetObject ( target ) ;
809809 return C . ERR_INVALID_TARGET ;
810810 }
811- if ( ! this . pos . inRangeTo ( target , 3 ) ) {
811+ if ( ! this . pos . inRangeTo ( target , C . RANGE_REPAIR ) ) {
812812 return C . ERR_NOT_IN_RANGE ;
813813 }
814814
@@ -835,7 +835,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
835835 register . assertTargetObject ( target ) ;
836836 return C . ERR_INVALID_TARGET ;
837837 }
838- if ( ! this . pos . inRangeTo ( target , 3 ) ) {
838+ if ( ! this . pos . inRangeTo ( target , C . RANGE_BUILD ) ) {
839839 return C . ERR_NOT_IN_RANGE ;
840840 }
841841 if ( _ . contains ( [ 'spawn' , 'extension' , 'constructedWall' ] , target . structureType ) &&
@@ -906,7 +906,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
906906 if ( this . getActiveBodyparts ( C . CLAIM ) == 0 ) {
907907 return C . ERR_NO_BODYPART ;
908908 }
909- if ( ! target . pos . isNearTo ( this . pos ) ) {
909+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_CLAIM_CONTROLLER ) ) {
910910 return C . ERR_NOT_IN_RANGE ;
911911 }
912912 if ( target . structureType != 'controller' ) {
@@ -942,7 +942,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
942942 if ( this . getActiveBodyparts ( C . CLAIM ) < 5 ) {
943943 return C . ERR_NO_BODYPART ;
944944 }
945- if ( ! target . pos . isNearTo ( this . pos ) ) {
945+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_ATTACK_CONTROLLER ) ) {
946946 return C . ERR_NOT_IN_RANGE ;
947947 }
948948 if ( ! target . owner && ! target . reservation ) {
@@ -977,7 +977,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
977977 if ( target . upgradeBlocked && target . upgradeBlocked > 0 ) {
978978 return C . ERR_INVALID_TARGET ;
979979 }
980- if ( ! target . pos . inRangeTo ( this . pos , 3 ) ) {
980+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_UPGRADE_CONTROLLER ) ) {
981981 return C . ERR_NOT_IN_RANGE ;
982982 }
983983 if ( ! target . my ) {
@@ -1004,7 +1004,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
10041004 register . assertTargetObject ( target ) ;
10051005 return C . ERR_INVALID_TARGET ;
10061006 }
1007- if ( ! target . pos . isNearTo ( this . pos ) ) {
1007+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_RESERVE_CONTROLLER ) ) {
10081008 return C . ERR_NOT_IN_RANGE ;
10091009 }
10101010 if ( target . structureType != 'controller' ) {
@@ -1070,7 +1070,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
10701070 register . assertTargetObject ( target ) ;
10711071 return C . ERR_INVALID_TARGET ;
10721072 }
1073- if ( ! target . pos . isNearTo ( this . pos ) ) {
1073+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_DISMANTLE ) ) {
10741074 return C . ERR_NOT_IN_RANGE ;
10751075 }
10761076 if ( this . room . controller && ! this . room . controller . my && this . room . controller . safeMode ) {
@@ -1096,7 +1096,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
10961096 register . assertTargetObject ( target ) ;
10971097 return C . ERR_INVALID_TARGET ;
10981098 }
1099- if ( ! target . pos . isNearTo ( this . pos ) ) {
1099+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_GENERATE_SAFEMODE ) ) {
11001100 return C . ERR_NOT_IN_RANGE ;
11011101 }
11021102
@@ -1114,7 +1114,7 @@ exports.make = function(_runtimeData, _intents, _register, _globals) {
11141114 register . assertTargetObject ( target ) ;
11151115 return C . ERR_INVALID_TARGET ;
11161116 }
1117- if ( ! target . pos . isNearTo ( this . pos ) ) {
1117+ if ( ! target . pos . inRangeTo ( this . pos , C . RANGE_SIGN_CONTROLLER ) ) {
11181118 return C . ERR_NOT_IN_RANGE ;
11191119 }
11201120 if ( target . structureType != 'controller' ) {
0 commit comments