Merge pull request #11179 from VOREStation/Arokha/opt

Optimize a couple things
This commit is contained in:
Aronai Sieyes
2021-07-20 17:28:31 -04:00
committed by GitHub
262 changed files with 546 additions and 975 deletions
+1 -2
View File
@@ -176,8 +176,7 @@
return M
/atom/movable/proc/handle_buckled_mob_movement(atom/old_loc, direct, movetime)
for(var/A in buckled_mobs)
var/mob/living/L = A
for(var/mob/living/L as anything in buckled_mobs)
if(!L.Move(loc, direct, movetime))
L.forceMove(loc, direct, movetime)
L.last_move = last_move
+1 -2
View File
@@ -294,8 +294,7 @@
for(var/obj/effect/alien/weeds/W in orange(node_range, src))
nearby_weeds |= W
for(var/nbw in nearby_weeds)
var/obj/effect/alien/weeds/W = nbw
for(var/obj/effect/alien/weeds/W as anything in nearby_weeds)
if(!W.linked_node)
W.linked_node = src
@@ -113,8 +113,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
var/lowest_y = 0
// First pass is for finding the top right corner.
for(var/thing in vis_contents)
var/turf/T = thing
for(var/turf/T as anything in vis_contents)
if(T.x > highest_x)
highest_x = T.x
if(T.y > highest_y)
@@ -124,8 +123,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
lowest_y = highest_y
// Second one is for the bottom left corner.
for(var/thing in vis_contents)
var/turf/T = thing
for(var/turf/T as anything in vis_contents)
if(T.x < lowest_x)
lowest_x = T.x
if(T.y < lowest_y)
@@ -182,8 +180,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
// Connects both sides of a portal together.
/obj/effect/map_effect/portal/master/proc/find_counterparts()
for(var/thing in GLOB.all_portal_masters)
var/obj/effect/map_effect/portal/master/M = thing
for(var/obj/effect/map_effect/portal/master/M as anything in GLOB.all_portal_masters)
if(M == src)
continue
if(M.counterpart)
@@ -205,8 +202,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
/obj/effect/map_effect/portal/master/proc/make_visuals()
var/list/observed_turfs = list()
for(var/thing in portal_lines + src)
var/obj/effect/map_effect/portal/P = thing
for(var/obj/effect/map_effect/portal/P as anything in portal_lines + src)
P.name = null
P.icon_state = null
@@ -230,8 +226,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
// Shifts the portal's pixels in order to line up properly, as BYOND offsets the sprite when it holds multiple turfs inside `vis_contents`.
// This undos the shift that BYOND did.
/obj/effect/map_effect/portal/master/proc/apply_offset()
for(var/thing in portal_lines + src)
var/obj/effect/map_effect/portal/P = thing
for(var/obj/effect/map_effect/portal/P as anything in portal_lines + src)
P.pixel_x = WORLD_ICON_SIZE * P.portal_distance_x
P.pixel_y = WORLD_ICON_SIZE * P.portal_distance_y
@@ -245,8 +240,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
var/list/in_range = get_mobs_and_objs_in_view_fast(T, world.view, 0)
var/list/mobs_to_relay = in_range["mobs"]
for(var/thing in mobs_to_relay)
var/mob/mob = thing
for(var/mob/mob as anything in mobs_to_relay)
var/rendered = "<span class='message'>[text]</span>"
mob.show_message(rendered)
@@ -261,8 +255,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
var/list/in_range = get_mobs_and_objs_in_view_fast(T, world.view, 0)
var/list/mobs_to_relay = in_range["mobs"]
for(var/thing in mobs_to_relay)
var/mob/mob = thing
for(var/mob/mob as anything in mobs_to_relay)
mob.show_message(rendered)
..()
@@ -275,8 +268,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
var/list/in_range = get_mobs_and_objs_in_view_fast(T, world.view, 0)
var/list/mobs_to_relay = in_range["mobs"]
for(var/thing in mobs_to_relay)
var/mob/mob = thing
for(var/mob/mob as anything in mobs_to_relay)
var/list/combined = mob.combine_message(message_pieces, verb, M)
var/message = combined["formatted"]
var/name_used = M.GetVoice()
@@ -296,8 +288,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec
var/obj/effect/map_effect/portal/master/other_master = counterpart
var/in_vis_contents = FALSE
for(var/thing in other_master.portal_lines + other_master)
var/obj/effect/map_effect/portal/P = thing
for(var/obj/effect/map_effect/portal/P as anything in other_master.portal_lines + other_master)
if(P in true_turf.vis_locs)
in_vis_contents = TRUE
break
@@ -11,8 +11,7 @@
var/shake_strength = 1 // How much it shakes.
/obj/effect/map_effect/interval/screen_shaker/trigger()
for(var/A in player_list)
var/mob/M = A
for(var/mob/M as anything in player_list)
if(M.z == src.z && get_dist(src, M) <= shake_radius)
shake_camera(M, shake_duration, shake_strength)
..()
@@ -23,8 +23,7 @@
if(light_range > 0 && light_intensity > 0)
var/list/turf/line = getline(starting.return_turf(), ending.return_turf())
tracing_line:
for(var/i in line)
var/turf/T = i
for(var/turf/T as anything in line)
for(var/obj/effect/projectile_lighting/PL in T)
if(PL.owner == instance_key)
continue tracing_line
@@ -24,8 +24,7 @@
cam_plane_masters = get_tgui_plane_masters()
for(var/plane in cam_plane_masters)
var/obj/screen/instance = plane
for(var/obj/screen/instance as anything in cam_plane_masters)
instance.assigned_map = map_name
instance.del_on_map_removal = FALSE
instance.screen_loc = "[map_name]:CENTER"
+1 -2
View File
@@ -15,8 +15,7 @@
hack_state = new(src)
/obj/item/device/multitool/hacktool/Destroy()
for(var/T in known_targets)
var/atom/target = T
for(var/atom/target as anything in known_targets)
target.unregister(OBSERVER_EVENT_DESTROY, src)
known_targets.Cut()
qdel(hack_state)
@@ -4,8 +4,7 @@ var/global/list/active_radio_jammers = list()
var/turf/Tr = get_turf(radio)
if(!Tr) return 0 //Nullspace radios don't get jammed.
for(var/jammer in active_radio_jammers)
var/obj/item/device/radio_jammer/J = jammer
for(var/obj/item/device/radio_jammer/J as anything in active_radio_jammers)
var/turf/Tj = get_turf(J)
if(J.on && Tj.z == Tr.z) //If we're on the same Z, it's worth checking.
+3 -6
View File
@@ -133,8 +133,7 @@ HALOGEN COUNTER - Radcount on mobs
var/unknown = 0
var/reagentdata[0]
var/unknownreagents[0]
for(var/A in C.reagents.reagent_list)
var/datum/reagent/R = A
for(var/datum/reagent/R as anything in C.reagents.reagent_list)
if(R.scannable)
reagentdata["[R.id]"] = "<span class='notice'>\t[round(C.reagents.get_reagent_amount(R.id), 1)]u [R.name][(R.overdose && R.volume > R.overdose) ? " - <span class='danger'>Overdose</span>" : ""]</span><br>"
else
@@ -155,8 +154,7 @@ HALOGEN COUNTER - Radcount on mobs
var/unknown = 0
var/stomachreagentdata[0]
var/stomachunknownreagents[0]
for(var/B in C.ingested.reagent_list)
var/datum/reagent/R = B
for(var/datum/reagent/R as anything in C.ingested.reagent_list)
if(R.scannable)
stomachreagentdata["[R.id]"] = "<span class='notice'>\t[round(C.ingested.get_reagent_amount(R.id), 1)]u [R.name][(R.overdose && R.volume > R.overdose) ? " - <span class='danger'>Overdose</span>" : ""]</span><br>"
if (advscan == 0 || showadvscan == 0)
@@ -179,8 +177,7 @@ HALOGEN COUNTER - Radcount on mobs
var/unknown = 0
var/touchreagentdata[0]
var/touchunknownreagents[0]
for(var/B in C.touching.reagent_list)
var/datum/reagent/R = B
for(var/datum/reagent/R as anything in C.touching.reagent_list)
if(R.scannable)
touchreagentdata["[R.id]"] = "<span class='notice'>\t[round(C.touching.get_reagent_amount(R.id), 1)]u [R.name][(R.overdose && R.can_overdose_touch && R.volume > R.overdose) ? " - <span class='danger'>Overdose</span>" : ""]</span><br>"
if (advscan == 0 || showadvscan == 0)
@@ -54,8 +54,7 @@ var/global/mob/living/carbon/human/dummy/mannequin/sleevemate_mob
// Gather potential subtargets
var/list/choices = list(M)
if(istype(M))
for(var/belly in M.vore_organs)
var/obj/belly/B = belly
for(var/obj/belly/B as anything in M.vore_organs)
for(var/mob/living/carbon/human/H in B) // I do want an istype
choices += H
// Subtargets
+2 -4
View File
@@ -43,16 +43,14 @@
var/clotted = 0
var/too_far_gone = 0
for(var/org in H.organs) //'organs' is just external organs, as opposed to 'internal_organs'
var/obj/item/organ/external/affecting = org
for(var/obj/item/organ/external/affecting as anything in H.organs) //'organs' is just external organs, as opposed to 'internal_organs'
// No amount of clotting is going to help you here.
if(affecting.open)
too_far_gone++
continue
for(var/wnd in affecting.wounds)
var/datum/wound/W = wnd
for(var/datum/wound/W as anything in affecting.wounds)
// No need
if(W.bandaged)
continue
+1 -2
View File
@@ -252,6 +252,5 @@
return TRUE
/obj/structure/proc/refresh_neighbors()
for(var/thing in RANGE_TURFS(1, src))
var/turf/T = thing
for(var/turf/T as anything in RANGE_TURFS(1, src))
T.update_icon()
@@ -65,8 +65,7 @@
s.set_up(12, 1, src)
s.start()
if(has_buckled_mobs())
for(var/a in buckled_mobs)
var/mob/living/L = a
for(var/mob/living/L as anything in buckled_mobs)
L.burn_skin(85)
to_chat(L, "<span class='danger'>You feel a deep shock course through your body!</span>")
sleep(1)
+2 -4
View File
@@ -456,8 +456,7 @@ GLOBAL_LIST_BOILERPLATE(all_janitorial_carts, /obj/structure/janitorialcart)
..()
update_layer()
if(has_buckled_mobs())
for(var/A in buckled_mobs)
var/mob/living/L = A
for(var/mob/living/L as anything in buckled_mobs)
if(L.loc != loc)
L.buckled = null //Temporary, so Move() succeeds.
L.buckled = src //Restoring
@@ -467,8 +466,7 @@ GLOBAL_LIST_BOILERPLATE(all_janitorial_carts, /obj/structure/janitorialcart)
/obj/structure/bed/chair/janicart/proc/update_mob()
if(has_buckled_mobs())
for(var/A in buckled_mobs)
var/mob/living/L = A
for(var/mob/living/L as anything in buckled_mobs)
L.set_dir(dir)
switch(dir)
if(SOUTH)
@@ -63,8 +63,7 @@
..()
update_layer()
if(has_buckled_mobs())
for(var/A in buckled_mobs)
var/mob/living/L = A
for(var/mob/living/L as anything in buckled_mobs)
L.set_dir(dir)
/obj/structure/bed/chair/verb/rotate_clockwise()
@@ -151,8 +150,7 @@
playsound(src, 'sound/effects/roll.ogg', 100, 1)
/obj/structure/bed/chair/office/handle_buckled_mob_movement(atom/new_loc, direction, movetime)
for(var/A in buckled_mobs)
var/mob/living/occupant = A
for(var/mob/living/occupant as anything in buckled_mobs)
occupant.buckled = null
occupant.Move(loc, direction, movetime)
occupant.buckled = src
@@ -51,8 +51,7 @@
. = ..()
if(.)
if(has_buckled_mobs())
for(var/A in buckled_mobs)
var/mob/living/L = A
for(var/mob/living/L as anything in buckled_mobs)
L.set_dir(dir)
/obj/structure/bed/chair/wheelchair/attackby(obj/item/weapon/W as obj, mob/user as mob)
@@ -95,8 +94,7 @@
var/turf/T = null
//--1---Move occupant---1--//
if(has_buckled_mobs())
for(var/A in buckled_mobs)
var/mob/living/L = A
for(var/mob/living/L as anything in buckled_mobs)
L.buckled = null
step(L, direction)
L.buckled = src
@@ -128,8 +126,7 @@
. = ..()
playsound(src, 'sound/effects/roll.ogg', 75, 1)
if(has_buckled_mobs())
for(var/A in buckled_mobs)
var/mob/living/occupant = A
for(var/mob/living/occupant as anything in buckled_mobs)
if(!driving)
occupant.buckled = null
occupant.Move(src.loc)
+4 -5
View File
@@ -265,12 +265,11 @@
/obj/machinery/shower/process()
if(!on) return
for(var/thing in loc)
var/atom/movable/AM = thing
var/mob/living/L = thing
if(istype(AM) && AM.simulated)
for(var/atom/movable/AM in loc)
if(AM.simulated)
wash(AM)
if(istype(L))
if(isliving(AM))
var/mob/living/L = AM
process_heat(L)
wash_floor()
reagents.add_reagent("water", reagents.get_free_space())