Changes all .len to length() where applicable (#25174)

* Globals work

* Double access works

* All other things

* Revert "All other things"

This reverts commit 6574442eb6.

* More changes that compile and work

* IT WORKS AAAAAA

* Changes even more .len to length()

* Apply suggestions from code review

* Update code/datums/mind.dm

* Update code/__HELPERS/sorts/InsertSort.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

* Update code/__HELPERS/sanitize_values.dm

Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>

---------

Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com>
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
This commit is contained in:
DGamerL
2024-04-19 17:32:09 +00:00
committed by GitHub
co-authored by Deniz FunnyMan3595
parent bdd417ada0
commit bad8b31afa
369 changed files with 1162 additions and 1163 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
/datum/event/abductor/proc/makeAbductorTeam()
var/list/mob/dead/observer/candidates = SSghost_spawns.poll_candidates("Do you wish to be considered for an Abductor Team?", ROLE_ABDUCTOR, TRUE)
if(candidates.len >= 2)
if(length(candidates) >= 2)
//Oh god why we can't have static functions
var/number = SSticker.mode.abductor_teams + 1
+3 -3
View File
@@ -22,9 +22,9 @@
set name = "Jump to Node"
set desc = "Transport back to a selected node."
if(GLOB.blob_nodes.len)
if(length(GLOB.blob_nodes))
var/list/nodes = list()
for(var/i = 1; i <= GLOB.blob_nodes.len; i++)
for(var/i = 1; i <= length(GLOB.blob_nodes); i++)
var/obj/structure/blob/node/B = GLOB.blob_nodes[i]
nodes["Blob Node #[i] ([get_location_name(B)])"] = B
var/node_name = tgui_input_list(src, "Choose a node to jump to.", "Node Jump", nodes)
@@ -362,7 +362,7 @@
to_chat(src, "You rally your spores.")
var/list/surrounding_turfs = block(locate(T.x - 1, T.y - 1, T.z), locate(T.x + 1, T.y + 1, T.z))
if(!surrounding_turfs.len)
if(!length(surrounding_turfs))
return
for(var/mob/living/simple_animal/hostile/blob/blobspore/BS in GLOB.alive_mob_list)
@@ -16,7 +16,7 @@
return ..()
/obj/structure/blob/factory/run_action()
if(spores.len >= max_spores)
if(length(spores) >= max_spores)
return
if(spore_delay > world.time)
return
+1 -1
View File
@@ -114,7 +114,7 @@ GLOBAL_LIST_EMPTY(blob_minions)
var/list/dirs = list(1,2,4,8)
dirs.Remove(origin_dir)//Dont pulse the guy who pulsed us
for(var/i = 1 to 4)
if(!dirs.len) break
if(!length(dirs)) break
var/dirn = pick(dirs)
dirs.Remove(dirn)
var/turf/T = get_step(src, dirn)
+2 -2
View File
@@ -21,7 +21,7 @@
/datum/event/carp_migration/start()
if(severity == EVENT_LEVEL_MAJOR)
spawn_fish(GLOB.landmarks_list.len)
spawn_fish(length(GLOB.landmarks_list))
else if(severity == EVENT_LEVEL_MODERATE)
spawn_fish(rand(4, 6)) //12 to 30 carp, in small groups
else
@@ -33,7 +33,7 @@
for(var/thing in GLOB.carplist)
spawn_locations.Add(get_turf(thing))
spawn_locations = shuffle(spawn_locations)
num_groups = min(num_groups, spawn_locations.len)
num_groups = min(num_groups, length(spawn_locations))
var/i = 1
while(i <= num_groups)
+2 -2
View File
@@ -13,12 +13,12 @@
for(var/obj/effect/landmark/lightsout/newEpicentre in GLOB.landmarks_list)
if(!(newEpicentre in epicentreList))
possibleEpicentres += newEpicentre
if(possibleEpicentres.len)
if(length(possibleEpicentres))
epicentreList += pick(possibleEpicentres)
else
break
if(!epicentreList.len)
if(!length(epicentreList))
return
for(var/thing in epicentreList)
+3 -3
View File
@@ -58,7 +58,7 @@ GLOBAL_LIST_EMPTY(event_last_fired)
/datum/event_container/proc/acquire_event()
if(available_events.len == 0)
if(length(available_events) == 0)
return
var/active_with_role = number_active_with_role()
@@ -79,7 +79,7 @@ GLOBAL_LIST_EMPTY(event_last_fired)
else
possible_events -= event_meta
if(possible_events.len == 0)
if(length(possible_events) == 0)
return null
// Select an event and remove it from the pool of available events
@@ -97,7 +97,7 @@ GLOBAL_LIST_EMPTY(event_last_fired)
// Otherwise, follow the standard setup process
else
var/playercount_modifier = 1
switch(GLOB.player_list.len)
switch(length(GLOB.player_list))
if(0 to 10)
playercount_modifier = 1.2
if(11 to 15)
+1 -1
View File
@@ -64,7 +64,7 @@
active_with_role["Cyborg"] = 0
active_with_role["Janitor"] = 0
active_with_role["Botanist"] = 0
active_with_role["Any"] = GLOB.player_list.len
active_with_role["Any"] = length(GLOB.player_list)
for(var/mob/M in GLOB.player_list)
if(!M.mind || !M.client || M.client.inactivity > 10 * 10 * 60) // longer than 10 minutes AFK counts them as inactive
+1 -1
View File
@@ -502,7 +502,7 @@
continue
players += player.real_name
var/random_player = "The Captain"
if(players.len)
if(length(players))
random_player = pick(players) //Random player's name, to be used in laws.
var/random_department = "Science"
+1 -1
View File
@@ -35,7 +35,7 @@
continue
viables.Add(check_pda)
if(!viables.len)
if(!length(viables))
return
var/obj/item/pda/P = pick(viables)
var/datum/data/pda/app/messenger/PM = P.find_program(/datum/data/pda/app/messenger)
+2 -2
View File
@@ -44,7 +44,7 @@
if(is_type_in_list(A,areaType) && !is_type_in_list(A,areaNotType))
areas += A
if(areas && areas.len > 0)
if(areas && length(areas) > 0)
var/my_department = "[station_name()] firewall subroutines"
var/rc_message = "An unknown malicious program has been detected in the [english_list(areaName)] lighting and airlock control systems at [station_time_timestamp()]. Systems will be fully compromised within approximately three minutes. Direct intervention is required immediately.<br>"
for(var/obj/machinery/message_server/MS in GLOB.machines)
@@ -58,7 +58,7 @@
/datum/event/prison_break/tick()
if(activeFor == releaseWhen)
if(areas && areas.len > 0)
if(areas && length(areas) > 0)
for(var/area/A in areas)
for(var/obj/machinery/light/L in A)
L.forced_flicker(10)
+1 -1
View File
@@ -38,7 +38,7 @@
qdel(D)
num_recovered++
if(num_recovered > drones_list.len * 0.75)
if(num_recovered > length(drones_list) * 0.75)
GLOB.minor_announcement.Announce("Icarus drone control reports the malfunctioning wing has been recovered safely.", "Rogue drone alert")
else
GLOB.minor_announcement.Announce("Icarus drone control registers disappointment at the loss of the drones, but the survivors have been recovered.", "Rogue drone alert")
+6 -6
View File
@@ -10,12 +10,12 @@
qdel(SV)
if(turfs.len) //Pick a turf to spawn at if we can
if(length(turfs)) //Pick a turf to spawn at if we can
var/turf/T = pick(turfs)
var/obj/structure/spacevine_controller/SC = new /obj/structure/spacevine_controller(T, null, rand(30,70),rand(5,2)) //spawn a controller at turf
// Make the event start fun - give the vine a random hostile mutation
if(SC.vines.len)
if(length(SC.vines))
SV = SC.vines[1]
var/list/mutations = subtypesof(/datum/spacevine_mutation)
while(mutations)
@@ -429,7 +429,7 @@
if(master)
master.vines -= src
master.growth_queue -= src
if(!master.vines.len)
if(!length(master.vines))
var/obj/item/seeds/kudzu/KZ = new(loc)
for(var/mutation in mutations)
KZ.mutations += mutation
@@ -591,7 +591,7 @@
SM.on_birth(SV)
/obj/structure/spacevine_controller/process()
if(!vines || !vines.len)
if(!vines || !length(vines))
qdel(src) //space vines exterminated. Remove the controller
return
if(!growth_queue)
@@ -600,7 +600,7 @@
var/length = 0
length = min( spread_cap , max( 1 , vines.len / spread_multiplier ) )
length = min( spread_cap , max( 1 , length(vines) / spread_multiplier ) )
var/i = 0
var/list/obj/structure/spacevine/queue_end = list()
@@ -663,7 +663,7 @@
for(var/SM_type in mutations)
var/datum/spacevine_mutation/SM = mutations[SM_type]
spread_search |= SM.on_search(src)
while(dir_list.len)
while(length(dir_list))
var/direction = pick(dir_list)
dir_list -= direction
var/turf/stepturf = get_step(src,direction)
+2 -2
View File
@@ -10,7 +10,7 @@ GLOBAL_LIST_INIT(unused_trade_stations, list("sol"))
var/list/trader_objectives = list()
/datum/event/traders/setup()
if(GLOB.unused_trade_stations.len)
if(length(GLOB.unused_trade_stations))
station = pick_n_take(GLOB.unused_trade_stations)
/datum/event/traders/fake_announce()
@@ -34,7 +34,7 @@ GLOBAL_LIST_INIT(unused_trade_stations, list("sol"))
var/list/spawnlocs = list()
for(var/obj/effect/landmark/spawner/soltrader/S in GLOB.landmarks_list)
spawnlocs += get_turf(S)
if(!spawnlocs.len)
if(!length(spawnlocs))
return
trader_objectives = forge_trader_objectives()
+3 -3
View File
@@ -25,9 +25,9 @@
if(okay)
turflist += T
if(!turflist.len) continue
var/turfs = round(turflist.len * spawn_prob/100,1)
while(turfs > 0 && turflist.len) // safety
if(!length(turflist)) continue
var/turfs = round(length(turflist) * spawn_prob/100,1)
while(turfs > 0 && length(turflist)) // safety
turfs--
var/turf/T = pick_n_take(turflist)
var/undeadtype = pick(/mob/living/simple_animal/hostile/retaliate/skeleton,
+1 -1
View File
@@ -12,7 +12,7 @@
endWhen = rand(25, 100)
for(var/obj/machinery/atmospherics/unary/vent_scrubber/temp_vent in GLOB.machines)
if(is_station_level(temp_vent.loc.z))
if(temp_vent.parent.other_atmosmch.len > 50)
if(length(temp_vent.parent.other_atmosmch) > 50)
vents += temp_vent
/datum/event/vent_clog/tick()
+1 -1
View File
@@ -52,7 +52,7 @@
return FALSE
var/turf/target
if(GLOB.portals.len)
if(length(GLOB.portals))
var/obj/effect/portal/P = pick(GLOB.portals)
if(P && isturf(P.loc))
target = P.loc