Merge pull request #12485 from xxalpha/ultrarange

Added ultra_range() proc.
This commit is contained in:
Razharas
2015-10-20 00:17:09 +03:00
35 changed files with 108 additions and 49 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ Code:
return 0
if(signal.encryption != code)
return 0
for(var/obj/effect/anomaly/A in orange(0, src))
for(var/obj/effect/anomaly/A in get_turf(src))
A.anomalyNeutralize()
/obj/item/device/assembly/signaler/anomaly/attack_self()
+1 -1
View File
@@ -49,7 +49,7 @@
var/y_distance = TO.y - FROM.y
var/x_distance = TO.x - FROM.x
for (var/atom/movable/A in range(12, FROM )) // iterate thru list of mobs in the area
for (var/atom/movable/A in ultra_range(12, FROM )) // iterate thru list of mobs in the area
if(istype(A, /obj/item/device/radio/beacon)) continue // don't teleport beacons because that's just insanely stupid
if(A.anchored) continue
+1 -1
View File
@@ -31,5 +31,5 @@
return
for(var/obj/effect/landmark/epicentre in epicentreList)
for(var/obj/machinery/power/apc/apc in range(epicentre,lightsoutRange))
for(var/obj/machinery/power/apc/apc in ultra_range(lightsoutRange, epicentre))
apc.overload_lighting()
+1 -1
View File
@@ -361,7 +361,7 @@
return
if(istype(W, /obj/item/weapon/scythe))
for(var/obj/effect/spacevine/B in orange(src,1))
for(var/obj/effect/spacevine/B in orange(1,src))
if(prob(80))
qdel(B)
qdel(src)
+1 -1
View File
@@ -483,7 +483,7 @@ var/list/non_fakeattack_weapons = list(/obj/item/weapon/gun/projectile, /obj/ite
target = T
var/image/I = null
var/count = 0
for(var/obj/machinery/door/airlock/A in range(target,7))
for(var/obj/machinery/door/airlock/A in range(7, target))
if(count>door_number && door_number>0)
break
count++
+1 -1
View File
@@ -267,7 +267,7 @@
lighting_object = locate() in src
init_lighting()
for(var/turf/space/S in orange(src,1))
for(var/turf/space/S in orange(1,src))
S.update_starlight()
+1 -1
View File
@@ -399,7 +399,7 @@ var/global/list/rockTurfEdgeCache
if(prob(30))
if(istype(loc, /area/mine/explored))
return
for(var/atom/A in range(15,T))//Lowers chance of mob clumps
for(var/atom/A in ultra_range(15,T))//Lowers chance of mob clumps
if(istype(A, /mob/living/simple_animal/hostile/asteroid))
return
var/randumb = pickweight(mob_spawn_list)
+4 -4
View File
@@ -395,17 +395,17 @@
doing |= TRAVEL
if(nearby.len > 4)
//i'm crowded, time to leave
TARGET = pick(target_filter(orange(MAX_RANGE_FIND,src)))
TARGET = pick(target_filter(ultra_range(MAX_RANGE_FIND,src,1)))
else if(prob((FUZZY_CHANCE_LOW+FUZZY_CHANCE_HIGH)/2))
//chance to chase an item
TARGET = locate(/obj/item) in orange(MIN_RANGE_FIND,src)
TARGET = locate(/obj/item) in ultra_range(MIN_RANGE_FIND,src,1)
else if(prob((FUZZY_CHANCE_LOW+FUZZY_CHANCE_HIGH)/2))
//chance to leave
TARGET = locate(/obj/machinery/door) in orange(MIN_RANGE_FIND,src) // this is a sort of fix for the current pathing.
TARGET = locate(/obj/machinery/door) in ultra_range(MIN_RANGE_FIND,src,1) // this is a sort of fix for the current pathing.
else
//else, target whatever, or go to our department
if(prob((FUZZY_CHANCE_LOW+FUZZY_CHANCE_HIGH)/2))
TARGET = pick(target_filter(orange(MIN_RANGE_FIND,src)))
TARGET = pick(target_filter(ultra_range(MIN_RANGE_FIND,src,1)))
else
TARGET = pick(get_area_turfs(job2area(myjob)))
tryWalk(TARGET)
+2 -2
View File
@@ -86,7 +86,7 @@ Sorry Giacom. Please don't be mad :(
//BubbleWrap: Should stop you pushing a restrained person out of the way
if(istype(M, /mob/living))
for(var/mob/MM in range(M, 1))
for(var/mob/MM in range(1,M))
if( ((MM.pulling == M && ( M.restrained() && !( MM.restrained() ) && MM.stat == CONSCIOUS)) || locate(/obj/item/weapon/grab, M.grabbed_by.len)) )
if ( !(world.time % 5) )
src << "<span class='warning'>[M] is restrained, you cannot push past.</span>"
@@ -517,7 +517,7 @@ Sorry Giacom. Please don't be mad :(
var/cuff_dragged = 0
if (restrained())
for(var/mob/living/M in range(src, 1))
for(var/mob/living/M in range(1, src))
if (M.pulling == src && !M.incapacitated())
cuff_dragged = 1
if (!cuff_dragged && pulling && !throwing && (get_dist(src, pulling) <= 1 || pulling.loc == loc))
@@ -140,7 +140,7 @@
src.y = y
src.z = z
for(var/obj/machinery/camera/c in range(CHUNK_SIZE, locate(x + (CHUNK_SIZE / 2), y + (CHUNK_SIZE / 2), z)))
for(var/obj/machinery/camera/c in ultra_range(CHUNK_SIZE, locate(x + (CHUNK_SIZE / 2), y + (CHUNK_SIZE / 2), z)))
if(c.can_use())
cameras += c
@@ -83,7 +83,7 @@
//1% chance to skitter madly away
if(!busy && prob(1))
stop_automated_movement = 1
Goto(pick(orange(20, src)), move_to_delay)
Goto(pick(ultra_range(20, src, 1)), move_to_delay)
spawn(50)
stop_automated_movement = 0
walk(src,0)
+1 -1
View File
@@ -147,7 +147,7 @@
move_delay += T.slowdown
if(mob.restrained()) //Why being pulled while cuffed prevents you from moving
for(var/mob/M in range(mob, 1))
for(var/mob/M in range(1, mob))
if(M.pulling == mob)
if(!M.incapacitated() && mob.Adjacent(M))
src << "<span class='warning'>You're restrained! You can't move!</span>"
+1 -1
View File
@@ -139,7 +139,7 @@
set background = BACKGROUND_ENABLED
// if(defer_powernet_rebuild != 2)
// defer_powernet_rebuild = 1
for(var/atom/X in orange(consume_range,src))
for(var/atom/X in ultra_range(consume_range,src,1))
if(isturf(X) || istype(X, /atom/movable))
consume(X)
// if(defer_powernet_rebuild != 2)
@@ -112,7 +112,7 @@
/obj/singularity/proc/admin_investigate_setup()
last_warning = world.time
var/count = locate(/obj/machinery/field/containment) in orange(30, src)
var/count = locate(/obj/machinery/field/containment) in ultra_range(30, src, 1)
if(!count) message_admins("A singulo has been created without containment fields active ([x],[y],[z])",1)
investigate_log("was created. [count?"":"<font color='red'>No containment fields were active</font>"]","singulo")
@@ -233,7 +233,8 @@
/obj/singularity/proc/eat()
set background = BACKGROUND_ENABLED
for(var/atom/X in orange(grav_pull,src))
var/list/L = grav_pull > 8 ? ultra_range(grav_pull, src, 1) : orange(grav_pull, src)
for(var/atom/X in L)
var/dist = get_dist(X, src)
var/obj/singularity/S = src
if(dist > consume_range)
@@ -368,7 +369,7 @@
/obj/singularity/proc/combust_mobs()
for(var/mob/living/carbon/C in orange(20, src))
for(var/mob/living/carbon/C in ultra_range(20, src, 1))
C.visible_message("<span class='warning'>[C]'s skin bursts into flame!</span>", \
"<span class='userdanger'>You feel an inner fire as your skin bursts into flames!</span>")
C.adjust_fire_stacks(5)
@@ -80,7 +80,7 @@
return
A.ex_act(2)
playsound(src.loc, 'sound/effects/meteorimpact.ogg', 40, 1)
for(var/mob/M in range(10, src))
for(var/mob/M in ultra_range(10, src))
if(!M.stat)
shake_camera(M, 3, 1)
qdel(src)