diff --git a/code/controllers/subsystems/ai.dm b/code/controllers/subsystems/ai.dm index 090a405a52..1bb26dd32f 100644 --- a/code/controllers/subsystems/ai.dm +++ b/code/controllers/subsystems/ai.dm @@ -17,7 +17,7 @@ SUBSYSTEM_DEF(ai) var/list/process_z = list() /datum/controller/subsystem/ai/stat_entry(msg) - msg = "P: [processing.len] | S: [slept_mobs]" + msg = "P: [length(processing)] | S: [slept_mobs]" return ..() /datum/controller/subsystem/ai/fire(resumed = 0) @@ -26,16 +26,16 @@ SUBSYSTEM_DEF(ai) process_z.Cut() slept_mobs = 0 var/level = 1 - while(process_z.len < GLOB.living_players_by_zlevel.len) + while(length(process_z) < length(GLOB.living_players_by_zlevel)) process_z.len++ - process_z[level] = GLOB.living_players_by_zlevel[level].len + process_z[level] = length(GLOB.living_players_by_zlevel[level]) level++ //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun - while(currentrun.len) - var/datum/ai_holder/A = currentrun[currentrun.len] + while(length(currentrun)) + var/datum/ai_holder/A = currentrun[length(currentrun)] --currentrun.len if(!A || QDELETED(A) || A.busy) // Doesn't exist or won't exist soon or not doing it this tick continue diff --git a/code/controllers/subsystems/aifast.dm b/code/controllers/subsystems/aifast.dm index bd3294af0e..4f2037ed93 100644 --- a/code/controllers/subsystems/aifast.dm +++ b/code/controllers/subsystems/aifast.dm @@ -13,7 +13,7 @@ SUBSYSTEM_DEF(aifast) var/list/currentrun = list() /datum/controller/subsystem/aifast/stat_entry(msg) - msg = "P:[processing.len]" + msg = "P:[length(processing)]" return ..() /datum/controller/subsystem/aifast/fire(resumed = 0) @@ -23,8 +23,8 @@ SUBSYSTEM_DEF(aifast) //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun - while(currentrun.len) - var/datum/ai_holder/A = currentrun[currentrun.len] + while(length(currentrun)) + var/datum/ai_holder/A = currentrun[length(currentrun)] --currentrun.len if(!A || QDELETED(A) || A.busy) // Doesn't exist or won't exist soon or not doing it this tick continue diff --git a/code/controllers/subsystems/air.dm b/code/controllers/subsystems/air.dm index 77d2238e4e..8f6087f33e 100644 --- a/code/controllers/subsystems/air.dm +++ b/code/controllers/subsystems/air.dm @@ -117,15 +117,15 @@ SUBSYSTEM_DEF(air) admin_notice(span_danger("Geometry initialized in [round(0.1*(REALTIMEOFDAY-start_timeofday),0.1)] seconds.") + \ span_info("
\ Total Simulated Turfs: [simulated_turf_count]
\ -Total Zones: [zones.len]
\ -Total Edges: [edges.len]
\ -Total Active Edges: [active_edges.len ? span_danger("[active_edges.len]") : "None"]
\ +Total Zones: [length(zones)]
\ +Total Edges: [length(edges)]
\ +Total Active Edges: [length(active_edges) ? span_danger("[length(active_edges)]") : "None"]
\ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_count]\ "), R_DEBUG) // Note - Baystation settles the air by running for one tick. We prefer to not have active edges. // Maps should not have active edges on boot. If we've got some, log it so it can get fixed. - if(active_edges.len) + if(length(active_edges)) var/list/edge_log = list() for(var/connection_edge/E in active_edges) @@ -177,7 +177,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun // Santity checks to make sure we don't somehow have items left over from last cycle // Or somehow didn't finish all the steps from last cycle if(LAZYLEN(currentrun) || current_step) - log_and_message_admins("SSair: Was told to start a new run, but the previous run wasn't finished! currentrun.len=[currentrun.len], current_step=[current_step]") + log_and_message_admins("SSair: Was told to start a new run, but the previous run wasn't finished! currentrun.len=[length(currentrun)], current_step=[current_step]") resumed = TRUE else current_cycle++ // Begin a new SSair cycle! @@ -216,8 +216,8 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun var/list/selfblock_deferred = src.selfblock_deferred // Run thru the list, processing non-self-zone-blocked and deferring self-zone-blocked - while(currentrun.len) - var/turf/T = currentrun[currentrun.len] + while(length(currentrun)) + var/turf/T = currentrun[length(currentrun)] currentrun.len-- //check if the turf is self-zone-blocked if(T.self_airblock() & ZONE_BLOCKED) @@ -238,8 +238,8 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun ASSERT(LAZYLEN(currentrun) == 0) // Run thru the deferred list and processing them - while(selfblock_deferred.len) - var/turf/T = selfblock_deferred[selfblock_deferred.len] + while(length(selfblock_deferred)) + var/turf/T = selfblock_deferred[length(selfblock_deferred)] selfblock_deferred.len-- T.update_air_properties() T.post_update_air_properties() @@ -258,8 +258,8 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun src.currentrun = active_edges.Copy() //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun - while(currentrun.len) - var/connection_edge/edge = currentrun[currentrun.len] + while(length(currentrun)) + var/connection_edge/edge = currentrun[length(currentrun)] currentrun.len-- if(edge) // TODO - Do we need to check this? Old one didn't, but old one was single-threaded. edge.tick() @@ -271,8 +271,8 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun src.currentrun = active_fire_zones.Copy() //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun - while(currentrun.len) - var/zone/Z = currentrun[currentrun.len] + while(length(currentrun)) + var/zone/Z = currentrun[length(currentrun)] currentrun.len-- if(Z) // TODO - Do we need to check this? Old one didn't, but old one was single-threaded. Z.process_fire() @@ -284,8 +284,8 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun src.currentrun = active_hotspots.Copy() //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun - while(currentrun.len) - var/obj/fire/fire = currentrun[currentrun.len] + while(length(currentrun)) + var/obj/fire/fire = currentrun[length(currentrun)] currentrun.len-- if(fire) // TODO - Do we need to check this? Old one didn't, but old one was single-threaded. fire.process() @@ -294,8 +294,8 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun /datum/controller/subsystem/air/proc/process_zones_to_update(resumed = 0) if (!resumed) - active_zones = zones_to_update.len // Save how many zones there were to update this cycle (used by some debugging stuff) - if(!zones_to_update.len) + active_zones = length(zones_to_update) // Save how many zones there were to update this cycle (used by some debugging stuff) + if(!length(zones_to_update)) return // Nothing to do here this cycle! // NOT a copy, because we are supposed to drain active turfs each cycle anyway, so just replace with empty list. // Blanking the public list means we actually are removing processed ones from the list! Maybe we could we use zones_for_update directly? @@ -306,8 +306,8 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun - while(currentrun.len) - var/zone/zone = currentrun[currentrun.len] + while(length(currentrun)) + var/zone/zone = currentrun[length(currentrun)] currentrun.len-- if(zone) // TODO - Do we need to check this? Old one didn't, but old one was single-threaded. zone.tick() @@ -324,14 +324,14 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun msg += "H [round(cost_hotspots, 1)] | " msg += "Z [round(cost_zones, 1)] " msg += "}" - msg += "Z: [zones.len] " - msg += "E: [edges.len] " + msg += "Z: [length(zones)] " + msg += "E: [length(edges)] " msg += "Cycle: [current_cycle] {" - msg += "T [tiles_to_update.len] | " - msg += "E [active_edges.len] | " - msg += "F [active_fire_zones.len] | " - msg += "H [active_hotspots.len] | " - msg += "Z [zones_to_update.len] " + msg += "T [length(tiles_to_update)] | " + msg += "E [length(active_edges)] | " + msg += "F [length(active_fire_zones)] | " + msg += "H [length(active_hotspots)] | " + msg += "Z [length(zones_to_update)] " msg += "}" return ..() @@ -403,7 +403,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun ASSERT(!B.invalid) ASSERT(A != B) #endif - if(A.contents.len < B.contents.len) + if(length(A.contents) < length(B.contents)) A.c_merge(B) mark_zone_update(B) else @@ -427,7 +427,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun var/space = !istype(B) if(!space) - if(min(A.zone.contents.len, B.zone.contents.len) < ZONE_MIN_SIZE || (direct && (equivalent_pressure(A.zone,B.zone) || current_cycle == 0))) + if(min(length(A.zone.contents), length(B.zone.contents)) < ZONE_MIN_SIZE || (direct && (equivalent_pressure(A.zone,B.zone) || current_cycle == 0))) merge(A.zone,B.zone) return diff --git a/code/controllers/subsystems/airflow.dm b/code/controllers/subsystems/airflow.dm index 0e87df8259..ec674bcb6f 100644 --- a/code/controllers/subsystems/airflow.dm +++ b/code/controllers/subsystems/airflow.dm @@ -30,8 +30,8 @@ SUBSYSTEM_DEF(airflow) var/mywait = wait var/list/curr = currentrun // Cache for sanic speed - while (curr.len) - var/atom/movable/target = curr[curr.len] + while (length(curr)) + var/atom/movable/target = curr[length(curr)] curr.len-- if(QDELETED(target)) processing -= target diff --git a/code/controllers/subsystems/alarm.dm b/code/controllers/subsystems/alarm.dm index 27a554403a..b4054f9aee 100644 --- a/code/controllers/subsystems/alarm.dm +++ b/code/controllers/subsystems/alarm.dm @@ -19,8 +19,8 @@ SUBSYSTEM_DEF(alarm) active_alarm_cache.Cut() var/list/currentrun = src.currentrun // Cache for sanic speed - while (currentrun.len) - var/datum/alarm_handler/AH = currentrun[currentrun.len] + while (length(currentrun)) + var/datum/alarm_handler/AH = currentrun[length(currentrun)] currentrun.len-- AH.process() active_alarm_cache += AH.alarms @@ -32,7 +32,7 @@ SUBSYSTEM_DEF(alarm) return active_alarm_cache.Copy() /datum/controller/subsystem/alarm/proc/number_of_active_alarms() - return active_alarm_cache.len + return length(active_alarm_cache) /datum/controller/subsystem/alarm/stat_entry(msg) msg = "[number_of_active_alarms()] alarm\s" diff --git a/code/controllers/subsystems/appreciation_messages.dm b/code/controllers/subsystems/appreciation_messages.dm index 714126decc..7fa380e5a4 100644 --- a/code/controllers/subsystems/appreciation_messages.dm +++ b/code/controllers/subsystems/appreciation_messages.dm @@ -43,8 +43,8 @@ SUBSYSTEM_DEF(appreciation) current_player_list = GLOB.player_list.Copy() - while(current_player_list.len) - var/mob/M = current_player_list[current_player_list.len] + while(length(current_player_list)) + var/mob/M = current_player_list[length(current_player_list)] current_player_list.len-- if(ishuman(M)) @@ -66,7 +66,7 @@ SUBSYSTEM_DEF(appreciation) /datum/controller/subsystem/appreciation/proc/build_appreciation() - if(human_list.len < required_humans) + if(length(human_list) < required_humans) appreciated = pick(loremaster.appreciation_targets) return diff --git a/code/controllers/subsystems/asset_loading.dm b/code/controllers/subsystems/asset_loading.dm index a4a539ccf2..d144985db2 100644 --- a/code/controllers/subsystems/asset_loading.dm +++ b/code/controllers/subsystems/asset_loading.dm @@ -12,7 +12,7 @@ SUBSYSTEM_DEF(asset_loading) /datum/controller/subsystem/asset_loading/fire(resumed) while(length(generate_queue)) - var/datum/asset/to_load = generate_queue[generate_queue.len] + var/datum/asset/to_load = generate_queue[length(generate_queue)] last_queue_len = length(generate_queue) diff --git a/code/controllers/subsystems/atoms.dm b/code/controllers/subsystems/atoms.dm index 27a0a98689..439e7f5254 100644 --- a/code/controllers/subsystems/atoms.dm +++ b/code/controllers/subsystems/atoms.dm @@ -59,14 +59,14 @@ SUBSYSTEM_DEF(atoms) CreateAtoms(atoms, atoms_to_return, source) clear_tracked_initalize(source) - if(late_loaders.len) - for(var/I in 1 to late_loaders.len) + if(length(late_loaders)) + for(var/I in 1 to length(late_loaders)) var/atom/A = late_loaders[I] //I hate that we need this if(QDELETED(A)) continue A.LateInitialize() - testing("Late initialized [late_loaders.len] atoms") + testing("Late initialized [length(late_loaders)] atoms") late_loaders.Cut() if (created_atoms) @@ -76,7 +76,7 @@ SUBSYSTEM_DEF(atoms) for (var/queued_deletion in queued_deletions) qdel(queued_deletion) - testing("[queued_deletions.len] atoms were queued for deletion.") + testing("[length(queued_deletions)] atoms were queued for deletion.") queued_deletions.Cut() #ifdef PROFILE_MAPLOAD_INIT_ATOM @@ -96,10 +96,10 @@ SUBSYSTEM_DEF(atoms) if(atoms) #ifdef TESTING - count = atoms.len + count = length(atoms) #endif - for(var/I in 1 to atoms.len) + for(var/I in 1 to length(atoms)) var/atom/A = atoms[I] if(!(A.flags & ATOM_INITIALIZED)) // Unrolled CHECK_TICK setup to let us enable/disable mapload based off source diff --git a/code/controllers/subsystems/character_setup.dm b/code/controllers/subsystems/character_setup.dm index 7f2f94ed1c..4ae2e80590 100644 --- a/code/controllers/subsystems/character_setup.dm +++ b/code/controllers/subsystems/character_setup.dm @@ -12,19 +12,19 @@ SUBSYSTEM_DEF(character_setup) var/list/save_queue = list() /* /datum/controller/subsystem/character_setup/Initialize() - while(prefs_awaiting_setup.len) - var/datum/preferences/prefs = prefs_awaiting_setup[prefs_awaiting_setup.len] + while(length(prefs_awaiting_setup)) + var/datum/preferences/prefs = prefs_awaiting_setup[length(prefs_awaiting_setup)] prefs_awaiting_setup.len-- prefs.setup() - while(newplayers_requiring_init.len) - var/mob/new_player/new_player = newplayers_requiring_init[newplayers_requiring_init.len] + while(length(newplayers_requiring_init)) + var/mob/new_player/new_player = newplayers_requiring_init[length(newplayers_requiring_init)] newplayers_requiring_init.len-- new_player.deferred_login() . = ..() */ //Might be useful if we ever switch to Bay prefs. /datum/controller/subsystem/character_setup/fire(resumed = FALSE) - while(save_queue.len) - var/datum/preferences/prefs = save_queue[save_queue.len] + while(length(save_queue)) + var/datum/preferences/prefs = save_queue[length(save_queue)] save_queue.len-- // Can't save prefs without client, because the sanitize functions will be diff --git a/code/controllers/subsystems/chemistry.dm b/code/controllers/subsystems/chemistry.dm index 80dab74121..5f963d6b51 100644 --- a/code/controllers/subsystems/chemistry.dm +++ b/code/controllers/subsystems/chemistry.dm @@ -24,7 +24,7 @@ SUBSYSTEM_DEF(chemistry) return SS_INIT_SUCCESS /datum/controller/subsystem/chemistry/stat_entry(msg) - msg = "C: [chemical_reagents.len] | R: [chemical_reactions.len]" + msg = "C: [length(chemical_reagents)] | R: [length(chemical_reactions)]" return ..() //Chemical Reactions - Initialises all /decl/chemical_reaction into a list @@ -46,7 +46,7 @@ SUBSYSTEM_DEF(chemistry) if(length(D.catalysts)) scan_list += D.catalysts - for(var/i in 1 to scan_list.len) + for(var/i in 1 to length(scan_list)) var/reagent_id = scan_list[i] var/list/add_to = instant_reactions_by_reagent // Default to instant reactions list, if something's gone wrong diff --git a/code/controllers/subsystems/communications.dm b/code/controllers/subsystems/communications.dm index 6f1240a2a7..e5ccd7a992 100644 --- a/code/controllers/subsystems/communications.dm +++ b/code/controllers/subsystems/communications.dm @@ -92,7 +92,7 @@ SUBSYSTEM_DEF(radio) if(frequency) frequency.remove_listener(device) - if(frequency.devices.len == 0) + if(!length(frequency.devices)) qdel(frequency) frequencies -= f_text @@ -157,8 +157,8 @@ SUBSYSTEM_DEF(radio) devices[radio_filter] = devices_line devices_line+=device // var/list/obj/devices_line___ = devices[filter_str] -// var/l = devices_line___.len - //log_admin("DEBUG: devices_line.len=[devices_line.len]") +// var/l = length(devices_line___) + //log_admin("DEBUG: devices_line.len=[length(devices_line)]") //log_admin("DEBUG: devices(filter_str).len=[l]") /datum/radio_frequency/proc/remove_listener(obj/device) @@ -167,7 +167,7 @@ SUBSYSTEM_DEF(radio) devices_line-=device while (null in devices_line) devices_line -= null - if (devices_line.len==0) + if (!length(devices_line)) devices -= devices_filter /datum/signal diff --git a/code/controllers/subsystems/dbcore.dm b/code/controllers/subsystems/dbcore.dm index ec542a63d8..ed9dd2d82a 100644 --- a/code/controllers/subsystems/dbcore.dm +++ b/code/controllers/subsystems/dbcore.dm @@ -389,7 +389,7 @@ Ignore_errors instructes mysql to continue inserting rows if some of them have e if (has_col) query_parts += ", " if (has_question_mark[column]) - var/name = "p[arguments.len]" + var/name = "p[length(arguments)]" query_parts += replacetext(columns[column], "?", ":[name]") arguments[name] = row[column] else @@ -586,7 +586,7 @@ Ignore_errors instructes mysql to continue inserting rows if some of them have e /datum/db_query/proc/NextRow(async = TRUE) Activity("NextRow") - if (rows && next_row_to_take <= rows.len) + if (rows && next_row_to_take <= length(rows)) item = rows[next_row_to_take] next_row_to_take++ return !!item diff --git a/code/controllers/subsystems/events.dm b/code/controllers/subsystems/events.dm index 01749c2b31..4269abdd0c 100644 --- a/code/controllers/subsystems/events.dm +++ b/code/controllers/subsystems/events.dm @@ -32,8 +32,8 @@ SUBSYSTEM_DEF(events) //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun - while (currentrun.len) - var/datum/event/E = currentrun[currentrun.len] + while (length(currentrun)) + var/datum/event/E = currentrun[length(currentrun)] currentrun.len-- if(E.processing_active) E.process() @@ -45,7 +45,7 @@ SUBSYSTEM_DEF(events) EC.process() /datum/controller/subsystem/events/stat_entry(msg) - msg = "E:[active_events.len]" + msg = "E:[length(active_events)]" return ..() /datum/controller/subsystem/events/Recover() diff --git a/code/controllers/subsystems/explosions.dm b/code/controllers/subsystems/explosions.dm index 3b4a76235f..0d296429b7 100644 --- a/code/controllers/subsystems/explosions.dm +++ b/code/controllers/subsystems/explosions.dm @@ -51,7 +51,7 @@ SUBSYSTEM_DEF(explosions) return // The heavy lifting part... - while(currentrun.len) + while(length(currentrun)) // Lets handle list management here instead of in each proc // get the first key of the current run, use the key to get the // data, use the data, than discard it from the list using the key! @@ -63,7 +63,7 @@ SUBSYSTEM_DEF(explosions) currentrun.Remove(key) // Check if we move on to final resolution - if(!currentrun.len) + if(!length(currentrun)) if(!resolve_explosions) start_resolve() currentrun = resolving_explosions.Copy() @@ -94,7 +94,7 @@ SUBSYSTEM_DEF(explosions) // return to setup mode... Unless... end_resolve() - if(!pending_explosions.len) + if(!length(pending_explosions)) suspend_and_invoke_deferred_subsystems() /datum/controller/subsystem/explosions/proc/fire_prepare_explosions(var/list/data) diff --git a/code/controllers/subsystems/garbage.dm b/code/controllers/subsystems/garbage.dm index 9a46e0510a..dd138dafa9 100644 --- a/code/controllers/subsystems/garbage.dm +++ b/code/controllers/subsystems/garbage.dm @@ -319,7 +319,7 @@ SUBSYSTEM_DEF(garbage) /datum/controller/subsystem/garbage/Recover() InitQueues() //We first need to create the queues before recovering data if (istype(SSgarbage.queues)) - for (var/i in 1 to SSgarbage.queues.len) + for (var/i in 1 to length(SSgarbage.queues)) queues[i] |= SSgarbage.queues[i] /// Qdel Item: Holds statistics on each type that passes thru qdel diff --git a/code/controllers/subsystems/inactivity.dm b/code/controllers/subsystems/inactivity.dm index 1cc2566d37..6bb56b7cd7 100644 --- a/code/controllers/subsystems/inactivity.dm +++ b/code/controllers/subsystems/inactivity.dm @@ -12,8 +12,8 @@ SUBSYSTEM_DEF(inactivity) if (!resumed) client_list = GLOB.clients.Copy() - while(client_list.len) - var/client/C = client_list[client_list.len] + while(length(client_list)) + var/client/C = client_list[length(client_list)] client_list.len-- if(C.is_afk(CONFIG_GET(number/kick_inactive) MINUTES) && can_kick(C)) to_chat_immediate(C, span_warning("You have been inactive for more than [CONFIG_GET(number/kick_inactive)] minute\s and have been disconnected.")) diff --git a/code/controllers/subsystems/input.dm b/code/controllers/subsystems/input.dm index 482b84de67..92ea832a7c 100644 --- a/code/controllers/subsystems/input.dm +++ b/code/controllers/subsystems/input.dm @@ -8,6 +8,6 @@ SUBSYSTEM_DEF(input) /datum/controller/subsystem/input/fire() var/list/clients = GLOB.clients // Let's sing the list cache song - for(var/i in 1 to clients.len) + for(var/i in 1 to length(clients)) var/client/C = clients[i] C?.keyLoop() diff --git a/code/controllers/subsystems/internal_wiki.dm b/code/controllers/subsystems/internal_wiki.dm index 4794a8e276..e54269e156 100644 --- a/code/controllers/subsystems/internal_wiki.dm +++ b/code/controllers/subsystems/internal_wiki.dm @@ -51,7 +51,7 @@ SUBSYSTEM_DEF(internal_wiki) VAR_PRIVATE/highest_cached_donator = null /datum/controller/subsystem/internal_wiki/stat_entry(msg) - msg = "P: [pages.len] | O: [ores.len] | M: [materials.len] | S: [smashers.len] | F: [foodrecipe.len] | D: [drinkreact.len] | C: [chemreact.len] | B: [botseeds.len] | V: [viruses.len] | G: [genes.len] " + msg = "P: [length(pages)] | O: [length(ores)] | M: [length(materials)] | S: [length(smashers)] | F: [length(foodrecipe)] | D: [length(drinkreact)] | C: [length(chemreact)] | B: [length(botseeds)] | V: [length(viruses)] | G: [length(genes)] " return ..() /datum/controller/subsystem/internal_wiki/Initialize() @@ -218,7 +218,7 @@ SUBSYSTEM_DEF(internal_wiki) // Donating /datum/controller/subsystem/internal_wiki/proc/get_donor_value(var/key) SHOULD_NOT_OVERRIDE(TRUE) - if(!dono_list.len || isnull(dono_list[key])) + if(!length(dono_list) || isnull(dono_list[key])) return 0 return dono_list[key] /datum/controller/subsystem/internal_wiki/proc/get_donation_current() @@ -241,7 +241,7 @@ SUBSYSTEM_DEF(internal_wiki) var/list/distilled_list = SSchemistry.distilled_reactions_by_product[R.id] data["instant_reactions"] = null - if(reaction_list != null && reaction_list.len > 0) + if(reaction_list != null && length(reaction_list) > 0) var/list/display_reactions = list() for(var/decl/chemical_reaction/CR in reaction_list) if(CR.wiki_flag & WIKI_SPOILER) @@ -281,11 +281,11 @@ SUBSYSTEM_DEF(internal_wiki) var/obj/item/slime_extract/slime_path = CRS.required assemble_reaction["is_slime"] = initial(slime_path.name) reactions += list(assemble_reaction) - if(display_reactions.len) + if(length(display_reactions)) data["instant_reactions"] = reactions data["distilled_reactions"] = null - if(distilled_list != null && distilled_list.len > 0) + if(distilled_list != null && length(distilled_list) > 0) var/list/display_reactions = list() for(var/decl/chemical_reaction/distilling/CR in distilled_list) if(CR.wiki_flag & WIKI_SPOILER) @@ -327,7 +327,7 @@ SUBSYSTEM_DEF(internal_wiki) assemble_reaction["catalysts"] = catal assemble_reaction["is_slime"] = null reactions += list(assemble_reaction) - if(display_reactions.len) + if(length(display_reactions)) data["distilled_reactions"] = reactions var/grind_list = list() @@ -337,7 +337,7 @@ SUBSYSTEM_DEF(internal_wiki) if(R.id in GLOB.ore_reagents[ore_type]) display_reactions.Add(initial(O.name)) grind_list["ore"] = null - if(display_reactions.len > 0) + if(length(display_reactions) > 0) grind_list["ore"] = display_reactions display_reactions = list() @@ -346,7 +346,7 @@ SUBSYSTEM_DEF(internal_wiki) if(R.id in GLOB.sheet_reagents[sheet_type]) display_reactions.Add(initial(M.name)) grind_list["material"] = null - if(display_reactions.len > 0) + if(length(display_reactions) > 0) grind_list["material"] = display_reactions display_reactions = list() @@ -355,13 +355,13 @@ SUBSYSTEM_DEF(internal_wiki) if(S && S.roundstart && !S.mysterious) if(S.wiki_flag & WIKI_SPOILER) continue - if(!S.chems || !S.chems.len) + if(!S.chems || !length(S.chems)) continue if(!(R.id in S.chems)) continue display_reactions.Add(S.display_name) grind_list["plant"] = null - if(display_reactions.len > 0) + if(length(display_reactions) > 0) grind_list["plant"] = display_reactions data["grinding"] = grind_list @@ -372,24 +372,24 @@ SUBSYSTEM_DEF(internal_wiki) if(OR.reagent == R.id) display_reactions.Add(OR.name) data["fluid"] = null - if(display_reactions.len > 0) + if(length(display_reactions) > 0) data["fluid"] = display_reactions display_reactions = list() var/list/instant_by_reagent = SSchemistry.instant_reactions_by_reagent["[R.id]"] - if(instant_by_reagent && instant_by_reagent.len) - for(var/i = 1, i <= instant_by_reagent.len, i++) + if(instant_by_reagent && length(instant_by_reagent)) + for(var/i = 1, i <= length(instant_by_reagent), i++) var/decl/chemical_reaction/OR = instant_by_reagent[i] if(istype(OR,/decl/chemical_reaction/instant/slime)) // very bloated and meant to be a mystery continue display_reactions.Add(OR.name) var/list/distilled_by_reagent = SSchemistry.distilled_reactions_by_reagent["[R.id]"] - if(distilled_by_reagent && distilled_by_reagent.len) - for(var/i = 1, i <= distilled_by_reagent.len, i++) + if(distilled_by_reagent && length(distilled_by_reagent)) + for(var/i = 1, i <= length(distilled_by_reagent), i++) var/decl/chemical_reaction/OR = distilled_by_reagent[i] display_reactions.Add(OR.name) data["produces"] = null - if(display_reactions.len > 0) + if(length(display_reactions) > 0) data["produces"] = display_reactions /datum/controller/subsystem/internal_wiki/proc/assemble_allergens(var/allergens) @@ -884,7 +884,7 @@ SUBSYSTEM_DEF(internal_wiki) data["grind_reagents"] = null if(GLOB.sheet_reagents[M.stack_type]) var/list/output = GLOB.sheet_reagents[M.stack_type] - if(output && output.len > 0) + if(output && length(output) > 0) var/list/collect = list() var/total_parts = 0 for(var/Rid in output) @@ -905,7 +905,7 @@ SUBSYSTEM_DEF(internal_wiki) data["recipies"] = null M.get_recipes() // generate if not already - if(M.recipes != null && M.recipes.len > 0) + if(M.recipes != null && length(M.recipes) > 0) var/list/recipie_list = list() for(var/datum/stack_recipe/R in M.recipes) recipie_list.Add(R.title) @@ -941,7 +941,7 @@ SUBSYSTEM_DEF(internal_wiki) if(data["grind_reagents"]) body += "
" var/list/grind_list = data["grind_reagents"] - if(grind_list && grind_list.len > 0) + if(grind_list && length(grind_list) > 0) body += "Sheet Grind Results:
" for(var/N in grind_list) body += "-[N]: [grind_list[N]]u
" @@ -996,13 +996,13 @@ SUBSYSTEM_DEF(internal_wiki) traits.Add("Spreading") if(S.get_trait(TRAIT_EXPLOSIVE)) traits.Add("Explosive") - if(!traits.len) + if(!length(traits)) traits.Add("None") data["traits"] = traits data["mob_product"] = S.has_mob_product data["chem_breakdown"] = null - if(S.chems && S.chems.len > 0) + if(S.chems && length(S.chems) > 0) var/list/chems = list() for(var/CB in S.chems) var/datum/reagent/CBR = SSchemistry.chemical_reagents[CB] @@ -1013,21 +1013,21 @@ SUBSYSTEM_DEF(internal_wiki) data["chem_breakdown"] = chems data["gas_consumed"] = null - if(S.consume_gasses && S.consume_gasses.len > 0) + if(S.consume_gasses && length(S.consume_gasses) > 0) var/list/consumed = list() for(var/CG in S.consume_gasses) consumed["[GLOB.gas_data.name[CG]]"] = S.consume_gasses[CG] data["gas_consumed"] = consumed data["gas_exuded"] = null - if(S.exude_gasses && S.exude_gasses.len > 0) + if(S.exude_gasses && length(S.exude_gasses) > 0) var/list/exude = list() for(var/EG in S.exude_gasses) exude["[GLOB.gas_data.name[EG]]"] = S.exude_gasses[EG] data["gas_exuded"] = exude data["mutations"] = null - if(S.mutants && S.mutants.len > 0) + if(S.mutants && length(S.mutants) > 0) var/list/mutations = list() for(var/MS in S.mutants) var/datum/seed/mut = SSplants.seeds[MS] @@ -1052,13 +1052,13 @@ SUBSYSTEM_DEF(internal_wiki) body += "DANGER - MAY BE MOBILE
" body += "
" var/list/chem_list = data["chem_breakdown"] - if(chem_list && chem_list.len > 0) + if(chem_list && length(chem_list) > 0) body += "Chemical Breakdown:
" for(var/CB in chem_list) body += "-[CB]
" body += "
" var/list/consumed_list = data["gas_consumed"] - if(consumed_list && consumed_list.len > 0) + if(consumed_list && length(consumed_list) > 0) body += "Gasses Consumed:
" for(var/CG in consumed_list) var/amount = "[consumed_list[CG]]" @@ -1067,7 +1067,7 @@ SUBSYSTEM_DEF(internal_wiki) body += "-[amount]
" body += "
" var/list/exuded_list = data["gas_exuded"] - if(exuded_list && exuded_list.len > 0) + if(exuded_list && length(exuded_list) > 0) body += "Gasses Produced:
" for(var/EG in exuded_list) var/amount = "[exuded_list[EG]]" @@ -1076,7 +1076,7 @@ SUBSYSTEM_DEF(internal_wiki) body += "-[amount]
" body += "
" var/list/mutations = data["mutations"] - if(mutations && mutations.len > 0) + if(mutations && length(mutations) > 0) body += "Mutant Strains:
" for(var/MS in mutations) body += "-[MS]
" @@ -1097,7 +1097,7 @@ SUBSYSTEM_DEF(internal_wiki) data["req_mat"] = initial(req_mat.name) data["target_items"] = null - if(M.items && M.items.len > 0) + if(M.items && length(M.items) > 0) var/list/targs = list() for(var/obj/Ir as anything in M.items) targs.Add(initial(Ir.name)) @@ -1109,7 +1109,7 @@ SUBSYSTEM_DEF(internal_wiki) data["required_atmos_temp_max"] = M.required_atmos_temp_max data["inducers"] = null - if(M.reagents != null && M.reagents.len > 0) + if(M.reagents != null && length(M.reagents) > 0) var/list/inducers = list() for(var/R in M.reagents) var/amnt = M.reagents[R] @@ -1127,13 +1127,13 @@ SUBSYSTEM_DEF(internal_wiki) if(data["req_mat"] != null) body += "Target Sheet: [data["req_mat"]]
" var/list/targ_items = data["target_items"] - if(targ_items && targ_items.len > 0) + if(targ_items && length(targ_items) > 0) for(var/Ir in targ_items) body += "-[Ir]
" body += "Threshold Energy: [data["required_energy_min"]] - [data["required_energy_max"]]
" body += "Threshold Temp: [data["required_atmos_temp_min"]]k - [data["required_atmos_temp_max"]]k | ([data["required_atmos_temp_min"] - T0C]C - [data["required_atmos_temp_max"] - T0C]C)
" var/list/inducers = data["inducers"] - if(inducers && inducers.len > 0) + if(inducers && length(inducers) > 0) body += "
" body += "Inducers:
" for(var/R in inducers) @@ -1282,19 +1282,19 @@ SUBSYSTEM_DEF(internal_wiki) var/list/ingred = list() for(var/ing in recipe["Ingredients"]) ingred["[ing]"] = recipe["Ingredients"][ing] - recipe_data["ingredients"] = ingred.len ? ingred : null + recipe_data["ingredients"] = length(ingred) ? ingred : null var/list/fruits = list() for(var/fru in recipe["Fruit"]) fruits["[fru]"] = recipe["Fruit"][fru] - recipe_data["fruits"] = fruits.len ? fruits : null + recipe_data["fruits"] = length(fruits) ? fruits : null var/list/reagents = list() for(var/rea in recipe["Reagents"]) reagents["[rea]"] = recipe["Reagents"][rea] - recipe_data["reagents"] = reagents.len ? reagents : null + recipe_data["reagents"] = length(reagents) ? reagents : null var/list/catalysts = list() for(var/cat in recipe["Catalysts"]) catalysts["[cat]"] = recipe["Catalysts"][cat] - recipe_data["catalysts"] = catalysts.len ? catalysts : null + recipe_data["catalysts"] = length(catalysts) ? catalysts : null data["recipe"] = recipe_data /datum/internal_wiki/page/recipe/get_print() @@ -1313,7 +1313,7 @@ SUBSYSTEM_DEF(internal_wiki) body += "Appliance: [data["recipe"]["appliance"]]

