Add 'as anything' to various for loops

This commit is contained in:
Aronai Sieyes
2021-07-20 12:39:59 -04:00
parent bb3b3d6214
commit 34982728cb
221 changed files with 483 additions and 914 deletions
+2 -4
View File
@@ -172,8 +172,7 @@ var/list/runechat_image_cache = list()
if(owned_by.seen_messages)
var/idx = 1
var/combined_height = approx_lines
for(var/msg in owned_by.seen_messages[message_loc])
var/datum/chatmessage/m = msg
for(var/datum/chatmessage/m as anything in owned_by.seen_messages[message_loc])
animate(m.message, pixel_y = m.message.pixel_y + mheight, time = CHAT_MESSAGE_SPAWN_TIME)
combined_height += m.approx_lines
@@ -336,8 +335,7 @@ var/list/runechat_image_cache = list()
var/list/hear = get_mobs_and_objs_in_view_fast(get_turf(src), range, remote_ghosts = FALSE)
hearing_mobs = hear["mobs"]
for(var/mob in hearing_mobs)
var/mob/M = mob
for(var/mob/M as anything in hearing_mobs)
if(!M.client)
continue
M.create_chat_message(src, message, italics, classes, audible)
+2 -4
View File
@@ -320,8 +320,7 @@
var/proctype = C.signal_procs[src][sigtype]
return NONE | CallAsync(C, proctype, arguments)
. = NONE
for(var/I in target)
var/datum/C = I
for(var/datum/C as anything in target)
if(!C.signal_enabled)
continue
var/proctype = C.signal_procs[src][sigtype]
@@ -444,8 +443,7 @@
var/list/arguments = raw_args.Copy()
arguments[1] = new_comp
var/make_new_component = TRUE
for(var/i in GetComponents(new_type))
var/datum/component/C = i
for(var/datum/component/C as anything in GetComponents(new_type))
if(C.CheckDupeComponent(arglist(arguments)))
make_new_component = FALSE
QDEL_NULL(new_comp)
+3 -5
View File
@@ -402,8 +402,7 @@
var/list/surroundings = get_surroundings(user)
var/list/craftability = list()
for(var/rec in GLOB.crafting_recipes)
var/datum/crafting_recipe/R = rec
for(var/datum/crafting_recipe/R as anything in GLOB.crafting_recipes)
if(!R.always_available && !(R.type in user?.mind?.learned_recipes)) //User doesn't actually know how to make this.
continue
@@ -420,11 +419,10 @@
var/list/data = list()
var/list/crafting_recipes = list()
for(var/rec in GLOB.crafting_recipes)
var/datum/crafting_recipe/R = rec
for(var/datum/crafting_recipe/R as anything in GLOB.crafting_recipes)
if(R.name == "") //This is one of the invalid parents that sneaks in
GLOB.crafting_recipes -= rec
GLOB.crafting_recipes -= R
continue
if(!R.always_available && !(R.type in user?.mind?.learned_recipes)) //User doesn't actually know how to make this.
+8 -9
View File
@@ -99,9 +99,8 @@
/datum/component/material_container/proc/on_examine(datum/source, mob/user, list/examine_texts)
SIGNAL_HANDLER
for(var/I in materials)
var/datum/material/M = I
var/amt = materials[I]
for(var/datum/material/M as anything in materials)
var/amt = materials[M]
if(amt)
examine_texts += "<span class='notice'>It has [amt] units of [lowertext(M.name)] stored.</span>"
@@ -327,13 +326,13 @@
var/list/mats_to_remove = list() //Assoc list MAT | AMOUNT
for(var/x in mats) //Loop through all required materials
var/datum/material/req_mat = x
for(var/datum/material/req_mat as anything in mats) //Loop through all required materials
var/imat = req_mat
if(!istype(req_mat))
req_mat = GET_MATERIAL_REF(req_mat) //Get the ref if necesary
if(!materials[req_mat]) //Do we have the resource?
return FALSE //Can't afford it
var/amount_required = mats[x] * multiplier
var/amount_required = mats[imat] * multiplier
if(!(materials[req_mat] >= amount_required)) // do we have enough of the resource?
return FALSE //Can't afford it
mats_to_remove[req_mat] += amount_required //Add it to the assoc list of things to remove
@@ -392,8 +391,8 @@
if(!mats || !mats.len)
return FALSE
for(var/x in mats) //Loop through all required materials
var/datum/material/req_mat = x
for(var/datum/material/req_mat as anything in mats) //Loop through all required materials
var/imat = req_mat
if(!istype(req_mat))
if(ispath(req_mat) || istext(req_mat)) //Is this an actual material, or is it a category?
req_mat = GET_MATERIAL_REF(req_mat) //Get the ref
@@ -404,7 +403,7 @@
// else
// continue
if(!has_enough_of_material(req_mat, mats[x], multiplier))//Not a category, so just check the normal way
if(!has_enough_of_material(req_mat, mats[imat], multiplier))//Not a category, so just check the normal way
return FALSE
return TRUE
+2 -4
View File
@@ -171,8 +171,7 @@
///Clears the affected_turfs lazylist, removing from its contents the effects of being near the light.
/datum/component/overlay_lighting/proc/clean_old_turfs()
for(var/t in affected_turfs)
var/turf/lit_turf = t
for(var/turf/lit_turf as anything in affected_turfs)
lit_turf.dynamic_lumcount -= lum_power
affected_turfs = null
@@ -431,8 +430,7 @@
. = lum_power
lum_power = new_lum_power
var/difference = . - lum_power
for(var/t in affected_turfs)
var/turf/lit_turf = t
for(var/turf/lit_turf as anything in affected_turfs)
lit_turf.dynamic_lumcount -= difference
///Moves the light directional_atom that emits our "light" based on our position and our direction
+3 -6
View File
@@ -30,8 +30,7 @@
//clear timers
var/list/timers = active_timers
active_timers = null
for(var/thing in timers)
var/datum/timedevent/timer = thing
for(var/datum/timedevent/timer as anything in timers)
if (timer.spent)
continue
qdel(timer)
@@ -45,8 +44,7 @@
if(dc)
var/all_components = dc[/datum/component]
if(length(all_components))
for(var/I in all_components)
var/datum/component/C = I
for(var/datum/component/C as anything in all_components)
qdel(C, FALSE, TRUE)
else
var/datum/component/C = all_components
@@ -58,8 +56,7 @@
for(var/sig in lookup)
var/list/comps = lookup[sig]
if(length(comps))
for(var/i in comps)
var/datum/component/comp = i
for(var/datum/component/comp as anything in comps)
comp.UnregisterSignal(src, sig)
else
var/datum/component/comp = comps
+2 -4
View File
@@ -17,8 +17,7 @@
log_game_master("Got [best_events.len] choice\s for the next event.")
var/list/weighted_events = list()
for(var/E in best_events)
var/datum/event2/meta/event = E
for(var/datum/event2/meta/event as anything in best_events)
var/weight = event.get_weight()
if(weight <= 0)
continue
@@ -71,8 +70,7 @@
// If no list is passed, all the events will be returned.
/datum/game_master/default/proc/filter_events_by_departments(list/departments)
. = list()
for(var/E in SSgame_master.available_events)
var/datum/event2/meta/event = E
for(var/datum/event2/meta/event as anything in SSgame_master.available_events)
if(!event.enabled)
continue
if(event.chaotic_threshold && !ignore_round_chaos)
@@ -3,8 +3,7 @@
// * Does not react to danger at all.
/datum/game_master/classic/choose_event()
var/list/weighted_events = list()
for(var/E in SSgame_master.available_events)
var/datum/event2/meta/event = E
for(var/datum/event2/meta/event as anything in SSgame_master.available_events)
if(!event.enabled)
continue
weighted_events[event] = event.get_weight()
@@ -31,8 +30,7 @@
/datum/game_master/brutal/choose_event()
var/list/weighted_events = list()
for(var/E in SSgame_master.available_events)
var/datum/event2/meta/event = E
for(var/datum/event2/meta/event as anything in SSgame_master.available_events)
if(!event.enabled)
continue
weighted_events[event] = event.get_weight() + (event.chaos * 2)
+1 -2
View File
@@ -45,8 +45,7 @@ GLOBAL_DATUM(revdata, /datum/getrev)
return
if(header)
. += "The following pull requests are currently test merged:"
for(var/line in testmerge)
var/datum/tgs_revision_information/test_merge/tm = line
for(var/datum/tgs_revision_information/test_merge/tm as anything in testmerge)
var/cm = tm.pull_request_commit
var/details = ": '" + html_encode(tm.title) + "' by " + html_encode(tm.author) + " at commit " + html_encode(copytext_char(cm, 1, 11))
if(details && findtext(details, "\[s\]") && (!usr || !usr.client.holder))
+3 -6
View File
@@ -40,8 +40,7 @@ GLOBAL_LIST_EMPTY(event_listen_count)
/decl/observ/destroyed/proc/cleanup_global_listener(listener, listen_count)
GLOB.global_listen_count -= listener
for(var/entry in GLOB.all_observable_events.events)
var/decl/observ/event = entry
for(var/decl/observ/event as anything in GLOB.all_observable_events.events)
if(event.unregister_global(listener))
// log_debug("[event] - [listener] was deleted while still registered to global events.") // TODO: Apply axe, reimplement with datum component listeners
if(!(--listen_count))
@@ -49,8 +48,7 @@ GLOBAL_LIST_EMPTY(event_listen_count)
/decl/observ/destroyed/proc/cleanup_source_listeners(event_source, source_listener_count)
GLOB.event_sources_count -= event_source
for(var/entry in GLOB.all_observable_events.events)
var/decl/observ/event = entry
for(var/decl/observ/event as anything in GLOB.all_observable_events.events)
var/proc_owners = event.event_sources[event_source]
if(proc_owners)
for(var/proc_owner in proc_owners)
@@ -61,8 +59,7 @@ GLOBAL_LIST_EMPTY(event_listen_count)
/decl/observ/destroyed/proc/cleanup_event_listener(listener, listener_count)
GLOB.event_listen_count -= listener
for(var/entry in GLOB.all_observable_events.events)
var/decl/observ/event = entry
for(var/decl/observ/event as anything in GLOB.all_observable_events.events)
for(var/event_source in event.event_sources)
if(event.unregister(event_source, listener))
// log_debug("[event] - [listener] was deleted while still listening to [event_source].") // TODO: Apply axe, reimplement with datum component listeners
+2 -4
View File
@@ -110,8 +110,7 @@
/atom/Destroy(force = FALSE)
. = ..()
if (orbiters)
for (var/thing in orbiters)
var/datum/orbit/O = thing
for(var/datum/orbit/O as anything in orbiters)
if (O.orbiter)
O.orbiter.stop_orbit()
@@ -123,8 +122,7 @@
/*
/atom/movable/proc/transfer_observers_to(atom/movable/target)
if(orbiters)
for(var/thing in orbiters)
var/datum/orbit/O = thing
for(var/datum/orbit/O as anything in orbiters)
if(O.orbiter && isobserver(O.orbiter))
var/mob/dead/observer/D = O.orbiter
D.ManualFollow(target)
+1 -2
View File
@@ -51,8 +51,7 @@
animate(bar, pixel_y = shiftheight, time = 5, easing = SINE_EASING)
/datum/progressbar/Destroy()
for(var/I in user.progressbars[bar.loc])
var/datum/progressbar/P = I
for(var/datum/progressbar/P as anything in user.progressbars[bar.loc])
if(P != src && P.listindex > listindex)
P.shiftDown()
+5 -9
View File
@@ -6,13 +6,11 @@
var/list/shared_soul_links // Soul links we are a/the sharer of.
/mob/living/Destroy()
for(var/s in owned_soul_links)
var/datum/soul_link/S = s
for(var/datum/soul_link/S as anything in owned_soul_links)
S.owner_died(FALSE)
qdel(s) // If the owner is destroy()'d, the soullink is destroy()'d.
qdel(S) // If the owner is destroy()'d, the soullink is destroy()'d.
owned_soul_links = null
for(var/s in shared_soul_links)
var/datum/soul_link/S = s
for(var/datum/soul_link/S as anything in shared_soul_links)
S.sharer_died(FALSE)
S.remove_soul_sharer(src) // If a sharer is destroy()'d, they are simply removed.
shared_soul_links = null
@@ -82,8 +80,7 @@
soul_owner = owner
soul_sharers = sharers
LAZYADD(owner.owned_soul_links, src)
for(var/l in sharers)
var/mob/living/L = l
for(var/mob/living/L as anything in sharers)
LAZYADD(L.shared_soul_links, src)
return TRUE
@@ -144,8 +141,7 @@
/datum/soul_link/multi_sharer/replacement_pool/owner_died(gibbed, mob/living/owner)
if(LAZYLEN(soul_sharers) && !gibbed) //let's not put them in some gibs
var/list/souls = shuffle(soul_sharers.Copy())
for(var/l in souls)
var/mob/living/L = l
for(var/mob/living/L as anything in souls)
if(L.stat != DEAD && L.mind)
L.mind.transfer_to(soul_owner)
soul_owner.revive(TRUE, TRUE)