diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm
index 20d35846a87..76e7357781e 100644
--- a/code/__HELPERS/unsorted.dm
+++ b/code/__HELPERS/unsorted.dm
@@ -1117,8 +1117,27 @@ B --><-- A
return I
+//ultra range (no limitations on distance, faster than range for distances > 8); including areas drastically decreases performance
+/proc/urange(dist=0, atom/center=usr, orange=0, areas=0)
+ if(!dist)
+ if(!orange)
+ return list(center)
+ else
+ return list()
+
+ var/list/turfs = RANGE_TURFS(dist, center)
+ if(orange)
+ turfs -= get_turf(center)
+ . = list()
+ for(var/V in turfs)
+ var/turf/T = V
+ . += T
+ . += T.contents
+ if(areas)
+ . |= T.loc
+
//similar function to range(), but with no limitations on the distance; will search spiralling outwards from the center
-/proc/ultra_range(dist=0, center=usr, orange=0)
+/proc/spiral_range(dist=0, center=usr, orange=0)
if(!dist)
if(!orange)
return list(center)
diff --git a/code/game/gamemodes/blob/theblob.dm b/code/game/gamemodes/blob/theblob.dm
index 942110135f2..9635508ed11 100644
--- a/code/game/gamemodes/blob/theblob.dm
+++ b/code/game/gamemodes/blob/theblob.dm
@@ -93,7 +93,7 @@
/obj/effect/blob/proc/Pulse_Area(pulsing_overmind = overmind, claim_range = 10, pulse_range = 3, expand_range = 2)
src.Be_Pulsed()
if(claim_range)
- for(var/obj/effect/blob/B in ultra_range(claim_range, src, 1))
+ for(var/obj/effect/blob/B in urange(claim_range, src, 1))
if(!B.overmind && !istype(B, /obj/effect/blob/core) && prob(30))
B.overmind = pulsing_overmind //reclaim unclaimed, non-core blobs.
B.update_icon()
diff --git a/code/game/machinery/computer/crew.dm b/code/game/machinery/computer/crew.dm
index a1f58a67ef5..ad992d3aba3 100644
--- a/code/game/machinery/computer/crew.dm
+++ b/code/game/machinery/computer/crew.dm
@@ -229,8 +229,8 @@ var/global/datum/crewmonitor/crewmonitor = new
var/obj/machinery/camera/C = locate(/obj/machinery/camera) in range(5, tile)
- if (!C) C = locate(/obj/machinery/camera) in ultra_range(10, tile)
- if (!C) C = locate(/obj/machinery/camera) in ultra_range(15, tile)
+ if (!C) C = locate(/obj/machinery/camera) in urange(10, tile)
+ if (!C) C = locate(/obj/machinery/camera) in urange(15, tile)
if (C)
var/turf/current_loc = AI.eyeobj.loc
diff --git a/code/game/machinery/computer/telecrystalconsoles.dm b/code/game/machinery/computer/telecrystalconsoles.dm
index 49fefa2e08f..f778b374959 100644
--- a/code/game/machinery/computer/telecrystalconsoles.dm
+++ b/code/game/machinery/computer/telecrystalconsoles.dm
@@ -134,7 +134,7 @@ var/list/possible_uplinker_IDs = list("Alfa","Bravo","Charlie","Delta","Echo","F
transferlog += ("[worldtime2text()] [logmessage]")
/obj/machinery/computer/telecrystals/boss/proc/scanUplinkers()
- for(var/obj/machinery/computer/telecrystals/uplinker/A in ultra_range(scanrange, src.loc))
+ for(var/obj/machinery/computer/telecrystals/uplinker/A in urange(scanrange, src.loc))
if(!A.linkedboss)
TCstations += A
A.linkedboss = src
diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm
index 77c1f3419c8..a72c6d98e41 100644
--- a/code/game/machinery/doors/brigdoors.dm
+++ b/code/game/machinery/doors/brigdoors.dm
@@ -39,15 +39,15 @@
Radio.listening = 0
spawn(20)
- for(var/obj/machinery/door/window/brigdoor/M in ultra_range(20, src))
+ for(var/obj/machinery/door/window/brigdoor/M in urange(20, src))
if (M.id == src.id)
targets += M
- for(var/obj/machinery/flasher/F in ultra_range(20, src))
+ for(var/obj/machinery/flasher/F in urange(20, src))
if(F.id == src.id)
targets += F
- for(var/obj/structure/closet/secure_closet/brig/C in ultra_range(20, src))
+ for(var/obj/structure/closet/secure_closet/brig/C in urange(20, src))
if(C.id == src.id)
targets += C
diff --git a/code/game/machinery/telecomms/computers/logbrowser.dm b/code/game/machinery/telecomms/computers/logbrowser.dm
index 756a72bb043..6fe32ddae80 100644
--- a/code/game/machinery/telecomms/computers/logbrowser.dm
+++ b/code/game/machinery/telecomms/computers/logbrowser.dm
@@ -173,7 +173,7 @@
temp = "- FAILED: CANNOT PROBE WHEN BUFFER FULL -"
else
- for(var/obj/machinery/telecomms/server/T in ultra_range(25, src))
+ for(var/obj/machinery/telecomms/server/T in urange(25, src))
if(T.network == network)
servers.Add(T)
diff --git a/code/game/machinery/telecomms/computers/telemonitor.dm b/code/game/machinery/telecomms/computers/telemonitor.dm
index efdbdaa4c9c..f76a0ca641b 100644
--- a/code/game/machinery/telecomms/computers/telemonitor.dm
+++ b/code/game/machinery/telecomms/computers/telemonitor.dm
@@ -94,7 +94,7 @@
temp = "- FAILED: CANNOT PROBE WHEN BUFFER FULL -"
else
- for(var/obj/machinery/telecomms/T in ultra_range(25, src))
+ for(var/obj/machinery/telecomms/T in urange(25, src))
if(T.network == network)
machinelist.Add(T)
diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm
index b46bd9577cd..161de617ea5 100644
--- a/code/game/machinery/telecomms/telecomunications.dm
+++ b/code/game/machinery/telecomms/telecomunications.dm
@@ -146,7 +146,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
if(autolinkers.len)
// Links nearby machines
if(!long_range_link)
- for(var/obj/machinery/telecomms/T in ultra_range(20, src, 1))
+ for(var/obj/machinery/telecomms/T in urange(20, src, 1))
add_link(T)
else
for(var/obj/machinery/telecomms/T in telecomms_list)
diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm
index af8237a5e70..7f77a68f41a 100644
--- a/code/game/objects/items/devices/traitordevices.dm
+++ b/code/game/objects/items/devices/traitordevices.dm
@@ -39,7 +39,7 @@ effective or pretty fucking useless.
add_logs(user, null, "knocked down people in the area", src)
- for(var/mob/living/carbon/human/M in ultra_range(10, user, 1))
+ for(var/mob/living/carbon/human/M in urange(10, user, 1))
if(prob(50))
M.Weaken(rand(10,20))
diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm
index 434f2715ecd..b3fbb324436 100755
--- a/code/game/objects/items/toys.dm
+++ b/code/game/objects/items/toys.dm
@@ -1131,7 +1131,7 @@
/obj/item/toy/minimeteor/throw_impact(atom/hit_atom)
if(!..())
playsound(src, 'sound/effects/meteorimpact.ogg', 40, 1)
- for(var/mob/M in ultra_range(10, src))
+ for(var/mob/M in urange(10, src))
if(!M.stat && !istype(M, /mob/living/silicon/ai))\
shake_camera(M, 3, 1)
qdel(src)
@@ -1178,7 +1178,7 @@
cooldown = (world.time + 300) // Sets cooldown at 30 seconds
user.visible_message("[user] presses the big red button.", "You press the button, it plays a loud noise!", "The button clicks loudly.")
playsound(src, 'sound/effects/explosionfar.ogg', 50, 0, surround = 0)
- for(var/mob/M in ultra_range(10, src)) // Checks range
+ for(var/mob/M in urange(10, src)) // Checks range
if(!M.stat && !istype(M, /mob/living/silicon/ai)) // Checks to make sure whoever's getting shaken is alive/not the AI
sleep(8) // Short delay to match up with the explosion sound
shake_camera(M, 2, 1) // Shakes player camera 2 squares for 1 second.
diff --git a/code/game/objects/items/weapons/teleportation.dm b/code/game/objects/items/weapons/teleportation.dm
index 6d2303a0483..8ddc35e8ee5 100644
--- a/code/game/objects/items/weapons/teleportation.dm
+++ b/code/game/objects/items/weapons/teleportation.dm
@@ -149,7 +149,7 @@ Frequency:
else
L["[get_area(com.target)] (Inactive)"] = com.target
var/list/turfs = list( )
- for(var/turf/T in ultra_range(10, orange=1))
+ for(var/turf/T in urange(10, orange=1))
if(T.x>world.maxx-8 || T.x<8)
continue //putting them at the edge is dumb
if(T.y>world.maxy-8 || T.y<8)
diff --git a/code/modules/atmospherics/machinery/other/area_atmos_computer.dm b/code/modules/atmospherics/machinery/other/area_atmos_computer.dm
index 53aa393b48d..cca6693dcae 100644
--- a/code/modules/atmospherics/machinery/other/area_atmos_computer.dm
+++ b/code/modules/atmospherics/machinery/other/area_atmos_computer.dm
@@ -113,7 +113,7 @@
connectedscrubbers = new()
var/found = 0
- for(var/obj/machinery/portable_atmospherics/scrubber/huge/scrubber in ultra_range(range, src.loc))
+ for(var/obj/machinery/portable_atmospherics/scrubber/huge/scrubber in urange(range, src.loc))
if(istype(scrubber))
found = 1
connectedscrubbers += scrubber
diff --git a/code/modules/events/anomaly_bluespace.dm b/code/modules/events/anomaly_bluespace.dm
index df4d6ffd8d3..bfb574706cc 100644
--- a/code/modules/events/anomaly_bluespace.dm
+++ b/code/modules/events/anomaly_bluespace.dm
@@ -49,7 +49,7 @@
var/y_distance = TO.y - FROM.y
var/x_distance = TO.x - FROM.x
- for (var/atom/movable/A in ultra_range(12, FROM )) // iterate thru list of mobs in the area
+ for (var/atom/movable/A in urange(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
diff --git a/code/modules/events/electrical_storm.dm b/code/modules/events/electrical_storm.dm
index 4108a34f6db..302586925c5 100644
--- a/code/modules/events/electrical_storm.dm
+++ b/code/modules/events/electrical_storm.dm
@@ -31,5 +31,5 @@
return
for(var/obj/effect/landmark/epicentre in epicentreList)
- for(var/obj/machinery/power/apc/apc in ultra_range(lightsoutRange, epicentre))
+ for(var/obj/machinery/power/apc/apc in urange(lightsoutRange, epicentre))
apc.overload_lighting()
diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm
index 6f31a22f717..154ebc9f00d 100644
--- a/code/modules/holodeck/computer.dm
+++ b/code/modules/holodeck/computer.dm
@@ -121,7 +121,7 @@
if(!floorcheck())
emergency_shutdown()
damaged = 1
- for(var/mob/M in ultra_range(10,src))
+ for(var/mob/M in urange(10,src))
M.show_message("The holodeck overloads!")
for(var/turf/T in linked)
diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm
index e8eb3462876..3299e098e7f 100644
--- a/code/modules/mining/mine_turfs.dm
+++ b/code/modules/mining/mine_turfs.dm
@@ -407,7 +407,7 @@ var/global/list/rockTurfEdgeCache
if(prob(30))
if(istype(loc, /area/mine/explored))
return
- for(var/atom/A in ultra_range(15,T))//Lowers chance of mob clumps
+ for(var/atom/A in urange(15,T))//Lowers chance of mob clumps
if(istype(A, /mob/living/simple_animal/hostile/asteroid))
return
var/randumb = pickweight(mob_spawn_list)
diff --git a/code/modules/mob/interactive.dm b/code/modules/mob/interactive.dm
index 5fc95dcfeef..03fdafe2d57 100644
--- a/code/modules/mob/interactive.dm
+++ b/code/modules/mob/interactive.dm
@@ -395,17 +395,17 @@
doing |= TRAVEL
if(nearby.len > 4)
//i'm crowded, time to leave
- TARGET = pick(target_filter(ultra_range(MAX_RANGE_FIND,src,1)))
+ TARGET = pick(target_filter(urange(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 ultra_range(MIN_RANGE_FIND,src,1)
+ TARGET = locate(/obj/item) in urange(MIN_RANGE_FIND,src,1)
else if(prob((FUZZY_CHANCE_LOW+FUZZY_CHANCE_HIGH)/2))
//chance to leave
- TARGET = locate(/obj/machinery/door) in ultra_range(MIN_RANGE_FIND,src,1) // this is a sort of fix for the current pathing.
+ TARGET = locate(/obj/machinery/door) in urange(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(ultra_range(MIN_RANGE_FIND,src,1)))
+ TARGET = pick(target_filter(urange(MIN_RANGE_FIND,src,1)))
else
TARGET = safepick(get_area_turfs(job2area(myjob)))
tryWalk(TARGET)
diff --git a/code/modules/mob/living/silicon/ai/freelook/chunk.dm b/code/modules/mob/living/silicon/ai/freelook/chunk.dm
index 515d4b54501..9f6cc242cb6 100644
--- a/code/modules/mob/living/silicon/ai/freelook/chunk.dm
+++ b/code/modules/mob/living/silicon/ai/freelook/chunk.dm
@@ -140,7 +140,7 @@
src.y = y
src.z = z
- for(var/obj/machinery/camera/c in ultra_range(CHUNK_SIZE, locate(x + (CHUNK_SIZE / 2), y + (CHUNK_SIZE / 2), z)))
+ for(var/obj/machinery/camera/c in urange(CHUNK_SIZE, locate(x + (CHUNK_SIZE / 2), y + (CHUNK_SIZE / 2), z)))
if(c.can_use())
cameras += c
diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
index ae40d8b279f..ba6a8efbaeb 100644
--- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
+++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
@@ -48,7 +48,7 @@
gold_core_spawnable = 1
see_invisible = SEE_INVISIBLE_MINIMUM
see_in_dark = 4
-
+
/mob/living/simple_animal/hostile/poison/giant_spider/Topic(href, href_list)
if(href_list["activate"])
var/mob/dead/observer/ghost = usr
@@ -105,7 +105,7 @@
//1% chance to skitter madly away
if(!busy && prob(1))
stop_automated_movement = 1
- Goto(pick(ultra_range(20, src, 1)), move_to_delay)
+ Goto(pick(urange(20, src, 1)), move_to_delay)
spawn(50)
stop_automated_movement = 0
walk(src,0)
diff --git a/code/modules/power/singularity/narsie.dm b/code/modules/power/singularity/narsie.dm
index 0c64d0d67d5..8b549a802ef 100644
--- a/code/modules/power/singularity/narsie.dm
+++ b/code/modules/power/singularity/narsie.dm
@@ -139,7 +139,7 @@
set background = BACKGROUND_ENABLED
// if(defer_powernet_rebuild != 2)
// defer_powernet_rebuild = 1
- for(var/atom/X in ultra_range(consume_range,src,1))
+ for(var/atom/X in urange(consume_range,src,1))
if(isturf(X) || istype(X, /atom/movable))
consume(X)
// if(defer_powernet_rebuild != 2)
diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm
index 7e0669991de..7478b5bfe5a 100644
--- a/code/modules/power/singularity/singularity.dm
+++ b/code/modules/power/singularity/singularity.dm
@@ -115,7 +115,7 @@
/obj/singularity/proc/admin_investigate_setup()
last_warning = world.time
- var/count = locate(/obj/machinery/field/containment) in ultra_range(30, src, 1)
+ var/count = locate(/obj/machinery/field/containment) in urange(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?"":"No containment fields were active"]","singulo")
@@ -236,7 +236,7 @@
/obj/singularity/proc/eat()
set background = BACKGROUND_ENABLED
- var/list/L = grav_pull > 8 ? ultra_range(grav_pull, src, 1) : orange(grav_pull, src)
+ var/list/L = grav_pull > 8 ? urange(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
@@ -372,7 +372,7 @@
/obj/singularity/proc/combust_mobs()
- for(var/mob/living/carbon/C in ultra_range(20, src, 1))
+ for(var/mob/living/carbon/C in urange(20, src, 1))
C.visible_message("[C]'s skin bursts into flame!", \
"You feel an inner fire as your skin bursts into flames!")
C.adjust_fire_stacks(5)
diff --git a/code/modules/projectiles/projectile/special.dm b/code/modules/projectiles/projectile/special.dm
index e84a7357080..c54813e62fb 100644
--- a/code/modules/projectiles/projectile/special.dm
+++ b/code/modules/projectiles/projectile/special.dm
@@ -80,7 +80,7 @@
return
A.ex_act(2)
playsound(src.loc, 'sound/effects/meteorimpact.ogg', 40, 1)
- for(var/mob/M in ultra_range(10, src))
+ for(var/mob/M in urange(10, src))
if(!M.stat)
shake_camera(M, 3, 1)
qdel(src)