" // ingredients var/list/ingreds = data["recipe"]["ingredients"] - if(ingreds && ingreds.len) + if(ingreds && length(ingreds)) var/count = 0 var/pretty_ing = "" for(var/ing in ingreds) @@ -1332,7 +1332,7 @@ SUBSYSTEM_DEF(internal_wiki) body += "Coating: [data["recipe"]["coating"]]
" // Fruits/Veggis var/list/fruits = data["recipe"]["fruits"] - if(fruits && fruits.len) // Can't use lazylen, assoc list + if(fruits && length(fruits)) // Can't use lazylen, assoc list var/count = 0 var/pretty_fru = "" for(var/fru in fruits) @@ -1342,7 +1342,7 @@ SUBSYSTEM_DEF(internal_wiki) body += "Components: [pretty_fru]
" //For each reagent var/list/reags = data["recipe"]["reagents"] - if(reags && reags.len) // Can't use lazylen, assoc list + if(reags && length(reags)) // Can't use lazylen, assoc list var/count = 0 var/pretty_rea = "" for(var/reg in reags) @@ -1352,7 +1352,7 @@ SUBSYSTEM_DEF(internal_wiki) body += "Mix in: [pretty_rea]
" //For each catalyst var/list/catalis = data["recipe"]["catalysts"] - if(catalis && catalis.len) // Can't use lazylen, assoc list + if(catalis && length(catalis)) // Can't use lazylen, assoc list var/count = 0 var/pretty_cat = "" for(var/cat in catalis) @@ -1501,7 +1501,7 @@ SUBSYSTEM_DEF(internal_wiki) for(var/path in blockers) var/datum/trait/TG = GLOB.all_traits[path] output_blockers.Add(TG.name) - if(output_blockers.len) + if(length(output_blockers)) data["blockers"] = output_blockers else // Old style gene @@ -1536,7 +1536,7 @@ SUBSYSTEM_DEF(internal_wiki) /datum/internal_wiki/page/proc/print_allergens(var/list/allergens) PROTECTED_PROC(TRUE) var/AG = "" - if(allergens && allergens.len > 0) + if(allergens && length(allergens) > 0) AG += "Allergens:
" for(var/ALGY in allergens) AG += "-[ALGY]
" @@ -1546,10 +1546,10 @@ SUBSYSTEM_DEF(internal_wiki) /datum/internal_wiki/page/proc/print_reaction_data(var/list/data) var/body = "" var/list/instant = data["instant_reactions"] - if(instant && instant.len > 0) + if(instant && length(instant) > 0) var/segment = 1 for(var/list/react in instant) - if(instant.len == 1) + if(length(instant) == 1) body += "Potential Chemical breakdown:
" else body += "Potential Chemical breakdown [segment]:
" @@ -1568,10 +1568,10 @@ SUBSYSTEM_DEF(internal_wiki) body += "Potential Chemical breakdown:
UNKNOWN OR BASE-REAGENT
" var/list/distilled = data["distilled_reactions"] - if(distilled && distilled.len > 0) + if(distilled && length(distilled) > 0) var/segment = 1 for(var/list/react in distilled) - if(distilled.len == 1) + if(length(distilled) == 1) body += "Potential Chemical breakdown:
" else body += "Potential Chemical breakdown [segment]:
" @@ -1589,28 +1589,28 @@ SUBSYSTEM_DEF(internal_wiki) body += " -Catalyst: [CL]
" var/list/grind_ore = data["grinding"]["ore"] - if(grind_ore && grind_ore.len) + if(grind_ore && length(grind_ore)) body += "
" body += "Ore processing results:
" for(var/PL in grind_ore) body += " -Grind: [PL]
" var/list/grind_mats = data["grinding"]["material"] - if(grind_mats && grind_mats.len) + if(grind_mats && length(grind_mats)) body += "
" body += "Material processing results:
" for(var/PL in grind_mats) body += " -Grind: [PL]
" var/list/grind_plants = data["grinding"]["plant"] - if(grind_plants && grind_plants.len) + if(grind_plants && length(grind_plants)) body += "
" body += "Organic processing results:
" for(var/PL in grind_plants) body += " -Grind: [PL]
" var/list/fluid_pumping = data["fluid"] - if(fluid_pumping && fluid_pumping.len) + if(fluid_pumping && length(fluid_pumping)) body += "
" body += "Fluid pump results:
" for(var/PL in fluid_pumping) @@ -1618,7 +1618,7 @@ SUBSYSTEM_DEF(internal_wiki) body += "
" var/list/produces = data["produces"] - if(produces && produces.len) + if(produces && length(produces)) body += "Is a component of:
" for(var/PL in produces) body += "-[PL]
" diff --git a/code/controllers/subsystems/job.dm b/code/controllers/subsystems/job.dm index 15b6e1ff98..fce533fc80 100644 --- a/code/controllers/subsystems/job.dm +++ b/code/controllers/subsystems/job.dm @@ -14,16 +14,16 @@ SUBSYSTEM_DEF(job) /datum/controller/subsystem/job/Initialize() - if(!department_datums.len) + if(!length(department_datums)) setup_departments() - if(!occupations.len) + if(!length(occupations)) setup_occupations() return SS_INIT_SUCCESS /datum/controller/subsystem/job/proc/setup_occupations(faction = FACTION_STATION) occupations = list() var/list/all_jobs = subtypesof(/datum/job) - if(!all_jobs.len) + if(!length(all_jobs)) to_chat(world, span_warning("Error setting up jobs, no job datums found")) return FALSE @@ -80,13 +80,9 @@ SUBSYSTEM_DEF(job) return dept_datums /datum/controller/subsystem/job/proc/get_job(rank) - if(!occupations.len) - setup_occupations() return name_occupations[rank] /datum/controller/subsystem/job/proc/get_job_type(jobtype) - if(!occupations.len) - setup_occupations() return type_occupations[jobtype] // Determines if a job title is inside of a specific department. diff --git a/code/controllers/subsystems/lighting.dm b/code/controllers/subsystems/lighting.dm index 1e861298f7..824fb76be3 100644 --- a/code/controllers/subsystems/lighting.dm +++ b/code/controllers/subsystems/lighting.dm @@ -164,12 +164,12 @@ SUBSYSTEM_DEF(lighting) //Wrapper for the list, because these type of lists are just awful to work with //Also takes care of initialization order issues /datum/controller/subsystem/lighting/proc/get_pshandler_z(var/z) - if(z > z_to_pshandler.len) + if(z > length(z_to_pshandler)) z_to_pshandler.len = z var/datum/planet_sunlight_handler/pshandler = z_to_pshandler[z] if(istype(pshandler)) return pshandler - else if(SSplanets && SSplanets.z_to_planet.len >= z && SSplanets.z_to_planet[z]) + else if(SSplanets && length(SSplanets.z_to_planet) >= z && SSplanets.z_to_planet[z]) var/datum/planet/P = SSplanets.z_to_planet[z] if(istype(P)) pshandler = get_pshandler_planet(P) diff --git a/code/controllers/subsystems/machines.dm b/code/controllers/subsystems/machines.dm index 80ee1e4fc4..e176e2c8ec 100644 --- a/code/controllers/subsystems/machines.dm +++ b/code/controllers/subsystems/machines.dm @@ -114,12 +114,12 @@ SUBSYSTEM_DEF(machines) msg += "PN:[round(cost_powernets,1)]|" msg += "PO:[round(cost_power_objects,1)]" msg += "} " - msg += "PI:[SSmachines.networks.len]|" - msg += "MC:[SSmachines.processing_machines.len]|" - msg += "PN:[SSmachines.powernets.len][defering_powernets ? " - !!DEFER!!" : ""]|" - msg += "PO:[SSmachines.powerobjs.len]|" - msg += "HV:[SSmachines.hibernating_vents.len]|" - msg += "MC/MS:[round((cost ? SSmachines.processing_machines.len/cost_machinery : 0),0.1)]" + msg += "PI:[length(SSmachines.networks)]|" + msg += "MC:[length(SSmachines.processing_machines)]|" + msg += "PN:[length(SSmachines.powernets)][defering_powernets ? " - !!DEFER!!" : ""]|" + msg += "PO:[length(SSmachines.powerobjs)]|" + msg += "HV:[length(SSmachines.hibernating_vents)]|" + msg += "MC/MS:[round((cost ? length(SSmachines.processing_machines)/cost_machinery : 0),0.1)]" return ..() /datum/controller/subsystem/machines/proc/process_pipenets(resumed = 0) @@ -128,8 +128,8 @@ SUBSYSTEM_DEF(machines) //cache for sanic speed (lists are references anyways) var/wait = src.wait var/list/current_run = src.current_run - while(current_run.len) - var/datum/pipe_network/PN = current_run[current_run.len] + while(length(current_run)) + var/datum/pipe_network/PN = current_run[length(current_run)] current_run.len-- if(!PN || QDELETED(PN)) networks.Remove(PN) @@ -146,8 +146,8 @@ SUBSYSTEM_DEF(machines) var/wait = src.wait var/list/current_run = src.current_run - while(current_run.len) - var/obj/machinery/M = current_run[current_run.len] + while(length(current_run)) + var/obj/machinery/M = current_run[length(current_run)] current_run.len-- if(!istype(M) || QDELETED(M) || (M.process(wait) == PROCESS_KILL)) processing_machines.Remove(M) @@ -161,8 +161,8 @@ SUBSYSTEM_DEF(machines) var/wait = src.wait var/list/current_run = src.current_run - while(current_run.len) - var/datum/powernet/PN = current_run[current_run.len] + while(length(current_run)) + var/datum/powernet/PN = current_run[length(current_run)] current_run.len-- if(!PN) powernets.Remove(PN) @@ -180,8 +180,8 @@ SUBSYSTEM_DEF(machines) var/wait = src.wait var/list/current_run = src.current_run - while(current_run.len) - var/obj/item/I = current_run[current_run.len] + while(length(current_run)) + var/obj/item/I = current_run[length(current_run)] current_run.len-- if(!I || (I.pwr_drain(wait) == PROCESS_KILL)) powerobjs.Remove(I) @@ -217,13 +217,13 @@ SUBSYSTEM_DEF(machines) // pick at random var/i = rand(20,40) while(i-- > 0) - if(!hibernating_vents.len) + if(!length(hibernating_vents)) break wake_vent(hibernating_vents[pick(hibernating_vents)]) // do first 10 entries i = 10 for(var/key in hibernating_vents) - if(i <= 0 || !hibernating_vents.len) + if(i <= 0 || !length(hibernating_vents)) break wake_vent(hibernating_vents[key]) i-- diff --git a/code/controllers/subsystems/mail.dm b/code/controllers/subsystems/mail.dm index 77eee0bb7e..c7e0484abe 100644 --- a/code/controllers/subsystems/mail.dm +++ b/code/controllers/subsystems/mail.dm @@ -30,7 +30,7 @@ SUBSYSTEM_DEF(mail) // Creates mail for all the mail waiting to arrive, if there's nobody to receive it, it will be a chance of junk mail. for(var/mail_iterator in 1 to mail_waiting) - if(!mail_recipients.len && prob(60)) // Oh, no mail for our Employees? Well don't just sent them all the junk. + if(!length(mail_recipients) && prob(60)) // Oh, no mail for our Employees? Well don't just sent them all the junk. continue var/obj/item/mail/new_mail if(prob(70)) @@ -38,7 +38,7 @@ SUBSYSTEM_DEF(mail) else new_mail = new /obj/item/mail/envelope(mailcrate) var/mob/living/carbon/human/mail_to - if(mail_recipients.len) + if(length(mail_recipients)) mail_to = pick(mail_recipients) new_mail.initialize_for_recipient(mail_to.mind) mail_recipients -= mail_to diff --git a/code/controllers/subsystems/mobs.dm b/code/controllers/subsystems/mobs.dm index 521d7cef4f..8dc38eb9c2 100644 --- a/code/controllers/subsystems/mobs.dm +++ b/code/controllers/subsystems/mobs.dm @@ -28,18 +28,18 @@ SUBSYSTEM_DEF(mobs) var/list/death_list = list() /datum/controller/subsystem/mobs/stat_entry(msg) - msg = "P: [GLOB.mob_list.len] | S: [slept_mobs] | D: [death_list.len]" + msg = "P: [length(GLOB.mob_list)] | S: [slept_mobs] | D: [length(death_list)]" return ..() /datum/controller/subsystem/mobs/fire(resumed = 0) if (!resumed) src.currentrun = GLOB.mob_list.Copy() - process_z.len = GLOB.living_players_by_zlevel.len + process_z.len = length(GLOB.living_players_by_zlevel) slept_mobs = 0 - for(var/level in 1 to process_z.len) - process_z[level] = GLOB.living_players_by_zlevel[level].len + for(var/level in 1 to length(process_z)) + process_z[level] = length(GLOB.living_players_by_zlevel[level]) // Lets handle all of these while we have time, should always remain extremely small... - if(death_list.len) // Don't contact DB if this list is empty + if(length(death_list)) // Don't contact DB if this list is empty if(CONFIG_GET(flag/sql_enabled)) establish_db_connection() if(!SSdbcore.IsConnected()) @@ -51,8 +51,8 @@ SUBSYSTEM_DEF(mobs) //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun var/times_fired = src.times_fired - while(currentrun.len) - var/mob/M = currentrun[currentrun.len] + while(length(currentrun)) + var/mob/M = currentrun[length(currentrun)] currentrun.len-- if(!M || QDELETED(M)) @@ -75,25 +75,25 @@ SUBSYSTEM_DEF(mobs) log_game(msg) log_world(msg) return - msg += "Lists: currentrun: [currentrun.len], mob_list: [GLOB.mob_list.len]\n" + msg += "Lists: currentrun: [length(currentrun)], mob_list: [length(GLOB.mob_list)]\n" - if(!currentrun.len) + if(!length(currentrun)) msg += "!!The subsystem just finished the mob_list list, and currentrun is empty (or has never run).\n" msg += "!!The info below is the tail of mob_list instead of currentrun.\n" - var/datum/D = currentrun.len ? currentrun[currentrun.len] : GLOB.mob_list[GLOB.mob_list.len] + var/datum/D = length(currentrun) ? currentrun[length(currentrun)] : GLOB.mob_list[length(GLOB.mob_list)] msg += "Tail entry: [describeThis(D)] (this is likely the item AFTER the problem item)\n" var/position = GLOB.mob_list.Find(D) if(!position) msg += "Unable to find context of tail entry in mob_list list.\n" else - if(position != GLOB.mob_list.len) + if(position != length(GLOB.mob_list)) var/additional = GLOB.mob_list.Find(D, position+1) if(additional) msg += "WARNING: Tail entry found more than once in mob_list list! Context is for the first found.\n" - var/start = clamp(position-2,1,GLOB.mob_list.len) - var/end = clamp(position+2,1,GLOB.mob_list.len) + var/start = clamp(position-2,1,length(GLOB.mob_list)) + var/end = clamp(position+2,1,length(GLOB.mob_list)) msg += "2 previous elements, then tail, then 2 next elements of mob_list list for context:\n" msg += "---\n" for(var/i in start to end) diff --git a/code/controllers/subsystems/motion_tracker.dm b/code/controllers/subsystems/motion_tracker.dm index 5cd4b1459a..0c5f3b4359 100644 --- a/code/controllers/subsystems/motion_tracker.dm +++ b/code/controllers/subsystems/motion_tracker.dm @@ -18,20 +18,20 @@ SUBSYSTEM_DEF(motiontracker) if(_listen_lookup) var/list/track_list = _listen_lookup[COMSIG_MOVABLE_MOTIONTRACKER] if(islist(track_list)) - count = track_list.len + count = length(track_list) else count = 1 // listen_lookup optimizes single entries into just returning the only thing if(hide_all) msg = "HIDE AND SEEK" else - msg = "L: [count] | Q: [queued_echo_turfs.len] | A: [all_echos_round]/[all_pings_round]" + msg = "L: [count] | Q: [length(queued_echo_turfs)] | A: [all_echos_round]/[all_pings_round]" return ..() /datum/controller/subsystem/motiontracker/fire(resumed = 0) if(!resumed) src.currentrun = queued_echo_turfs.Copy() expended_echos.Cut() - while(currentrun.len) + while(length(currentrun)) var/key = currentrun[1] // Because using an index into an associative array gets the key at that index... I hate you byond. var/list/data = currentrun[key] var/datum/weakref/AF= data[1] diff --git a/code/controllers/subsystems/nightshift.dm b/code/controllers/subsystems/nightshift.dm index b66581d5fe..f3688bfff8 100644 --- a/code/controllers/subsystems/nightshift.dm +++ b/code/controllers/subsystems/nightshift.dm @@ -27,7 +27,7 @@ SUBSYSTEM_DEF(nightshift) /datum/controller/subsystem/nightshift/proc/announce(message) var/announce_z - if(using_map.station_levels.len) + if(length(using_map.station_levels)) announce_z = pick(using_map.station_levels) var/pickedsound if(!high_security_mode) diff --git a/code/controllers/subsystems/orbits.dm b/code/controllers/subsystems/orbits.dm index af7a5ab7ea..46202e5738 100644 --- a/code/controllers/subsystems/orbits.dm +++ b/code/controllers/subsystems/orbits.dm @@ -8,7 +8,7 @@ SUBSYSTEM_DEF(orbit) var/list/processing = list() /datum/controller/subsystem/orbit/stat_entry(msg) - msg = "P:[processing.len]" + msg = "P:[length(processing)]" return ..() @@ -19,8 +19,8 @@ SUBSYSTEM_DEF(orbit) //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun - while (currentrun.len) - var/datum/orbit/O = currentrun[currentrun.len] + while (length(currentrun)) + var/datum/orbit/O = currentrun[length(currentrun)] currentrun.len-- if (!O) processing -= O diff --git a/code/controllers/subsystems/overlays.dm b/code/controllers/subsystems/overlays.dm index b2668e4122..1ecc1127ad 100644 --- a/code/controllers/subsystems/overlays.dm +++ b/code/controllers/subsystems/overlays.dm @@ -149,7 +149,7 @@ SUBSYSTEM_DEF(overlays) var/list/cached_other = other.overlays.Copy() if(cached_other) - if(cut_old || !overlays.len) + if(cut_old || !length(overlays)) overlays = cached_other else overlays |= cached_other diff --git a/code/controllers/subsystems/persist_vr.dm b/code/controllers/subsystems/persist_vr.dm index 870a079c3d..c2d50c8d6e 100644 --- a/code/controllers/subsystems/persist_vr.dm +++ b/code/controllers/subsystems/persist_vr.dm @@ -31,8 +31,8 @@ SUBSYSTEM_DEF(persist) //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun var/list/query_stack = src.query_stack - while (currentrun.len) - var/mob/M = currentrun[currentrun.len] + while (length(currentrun)) + var/mob/M = currentrun[length(currentrun)] currentrun.len-- if (QDELETED(M) || !istype(M) || !M.mind || !M.client || TICKS2DS(M.client.inactivity) > wait) continue @@ -98,7 +98,7 @@ SUBSYSTEM_DEF(persist) if (MC_TICK_CHECK) return - if(query_stack.len) + if(length(query_stack)) SSdbcore.MassInsert(format_table_name("vr_player_hours"), query_stack, duplicate_key = "ON DUPLICATE KEY UPDATE hours = VALUES(hours), total_hours = VALUES(total_hours)") query_stack.Cut() diff --git a/code/controllers/subsystems/ping.dm b/code/controllers/subsystems/ping.dm index 2ef44bc167..7c53ea087f 100644 --- a/code/controllers/subsystems/ping.dm +++ b/code/controllers/subsystems/ping.dm @@ -13,7 +13,7 @@ SUBSYSTEM_DEF(ping) var/list/currentrun = list() /datum/controller/subsystem/ping/stat_entry(msg) - msg = "P:[GLOB.clients.len]" + msg = "P:[length(GLOB.clients)]" return ..() /datum/controller/subsystem/ping/fire(resumed = FALSE) @@ -24,8 +24,8 @@ SUBSYSTEM_DEF(ping) // De-reference the list for sanic speeds var/list/currentrun = src.currentrun - while (currentrun.len) - var/client/client = currentrun[currentrun.len] + while (length(currentrun)) + var/client/client = currentrun[length(currentrun)] currentrun.len-- if(!client?.prefs?.read_preference(/datum/preference/toggle/vchat_enable)) diff --git a/code/controllers/subsystems/planets.dm b/code/controllers/subsystems/planets.dm index b3d319bad4..18ae51f963 100644 --- a/code/controllers/subsystems/planets.dm +++ b/code/controllers/subsystems/planets.dm @@ -42,7 +42,7 @@ SUBSYSTEM_DEF(planets) // USE turf/simulated/proc/make_indoors() and // turf/simulated/proc/make_outdoors() /datum/controller/subsystem/planets/proc/addTurf(var/turf/T) - if(z_to_planet.len >= T.z && z_to_planet[T.z]) + if(length(z_to_planet) >= T.z && z_to_planet[T.z]) var/datum/planet/P = z_to_planet[T.z] if(!istype(P)) return @@ -53,7 +53,7 @@ SUBSYSTEM_DEF(planets) P.weather_holder.apply_to_turf(T) /datum/controller/subsystem/planets/proc/removeTurf(var/turf/T,var/is_edge) - if(z_to_planet.len >= T.z) + if(length(z_to_planet) >= T.z) var/datum/planet/P = z_to_planet[T.z] if(!P) return @@ -70,8 +70,8 @@ SUBSYSTEM_DEF(planets) src.currentrun = planets.Copy() var/list/needs_sun_update = src.needs_sun_update - while(needs_sun_update.len) - var/datum/planet/P = needs_sun_update[needs_sun_update.len] + while(length(needs_sun_update)) + var/datum/planet/P = needs_sun_update[length(needs_sun_update)] needs_sun_update.len-- updateSunlight(P) if(MC_TICK_CHECK) @@ -79,8 +79,8 @@ SUBSYSTEM_DEF(planets) #ifndef UNIT_TESTS // Don't be updating temperatures and such during unit tests var/list/needs_temp_update = src.needs_temp_update - while(needs_temp_update.len) - var/datum/planet/P = needs_temp_update[needs_temp_update.len] + while(length(needs_temp_update)) + var/datum/planet/P = needs_temp_update[length(needs_temp_update)] needs_temp_update.len-- updateTemp(P) if(MC_TICK_CHECK) @@ -88,8 +88,8 @@ SUBSYSTEM_DEF(planets) #endif var/list/currentrun = src.currentrun - while(currentrun.len) - var/datum/planet/P = currentrun[currentrun.len] + while(length(currentrun)) + var/datum/planet/P = currentrun[length(currentrun)] currentrun.len-- P.process(last_fire) diff --git a/code/controllers/subsystems/plants.dm b/code/controllers/subsystems/plants.dm index 653991e48c..bec11f8d16 100644 --- a/code/controllers/subsystems/plants.dm +++ b/code/controllers/subsystems/plants.dm @@ -25,7 +25,7 @@ SUBSYSTEM_DEF(plants) var/list/currentrun = list() /datum/controller/subsystem/plants/stat_entry(msg) - msg = "P:[processing.len]|S:[seeds.len]" + msg = "P:[length(processing)]|S:[length(seeds)]" return ..() /datum/controller/subsystem/plants/Initialize() @@ -68,7 +68,7 @@ SUBSYSTEM_DEF(plants) for(var/type in subtypesof(/datum/seed)) var/datum/seed/S = new type seeds[S.name] = S - S.uid = "[seeds.len]" + S.uid = "[length(seeds)]" S.roundstart = 1 // Make sure any seed packets that were mapped in are updated @@ -80,7 +80,7 @@ SUBSYSTEM_DEF(plants) var/list/gene_datums = decls_repository.get_decls_of_subtype(/decl/plantgene) var/list/used_masks = list() var/list/plant_traits = ALL_GENES - while(plant_traits && plant_traits.len) + while(plant_traits && length(plant_traits)) var/gene_tag = pick(plant_traits) var/gene_mask = "[uppertext(num2hex(rand(0,255), 2))]" @@ -131,8 +131,8 @@ SUBSYSTEM_DEF(plants) // Caching var/list/currentrun = src.currentrun - while(currentrun.len) - var/obj/effect/plant/P = currentrun[currentrun.len] + while(length(currentrun)) + var/obj/effect/plant/P = currentrun[length(currentrun)] --currentrun.len if(!P || QDELETED(P)) continue diff --git a/code/controllers/subsystems/pois.dm b/code/controllers/subsystems/pois.dm index f63f19d152..f3212a4f01 100644 --- a/code/controllers/subsystems/pois.dm +++ b/code/controllers/subsystems/pois.dm @@ -10,14 +10,14 @@ SUBSYSTEM_DEF(points_of_interest) var/list/obj/effect/landmark/poi_loader/poi_queue = list() /datum/controller/subsystem/points_of_interest/Initialize() - while (poi_queue.len) + while (length(poi_queue)) load_next_poi() log_mapping("Initializing POIs") admin_notice(span_danger("Initializing POIs"), R_DEBUG) return SS_INIT_SUCCESS /datum/controller/subsystem/points_of_interest/fire(resumed = FALSE) - while (poi_queue.len) + while (length(poi_queue)) load_next_poi() if (MC_TICK_CHECK) @@ -37,7 +37,7 @@ SUBSYSTEM_DEF(points_of_interest) //var/deleted_atoms = 0 //admin_notice(span_danger("Annihilating objects in poi loading location."), R_DEBUG) var/list/turfs_to_clean = get_turfs_to_clean(poi_to_load) - if(turfs_to_clean.len) + if(length(turfs_to_clean)) for(var/x in 1 to 2) // Requires two passes to get everything. for(var/turf/T in turfs_to_clean) for(var/atom/movable/AM in T) @@ -57,7 +57,7 @@ SUBSYSTEM_DEF(points_of_interest) if(!poi_to_load.poi_type) return - if(!(GLOB.global_used_pois.len) || !(GLOB.global_used_pois[poi_to_load.poi_type])) + if(!(length(GLOB.global_used_pois)) || !(GLOB.global_used_pois[poi_to_load.poi_type])) GLOB.global_used_pois[poi_to_load.poi_type] = list() var/list/poi_list = GLOB.global_used_pois[poi_to_load.poi_type] for(var/map in SSmapping.map_templates) @@ -69,7 +69,7 @@ SUBSYSTEM_DEF(points_of_interest) var/list/our_poi_list = GLOB.global_used_pois[poi_to_load.poi_type] - if(!our_poi_list.len) + if(!length(our_poi_list)) return else template_to_use = pick(our_poi_list) diff --git a/code/controllers/subsystems/processing/obj_tab_items.dm b/code/controllers/subsystems/processing/obj_tab_items.dm index 53786daf01..6be6bceab1 100644 --- a/code/controllers/subsystems/processing/obj_tab_items.dm +++ b/code/controllers/subsystems/processing/obj_tab_items.dm @@ -12,8 +12,8 @@ PROCESSING_SUBSYSTEM_DEF(obj_tab_items) //cache for sanic speed (lists are references anyways) var/list/current_run = currentrun - while(current_run.len) - var/datum/thing = current_run[current_run.len] + while(length(current_run)) + var/datum/thing = current_run[length(current_run)] if(QDELETED(thing)) processing -= thing else if(thing.process(wait * 0.1) == PROCESS_KILL) diff --git a/code/controllers/subsystems/processing/processing.dm b/code/controllers/subsystems/processing/processing.dm index ceff7b6e37..808f57226a 100644 --- a/code/controllers/subsystems/processing/processing.dm +++ b/code/controllers/subsystems/processing/processing.dm @@ -25,7 +25,7 @@ SUBSYSTEM_DEF(processing) processing |= D /datum/controller/subsystem/processing/stat_entry(msg) - msg = "[stat_tag]:[processing.len]" + msg = "[stat_tag]:[length(processing)]" return ..() /datum/controller/subsystem/processing/fire(resumed = 0) @@ -34,8 +34,8 @@ SUBSYSTEM_DEF(processing) //cache for sanic speed (lists are references anyways) var/list/current_run = currentrun - while(current_run.len) - current_thing = current_run[current_run.len] + while(length(current_run)) + current_thing = current_run[length(current_run)] current_run.len-- if(QDELETED(current_thing)) processing -= current_thing @@ -68,25 +68,25 @@ SUBSYSTEM_DEF(processing) msg += "ERROR: A critical list [currentrun ? "processing" : "currentrun"] is gone!" log_world(msg) return - msg += "Lists: current_run: [currentrun.len], processing: [processing.len]\n" + msg += "Lists: current_run: [length(currentrun)], processing: [length(processing)]\n" - if(!currentrun.len) + if(!length(currentrun)) msg += "!!The subsystem just finished the processing list, and currentrun is empty (or has never run).\n" msg += "!!The info below is the tail of processing instead of currentrun.\n" - var/datum/D = currentrun.len ? currentrun[currentrun.len] : processing[processing.len] + var/datum/D = length(currentrun) ? currentrun[length(currentrun)] : processing[length(processing)] msg += "Tail entry: [describeThis(D)] (this is likely the item AFTER the problem item)\n" var/position = processing.Find(D) if(!position) msg += "Unable to find context of tail entry in processing list.\n" else - if(position != processing.len) + if(position != length(processing)) var/additional = processing.Find(D, position+1) if(additional) msg += "WARNING: Tail entry found more than once in processing list! Context is for the first found.\n" - var/start = clamp(position-2,1,processing.len) - var/end = clamp(position+2,1,processing.len) + var/start = clamp(position-2,1,length(processing)) + var/end = clamp(position+2,1,length(processing)) msg += "2 previous elements, then tail, then 2 next elements of processing list for context:\n" msg += "---\n" for(var/i in start to end) diff --git a/code/controllers/subsystems/radiation.dm b/code/controllers/subsystems/radiation.dm index 7a461fe9cd..165c2120ef 100644 --- a/code/controllers/subsystems/radiation.dm +++ b/code/controllers/subsystems/radiation.dm @@ -17,8 +17,8 @@ SUBSYSTEM_DEF(radiation) current_res_cache = resistance_cache.Copy() listeners = GLOB.living_mob_list.Copy() - while(current_sources.len) - var/datum/radiation_source/S = current_sources[current_sources.len] + while(length(current_sources)) + var/datum/radiation_source/S = current_sources[length(current_sources)] current_sources.len-- if(QDELETED(S)) @@ -28,8 +28,8 @@ SUBSYSTEM_DEF(radiation) if (MC_TICK_CHECK) return - while(current_res_cache.len) - var/turf/T = current_res_cache[current_res_cache.len] + while(length(current_res_cache)) + var/turf/T = current_res_cache[length(current_res_cache)] current_res_cache.len-- if(QDELETED(T)) @@ -39,11 +39,11 @@ SUBSYSTEM_DEF(radiation) if (MC_TICK_CHECK) return - if(!sources.len) + if(!length(sources)) listeners.Cut() - while(listeners.len) - var/atom/A = listeners[listeners.len] + while(length(listeners)) + var/atom/A = listeners[length(listeners)] listeners.len-- if(!QDELETED(A)) @@ -55,7 +55,7 @@ SUBSYSTEM_DEF(radiation) return /datum/controller/subsystem/radiation/stat_entry(msg) - msg = "S:[sources.len], RC:[resistance_cache.len]" + msg = "S:[length(sources)], RC:[length(resistance_cache)]" return ..() // Ray trace from all active radiation sources to T and return the strongest effect. diff --git a/code/controllers/subsystems/research.dm b/code/controllers/subsystems/research.dm index d086c7122c..16070edea4 100644 --- a/code/controllers/subsystems/research.dm +++ b/code/controllers/subsystems/research.dm @@ -331,7 +331,7 @@ SUBSYSTEM_DEF(research) // for(var/partner_path in subtypesof(/datum/scientific_partner)) // var/datum/scientific_partner/partner = new partner_path -// if(!partner.accepted_experiments.len) +// if(!length(partner.accepted_experiments)) // for (var/datum/experiment/ordnance/ordnance_experiment as anything in ordnance_experiments) // partner.accepted_experiments += ordnance_experiment.type // scientific_partners += partner diff --git a/code/controllers/subsystems/robot_sprites.dm b/code/controllers/subsystems/robot_sprites.dm index d2c12dd015..53b2d83552 100644 --- a/code/controllers/subsystems/robot_sprites.dm +++ b/code/controllers/subsystems/robot_sprites.dm @@ -85,13 +85,13 @@ SUBSYSTEM_DEF(robot_sprites) if(!islist(sprite_list)) return 0 - return sprite_list.len + return length(sprite_list) /datum/controller/subsystem/robot_sprites/proc/get_default_module_sprite(var/module) var/list/module_sprites = get_module_sprites(module) - if(!module_sprites || !module_sprites.len) + if(!module_sprites || !length(module_sprites)) return var/chosen_sprite diff --git a/code/controllers/subsystems/runechat.dm b/code/controllers/subsystems/runechat.dm index 663bb8cf34..5a855f677f 100644 --- a/code/controllers/subsystems/runechat.dm +++ b/code/controllers/subsystems/runechat.dm @@ -6,8 +6,8 @@ TIMER_SUBSYSTEM_DEF(runechat) /datum/controller/subsystem/timer/runechat/fire(resumed) . = ..() //poggers - while(message_queue.len) - var/datum/callback/queued_message = message_queue[message_queue.len] + while(length(message_queue)) + var/datum/callback/queued_message = message_queue[length(message_queue)] queued_message.Invoke() message_queue.len-- if(MC_TICK_CHECK) diff --git a/code/controllers/subsystems/server_maint.dm b/code/controllers/subsystems/server_maint.dm index 0db62b2606..23df3001c2 100644 --- a/code/controllers/subsystems/server_maint.dm +++ b/code/controllers/subsystems/server_maint.dm @@ -106,7 +106,7 @@ SUBSYSTEM_DEF(server_maint) var/max_pop = CONFIG_GET(number/max_hub_pop) - if(GLOB.clients.len > max_pop) + if(length(GLOB.clients) > max_pop) world.update_hub_visibility(FALSE) else world.update_hub_visibility(TRUE) diff --git a/code/controllers/subsystems/shuttles.dm b/code/controllers/subsystems/shuttles.dm index ded9b4c462..78a74e9d60 100644 --- a/code/controllers/subsystems/shuttles.dm +++ b/code/controllers/subsystems/shuttles.dm @@ -54,8 +54,8 @@ SUBSYSTEM_DEF(shuttles) src.current_run = process_shuttles.Copy() var/list/working_shuttles = src.current_run // Cache for sanic speed - while(working_shuttles.len) - var/datum/shuttle/S = working_shuttles[working_shuttles.len] + while(length(working_shuttles)) + var/datum/shuttle/S = working_shuttles[length(working_shuttles)] working_shuttles.len-- if(!istype(S) || QDELETED(S)) log_world("## ERROR Bad entry in SSshuttles.process_shuttles - [log_info_line(S)] ") @@ -177,5 +177,5 @@ SUBSYSTEM_DEF(shuttles) overmap_halted ? ship_effect.halt() : ship_effect.unhalt() /datum/controller/subsystem/shuttles/stat_entry(msg) - msg = "Shuttles:[process_shuttles.len]/[shuttles.len], Ships:[ships.len], L:[registered_shuttle_landmarks.len][overmap_halted ? ", HALT" : ""]" + msg = "Shuttles:[length(process_shuttles)]/[length(shuttles)], Ships:[length(ships)], L:[length(registered_shuttle_landmarks)][overmap_halted ? ", HALT" : ""]" return ..() diff --git a/code/controllers/subsystems/starmover.dm b/code/controllers/subsystems/starmover.dm index 36a7678a52..675770dab2 100644 --- a/code/controllers/subsystems/starmover.dm +++ b/code/controllers/subsystems/starmover.dm @@ -25,7 +25,7 @@ SUBSYSTEM_DEF(starmover) /datum/controller/subsystem/starmover/fire(resumed) // Get next in queue or dropout if(!resumed && !current_movement) - if(!zqueue.len) + if(!length(zqueue)) return current_movement = zqueue[1] zqueue[1] = null @@ -34,15 +34,15 @@ SUBSYSTEM_DEF(starmover) var/zlevel = current_movement[CR_ZLEVEL] var/new_dir = current_movement[CR_DIRECTION] var/list/turf_list = current_movement[CR_TURFS] - if(!turf_list.len || moving_levels["[zlevel]"] == new_dir) + if(!length(turf_list) || moving_levels["[zlevel]"] == new_dir) clear_movement_run() return moving_levels["[zlevel]"] = new_dir currentrun = turf_list // Has a movement queued, process all turfs - while(currentrun.len) - var/turf/space/T = currentrun[currentrun.len] + while(length(currentrun)) + var/turf/space/T = currentrun[length(currentrun)] currentrun.len-- if(istype(T)) T.toggle_transit(current_movement[CR_DIRECTION]) @@ -56,7 +56,7 @@ SUBSYSTEM_DEF(starmover) currentrun = null /datum/controller/subsystem/starmover/stat_entry(msg) - msg = "Q:[zqueue.len] C:[currentrun ? currentrun.len : "-"]" + msg = "Q:[length(zqueue)] C:[currentrun ? length(currentrun) : "-"]" return ..() /// Used to 'move' stars in spess. null direction stops movement diff --git a/code/controllers/subsystems/statpanel.dm b/code/controllers/subsystems/statpanel.dm index c40c591d07..80e2b8e7ba 100644 --- a/code/controllers/subsystems/statpanel.dm +++ b/code/controllers/subsystems/statpanel.dm @@ -114,11 +114,11 @@ SUBSYSTEM_DEF(statpanels) /datum/controller/subsystem/statpanels/proc/update_misc_tabs(var/client/target,var/mob/target_mob) target_mob.update_misc_tabs() for(var/tab in target_mob.misc_tabs) - if(target_mob.misc_tabs[tab].len == 0 && (tab in target.misc_tabs)) + if(length(target_mob.misc_tabs[tab]) == 0 && (tab in target.misc_tabs)) target.misc_tabs -= tab target.stat_panel.send_message("remove_misc",tab) - if(target_mob.misc_tabs[tab].len > 0) + if(length(target_mob.misc_tabs[tab]) > 0) if(!(tab in target.misc_tabs)) target.misc_tabs += tab target.stat_panel.send_message("create_misc",tab) @@ -211,7 +211,7 @@ SUBSYSTEM_DEF(statpanels) /datum/controller/subsystem/statpanels/proc/generate_mc_data() mc_data = list( list("CPU:", world.cpu), - list("Instances:", "[num2text(world.contents.len, 10)]"), + list("Instances:", "[num2text(length(world.contents), 10)]"), list("World Time:", "[world.time]"), list("Globals:", GLOB.stat_entry(), text_ref(GLOB)), list("[config]:", config.stat_entry(), text_ref(config)), @@ -240,7 +240,7 @@ SUBSYSTEM_DEF(statpanels) #endif for(var/datum/controller/subsystem/sub_system as anything in Master.subsystems) mc_data[++mc_data.len] = list("\[[sub_system.state_letter()]][sub_system.name]", sub_system.stat_entry(), "\ref[sub_system]") - mc_data[++mc_data.len] = list("Camera Net", "Cameras: [global.cameranet.cameras.len] | Chunks: [global.cameranet.chunks.len]", "\ref[global.cameranet]") + mc_data[++mc_data.len] = list("Camera Net", "Cameras: [length(global.cameranet.cameras)] | Chunks: [length(global.cameranet.chunks)]", "\ref[global.cameranet]") ///immediately update the active statpanel tab of the target client /datum/controller/subsystem/statpanels/proc/immediate_send_stat_data(client/target) diff --git a/code/controllers/subsystems/sun.dm b/code/controllers/subsystems/sun.dm index 2c1b83c0ab..00b0c6bec1 100644 --- a/code/controllers/subsystems/sun.dm +++ b/code/controllers/subsystems/sun.dm @@ -11,8 +11,8 @@ SUBSYSTEM_DEF(sun) sun.calc_position() //now tell the solar control computers to update their status and linked devices - while(current_run.len) - var/obj/machinery/power/solar_control/SC = current_run[current_run.len] + while(length(current_run)) + var/obj/machinery/power/solar_control/SC = current_run[length(current_run)] current_run.len-- if(!SC.powernet) GLOB.solars_list.Remove(SC) diff --git a/code/controllers/subsystems/supply.dm b/code/controllers/subsystems/supply.dm index 0d1d4eb0a8..13d978f229 100644 --- a/code/controllers/subsystems/supply.dm +++ b/code/controllers/subsystems/supply.dm @@ -135,19 +135,20 @@ SUBSYSTEM_DEF(supply) if(SO.status == SUP_ORDER_APPROVED) shoppinglist += SO - if(!shoppinglist.len) + var/orderedamount = length(shoppinglist) + + if(!orderedamount) return - var/orderedamount = shoppinglist.len var/list/clear_turfs = get_clear_turfs() var/shopping_log = "SUPPLY_BUY: " for(var/datum/supply_order/SO in shoppinglist) - if(!clear_turfs.len) + if(!length(clear_turfs)) break - var/i = rand(1,clear_turfs.len) + var/i = rand(1,length(clear_turfs)) var/turf/pickedloc = clear_turfs[i] clear_turfs.Cut(i,i+1) @@ -191,7 +192,7 @@ SUBSYSTEM_DEF(supply) if(istype(SP,/datum/supply_pack/randomised)) var/datum/supply_pack/randomised/SPR = SP contains = list() - if(SPR.contains.len) + if(length(SPR.contains)) for(var/j=1,j<=SPR.num_contained,j++) contains += pick(SPR.contains) else diff --git a/code/controllers/subsystems/tgui.dm b/code/controllers/subsystems/tgui.dm index aec707a52a..f35eaa8567 100644 --- a/code/controllers/subsystems/tgui.dm +++ b/code/controllers/subsystems/tgui.dm @@ -66,7 +66,7 @@ SUBSYSTEM_DEF(tgui) close_all_uis() /datum/controller/subsystem/tgui/stat_entry(msg) - msg = "P:[all_uis.len]" + msg = "P:[length(all_uis)]" return ..() /datum/controller/subsystem/tgui/fire(resumed = FALSE) @@ -74,8 +74,8 @@ SUBSYSTEM_DEF(tgui) src.current_run = all_uis.Copy() // Cache for sanic speed (lists are references anyways) var/list/current_run = src.current_run - while(current_run.len) - var/datum/tgui/ui = current_run[current_run.len] + while(length(current_run)) + var/datum/tgui/ui = current_run[length(current_run)] current_run.len-- // TODO: Move user/src_object check to process() if(ui?.user && ui.src_object) diff --git a/code/controllers/subsystems/throwing.dm b/code/controllers/subsystems/throwing.dm index 33e30895e0..e8fc4afccc 100644 --- a/code/controllers/subsystems/throwing.dm +++ b/code/controllers/subsystems/throwing.dm @@ -23,7 +23,7 @@ SUBSYSTEM_DEF(throwing) var/list/currentrun = src.currentrun while(length(currentrun)) - var/atom/movable/AM = currentrun[currentrun.len] + var/atom/movable/AM = currentrun[length(currentrun)] var/datum/thrownthing/TT = currentrun[AM] currentrun.len-- if (QDELETED(AM) || QDELETED(TT)) diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index 28dc6b218b..9b2a617fad 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -258,7 +258,7 @@ SUBSYSTEM_DEF(ticker) var/list/adm = get_admin_counts() var/list/allmins = adm["present"] - send2adminchat("Server", "Round [GLOB.round_id ? "#[GLOB.round_id]" : ""] has started[allmins.len ? ".":" with no active admins online!"]") + send2adminchat("Server", "Round [GLOB.round_id ? "#[GLOB.round_id]" : ""] has started[length(allmins) ? ".":" with no active admins online!"]") setup_done = TRUE // TODO START @@ -295,7 +295,7 @@ SUBSYSTEM_DEF(ticker) var/list/runnable_modes = config.get_runnable_modes() if((GLOB.master_mode == "random") || (GLOB.master_mode == "secret")) - if(!runnable_modes.len) + if(!length(runnable_modes)) to_chat(world, span_filter_system(span_bold("Unable to choose playable game mode.") + " Reverting to pregame lobby.")) return 0 if(GLOB.secret_force_mode != "secret") @@ -326,12 +326,12 @@ SUBSYSTEM_DEF(ticker) if(hide_mode) to_chat(world, span_world(span_notice("The current game mode is - Secret!"))) - if(runnable_modes.len) + if(length(runnable_modes)) var/list/tmpmodes = list() for (var/datum/game_mode/M in runnable_modes) tmpmodes+=M.name tmpmodes = sortList(tmpmodes) - if(tmpmodes.len) + if(length(tmpmodes)) to_chat(world, span_filter_system(span_bold("Possibilities:") + " [english_list(tmpmodes, and_text= "; ", comma_text = "; ")]")) else src.mode.announce() diff --git a/code/controllers/subsystems/transcore_vr.dm b/code/controllers/subsystems/transcore_vr.dm index fec9dc87a4..9a3cbcd3e6 100644 --- a/code/controllers/subsystems/transcore_vr.dm +++ b/code/controllers/subsystems/transcore_vr.dm @@ -56,8 +56,8 @@ SUBSYSTEM_DEF(transcore) src.current_run[imp] = db var/list/current_run = src.current_run - while(current_run.len) - var/obj/item/implant/backup/imp = current_run[current_run.len] + while(length(current_run)) + var/obj/item/implant/backup/imp = current_run[length(current_run)] var/datum/transcore_db/db = current_run[imp] current_run.len-- @@ -93,8 +93,8 @@ SUBSYSTEM_DEF(transcore) src.current_run[mr] = db var/list/current_run = src.current_run - while(current_run.len) - var/datum/transhuman/mind_record/curr_MR = current_run[current_run.len] + while(length(current_run)) + var/datum/transhuman/mind_record/curr_MR = current_run[length(current_run)] var/datum/transcore_db/db = current_run[curr_MR] current_run.len-- @@ -129,13 +129,13 @@ SUBSYSTEM_DEF(transcore) msg += "BK:[round(cost_backups,1)]" msg += "} " msg += "#:{" - msg += "DB:[databases.len]|" + msg += "DB:[length(databases)]|" if(!default_db) msg += "DEFAULT DB MISSING" else - msg += "DFM:[default_db.backed_up.len]|" - msg += "DFB:[default_db.body_scans.len]|" - msg += "DFI:[default_db.implants.len]" + msg += "DFM:[length(default_db.backed_up)]|" + msg += "DFB:[length(default_db.body_scans)]|" + msg += "DFI:[length(default_db.implants)]" msg += "} " return ..() @@ -296,7 +296,7 @@ SUBSYSTEM_DEF(transcore) disk.stored += backed_up backed_up.Cut() core_dumped = TRUE - return disk.stored.len + return length(disk.stored) #undef SSTRANSCORE_BACKUPS #undef SSTRANSCORE_IMPLANTS diff --git a/code/controllers/subsystems/vis_overlays.dm b/code/controllers/subsystems/vis_overlays.dm index 372dd4b306..a39752cffb 100644 --- a/code/controllers/subsystems/vis_overlays.dm +++ b/code/controllers/subsystems/vis_overlays.dm @@ -15,8 +15,8 @@ SUBSYSTEM_DEF(vis_overlays) currentrun = vis_overlay_cache.Copy() var/list/current_run = currentrun - while(current_run.len) - var/key = current_run[current_run.len] + while(length(current_run)) + var/key = current_run[length(current_run)] var/obj/effect/overlay/vis/overlay = current_run[key] current_run.len-- if(!overlay.unused && !length(overlay.vis_locs)) diff --git a/code/controllers/subsystems/vote.dm b/code/controllers/subsystems/vote.dm index 11e7d292aa..eb241e85ec 100644 --- a/code/controllers/subsystems/vote.dm +++ b/code/controllers/subsystems/vote.dm @@ -79,8 +79,8 @@ SUBSYSTEM_DEF(vote) if(votes > greatest_votes) greatest_votes = votes - if(!config.vote_no_default && choices.len) // Default-vote for everyone who didn't vote - var/non_voters = (GLOB.clients.len - total_votes) + if(!config.vote_no_default && length(choices)) // Default-vote for everyone who didn't vote + var/non_voters = (length(GLOB.clients) - total_votes) if(non_voters > 0) if(mode == VOTE_RESTART) choices["Continue Playing"] += non_voters @@ -117,8 +117,8 @@ SUBSYSTEM_DEF(vote) /datum/controller/subsystem/vote/proc/announce_result() var/list/winners = get_result() var/text - if(winners.len > 0) - if(winners.len > 1) + if(length(winners) > 0) + if(length(winners) > 1) if(mode != VOTE_GAMEMODE || ticker.hide_mode == 0) // Here we are making sure we don't announce potential game modes text = span_bold("Vote Tied Between:") + "\n" for(var/option in winners) @@ -184,7 +184,7 @@ SUBSYSTEM_DEF(vote) return if(current_votes[ckey]) choices[choices[current_votes[ckey]]]-- - if(newVote && newVote >= 1 && newVote <= choices.len) + if(newVote && newVote >= 1 && newVote <= length(choices)) choices[choices[newVote]]++ current_votes[ckey] = newVote else @@ -285,7 +285,7 @@ SUBSYSTEM_DEF(vote) if(mode == VOTE_GAMEMODE) .+= "Minimum Players" - for(var/i = 1 to choices.len) + for(var/i = 1 to length(choices)) var/votes = choices[choices[i]] if(!votes) votes = 0 @@ -295,7 +295,7 @@ SUBSYSTEM_DEF(vote) . += "[thisVote ? "" : ""][gamemode_names[choices[i]]][thisVote ? "" : ""][votes]" else . += "[thisVote ? "" : ""][choices[i]][thisVote ? "" : ""][votes]" - if (additional_text.len >= i) + if (length(additional_text) >= i) . += additional_text[i] . += "" @@ -392,5 +392,5 @@ SUBSYSTEM_DEF(vote) set name = "Vote" if(SSvote) - src << browse(SSvote.interface(src), "window=vote;size=500x[300 + SSvote.choices.len * 25]") + src << browse(SSvote.interface(src), "window=vote;size=500x[300 + length(SSvote.choices) * 25]") */