Skip to content

Commit

Permalink
Optimizes most LC13 uses of Range to incorporate urange and livinginr…
Browse files Browse the repository at this point in the history
…ange (#2344)

* Removes various Living in ranges, replaced them with in range

* updates range to urange
  • Loading branch information
Kitsunemitsu authored Aug 1, 2024
1 parent 0ca42b3 commit 1448f81
Show file tree
Hide file tree
Showing 22 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion code/datums/ai/sanity/_sanityloss_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@
if(living_enemy.status_flags & GODMODE)
blackboard[BB_INSANE_CURRENT_ATTACK_TARGET] = null
return
if(!(living_enemy in livinginrange(10, living_pawn)))
if(!(living_enemy in range(10, living_pawn)))
blackboard[BB_INSANE_CURRENT_ATTACK_TARGET] = null
return
if(living_enemy.stat != DEAD)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/ego_weapons/he.dm
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@
to_chat(user, span_userdanger("Impending Day extends outward!"))
playsound('sound/abnormalities/doomsdaycalendar/Doomsday_Attack.ogg', 3, TRUE)
sacrifice = FALSE
for(var/mob/living/L in livinginrange(1, target))
for(var/mob/living/L in range(1, target))
var/aoe = 50
var/userjust = (get_modified_attribute_level(user, JUSTICE_ATTRIBUTE))
var/justicemod = 1 + userjust/100
Expand Down Expand Up @@ -912,7 +912,7 @@
force = initial(force)
can_attack = FALSE
addtimer(CALLBACK(src, PROC_REF(JumpReset)), 20)
for(var/mob/living/L in livinginrange(1, A))
for(var/mob/living/L in range(1, A))
if(L.z != user.z) // Not on our level
continue
var/aoe = 25
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
to_chat(user, span_blueteamradio("We will shape this world together."), MESSAGE_TYPE_LOCALCHAT)
deltimer(vibration_timer)
var/hit_target = FALSE
for(var/mob/living/L in livinginrange(8, user))
for(var/mob/living/L in range(8, user))
if(L == src)
continue
if(faction_check(user.faction, L.faction))
Expand Down Expand Up @@ -187,7 +187,7 @@
var/turf/original_turf = get_turf(user)
var/list/to_hit = list()
var/hit_target = FALSE
for(var/mob/living/L in livinginrange(12, user))
for(var/mob/living/L in range(12, user))
if(L == src)
continue
if(faction_check(user.faction, L.faction))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
if(active || !CanUseEgo(user))
return FALSE
active = TRUE
for(var/mob/living/L in livinginrange(8, user))
for(var/mob/living/L in range(8, user))
if(L == src)
continue
if(faction_check(user.faction, L.faction))
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/ego_weapons/ordeal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@

/obj/item/ego_weapon/the_claw/proc/TriSerum(mob/living/user) // from PT, which was from Blue reverb
var/list/targets = list()
for(var/mob/living/L in livinginrange(12, user))
for(var/mob/living/L in range(12, user))
if(L == src)
continue
if(faction_check(user.faction, L.faction))
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/ego_weapons/waw.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@
force = initial(force)
can_attack = FALSE
addtimer(CALLBACK(src, PROC_REF(JumpReset)), 20)
for(var/mob/living/L in livinginrange(2, A))
for(var/mob/living/L in range(2, A))
if(L.z != user.z) // Not on our level
continue
var/aoe = 25
Expand Down Expand Up @@ -2086,7 +2086,7 @@
for(var/turf/open/T in range(1, user))
var/obj/effect/temp_visual/small_smoke/halfsecond/smonk = new(T)
smonk.color = COLOR_TEAL
for(var/mob/living/L in livinginrange(1, user))
for(var/mob/living/L in range(1, user))
if(L.z != user.z) // Not on our level
continue
var/aoe = 40
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
animate(V, alpha = 0, transform = matrix()*2, time = 10)
for(var/turf/open/T in view(2, target))
new /obj/effect/temp_visual/small_smoke/halfsecond(T)
for(var/mob/living/L in livinginrange(2, target))
for(var/mob/living/L in range(2, target))
if(L.z != user.z)
continue
var/userjust = (get_modified_attribute_level(user, JUSTICE_ATTRIBUTE))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
/datum/status_effect/boomsap/on_remove()
. = ..()
owner.gib()
for(var/mob/living/carbon/human/L in livinginrange(10, src))
for(var/mob/living/carbon/human/L in urange(10, src))
L.deal_damage(60, WHITE_DAMAGE)
to_chat(L, span_danger("Oh god, what the fuck was that!?"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ GLOBAL_LIST_EMPTY(army)
return
playsound(get_turf(src), 'sound/abnormalities/armyinblack/black_explosion.ogg', 125, 0, 8)
visible_message(span_danger("[src] suddenly explodes!"))
for(var/mob/living/simple_animal/hostile/abnormality/P in range(20, src))
for(var/mob/living/simple_animal/hostile/abnormality/P in livinginrange(20, src))
if(!P.datum_reference)//Prevents a runtime if the abno lacks datums, such as those spawned by contract
continue
P.datum_reference.qliphoth_change(-1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
return
var/punishment = TRUE
var/transform_target
for(var/mob/living/L in livinginrange(15, src))
for(var/mob/living/L in urange(15, src))
if(L.z != z)
continue
if(faction_check_mob(L))
Expand Down Expand Up @@ -548,7 +548,7 @@
if(!can_act)
return
var/list/target_list = list()
for(var/mob/living/L in livinginrange(10, src))
for(var/mob/living/L in urange(10, src))
if(L.z != z || (L.status_flags & GODMODE))
continue
if(faction_check_mob(L, FALSE))
Expand Down Expand Up @@ -682,7 +682,7 @@
for(var/turf/T in range(1, target))
new /obj/effect/temp_visual/mustardgas(T)
var/list/target_list = list()
for(var/mob/living/L in livinginrange(1, target))
for(var/mob/living/L in range(1, target))
if(L.z != z || (L.status_flags & GODMODE))
continue
if(faction_check_mob(L, FALSE))
Expand Down Expand Up @@ -737,7 +737,7 @@
playsound(target, 'sound/abnormalities/crying_children/sorrow_shot.ogg', 50, FALSE)
new /obj/effect/temp_visual/beam_in_giant(get_turf(target))
var/list/target_list = list()
for(var/mob/living/L in livinginrange(2, target))
for(var/mob/living/L in range(2, target))
if(L.z != z || (L.status_flags & GODMODE))
continue
if(faction_check_mob(L, FALSE))
Expand Down Expand Up @@ -948,7 +948,7 @@
addtimer(CALLBACK(src, PROC_REF(CrumblingArmorAttack)), 20)

/mob/living/simple_animal/hostile/abnormality/distortedform/proc/CrumblingArmorAttack()
for(var/mob/living/L in livinginrange(10, src))
for(var/mob/living/L in urange(10, src))
if(L.z != z || (L.status_flags & GODMODE))
continue
if(faction_check_mob(L, FALSE))
Expand Down Expand Up @@ -985,7 +985,7 @@
/mob/living/simple_animal/hostile/abnormality/distortedform/proc/HammerOfLightAttack()
playsound(src, 'sound/abnormalities/crying_children/sorrow_shot.ogg', 50, FALSE, 7)
var/targetAmount = 0
for(var/mob/living/L in livinginrange(10, src))
for(var/mob/living/L in urange(10, src))
if(L.z != z || (L.status_flags & GODMODE))
continue
if(faction_check_mob(L, FALSE))
Expand Down Expand Up @@ -1638,7 +1638,7 @@
can_move = FALSE
can_attack = FALSE
var/LongRange = TRUE //Check if there's anyone within 15 tiles when we transformed
for(var/mob/living/L in livinginrange(15, src))
for(var/mob/living/L in urange(15, src))
if(L.z != z)
continue
if(faction_check_mob(L))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
L.flicker(4)
for(var/turf/open/L in range(7, src))
new /obj/effect/temp_visual/cult/sparks(L)
for(var/turf/open/T in range(25, src))
for(var/turf/open/T in urange(25, src))
if(prob(50))
addtimer(CALLBACK(src, PROC_REF(NukeAttackEffectHelper),T), rand(0,40))
SLEEP_CHECK_DEATH(50)
Expand Down Expand Up @@ -203,7 +203,7 @@
if(!can_act && !forced)
return FALSE
var/list/teleport_potential = list()
for(var/mob/living/L in range(13, src)) //1st priority - anyone in about viewport distance
for(var/mob/living/L in urange(13, src)) //1st priority - anyone in about viewport distance
if(!faction_check_mob(L) && L.stat != DEAD && !(L.status_flags & GODMODE))
if(ishuman(L))
var/mob/living/carbon/human/H = L
Expand All @@ -227,7 +227,7 @@
teleport_potential += P
can_act = FALSE
LoseTarget()
for(var/mob/living/L in range(13, src)) //vfx
for(var/mob/living/L in urange(13, src)) //vfx
if(L.z == z && L.client)
shake_camera(L, 10, 1)
playsound(src, 'sound/abnormalities/hatredqueen/gun.ogg', 65, FALSE, 10)
Expand Down Expand Up @@ -276,7 +276,7 @@
TeleportIn() //Same effect
if("DESPAIR")
var/list/target_list = list()
for(var/mob/living/L in livinginrange(10, src))
for(var/mob/living/L in urange(10, src))
if(L.z != z || (L.status_flags & GODMODE))
continue
if(faction_check_mob(L, FALSE))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

//Babies crying hurts your head
SLEEP_CHECK_DEATH(3)
for(var/mob/living/L in range(10, src))
for(var/mob/living/L in urange(10, src))
if(faction_check_mob(L, FALSE))
continue
if(L.stat == DEAD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
var/datum/effect_system/smoke_spread/S = new
S.set_up(7, get_turf(src))
S.start()
for(var/mob/living/simple_animal/hostile/abnormality/P in range(pulse_range, src))
for(var/mob/living/simple_animal/hostile/abnormality/P in urange(pulse_range, src))
if(!(P.IsContained()))
continue
P.datum_reference.qliphoth_change(-1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

/mob/living/simple_animal/hostile/abnormality/voiddream/proc/Shout()
playsound(get_turf(src), 'sound/abnormalities/voiddream/shout.ogg', 75, FALSE, 5)
for(var/mob/living/carbon/human/L in range(10, src))
for(var/mob/living/carbon/human/L in urange(10, src))
if(faction_check(src.faction, L.faction)) // I LOVE NESTING IF STATEMENTS
continue
if(L.has_status_effect(STATUS_EFFECT_SLEEPING))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
playsound(get_turf(src), 'sound/abnormalities/judgementbird/pre_ability.ogg', 50, 0, 2)
SLEEP_CHECK_DEATH(2 SECONDS)
playsound(get_turf(src), 'sound/abnormalities/judgementbird/ability.ogg', 75, 0, 7)
for(var/mob/living/L in livinginrange(judgement_range, src))
for(var/mob/living/L in urange(judgement_range, src))
if(faction_check_mob(L, FALSE))
continue
if(L.stat == DEAD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
var/mob/living/selected_enemy = blackboard[BB_INSANE_CURRENT_ATTACK_TARGET]

if(selected_enemy)
if(!(selected_enemy in livinginrange(10, living_pawn)))
if(!(selected_enemy in urange(10, living_pawn)))
blackboard[BB_INSANE_CURRENT_ATTACK_TARGET] = null
return
if(selected_enemy.status_flags & GODMODE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ It has now been over four months. Now we get her for real. -Coxswain
say("Work's done. Time to go home.")
else
say("Finally, the nightmare is over...")
for(var/mob/living/carbon/human/survivor in range(10, src))
for(var/mob/living/carbon/human/survivor in urange(10, src))
if(survivor.stat == DEAD || !survivor.ckey)
continue
survivor.Apply_Gift(new /datum/ego_gifts/sheep)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
if(toggleplants)
SpreadPlants()
oldGrowth()
for(var/obj/structure/spreading/apple_vine/W in range(15, get_turf(src)))
for(var/obj/structure/spreading/apple_vine/W in urange(15, get_turf(src)))
if(W.last_expand <= world.time)
W.expand()
if(teleport_cooldown <= world.time && !togglemovement && !client && !IsCombatMap())
Expand Down Expand Up @@ -239,7 +239,7 @@
ranged_cooldown = world.time + ranged_cooldown_time

/mob/living/simple_animal/hostile/abnormality/snow_whites_apple/proc/oldGrowth()
for(var/obj/structure/spreading/apple_vine/W in range(15, get_turf(src)))
for(var/obj/structure/spreading/apple_vine/W in urange(15, get_turf(src)))
if(!W.old_growth)
W.OverGrowth()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
//thunderbolts
/mob/living/simple_animal/hostile/abnormality/thunder_bird/proc/fireshell()
fire_cooldown = world.time + fire_cooldown_time
for(var/mob/living/carbon/human/L in livinginrange(fireball_range, src))
for(var/mob/living/carbon/human/L in range(fireball_range, src))
if(faction_check_mob(L, FALSE))
continue
if (targetAmount <= 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
if(IsContained() || !can_act)
return
if(stunned && COOLDOWN_FINISHED(src, stun))
for(var/mob/living/L in range(10, src))
for(var/mob/living/L in urange(10, src))
if(L.z != z)
continue
if(istype(L, /mob/living/simple_animal/hostile/azure_hermit) || istype(L, /mob/living/simple_animal/hostile/azure_stave))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
for(var/turf/open/T in turf_list)
if(prob(25))
new /obj/effect/temp_visual/revenant(T)
for(var/mob/living/L in livinginrange(15, target_c))
for(var/mob/living/L in range(15, target_c))
if(faction_check_mob(L))
continue
L.apply_damage(33, WHITE_DAMAGE, null, L.run_armor_check(null, WHITE_DAMAGE))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/spells/ability_types/realized.dm
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@
/mob/living/simple_animal/hostile/spicebush_plant/proc/HealPulse()
pulse_cooldown = world.time + pulse_cooldown_time
//playsound(src, 'sound/abnormalities/rudolta/throw.ogg', 50, FALSE, 4)//TODO: proper SFX goes here
for(var/mob/living/carbon/human/L in livinginrange(8, src))//livinginview(8, src))
for(var/mob/living/carbon/human/L in range(8, src))//livinginview(8, src))
if(L.stat == DEAD || L.is_working)
continue
L.adjustBruteLoss(-2)
Expand Down

0 comments on commit 1448f81

Please sign in to comment.