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
+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>"