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 19:32:09 +02:00
committed by GitHub
parent bdd417ada0
commit bad8b31afa
369 changed files with 1162 additions and 1163 deletions
+1 -1
View File
@@ -152,7 +152,7 @@
memolist += "[ckey]"
qdel(query_memodellist)
if(!memolist.len)
if(!length(memolist))
to_chat(src, "No memos found in database.")
return
+1 -1
View File
@@ -871,7 +871,7 @@ GLOBAL_LIST_INIT(view_runtimes_verbs, list(
for(var/datum/job/J in SSjobs.occupations)
if(J.current_positions >= J.total_positions && J.total_positions != -1)
jobs += J.title
if(!jobs.len)
if(!length(jobs))
to_chat(usr, "There are no fully staffed jobs.")
return
var/job = input("Please select job slot to free", "Free Job Slot") as null|anything in jobs
+4 -4
View File
@@ -111,9 +111,9 @@ GLOBAL_VAR_INIT(nologevent, 0)
body += "<a href='byond://?_src_=holder;adminalert=[M.UID()]'>SEND ALERT</a>\]</b><br>"
body += "<b>Mob type:</b> [M.type]<br>"
if(M.client)
if(M.client.related_accounts_cid.len)
if(length(M.client.related_accounts_cid))
body += "<b>Related accounts by CID:</b> [jointext(M.client.related_accounts_cid, " - ")]<br>"
if(M.client.related_accounts_ip.len)
if(length(M.client.related_accounts_ip))
body += "<b>Related accounts by IP:</b> [jointext(M.client.related_accounts_ip, " - ")]<br><br>"
if(M.ckey)
@@ -726,11 +726,11 @@ GLOBAL_VAR_INIT(nologevent, 0)
if(copytext("[path]", -needle_length) == object)
matches += path
if(matches.len==0)
if(length(matches)==0)
return
var/chosen
if(matches.len==1)
if(length(matches)==1)
chosen = matches[1]
else
chosen = input("Select an atom type", "Spawn Atom", matches[1]) as null|anything in matches
+20 -20
View File
@@ -366,7 +366,7 @@
dat += "<a href='byond://?src=[UID()];delay_round_end=1'>[SSticker.delay_end ? "End Round Normally" : "Delay Round End"]</a><br>"
dat += "<br><b>Antagonist Teams</b><br>"
dat += "<a href='byond://?src=[UID()];check_teams=1'>View Teams</a><br>"
if(SSticker.mode.syndicates.len)
if(length(SSticker.mode.syndicates))
dat += "<br><table cellspacing=5><tr><td><B>Syndicates</B></td><td></td></tr>"
for(var/datum/mind/N in SSticker.mode.syndicates)
var/mob/M = N.current
@@ -413,65 +413,65 @@
dat += "</table>"
if(SSticker.mode.blob_overminds.len)
if(length(SSticker.mode.blob_overminds))
dat += check_role_table("Blob Overminds", SSticker.mode.blob_overminds)
dat += "<i>Blob Tiles: [length(GLOB.blobs)]</i>"
if(SSticker.mode.changelings.len)
if(length(SSticker.mode.changelings))
dat += check_role_table("Changelings", SSticker.mode.changelings)
if(SSticker.mode.wizards.len)
if(length(SSticker.mode.wizards))
dat += check_role_table("Wizards", SSticker.mode.wizards)
if(SSticker.mode.apprentices.len)
if(length(SSticker.mode.apprentices))
dat += check_role_table("Apprentices", SSticker.mode.apprentices)
/*if(ticker.mode.ninjas.len)
/*if(length(ticker.mode.ninjas))
dat += check_role_table("Ninjas", ticker.mode.ninjas)*/
if(SSticker.mode.cult_team)
dat += check_role_table("Cultists", SSticker.mode.cult_team.members)
dat += "<a href='byond://?src=[UID()];check_teams=1'>View Cult Team & Controls</a><br>"
if(SSticker.mode.traitors.len)
if(length(SSticker.mode.traitors))
dat += check_role_table("Traitors", SSticker.mode.traitors)
if(SSticker.mode.implanted.len)
if(length(SSticker.mode.implanted))
dat += check_role_table("Mindslaves", SSticker.mode.implanted)
if(SSticker.mode.abductors.len)
if(length(SSticker.mode.abductors))
dat += check_role_table("Abductors", SSticker.mode.abductors)
if(SSticker.mode.abductees.len)
if(length(SSticker.mode.abductees))
dat += check_role_table("Abductees", SSticker.mode.abductees)
if(SSticker.mode.vampires.len)
if(length(SSticker.mode.vampires))
dat += check_role_table("Vampires", SSticker.mode.vampires)
if(SSticker.mode.vampire_enthralled.len)
if(length(SSticker.mode.vampire_enthralled))
dat += check_role_table("Vampire Thralls", SSticker.mode.vampire_enthralled)
if(SSticker.mode.xenos.len)
if(length(SSticker.mode.xenos))
dat += check_role_table("Xenos", SSticker.mode.xenos)
if(SSticker.mode.superheroes.len)
if(length(SSticker.mode.superheroes))
dat += check_role_table("Superheroes", SSticker.mode.superheroes)
if(SSticker.mode.supervillains.len)
if(length(SSticker.mode.supervillains))
dat += check_role_table("Supervillains", SSticker.mode.supervillains)
if(SSticker.mode.greyshirts.len)
if(length(SSticker.mode.greyshirts))
dat += check_role_table("Greyshirts", SSticker.mode.greyshirts)
if(SSticker.mode.eventmiscs.len)
if(length(SSticker.mode.eventmiscs))
dat += check_role_table("Event Roles", SSticker.mode.eventmiscs)
if(GLOB.ts_spiderlist.len)
if(length(GLOB.ts_spiderlist))
var/list/spider_minds = list()
for(var/mob/living/simple_animal/hostile/poison/terror_spider/S in GLOB.ts_spiderlist)
if(S.ckey)
spider_minds += S.mind
if(spider_minds.len)
if(length(spider_minds))
dat += check_role_table("Terror Spiders", spider_minds)
var/count_eggs = 0
@@ -486,7 +486,7 @@
count_infected = length(GLOB.ts_infected_list)
dat += "<table cellspacing=5><tr><td>Growing TS on-station: [count_eggs] egg\s, [count_spiderlings] spiderling\s, [count_infected] infected</td></tr></table>"
if(SSticker.mode.ert.len)
if(length(SSticker.mode.ert))
dat += check_role_table("ERT", SSticker.mode.ert)
//list active security force count, so admins know how bad things are
+10 -10
View File
@@ -269,7 +269,7 @@
else if(task == "rank")
var/new_rank
if(GLOB.admin_ranks.len)
if(length(GLOB.admin_ranks))
new_rank = input("Please select a rank", "New rank", null, null) as null|anything in (GLOB.admin_ranks|"*New Rank*")
else
new_rank = input("Please select a rank", "New rank", null, null) as null|anything in list("Mentor", "Trial Admin", "Game Admin", "*New Rank*")
@@ -287,7 +287,7 @@
to_chat(usr, "<font color='red'>Error: Topic 'editrights': Invalid rank</font>")
return
if(!GLOB.configuration.admin.use_database_admins)
if(GLOB.admin_ranks.len)
if(length(GLOB.admin_ranks))
if(new_rank in GLOB.admin_ranks)
rights = GLOB.admin_ranks[new_rank] //we typed a rank which already exists, use its rights
else
@@ -757,7 +757,7 @@
notbannedlist += job
//Banning comes first
if(notbannedlist.len) //at least 1 unbanned job exists in joblist so we have stuff to ban.
if(length(notbannedlist)) //at least 1 unbanned job exists in joblist so we have stuff to ban.
switch(alert("Temporary Ban of [M.ckey]?", null,"Yes","No", "Cancel"))
if("Yes")
var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null
@@ -1991,7 +1991,7 @@
return
var/list/mob/dead/observer/candidates = SSghost_spawns.poll_candidates("Play as the special event pet [H]?", poll_time = 20 SECONDS, min_hours = 10, source = petchoice)
var/mob/dead/observer/theghost = null
if(candidates.len)
if(length(candidates))
var/mob/living/simple_animal/pet/P = new petchoice(H.loc)
theghost = pick(candidates)
P.key = theghost.key
@@ -2148,7 +2148,7 @@
if(player.current)
if(ismindshielded(player.current))
possible_traitors -= player
if(possible_traitors.len)
if(length(possible_traitors))
var/datum/mind/newtraitormind = pick(possible_traitors)
var/datum/objective/assassinate/kill_objective = new()
@@ -2678,9 +2678,9 @@
var/list/offset = splittext(href_list["offset"],",")
var/number = dd_range(1, 100, text2num(href_list["object_count"]))
var/X = offset.len > 0 ? text2num(offset[1]) : 0
var/Y = offset.len > 1 ? text2num(offset[2]) : 0
var/Z = offset.len > 2 ? text2num(offset[3]) : 0
var/X = length(offset) > 0 ? text2num(offset[1]) : 0
var/Y = length(offset) > 1 ? text2num(offset[2]) : 0
var/Z = length(offset) > 2 ? text2num(offset[3]) : 0
var/tmp_dir = href_list["object_dir"]
var/obj_dir = tmp_dir ? text2num(tmp_dir) : 2
if(!obj_dir || !(obj_dir in list(1,2,4,8,5,6,9,10)))
@@ -3276,7 +3276,7 @@
var/dat = "<b>Admin Log<hr></b>"
for(var/l in GLOB.admin_log)
dat += "<li>[l]</li>"
if(!GLOB.admin_log.len)
if(!length(GLOB.admin_log))
dat += "No-one has done anything this round!"
usr << browse(dat, "window=admin_log")
if("maint_ACCESS_BRIG")
@@ -3520,7 +3520,7 @@
message_admins("[key_name_admin(mob)] is sending a ([dresscode]) to [killthem ? "assassinate" : "protect"] [key_name_admin(H)]...")
var/image/source = image('icons/obj/cardboard_cutout.dmi', "cutout_traitor")
var/list/candidates = SSghost_spawns.poll_candidates("Play as a [killthem ? "murderous" : "protective"] [dresscode]?", ROLE_TRAITOR, TRUE, source = source, role_cleanname = "[killthem ? "murderous" : "protective"] [dresscode]")
if(!candidates.len)
if(!length(candidates))
to_chat(usr, "<span class='warning'>ERROR: Could not create eventmob. No valid candidates.</span>")
return
var/mob/C = pick(candidates)
+10 -10
View File
@@ -32,12 +32,12 @@
var/list/query_list = SDQL2_tokenize(query_text)
if(!query_list || query_list.len < 1)
if(!query_list || length(query_list) < 1)
return
var/list/querys = SDQL_parse(query_list)
if(!querys || querys.len < 1)
if(!querys || length(querys) < 1)
return
var/query_log = "executed SDQL query: \"[query_text]\"."
@@ -129,7 +129,7 @@
var/datum/temp = d
var/i = 0
for(var/v in sets)
if(++i == sets.len)
if(++i == length(sets))
if(isturf(temp) && (v == "x" || v == "y" || v == "z"))
continue
if(!temp.vv_edit_var(v, SDQL_expression(d, set_list[sets])))
@@ -156,7 +156,7 @@
for(var/val in query_list)
if(val == ";")
do_parse = 1
else if(pos >= query_list.len)
else if(pos >= length(query_list))
query_tree += val
do_parse = 1
@@ -164,7 +164,7 @@
parser.query = query_tree
var/list/parsed_tree
parsed_tree = parser.parse()
if(parsed_tree.len > 0)
if(length(parsed_tree) > 0)
querys.len = querys_pos
querys[querys_pos] = parsed_tree
querys_pos++
@@ -282,7 +282,7 @@
var/result = 0
var/val
for(var/i = start, i <= expression.len, i++)
for(var/i = start, i <= length(expression), i++)
var/op = ""
if(i > start)
@@ -337,7 +337,7 @@
var/i = start
var/val = null
if(i > expression.len)
if(i > length(expression))
return list("val" = null, "i" = i)
if(istype(expression[i], /list))
@@ -375,14 +375,14 @@
else
val = SDQL_var(object, expression, i, object)
i = expression.len
i = length(expression)
return list("val" = val, "i" = i)
/proc/SDQL_var(datum/object, list/expression, start = 1, source)
var/v
var/long = start < expression.len
var/long = start < length(expression)
if(object == world && long && expression[start + 1] == ".")
to_chat(usr, "Sorry, but global variables are not supported at the moment.")
@@ -431,7 +431,7 @@
else if(expression[start + 1] == "\[" && islist(v))
var/list/L = v
var/index = SDQL_expression(source, expression[start + 2])
if(isnum(index) && (!ISINTEGER(index) || L.len < index))
if(isnum(index) && (!ISINTEGER(index) || length(L) < index))
to_chat(world, "<span class='danger'>Invalid list index: [index]</span>")
return null
return L[index]
@@ -61,7 +61,7 @@
/datum/SDQL_parser/proc/parse_error(error_message)
error = 1
to_chat(usr, "<span class='danger'>SDQL2 Parsing Error: [error_message]</span>")
return query.len + 1
return length(query) + 1
/datum/SDQL_parser/proc/parse()
tree = list()
@@ -73,14 +73,14 @@
return tree
/datum/SDQL_parser/proc/token(i)
if(i <= query.len)
if(i <= length(query))
return query[i]
else
return null
/datum/SDQL_parser/proc/tokens(i, num)
if(i + num <= query.len)
if(i + num <= length(query))
return query.Copy(i, i + num)
else
+4 -4
View File
@@ -47,12 +47,12 @@
SSblackbox.record_feedback("tally", "admin_verb", 1, "Check Power") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
for(var/datum/regional_powernet/PN in SSmachines.powernets)
if(!PN.nodes || !PN.nodes.len)
if(PN.cables && (PN.cables.len > 1))
if(!PN.nodes || !length(PN.nodes))
if(PN.cables && (length(PN.cables) > 1))
var/obj/structure/cable/C = PN.cables[1]
to_chat(usr, "Powernet with no nodes! (number [PN.number]) - example cable at [C.x], [C.y], [C.z] in area [get_area(C.loc)]")
if(!PN.cables || (PN.cables.len < 10))
if(PN.cables && (PN.cables.len > 1))
if(!PN.cables || (length(PN.cables) < 10))
if(PN.cables && (length(PN.cables) > 1))
var/obj/structure/cable/C = PN.cables[1]
to_chat(usr, "Powernet with fewer than 10 cables! (number [PN.number]) - example cable at [C.x], [C.y], [C.z] in area [get_area(C.loc)]")
+6 -6
View File
@@ -64,13 +64,13 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(!target)
to_chat(usr, "<font color='red'>Error: callproc(): owner of proc no longer exists.</font>")
return
message_admins("[key_name_admin(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
log_admin("[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
message_admins("[key_name_admin(src)] called [target]'s [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"].")
log_admin("[key_name(src)] called [target]'s [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"].")
returnval = WrapAdminProcCall(target, procname, lst) // Pass the lst as an argument list to the proc
else
//this currently has no hascall protection. wasn't able to get it working.
message_admins("[key_name_admin(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]")
log_admin("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]")
message_admins("[key_name_admin(src)] called [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"]")
log_admin("[key_name(src)] called [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"]")
returnval = WrapAdminProcCall(GLOBAL_PROC, procname, lst) // Pass the lst as an argument list to the proc
to_chat(usr, "<font color='#EB4E00'>[procname] returned: [!isnull(returnval) ? returnval : "null"]</font>")
@@ -173,8 +173,8 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!A || !IsValidSrc(A))
to_chat(src, "<span class='warning'>Error: callproc_datum(): owner of proc no longer exists.</span>")
return
message_admins("[key_name_admin(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]")
log_admin("[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]")
message_admins("[key_name_admin(src)] called [A]'s [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"]")
log_admin("[key_name(src)] called [A]'s [procname]() with [length(lst) ? "the arguments [list2params(lst)]":"no arguments"]")
spawn()
var/returnval = WrapAdminProcCall(A, procname, lst) // Pass the lst as an argument list to the proc
+1 -1
View File
@@ -92,7 +92,7 @@
if(!f)
output += "&nbsp;&nbsp;[filters[filter]]: ERROR<br>"
continue
output += "&nbsp;&nbsp;[filters[filter]]: [f.len]<br>"
output += "&nbsp;&nbsp;[filters[filter]]: [length(f)]<br>"
for(var/device in f)
if(isobj(device))
output += "&nbsp;&nbsp;&nbsp;&nbsp;[device] ([device:x],[device:y],[device:z] in area [get_area(device:loc)])<br>"
+2 -2
View File
@@ -47,7 +47,7 @@
if(!G.client.is_afk())
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
possible_ghosts += G
for(var/i=teamsize,(i>0&&possible_ghosts.len),i--) //Decrease with every member selected.
for(var/i=teamsize,(i>0&&length(possible_ghosts)),i--) //Decrease with every member selected.
var/candidate = input("Pick characters to spawn. This will go on until there either no more ghosts to pick from, or the slots are full.", "Active Players") as null|anything in possible_ghosts // auto-picks if only one candidate
possible_ghosts -= candidate
players_to_spawn += candidate
@@ -55,7 +55,7 @@
to_chat(src, "Polling candidates...")
players_to_spawn = SSghost_spawns.poll_candidates("Do you want to play as \a [initial(O.name)]?")
if(!players_to_spawn.len)
if(!length(players_to_spawn))
to_chat(src, "Nobody volunteered.")
return 0
@@ -49,7 +49,7 @@ GLOBAL_VAR_INIT(sent_syndicate_infiltration_team, 0)
if(!G.client.is_afk())
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
possible_ghosts += G
for(var/i=teamsize,(i>0&&possible_ghosts.len),i--) //Decrease with every SIT member selected.
for(var/i=teamsize,(i>0&&length(possible_ghosts)),i--) //Decrease with every SIT member selected.
var/candidate = input("Pick characters to spawn as a SIT member. This will go on until there either no more ghosts to pick from, or the slots are full.", "Active Players") as null|anything in possible_ghosts // auto-picks if only one candidate
possible_ghosts -= candidate
infiltrators += candidate
@@ -58,7 +58,7 @@ GLOBAL_VAR_INIT(sent_syndicate_infiltration_team, 0)
var/image/I = new('icons/obj/cardboard_cutout.dmi', "cutout_sit")
infiltrators = SSghost_spawns.poll_candidates("Do you want to play as a Syndicate infiltrator?", ROLE_TRAITOR, TRUE, source = I, role_cleanname = "Syndicate infiltrator")
if(!infiltrators.len)
if(!length(infiltrators))
to_chat(src, "Nobody volunteered.")
return 0
@@ -76,10 +76,10 @@ GLOBAL_VAR_INIT(sent_syndicate_infiltration_team, 0)
var/num_spawned = 1
var/team_leader = null
for(var/obj/effect/landmark/L in sit_spawns)
if(!infiltrators.len && !spawn_dummies) break
if(!length(infiltrators) && !spawn_dummies) break
syndicate_leader_selected = num_spawned == 1?1:0
var/mob/living/carbon/human/new_syndicate_infiltrator = create_syndicate_infiltrator(L, syndicate_leader_selected, tcamount, 0)
if(infiltrators.len)
if(length(infiltrators))
var/mob/theguy = pick(infiltrators)
if(theguy.key != key)
new_syndicate_infiltrator.key = theguy.key
+1 -1
View File
@@ -14,7 +14,7 @@ GLOBAL_LIST_EMPTY(open_logging_views)
else if(clear_view)
cur_view.clear_all()
if(mobs_to_add?.len)
if(length(mobs_to_add))
cur_view.add_mobs(mobs_to_add)
cur_view.show_ui(usr)
+5 -5
View File
@@ -111,7 +111,7 @@
if(VV_RESTORE_DEFAULT)
to_chat(src, "Finding items...")
var/list/items = get_all_of_type(O.type, method)
to_chat(src, "Changing [items.len] items...")
to_chat(src, "Changing [length(items)] items...")
for(var/thing in items)
if(!thing)
continue
@@ -126,7 +126,7 @@
var/list/varsvars = vv_parse_text(O, new_value)
var/pre_processing = new_value
var/unique
if(varsvars && varsvars.len)
if(varsvars && length(varsvars))
unique = alert(usr, "Process vars unique to each instance, or same for all?", "Variable Association", "Unique", "Same")
if(unique == "Unique")
unique = TRUE
@@ -137,7 +137,7 @@
to_chat(src, "Finding items...")
var/list/items = get_all_of_type(O.type, method)
to_chat(src, "Changing [items.len] items...")
to_chat(src, "Changing [length(items)] items...")
for(var/thing in items)
if(!thing)
continue
@@ -165,7 +165,7 @@
var/type = value["type"]
to_chat(src, "Finding items...")
var/list/items = get_all_of_type(O.type, method)
to_chat(src, "Changing [items.len] items...")
to_chat(src, "Changing [length(items)] items...")
for(var/thing in items)
if(!thing)
continue
@@ -183,7 +183,7 @@
else
to_chat(src, "Finding items...")
var/list/items = get_all_of_type(O.type, method)
to_chat(src, "Changing [items.len] items...")
to_chat(src, "Changing [length(items)] items...")
for(var/thing in items)
if(!thing)
continue
+4 -4
View File
@@ -282,9 +282,9 @@ GLOBAL_PROTECT(VVmaint_only)
if(!ispath(type))
return
var/list/subtypes = subtypesof(type)
if(!subtypes || !subtypes.len)
if(!subtypes || !length(subtypes))
return FALSE
if(subtypes && subtypes.len)
if(subtypes && length(subtypes))
switch(alert("Strict object type detection?", "Type detection", "Strictly this type","This type and subtypes", "Cancel"))
if("Strictly this type")
return FALSE
@@ -374,7 +374,7 @@ GLOBAL_PROTECT(VVmaint_only)
to_chat(src, "Not a List.")
return
if(L.len > 1000)
if(length(L) > 1000)
var/confirm = alert(src, "The list you're trying to edit is very long, continuing may crash the server.", "Warning", "Continue", "Abort")
if(confirm != "Continue")
return
@@ -382,7 +382,7 @@ GLOBAL_PROTECT(VVmaint_only)
var/list/names = list()
for(var/i in 1 to L.len)
for(var/i in 1 to length(L))
var/key = L[i]
var/value
if(IS_NORMAL_LIST(L) && !isnum(key))
+9 -9
View File
@@ -60,8 +60,8 @@
if(CandCheck(ROLE_TRAITOR, applicant, temp))
candidates += applicant
if(candidates.len)
var/numTraitors = min(candidates.len, antnum)
if(length(candidates))
var/numTraitors = min(length(candidates), antnum)
for(var/i = 0, i<numTraitors, i++)
H = pick(candidates)
@@ -91,8 +91,8 @@
if(CandCheck(ROLE_CHANGELING, applicant, temp))
candidates += applicant
if(candidates.len)
var/numChangelings = min(candidates.len, antnum)
if(length(candidates))
var/numChangelings = min(length(candidates), antnum)
for(var/i = 0, i<numChangelings, i++)
H = pick(candidates)
@@ -121,8 +121,8 @@
if(CandCheck(ROLE_REV, applicant, temp))
candidates += applicant
if(candidates.len)
var/numRevs = min(candidates.len, antnum)
if(length(candidates))
var/numRevs = min(length(candidates), antnum)
for(var/i = 0, i<numRevs, i++)
H = pick(candidates)
@@ -142,7 +142,7 @@
log_admin("[key_name(owner)] tried making a Wizard with One-Click-Antag")
message_admins("[key_name_admin(owner)] tried making a Wizard with One-Click-Antag")
if(candidates.len)
if(length(candidates))
var/mob/dead/observer/selected = pick(candidates)
candidates -= selected
@@ -276,8 +276,8 @@
if(CandCheck(ROLE_VAMPIRE, applicant, temp))
candidates += applicant
if(candidates.len)
var/numVampires = min(candidates.len, antnum)
if(length(candidates))
var/numVampires = min(length(candidates), antnum)
for(var/i = 0, i<numVampires, i++)
H = pick(candidates)
+3 -3
View File
@@ -368,7 +368,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(G_found.mind.assigned_role=="Alien")
if(alert("This character appears to have been an alien. Would you like to respawn them as such?", null,"Yes","No")=="Yes")
var/turf/T
if(GLOB.xeno_spawn.len) T = pick(GLOB.xeno_spawn)
if(length(GLOB.xeno_spawn)) T = pick(GLOB.xeno_spawn)
else T = pick(GLOB.latejoin)
var/mob/living/carbon/alien/new_xeno
@@ -519,14 +519,14 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(M.mind && M.mind.current && M.mind.current.stat != DEAD)
continue //we have a live body we are tied to
candidates += M.ckey
if(candidates.len)
if(length(candidates))
ckey = input("Pick the player you want to respawn as a xeno.", "Suitable Candidates") as null|anything in candidates
else
to_chat(usr, "<font color='red'>Error: create_xeno(): no suitable candidates.</font>")
if(!istext(ckey)) return 0
var/alien_caste = input(usr, "Please choose which caste to spawn.","Pick a caste",null) as null|anything in list("Queen","Hunter","Sentinel","Drone","Larva")
var/obj/effect/landmark/spawn_here = GLOB.xeno_spawn.len ? pick(GLOB.xeno_spawn) : pick(GLOB.latejoin)
var/obj/effect/landmark/spawn_here = length(GLOB.xeno_spawn) ? pick(GLOB.xeno_spawn) : pick(GLOB.latejoin)
var/mob/living/carbon/alien/new_xeno
switch(alien_caste)
if("Queen") new_xeno = new /mob/living/carbon/alien/humanoid/queen/large(spawn_here)
@@ -203,7 +203,7 @@
type = "laughter"
var/list/candidates = SSghost_spawns.poll_candidates("Do you want to play as a [type] demon summoned by [user.real_name]?", ROLE_DEMON, TRUE, 10 SECONDS, source = demon_type)
if(candidates.len > 0)
if(length(candidates) > 0)
var/mob/C = pick(candidates)
spawn_antag(C, get_turf(src.loc), initial(demon_type.name), user)
dust_if_respawnable(C)
@@ -292,7 +292,7 @@
var/list/candidates = SSghost_spawns.poll_candidates("Do you want to play as a magical morph awakened by [user.real_name]?", ROLE_MORPH, 1, 10 SECONDS, source = morph_type)
if(candidates.len > 0)
if(length(candidates) > 0)
var/mob/C = pick(candidates)
spawn_antag(C, get_turf(src.loc), initial(morph_type.name), user)
dust_if_respawnable(C)
@@ -64,8 +64,8 @@
//Recent as opposed to all because rounds tend to have a LOT of text.
var/list/recent_speech = list()
if(target.say_log.len > CHANGELING_ABSORB_RECENT_SPEECH)
recent_speech = target.say_log.Copy(target.say_log.len-CHANGELING_ABSORB_RECENT_SPEECH+1,0) //0 so len-LING_ARS+1 to end of list
if(length(target.say_log) > CHANGELING_ABSORB_RECENT_SPEECH)
recent_speech = target.say_log.Copy(length(target.say_log)-CHANGELING_ABSORB_RECENT_SPEECH+1,0) //0 so len-LING_ARS+1 to end of list
else
recent_speech = target.say_log.Copy()
+3 -3
View File
@@ -65,10 +65,10 @@
/datum/mob_hunt/proc/select_spawn()
var/list/possible_areas = get_possible_areas()
if(!possible_areas.len)
if(!length(possible_areas))
log_admin("No possible areas to spawn [type] found. Possible code/mapping error?")
return 0
while(possible_areas.len)
while(length(possible_areas))
//randomly select an area from our possible_areas list to try spawning in, then remove it from possible_areas so it won't get picked over and over forever.
var/spawn_area_path = pickweight(possible_areas)
var/area/spawn_area = locate(spawn_area_path)
@@ -77,7 +77,7 @@
break
//clear and generate a fresh list of turfs in the selected area, weighted based on white/black lists
var/list/possible_turfs = get_possible_turfs(spawn_area)
if(!possible_turfs.len) //If we don't have any possible turfs, this attempt was a failure. Try again.
if(!length(possible_turfs)) //If we don't have any possible turfs, this attempt was a failure. Try again.
continue
//if we got this far, we're spawning on this attempt, hooray!
spawn_point = pickweight(possible_turfs)
+1 -1
View File
@@ -311,7 +311,7 @@ GLOBAL_LIST_EMPTY(asset_datums)
if(!asset)
continue
asset = fcopy_rsc(asset) //dedupe
var/prefix2 = (directions.len > 1) ? "[dir2text(direction)]." : ""
var/prefix2 = (length(directions) > 1) ? "[dir2text(direction)]." : ""
var/asset_name = "[prefix].[prefix2][icon_state_name].png"
if(generic_icon_names)
asset_name = "[GENERATE_ASSET_NAME(asset)].png"
@@ -247,7 +247,7 @@
if(falloff)
max_dist = min((temp - (T0C + 60)) / falloff, radius)
open[Ce] = 0
while(open.len)
while(length(open))
var/turf/T = open[1]
var/dist = open[T]
open -= T
@@ -126,7 +126,7 @@
//cache for sanic speed
var/list/adjacent_turfs = atmos_adjacent_turfs
var/datum/excited_group/our_excited_group = excited_group
var/adjacent_turfs_length = adjacent_turfs.len
var/adjacent_turfs_length = length(adjacent_turfs)
if(planetary_atmos)
adjacent_turfs_length++
+12 -12
View File
@@ -744,24 +744,24 @@
for(var/g in gas_names)
thresholds += list(list("name" = gas_names[g], "settings" = list()))
selected = TLV[g]
thresholds[thresholds.len]["settings"] += list(list("env" = g, "val" = "min2", "selected" = selected.min2))
thresholds[thresholds.len]["settings"] += list(list("env" = g, "val" = "min1", "selected" = selected.min1))
thresholds[thresholds.len]["settings"] += list(list("env" = g, "val" = "max1", "selected" = selected.max1))
thresholds[thresholds.len]["settings"] += list(list("env" = g, "val" = "max2", "selected" = selected.max2))
thresholds[length(thresholds)]["settings"] += list(list("env" = g, "val" = "min2", "selected" = selected.min2))
thresholds[length(thresholds)]["settings"] += list(list("env" = g, "val" = "min1", "selected" = selected.min1))
thresholds[length(thresholds)]["settings"] += list(list("env" = g, "val" = "max1", "selected" = selected.max1))
thresholds[length(thresholds)]["settings"] += list(list("env" = g, "val" = "max2", "selected" = selected.max2))
selected = TLV["pressure"]
thresholds += list(list("name" = "Pressure", "settings" = list()))
thresholds[thresholds.len]["settings"] += list(list("env" = "pressure", "val" = "min2", "selected" = selected.min2))
thresholds[thresholds.len]["settings"] += list(list("env" = "pressure", "val" = "min1", "selected" = selected.min1))
thresholds[thresholds.len]["settings"] += list(list("env" = "pressure", "val" = "max1", "selected" = selected.max1))
thresholds[thresholds.len]["settings"] += list(list("env" = "pressure", "val" = "max2", "selected" = selected.max2))
thresholds[length(thresholds)]["settings"] += list(list("env" = "pressure", "val" = "min2", "selected" = selected.min2))
thresholds[length(thresholds)]["settings"] += list(list("env" = "pressure", "val" = "min1", "selected" = selected.min1))
thresholds[length(thresholds)]["settings"] += list(list("env" = "pressure", "val" = "max1", "selected" = selected.max1))
thresholds[length(thresholds)]["settings"] += list(list("env" = "pressure", "val" = "max2", "selected" = selected.max2))
selected = TLV["temperature"]
thresholds += list(list("name" = "Temperature", "settings" = list()))
thresholds[thresholds.len]["settings"] += list(list("env" = "temperature", "val" = "min2", "selected" = selected.min2))
thresholds[thresholds.len]["settings"] += list(list("env" = "temperature", "val" = "min1", "selected" = selected.min1))
thresholds[thresholds.len]["settings"] += list(list("env" = "temperature", "val" = "max1", "selected" = selected.max1))
thresholds[thresholds.len]["settings"] += list(list("env" = "temperature", "val" = "max2", "selected" = selected.max2))
thresholds[length(thresholds)]["settings"] += list(list("env" = "temperature", "val" = "min2", "selected" = selected.min2))
thresholds[length(thresholds)]["settings"] += list(list("env" = "temperature", "val" = "min1", "selected" = selected.min1))
thresholds[length(thresholds)]["settings"] += list(list("env" = "temperature", "val" = "max1", "selected" = selected.max1))
thresholds[length(thresholds)]["settings"] += list(list("env" = "temperature", "val" = "max2", "selected" = selected.max2))
return thresholds
@@ -253,7 +253,7 @@
data["beakerVolume"] = 0
if(beaker)
data["beakerLabel"] = beaker.label_text ? beaker.label_text : null
if(beaker.reagents && beaker.reagents.reagent_list.len)
if(beaker.reagents && length(beaker.reagents.reagent_list))
for(var/datum/reagent/R in beaker.reagents.reagent_list)
data["beakerVolume"] += R.volume
data["cooldownProgress"] = round(clamp((world.time - last_injection) / injection_cooldown, 0, 1) * 100)
@@ -40,12 +40,12 @@
if(!air)
air = new
var/list/possible_expansions = list(base)
while(possible_expansions.len>0)
while(length(possible_expansions)>0)
for(var/obj/machinery/atmospherics/borderline in possible_expansions)
var/list/result = borderline.pipeline_expansion(src)
if(result.len>0)
if(length(result)>0)
for(var/obj/machinery/atmospherics/P in result)
if(istype(P, /obj/machinery/atmospherics/pipe))
var/obj/machinery/atmospherics/pipe/item = P
@@ -186,7 +186,7 @@
var/list/datum/pipeline/PL = list()
PL += src
for(var/i=1;i<=PL.len;i++)
for(var/i=1;i<=length(PL);i++)
var/datum/pipeline/P = PL[i]
if(!P)
return
@@ -33,7 +33,7 @@
qdel(meter)
// if we're somehow by ourself
if(parent && !QDELETED(parent) && parent.members.len == 1 && parent.members[1] == src)
if(parent && !QDELETED(parent) && length(parent.members) == 1 && parent.members[1] == src)
qdel(parent)
parent = null
+2 -2
View File
@@ -9,9 +9,9 @@
..()
var/list/things = params2list(loot)
if(things && things.len)
if(things && length(things))
for(var/i = lootcount, i > 0, i--)
if(!things.len)
if(!length(things))
return
var/loot_spawn = pick(things)
@@ -98,18 +98,18 @@ GLOBAL_DATUM_INIT(_preloader, /datum/dmm_suite/preloader, new())
var/list/gridLines = splittext(dmmRegex.group[6], "\n")
var/leadingBlanks = 0
while(leadingBlanks < gridLines.len && gridLines[++leadingBlanks] == "")
while(leadingBlanks < length(gridLines) && gridLines[++leadingBlanks] == "")
if(leadingBlanks > 1)
gridLines.Cut(1, leadingBlanks) // Remove all leading blank lines.
if(!gridLines.len) // Skip it if only blank lines exist.
if(!length(gridLines)) // Skip it if only blank lines exist.
continue
if(gridLines.len && gridLines[gridLines.len] == "")
gridLines.Cut(gridLines.len) // Remove only one blank line at the end.
if(length(gridLines) && gridLines[length(gridLines)] == "")
gridLines.Cut(length(gridLines)) // Remove only one blank line at the end.
bounds[MAP_MINY] = min(bounds[MAP_MINY], ycrd)
ycrd += gridLines.len - 1 // Start at the top and work down
ycrd += length(gridLines) - 1 // Start at the top and work down
if(!shouldCropMap && ycrd > world.maxy)
if(!measureOnly)
@@ -253,7 +253,7 @@ GLOBAL_DATUM_INIT(_preloader, /datum/dmm_suite/preloader, new())
// The next part of the code assumes there's ALWAYS an /area AND a /turf on a given tile
// first instance the /area and remove it from the members list
index = members.len
index = length(members)
var/turf/crds = locate(xcrd, ycrd, zcrd)
if(members[index] != /area/template_noop)
@@ -285,7 +285,7 @@ GLOBAL_DATUM_INIT(_preloader, /datum/dmm_suite/preloader, new())
if(T)
// if others /turf are presents, simulates the underlays piling effect
index = first_turf_index + 1
var/mlen = members.len - 1
var/mlen = length(members) - 1
while(index <= mlen) // Last item is an /area
var/underlay
if(isturf(T)) // I blame this on the stupid clown who coded the BYOND map editor
@@ -432,7 +432,7 @@ GLOBAL_DATUM_INIT(_preloader, /datum/dmm_suite/preloader, new())
var/json_ready = 0
/datum/dmm_suite/preloader/proc/setup(list/the_attributes, path)
if(the_attributes.len)
if(length(the_attributes))
json_ready = 0
if("map_json_data" in the_attributes)
json_ready = 1
+2 -2
View File
@@ -54,7 +54,7 @@
speed_execute()
return
if(!M.normaldoorcontrol)
if(link_lines.len && alert(user, "Warning: This will disable links to connected pod doors. Continue?", "Buildmode", "Yes", "No") == "No")
if(length(link_lines) && alert(user, "Warning: This will disable links to connected pod doors. Continue?", "Buildmode", "Yes", "No") == "No")
speed_execute()
return
M.normaldoorcontrol = TRUE
@@ -76,7 +76,7 @@
speed_execute()
return
if(M.normaldoorcontrol)
if(link_lines.len && alert(user, "Warning: This will disable links to connected airlocks. Continue?", "Buildmode", "Yes", "No") == "No")
if(length(link_lines) && alert(user, "Warning: This will disable links to connected airlocks. Continue?", "Buildmode", "Yes", "No") == "No")
speed_execute()
return
M.normaldoorcontrol = FALSE
@@ -807,11 +807,11 @@
var/datum/robolimb/L = new limb_type()
if(limb in L.parts) //Make sure that only models that provide the parts the user needs populate the list.
robolimb_models[L.company] = L
if(robolimb_models.len == 1) //If there's only one model available in the list, autoselect it to avoid having to bother the user with a dialog that provides only one option.
if(length(robolimb_models) == 1) //If there's only one model available in the list, autoselect it to avoid having to bother the user with a dialog that provides only one option.
subchoice = L.company //If there ends up being more than one model populating the list, subchoice will be overwritten later anyway, so this isn't a problem.
if(second_limb in L.parts) //If the child limb of the limb the user selected is also present in the model's parts list, state it's been found so the second limb can be set later.
in_model = 1
if(robolimb_models.len > 1) //If there's more than one model in the list that can provide the part the user wants, let them choose.
if(length(robolimb_models) > 1) //If there's more than one model in the list that can provide the part the user wants, let them choose.
subchoice = tgui_input_list(user, "Which model of [choice] [limb_name] do you wish to use?", "[limb_name] - Prosthesis - Model", robolimb_models)
if(subchoice)
choice = subchoice
@@ -81,14 +81,14 @@
/datum/gear_tweak/contents/get_default()
. = list()
for(var/i = 1 to valid_contents.len)
for(var/i = 1 to length(valid_contents))
. += "Random"
/datum/gear_tweak/contents/get_metadata(user, list/metadata)
. = list()
for(var/i = metadata.len to valid_contents.len)
for(var/i = length(metadata) to length(valid_contents))
metadata += "Random"
for(var/i = 1 to valid_contents.len)
for(var/i = 1 to length(valid_contents))
var/entry = input(user, "Choose an entry.", "Character Preference", metadata[i]) as null|anything in (valid_contents[i] + list("Random", "None"))
if(entry)
. += entry
@@ -96,9 +96,9 @@
return metadata
/datum/gear_tweak/contents/tweak_item(obj/item/I, list/metadata)
if(metadata.len != valid_contents.len)
if(length(metadata) != length(valid_contents))
return
for(var/i = 1 to valid_contents.len)
for(var/i = 1 to length(valid_contents))
var/path
var/list/contents = valid_contents[i]
if(metadata[i] == "Random")
+1 -1
View File
@@ -826,7 +826,7 @@
data["accessories"] = accessories_list
for(var/obj/item/clothing/accessory/A in accessories)
accessories_list.len++
accessories_list[accessories_list.len] = A.serialize()
accessories_list[length(accessories_list)] = A.serialize()
return data
@@ -815,10 +815,10 @@
item_color = "corset_blue"
/proc/english_accessory_list(obj/item/clothing/under/U)
if(!istype(U) || !U.accessories.len)
if(!istype(U) || !length(U.accessories))
return
var/list/A = U.accessories
var/total = A.len
var/total = length(A)
if(total == 1)
return "\a [A[1]]"
else if(total == 2)
+10 -10
View File
@@ -107,7 +107,7 @@
.["toolsother"][I] += 1
/datum/personal_crafting/proc/check_tools(mob/user, datum/crafting_recipe/R, list/contents)
if(!R.tools.len) //does not run if no tools are needed
if(!length(R.tools)) //does not run if no tools are needed
return TRUE
var/list/possible_tools = list()
var/list/tools_used = list()
@@ -133,7 +133,7 @@
return TRUE
/datum/personal_crafting/proc/check_pathtools(mob/user, datum/crafting_recipe/R, list/contents)
if(!R.pathtools.len) //does not run if no tools are needed
if(!length(R.pathtools)) //does not run if no tools are needed
return TRUE
var/list/other_possible_tools = list()
for(var/obj/item/I in user.contents) // searchs the inventory of the mob
@@ -384,34 +384,34 @@
/datum/personal_crafting/proc/next_cat(readonly = TRUE)
if(!readonly)
viewing_subcategory = 1
. = viewing_category % categories.len + 1
. = viewing_category % length(categories) + 1
/datum/personal_crafting/proc/next_subcat()
if(islist(subcategories[viewing_category]))
var/list/subs = subcategories[viewing_category]
. = viewing_subcategory % subs.len + 1
. = viewing_subcategory % length(subs) + 1
//Previous can go fuck itself
/datum/personal_crafting/proc/prev_cat(readonly = TRUE)
if(!readonly)
viewing_subcategory = 1
if(viewing_category == categories.len)
if(viewing_category == length(categories))
. = viewing_category-1
else
. = viewing_category % categories.len - 1
. = viewing_category % length(categories) - 1
if(. <= 0)
. = categories.len
. = length(categories)
/datum/personal_crafting/proc/prev_subcat()
if(islist(subcategories[viewing_category]))
var/list/subs = subcategories[viewing_category]
if(viewing_subcategory == subs.len)
if(viewing_subcategory == length(subs))
. = viewing_subcategory-1
else
. = viewing_subcategory % subs.len - 1
. = viewing_subcategory % length(subs) - 1
if(. <= 0)
. = subs.len
. = length(subs)
else
. = null
+2 -2
View File
@@ -33,7 +33,7 @@
to_chat(user, "<span class='notice'>[I] won't fit in [src].</span>")
return
if(contents.len)
if(length(contents))
to_chat(user, "<span class='notice'>[src] already has something inside it.</span>")
return
@@ -66,7 +66,7 @@
return 1
/obj/item/evidencebag/attack_self(mob/user)
if(contents.len)
if(length(contents))
var/obj/item/I = contents[1]
user.visible_message("<span class='notice'>[user] takes [I] out of [src].</span>", "<span class='notice'>You take [I] out of [src].</span>",\
"<span class='notice'>You hear someone rustle around in a plastic bag, and remove something.</span>")
@@ -8,7 +8,7 @@
/datum/event/economic_event/start()
affected_dest = pickweight(GLOB.weighted_randomevent_locations)
if(affected_dest.viable_random_events.len)
if(length(affected_dest.viable_random_events))
endWhen = rand(60,300)
event_type = pick(affected_dest.viable_random_events)
@@ -5,7 +5,7 @@
/datum/event/mundane_news/announce()
var/datum/trade_destination/affected_dest = pickweight(GLOB.weighted_mundaneevent_locations)
var/event_type = 0
if(affected_dest.viable_mundane_events.len)
if(length(affected_dest.viable_mundane_events))
event_type = pick(affected_dest.viable_mundane_events)
if(!event_type)
+1 -1
View File
@@ -99,7 +99,7 @@ GLOBAL_VAR_INIT(total_runtimes_skipped, 0)
// I apologize in advance
var/list/splitlines = splittext(e.desc, "\n")
var/list/desclines = list()
if(splitlines.len > 2) // If there aren't at least three lines, there's no info
if(length(splitlines) > 2) // If there aren't at least three lines, there's no info
for(var/line in splitlines)
if(length(line) < 3)
continue // Blank line, skip it
+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
+3 -3
View File
@@ -10,14 +10,14 @@
for(var/i in 1 to rand(3, rand(5, 10)))
dream_images += pick_n_take(dreams)
dreaming++
for(var/i in 1 to dream_images.len)
for(var/i in 1 to length(dream_images))
addtimer(CALLBACK(src, PROC_REF(experience_dream), dream_images[i], FALSE), ((i - 1) * rand(30,60)))
return TRUE
/mob/living/carbon/proc/custom_dreams(list/dreamlist, mob/user)
var/list/newlist = dreamlist.Copy()
for(var/i in 1 to newlist.len)
for(var/i in 1 to length(newlist))
newlist[i] = replacetext(newlist[i], "DREAMER", "[user.name]")
return newlist
@@ -32,7 +32,7 @@
for(var/i in 1 to rand(3, rand(5, 10)))
dream_images += pick_n_take(nightmares)
nightmare++
for(var/i in 1 to dream_images.len)
for(var/i in 1 to length(dream_images))
addtimer(CALLBACK(src, PROC_REF(experience_dream), dream_images[i], TRUE), ((i - 1) * rand(30,60)))
return TRUE
@@ -35,7 +35,7 @@
var/datum/bottler_recipe/recipe = new type
if(recipe.result) // Ignore recipe subtypes that lack a result
available_recipes += recipe
for(var/i = 1, i <= recipe.ingredients.len, i++)
for(var/i = 1, i <= length(recipe.ingredients), i++)
acceptable_items |= recipe.ingredients[i]
else
qdel(recipe)
@@ -95,7 +95,7 @@
to_chat(user, "<span class='warning'>[src] is full, please remove or process the contents first.</span>")
return
var/slot_inserted = 0
for(var/i = 1, i <= slots.len, i++)
for(var/i = 1, i <= length(slots), i++)
if(!slots[i])
slots[i] = O
slot_inserted = i
@@ -111,7 +111,7 @@
/obj/machinery/bottler/proc/eject_items(slot)
var/obj/item/O = null
if(!slot)
for(var/i = 1, i <= slots.len, i++)
for(var/i = 1, i <= length(slots), i++)
if(slots[i])
O = slots[i]
O.forceMove(loc)
@@ -205,7 +205,7 @@
/obj/machinery/bottler/proc/select_recipe()
for(var/datum/bottler_recipe/recipe in available_recipes)
var/number_matches = 0
for(var/i = 1, i <= slots.len, i++)
for(var/i = 1, i <= length(slots), i++)
var/obj/item/O = slots[i]
if(istype(O, recipe.ingredients[i]))
number_matches++
@@ -335,7 +335,7 @@
dat += "</tr>"
dat += "<tr>"
for(var/i = 1, i <= slots.len, i++)
for(var/i = 1, i <= length(slots), i++)
var/obj/O = slots[i]
if(O)
dat += "<td>[bicon(O)]<br>[O.name]</td>"
@@ -349,7 +349,7 @@
dat += "</tr>"
dat += "<tr>"
for(var/i = 1, i <= slots.len, i++)
for(var/i = 1, i <= length(slots), i++)
if(slots[i])
dat += "<td><A href='byond://?src=[UID()];eject=[i]'>Eject</a></td>"
else
@@ -40,7 +40,7 @@
/obj/item/reagent_containers/drinks/drinkingglass/on_reagent_change()
overlays.Cut()
if(reagents.reagent_list.len)
if(length(reagents.reagent_list))
var/datum/reagent/R = reagents.get_master_reagent()
name = R.drink_name
desc = R.drink_desc
@@ -96,9 +96,9 @@
to_chat(user, "<span class='notice'>You transfer [trans] units of the condiment to [target].</span>")
/obj/item/reagent_containers/condiment/on_reagent_change()
if(!possible_states.len)
if(!length(possible_states))
return
if(reagents.reagent_list.len > 0)
if(length(reagents.reagent_list) > 0)
var/main_reagent = reagents.get_master_reagent_id()
if(main_reagent in possible_states)
var/list/temp_list = possible_states[main_reagent]
@@ -110,7 +110,7 @@
name = "[originalname] bottle"
main_reagent = reagents.get_master_reagent_name()
desc = "Looks like it is [lowertext(main_reagent)], but you are not sure."
if(reagents.reagent_list.len==1)
if(length(reagents.reagent_list)==1)
desc = "A mixture of various condiments. [lowertext(main_reagent)] is one of them."
icon_state = "mixedcondiments"
else
@@ -332,7 +332,7 @@
qdel(src)
/obj/item/reagent_containers/condiment/pack/on_reagent_change()
if(reagents.reagent_list.len > 0)
if(length(reagents.reagent_list) > 0)
var/main_reagent = reagents.get_master_reagent_id()
if(main_reagent in possible_states)
var/list/temp_list = possible_states[main_reagent]
@@ -481,15 +481,15 @@ do {\
for(var/ings in sorteditems) //add the non-basename items to the name, sorting out the , and the and
c++
if(c == sorteditems.len - 1)
if(c == length(sorteditems) - 1)
seperator = " and "
else if(c == sorteditems.len)
else if(c == length(sorteditems))
seperator = " "
else
seperator = ", "
if(sorteditems[ings] > levels.len)
sorteditems[ings] = levels.len
if(sorteditems[ings] > length(levels))
sorteditems[ings] = length(levels)
if(sorteditems[ings] <= 1)
sendback +="[ings][seperator]"
@@ -497,10 +497,10 @@ do {\
sendback +="[levels[sorteditems[ings]]] [ings][seperator]"
for(var/ingtype in sortedtypes) // now add the types basenames, keeping the src one seperate so it can go on the end
if(sortedtypes[ingtype] > levels.len)
sortedtypes[ingtype] = levels.len
if(sortedtypes[ingtype] > length(levels))
sortedtypes[ingtype] = length(levels)
if(ingtype == basename)
if(sortedtypes[ingtype] < levels.len)
if(sortedtypes[ingtype] < length(levels))
sortedtypes[ingtype]++
endpart = "[levels[sortedtypes[ingtype]]] decker [basename]"
continue
@@ -268,9 +268,9 @@
. = ..()
if(open && pizza)
desc = "A box suited for pizzas. It appears to have a [pizza.name] inside."
else if(boxes.len > 0)
desc = "A pile of boxes suited for pizzas. There appears to be [boxes.len + 1] boxes in the pile."
var/obj/item/pizzabox/top_box = boxes[boxes.len]
else if(length(boxes) > 0)
desc = "A pile of boxes suited for pizzas. There appears to be [length(boxes) + 1] boxes in the pile."
var/obj/item/pizzabox/top_box = boxes[length(boxes)]
var/top_tag = top_box.box_tag
if(top_tag != "")
desc = "[desc] The box on top has a tag, it reads: '[top_tag]'."
@@ -298,8 +298,8 @@
else
// Stupid code because byondcode sucks
var/set_tag = TRUE
if(boxes.len > 0)
var/obj/item/pizzabox/top_box = boxes[boxes.len]
if(length(boxes) > 0)
var/obj/item/pizzabox/top_box = boxes[length(boxes)]
if(top_box.box_tag != "")
set_tag = TRUE
else
@@ -307,7 +307,7 @@
set_tag = TRUE
if(!open && set_tag)
var/image/tag = image("food/pizza.dmi", icon_state = "pizzabox_tag")
tag.pixel_y = boxes.len * 3
tag.pixel_y = length(boxes) * 3
. += tag
/obj/item/pizzabox/attack_hand(mob/user)
@@ -318,11 +318,11 @@
update_appearance(UPDATE_DESC|UPDATE_ICON)
return
if(boxes.len > 0)
if(length(boxes) > 0)
if(user.is_in_inactive_hand(src))
..()
return
var/obj/item/pizzabox/box = boxes[boxes.len]
var/obj/item/pizzabox/box = boxes[length(boxes)]
boxes -= box
user.put_in_hands(box)
to_chat(user, "<span class='warning'>You remove the topmost [src] from your hand.</span>")
@@ -339,7 +339,7 @@
update_appearance(UPDATE_DESC|UPDATE_ICON)
/obj/item/pizzabox/attack_self(mob/user)
if(boxes.len > 0)
if(length(boxes) > 0)
return
open = !open
if(open && pizza)
@@ -355,7 +355,7 @@
boxestoadd += box
for(var/obj/item/pizzabox/i in box.boxes)
boxestoadd += i
if((boxes.len+1) + boxestoadd.len <= 5)
if((boxes.len+1) + length(boxestoadd) <= 5)
user.drop_item()
box.loc = src
box.boxes = list() // Clear the box boxes so we don't have boxes inside boxes. - Xzibit
@@ -389,8 +389,8 @@
if(!t)
return
var/obj/item/pizzabox/boxtotagto = src
if(boxes.len > 0)
boxtotagto = boxes[boxes.len]
if(length(boxes) > 0)
boxtotagto = boxes[length(boxes)]
boxtotagto.box_tag = copytext("[t]", 1, 30)
update_appearance(UPDATE_DESC|UPDATE_ICON)
return
+1 -1
View File
@@ -92,7 +92,7 @@
var/obj/item/kitchen/utensil/U = W
if(U.contents.len >= U.max_contents)
if(length(U.contents) >= U.max_contents)
to_chat(user, "<span class='warning'>You cannot fit anything else on your [U].")
return
@@ -349,7 +349,7 @@
RefreshParts()
/obj/machinery/gibber/autogibber/process()
if(!lturf || occupant || locked || operating || victim_targets.len)
if(!lturf || occupant || locked || operating || length(victim_targets))
return
if(acceptdir != lastacceptdir)
@@ -362,7 +362,7 @@
for(var/mob/living/carbon/human/H in lturf)
victim_targets += H
if(victim_targets.len)
if(length(victim_targets))
visible_message({"<span class='danger'>\The [src] states, "Food detected!"</span>"})
sleep(consumption_delay)
for(var/mob/living/carbon/H in victim_targets)
@@ -250,7 +250,7 @@
var/list/recipes_to_make = choose_recipes()
if(recipes_to_make.len == 1 && recipes_to_make[1][2] == RECIPE_FAIL)
if(length(recipes_to_make) == 1 && recipes_to_make[1][2] == RECIPE_FAIL)
//This only runs if there is a single recipe source to be made and it is a failure (the machine was loaded with only 1 mixing bowl that results in failure OR was directly loaded with ingredients that results in failure).
//If there are multiple sources, this bit gets skipped.
dirty += 1
@@ -305,7 +305,7 @@
var/datum/recipe/recipe_src = select_recipe(GLOB.cooking_recipes[recipe_type], src, ignored_items = list(/obj/item/mixing_bowl)) //check the machine's directly-inserted ingredients for possible recipes as well, ignoring the mixing bowls when selecting recipe
if(recipe_src) //if we found a valid recipe for directly-inserted ingredients, add that to our list
recipes_to_make.Add(list(list(src, recipe_src)))
else if(!recipes_to_make.len) //if the machine has no mixing bowls to make recipes from AND also doesn't have a valid recipe of directly-inserted ingredients, return a failure so we can make a burned mess
else if(!length(recipes_to_make)) //if the machine has no mixing bowls to make recipes from AND also doesn't have a valid recipe of directly-inserted ingredients, return a failure so we can make a burned mess
recipes_to_make.Add(list(list(src, RECIPE_FAIL)))
return recipes_to_make
@@ -233,7 +233,7 @@
to_chat(user, "<span class='warning'>\the [src] is already processing something!</span>")
return 1
if(contents.len == 0)
if(length(contents) == 0)
to_chat(user, "<span class='warning'>\the [src] is empty.</span>")
return 1
processing = TRUE
+1 -1
View File
@@ -17,7 +17,7 @@
var/mob/living/user = usr
if(cooldown < world.time - 1 SECONDS)
var/list/newcards = list()
while(cards.len)
while(length(cards))
var/datum/playingcard/P = pick(cards)
P.name = replacetext(P.name," reversed","")
if(prob(50))
+11 -11
View File
@@ -93,16 +93,16 @@
/obj/structure/beebox/process()
if(queen_bee)
if(bee_resources >= BEE_RESOURCE_HONEYCOMB_COST && honeycombs.len < get_max_honeycomb())
if(bee_resources >= BEE_RESOURCE_HONEYCOMB_COST && length(honeycombs) < get_max_honeycomb())
bee_resources = max(bee_resources-BEE_RESOURCE_HONEYCOMB_COST, 0)
var/obj/item/food/snacks/honeycomb/HC = new(src)
if(queen_bee.beegent)
HC.set_reagent(queen_bee.beegent.id)
honeycombs += HC
if(bees.len < get_max_bees())
if(length(bees) < get_max_bees())
var/freebee = FALSE //a freebee, geddit?, hahaha HAHAHAHA
if(bees.len <= 1) //there's always one set of worker bees, this isn't colony collapse disorder its 2d spessmen
if(length(bees) <= 1) //there's always one set of worker bees, this isn't colony collapse disorder its 2d spessmen
freebee = TRUE
if((bee_resources >= BEE_RESOURCE_NEW_BEE_COST && prob(BEE_PROB_NEW_BEE)) || freebee)
if(!freebee)
@@ -131,25 +131,25 @@
. += "<span class='warning'>There is no queen bee! There won't bee any honeycomb without a queen!</span>"
var/half_bee = get_max_bees()*0.5
if(half_bee && (bees.len >= half_bee))
if(half_bee && (length(bees) >= half_bee))
. += "<span class='notice'>This place is a BUZZ with activity... there are lots of bees!</span>"
. += "<span class='notice'>[bee_resources]/100 resource supply.</span>"
. += "<span class='notice'>[bee_resources]% towards a new honeycomb.</span>"
. += "<span class='notice'>[bee_resources*2]% towards a new bee.</span>"
if(honeycombs.len)
var/plural = honeycombs.len > 1
. += "<span class='notice'>There [plural? "are" : "is"] [honeycombs.len] uncollected honeycomb[plural ? "s":""] in the apiary.</span>"
if(length(honeycombs))
var/plural = length(honeycombs) > 1
. += "<span class='notice'>There [plural? "are" : "is"] [length(honeycombs)] uncollected honeycomb[plural ? "s":""] in the apiary.</span>"
if(honeycombs.len >= get_max_honeycomb())
if(length(honeycombs) >= get_max_honeycomb())
. += "<span class='warning'>there's no room for more honeycomb!</span>"
/obj/structure/beebox/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/honey_frame))
var/obj/item/honey_frame/HF = I
if(honey_frames.len < BEEBOX_MAX_FRAMES)
if(length(honey_frames) < BEEBOX_MAX_FRAMES)
if(!user.unEquip(HF))
return
visible_message("<span class='notice'>[user] adds a frame to the apiary.</span>")
@@ -227,7 +227,7 @@
return
switch(option)
if("Remove a Honey Frame")
if(!honey_frames.len)
if(!length(honey_frames))
to_chat(user, "<span class='warning'>There are no honey frames to remove!</span>")
return
@@ -239,7 +239,7 @@
var/amtH = HF.honeycomb_capacity
var/fallen = 0
while(honeycombs.len && amtH) //let's pretend you always grab the frame with the most honeycomb on it
while(length(honeycombs) && amtH) //let's pretend you always grab the frame with the most honeycomb on it
var/obj/item/food/snacks/honeycomb/HC = pick_n_take(honeycombs)
if(HC)
HC.forceMove(get_turf(src))
+3 -3
View File
@@ -55,7 +55,7 @@
for(var/datum/spacevine_mutation/SM in mutations)
if(initial(SM.quality) == SPACEVINE_MUTATION_NEGATIVE)
temp_mut_list += SM
if(prob(20) && temp_mut_list.len)
if(prob(20) && length(temp_mut_list))
mutations.Remove(pick(temp_mut_list))
temp_mut_list.Cut()
@@ -63,7 +63,7 @@
for(var/datum/spacevine_mutation/SM in mutations)
if(initial(SM.quality) == SPACEVINE_MUTATION_POSITIVE)
temp_mut_list += SM
if(prob(20) && temp_mut_list.len)
if(prob(20) && length(temp_mut_list))
mutations.Remove(pick(temp_mut_list))
temp_mut_list.Cut()
@@ -71,7 +71,7 @@
for(var/datum/spacevine_mutation/SM in mutations)
if(initial(SM.quality) == SPACEVINE_MUTATION_MINOR_NEGATIVE)
temp_mut_list += SM
if(prob(20) && temp_mut_list.len)
if(prob(20) && length(temp_mut_list))
mutations.Remove(pick(temp_mut_list))
temp_mut_list.Cut()
@@ -37,7 +37,7 @@
return
var/list/L = get_destinations(user)
if(!L.len)
if(!length(L))
to_chat(user, "<span class='notice'>[src] found no beacons in the world to anchor a wormhole to.</span>")
return
var/chosen_beacon = pick(L)
+1 -1
View File
@@ -24,7 +24,7 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons)
if(EP.beacon_network in beacon_networks)
possible_beacons += EP
if(!possible_beacons.len)
if(!length(possible_beacons))
to_chat(user, "There are no extraction beacons in existence!")
return
@@ -139,7 +139,7 @@
if(O.air)
var/datum/gas_mixture/G = O.air
G.copy_from(O.air)
if(prob(florachance) && NewFlora.len && !is_blocked_turf(O))
if(prob(florachance) && length(NewFlora) && !is_blocked_turf(O))
var/atom/Picked = pick(NewFlora)
new Picked(O)
continue
+1 -1
View File
@@ -192,7 +192,7 @@
generate_mineral(alloy.build_path)
/obj/machinery/mineral/processing_unit/proc/can_smelt(datum/design/D)
if(D.make_reagents.len)
if(length(D.make_reagents))
return FALSE
var/build_amount = SMELT_AMOUNT
+1 -1
View File
@@ -195,7 +195,7 @@
O.forceMove(src)
/mob/living/simple_animal/hostile/mining_drone/proc/DropOre(message = 1)
if(!contents.len)
if(!length(contents))
if(message)
to_chat(src, "<span class='warning'>You attempt to dump your stored ore, but you have none.</span>")
return
+2 -2
View File
@@ -177,8 +177,8 @@
message = strip_html_properly(message)
var/list/punctuation = list(",", "!", ".", ";", "?")
var/list/messages = splittext(message, " ")
if(messages.len > 0)
var/R = rand(1, messages.len)
if(length(messages) > 0)
var/R = rand(1, length(messages))
var/heardword = messages[R]
if(copytext(heardword,1, 1) in punctuation)
heardword = copytext(heardword,2)
+4 -4
View File
@@ -24,7 +24,7 @@
var/join_override
/datum/language/proc/get_random_name(gender, name_count=2, syllable_count=4)
if(!syllables || !syllables.len || english_names)
if(!syllables || !length(syllables) || english_names)
if(gender==FEMALE)
return capitalize(pick(GLOB.first_names_female)) + " " + capitalize(pick(GLOB.last_names))
else
@@ -43,7 +43,7 @@
/datum/language/proc/scramble(input)
if(!syllables || !syllables.len)
if(!syllables || !length(syllables))
return stars(input)
// If the input is cached already, move it to the end of the cache and return it
@@ -82,8 +82,8 @@
// Add it to cache, cutting old entries if the list is too long
scramble_cache[input] = scrambled_text
if(scramble_cache.len > SCRAMBLE_CACHE_LEN)
scramble_cache.Cut(1, scramble_cache.len-SCRAMBLE_CACHE_LEN-1)
if(length(scramble_cache) > SCRAMBLE_CACHE_LEN)
scramble_cache.Cut(1, length(scramble_cache)-SCRAMBLE_CACHE_LEN-1)
return scrambled_text
@@ -84,7 +84,7 @@
// he will become the alien but if he doesn't then we will set the stage
// to 2, so we don't do a process heavy check everytime.
if(candidates.len)
if(length(candidates))
C = pick(candidates)
else if(owner.client)
C = owner.client
@@ -355,7 +355,7 @@
clear_fullscreen("brute")
/mob/living/carbon/proc/handle_patches()
var/multiple_patch_multiplier = processing_patches.len > 1 ? (processing_patches.len * 1.5) : 1
var/multiple_patch_multiplier = length(processing_patches) > 1 ? (length(processing_patches) * 1.5) : 1
var/applied_amount = 0.35 * multiple_patch_multiplier
for(var/patch in processing_patches)
@@ -908,7 +908,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
if(I == handcuffed)
if(istype(I, /obj/item/restraints/handcuffs/twimsts))
playsound(loc, 'sound/items/eatfood.ogg', 50, FALSE)
if(I.reagents && I.reagents.reagent_list.len)
if(I.reagents && length(I.reagents.reagent_list))
taste(I.reagents)
I.reagents.reaction(src, REAGENT_INGEST)
I.reagents.trans_to(src, I.reagents.total_volume)
@@ -154,7 +154,7 @@
if(!H)
return
var/list/valid_hairstyles = generate_valid_hairstyles()
if(valid_hairstyles.len)
if(length(valid_hairstyles))
H.h_style = pick(valid_hairstyles)
else
//this shouldn't happen
@@ -173,7 +173,7 @@
if(!H)
return
var/list/valid_facial_hairstyles = generate_valid_facial_hairstyles()
if(valid_facial_hairstyles.len)
if(length(valid_facial_hairstyles))
H.f_style = pick(valid_facial_hairstyles)
else
//this shouldn't happen
@@ -185,7 +185,7 @@
if(location)
valid_markings = generate_valid_markings(location)
if(valid_markings.len)
if(length(valid_markings))
m_styles[location] = pick(valid_markings)
else
//this shouldn't happen
@@ -193,7 +193,7 @@
else
for(var/m_location in list("head", "body", "tail"))
valid_markings = generate_valid_markings(m_location)
if(valid_markings.len)
if(length(valid_markings))
m_styles[m_location] = pick(valid_markings)
else
//this shouldn't happen
@@ -207,7 +207,7 @@
if(!H)
return
var/list/valid_head_accessories = generate_valid_head_accessories()
if(valid_head_accessories.len)
if(length(valid_head_accessories))
H.ha_style = pick(valid_head_accessories)
else
//this shouldn't happen
@@ -350,9 +350,9 @@
var/list/valid_species = new()
for(var/current_species_name in GLOB.all_species)
if(check_whitelist && !check_rights(R_ADMIN, FALSE, src)) //If we're using the whitelist, make sure to check it!
if(whitelist.len && !(current_species_name in whitelist))
if(length(whitelist) && !(current_species_name in whitelist))
continue
if(blacklist.len && (current_species_name in blacklist))
if(length(blacklist) && (current_species_name in blacklist))
continue
if(!can_use_species(src, current_species_name))
continue
@@ -12,7 +12,7 @@ GLOBAL_LIST_EMPTY(body_accessory_by_species)
GLOB.body_accessory_by_species["[species]"] = list()
GLOB.body_accessory_by_species["[species]"]["[accessory.name]"] = accessory
if(GLOB.body_accessory_by_species.len)
if(length(GLOB.body_accessory_by_species))
return TRUE
return FALSE
@@ -241,7 +241,7 @@
//It automatically updates health status
/mob/living/carbon/human/heal_organ_damage(brute, burn, updating_health = TRUE)
var/list/obj/item/organ/external/parts = get_damaged_organs(brute,burn)
if(!parts.len)
if(!length(parts))
return
var/obj/item/organ/external/picked = pick(parts)
if(picked.heal_damage(brute,burn, updating_health))
@@ -252,7 +252,7 @@
//It automatically updates health status
/mob/living/carbon/human/take_organ_damage(brute, burn, updating_health = TRUE, sharp = FALSE, edge = 0)
var/list/obj/item/organ/external/parts = get_damageable_organs()
if(!parts.len)
if(!length(parts))
return
var/obj/item/organ/external/picked = pick(parts)
if(picked.receive_damage(brute, burn, sharp, updating_health))
@@ -264,7 +264,7 @@
var/list/obj/item/organ/external/parts = get_damaged_organs(brute,burn)
var/update = 0
while(parts.len && ( brute > 0 || burn > 0))
while(length(parts) && ( brute > 0 || burn > 0))
var/obj/item/organ/external/picked = pick(parts)
var/brute_was = picked.brute_dam
@@ -289,10 +289,10 @@
var/list/obj/item/organ/external/parts = get_damageable_organs()
var/update = 0
while(parts.len && (brute>0 || burn>0))
while(length(parts) && (brute>0 || burn>0))
var/obj/item/organ/external/picked = pick(parts)
var/brute_per_part = brute/parts.len
var/burn_per_part = burn/parts.len
var/brute_per_part = brute / length(parts)
var/burn_per_part = burn / length(parts)
var/brute_was = picked.brute_dam
var/burn_was = picked.burn_dam
@@ -228,7 +228,7 @@
criminal = R.fields["criminal"]
if(LAZYLEN(R.fields["comments"])) //if the commentlist is present
var/list/comments = R.fields["comments"]
commentLatest = LAZYACCESS(comments, comments.len) //get the latest entry from the comment log
commentLatest = LAZYACCESS(comments, length(comments)) //get the latest entry from the comment log
if(islist(commentLatest))
commentLatest = "[commentLatest["header"]]: [commentLatest["text"]]"
else
@@ -201,7 +201,7 @@
update_hair() //rebuild hair
update_fhair()
update_head_accessory()
if(hud_list.len)
if(length(hud_list))
sec_hud_set_ID()
wear_mask_update(I, toggle_off = TRUE)
update_inv_wear_mask()
@@ -222,7 +222,7 @@
update_inv_belt()
if(SLOT_HUD_WEAR_ID)
wear_id = I
if(hud_list.len)
if(length(hud_list))
sec_hud_set_ID()
update_inv_wear_id()
if(SLOT_HUD_WEAR_PDA)
@@ -635,7 +635,7 @@
if(healthdoll)
if(stat == DEAD)
healthdoll.icon_state = "healthdoll_DEAD"
if(healthdoll.overlays.len)
if(length(healthdoll.overlays))
healthdoll.overlays.Cut()
else
var/list/new_overlays = list()
@@ -555,7 +555,7 @@
if(setmedical != "Cancel")
R.fields["p_stat"] = setmedical
modified = TRUE
if(GLOB.PDA_Manifest.len)
if(length(GLOB.PDA_Manifest))
GLOB.PDA_Manifest.Cut()
if(!modified)
@@ -864,7 +864,7 @@
obscured |= SLOT_HUD_RIGHT_EAR
obscured |= SLOT_HUD_LEFT_EAR
if(obscured.len > 0)
if(length(obscured) > 0)
return obscured
else
return null
@@ -18,7 +18,7 @@
if(!IS_HORIZONTAL(src) && world.time - l_move_time < 15)
//Moving around with fractured ribs won't do you any good
if(E.is_broken() && E.internal_organs && E.internal_organs.len && prob(15))
if(E.is_broken() && E.internal_organs && length(E.internal_organs) && prob(15))
var/obj/item/organ/internal/I = pick(E.internal_organs)
E.custom_pain("You feel broken bones moving in your [E.name]!")
I.receive_damage(rand(3, 5))
@@ -13,7 +13,7 @@
//These only pertain to common. Languages are handled by mob/say_understands()
if(!speaking)
if(isnymph(other))
if(other.languages.len >= 2) //They've sucked down some blood and can speak common now.
if(length(other.languages) >= 2) //They've sucked down some blood and can speak common now.
return 1
if(issilicon(other))
return 1
@@ -590,7 +590,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
bloodsies.color = w_uniform.blood_color
standing.overlays += bloodsies
if(w_uniform.accessories.len) //WE CHECKED THE TYPE ABOVE. THIS REALLY SHOULD BE FINE. // oh my god kys whoever made this if statement jfc :gun:
if(length(w_uniform.accessories)) //WE CHECKED THE TYPE ABOVE. THIS REALLY SHOULD BE FINE. // oh my god kys whoever made this if statement jfc :gun:
for(var/obj/item/clothing/accessory/A in w_uniform:accessories)
var/tie_color = A.item_color
if(!tie_color)
@@ -858,13 +858,13 @@
if(SLOT_HUD_IN_BACKPACK)
if(H.back && istype(H.back, /obj/item/storage/backpack))
var/obj/item/storage/backpack/B = H.back
if(B.contents.len < B.storage_slots && I.w_class <= B.max_w_class)
if(length(B.contents) < B.storage_slots && I.w_class <= B.max_w_class)
return TRUE
if(H.back && ismodcontrol(H.back))
var/obj/item/mod/control/C = H.back
if(C.bag)
var/obj/item/storage/backpack/B = C.bag
if(B.contents.len < B.storage_slots && I.w_class <= B.max_w_class)
if(length(B.contents) < B.storage_slots && I.w_class <= B.max_w_class)
return TRUE
return FALSE
if(SLOT_HUD_TIE)
@@ -53,7 +53,7 @@
// 3% chance that our golem has a human surname, because cultural contamination
if(prob(human_surname_chance))
golem_surname = pick(GLOB.last_names)
else if(special_names && special_names.len && prob(special_name_chance))
else if(special_names && length(special_names) && prob(special_name_chance))
golem_surname = pick(special_names)
var/golem_name = "[prefix] [golem_surname]"
@@ -448,7 +448,7 @@
if(T.y>world.maxy-tele_range || T.y<tele_range)
continue
turfs += T
if(!turfs.len)
if(!length(turfs))
turfs += pick(/turf in orange(tele_range, H))
var/turf/picked = pick(turfs)
if(!isturf(picked))
@@ -532,7 +532,7 @@
if(T.y>world.maxy-tele_range || T.y<tele_range)
continue
turfs += T
if(!turfs.len)
if(!length(turfs))
turfs += pick(/turf in orange(tele_range, H))
var/turf/picked = pick(turfs)
if(!isturf(picked))
@@ -147,7 +147,7 @@
continue
missing_limbs[initial(limb.name)] = l
if(!missing_limbs.len)
if(!length(missing_limbs))
to_chat(H, "<span class='warning'>You're not missing any limbs!</span>")
return
@@ -34,7 +34,7 @@
singlemutcheck(H, mutation, MUTCHK_FORCED)
/datum/superheroes/proc/assign_spells(mob/living/carbon/human/H)
if(default_spells.len)
if(length(default_spells))
for(var/spell in default_spells)
var/datum/spell/S = spell
if(!S)
@@ -161,7 +161,7 @@
return T
/datum/spell/recruit/can_cast(mob/user = usr, charge_check = TRUE, show_message = FALSE)
if(SSticker.mode.greyshirts.len >= 3)
if(length(SSticker.mode.greyshirts) >= 3)
if(show_message)
to_chat(user, "<span class='warning'>You have already recruited the maximum number of henchmen.</span>")
return FALSE
+1 -1
View File
@@ -1010,7 +1010,7 @@
if(client)
if(new_z)
SSmobs.clients_by_zlevel[new_z] += src
for(var/I in length(SSidlenpcpool.idle_mobs_by_zlevel[new_z]) to 1 step -1) //Backwards loop because we're removing (guarantees optimal rather than worst-case performance), it's fine to use .len here but doesn't compile on 511
for(var/I in length(SSidlenpcpool.idle_mobs_by_zlevel[new_z]) to 1 step -1) //Backwards loop because we're removing (guarantees optimal rather than worst-case performance)
var/mob/living/simple_animal/SA = SSidlenpcpool.idle_mobs_by_zlevel[new_z][I]
if(SA)
SA.toggle_ai(AI_ON) // Guarantees responsiveness for when appearing right next to mobs
+3 -3
View File
@@ -210,7 +210,7 @@ GLOBAL_LIST_EMPTY(channel_to_radio_key)
var/message_range = world.view
//speaking into radios
if(used_radios.len)
if(length(used_radios))
italics = TRUE
message_range = 1
if(first_piece.speaking)
@@ -440,7 +440,7 @@ GLOBAL_LIST_EMPTY(channel_to_radio_key)
if(M.client)
speech_bubble_recipients.Add(M.client)
if(eavesdropping.len)
if(length(eavesdropping))
stars_all(message_pieces) //hopefully passing the message twice through stars() won't hurt... I guess if you already don't understand the language, when they speak it too quietly to hear normally you would be able to catch even less.
for(var/mob/M in eavesdropping)
M.hear_say(message_pieces, verb, italics, src, use_voice = FALSE)
@@ -449,7 +449,7 @@ GLOBAL_LIST_EMPTY(channel_to_radio_key)
speech_bubble("[bubble_icon][speech_bubble_test]", src, speech_bubble_recipients)
if(watching.len)
if(length(watching))
var/rendered = "<span class='game say'><span class='name'>[name]</span> [not_heard].</span>"
for(var/mob/M in watching)
M.show_message(rendered, 2)
+9 -9
View File
@@ -155,7 +155,7 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
while(!pickedName)
pickedName = pick(GLOB.ai_names)
for(var/mob/living/silicon/ai/A in GLOB.mob_list)
if(A.real_name == pickedName && possibleNames.len > 1) //fixing the theoretically possible infinite loop
if(A.real_name == pickedName && length(possibleNames) > 1) //fixing the theoretically possible infinite loop
possibleNames -= pickedName
pickedName = null
@@ -273,11 +273,11 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
to_chat(src, "For department channels, use the following say commands:")
var/radio_text = ""
for(var/i = 1 to aiRadio.channels.len)
for(var/i = 1 to length(aiRadio.channels))
var/channel = aiRadio.channels[i]
var/key = get_radio_key_from_channel(channel)
radio_text += "[key] - [channel]"
if(i != aiRadio.channels.len)
if(i != length(aiRadio.channels))
radio_text += ", "
to_chat(src, radio_text)
@@ -324,10 +324,10 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
dat += "-- [area_name] ([(dat2 != "") ? dat2 : "No Camera"])"
else
dat += "-- [area_name] (No Camera)"
if(sources.len > 1)
if(length(sources) > 1)
dat += "- [length(sources)] sources"
dat += "</nobr><br>\n"
if(!L.len)
if(!length(L))
dat += "-- All Systems Nominal<br>\n"
dat += "<br>\n"
@@ -883,9 +883,9 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
return TRUE
if(O)
var/obj/machinery/camera/C = locateUID(O[1])
if(O.len == 1 && !QDELETED(C) && C.can_use())
if(length(O) == 1 && !QDELETED(C) && C.can_use())
queueAlarm("--- [class] alarm detected in [A.name]! (<A href=byond://?src=[UID()];switchcamera=[O[1]]>[C.c_tag]</A>)", class)
else if(O && O.len)
else if(O && length(O))
var/foo = 0
var/dat2 = ""
for(var/thing in O)
@@ -951,7 +951,7 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
continue
var/list/tempnetwork = difflist(C.network,GLOB.restricted_camera_networks,1)
if(tempnetwork.len)
if(length(tempnetwork))
for(var/i in tempnetwork)
cameralist[i] = i
var/old_network = network
@@ -1034,7 +1034,7 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
for(var/datum/data/record/t in GLOB.data_core.general)//Look in data core general.
personnel_list["[t.fields["name"]]: [t.fields["rank"]]"] = t.fields["photo"]//Pull names, rank, and id photo.
if(personnel_list.len)
if(length(personnel_list))
input = tgui_input_list(usr, "Select a crew member", "Change Hologram", personnel_list)
var/icon/character_icon = personnel_list[input]
if(character_icon)
@@ -63,7 +63,7 @@ GLOBAL_LIST_EMPTY(empty_playable_ai_cores)
// Before calling this, make sure an empty core exists, or this will no-op
/mob/living/silicon/ai/proc/moveToEmptyCore()
if(!GLOB.empty_playable_ai_cores.len)
if(!length(GLOB.empty_playable_ai_cores))
CRASH("moveToEmptyCore called without any available cores")
// IsJobAvailable for AI checks that there is an empty core available in this list
@@ -107,10 +107,10 @@
gripped_item?.afterattack(target, user, 1, params)
//If gripped_item either didn't get deleted, or it failed to be transfered to its target
if(!gripped_item && contents.len)
if(!gripped_item && length(contents))
gripped_item = contents[1]
return FALSE
else if(gripped_item && !contents.len)
else if(gripped_item && !length(contents))
gripped_item = null
else if(isitem(target)) //Check that we're not pocketing a mob.
@@ -742,7 +742,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
dat += "<NOBR>"
dat += "-- [area_name]"
dat += "</NOBR><BR>\n"
if(!L.len)
if(!length(L))
dat += "-- All Systems Nominal<BR>\n"
dat += "<BR>\n"
@@ -133,7 +133,7 @@
return
/mob/living/silicon/proc/queueAlarm(message, type, incoming = TRUE)
var/in_cooldown = (alarms_to_show.len > 0 || alarms_to_clear.len > 0)
var/in_cooldown = (length(alarms_to_show) > 0 || length(alarms_to_clear) > 0)
if(incoming)
alarms_to_show += message
alarm_types_show[type] += 1
@@ -147,7 +147,7 @@
addtimer(CALLBACK(src, PROC_REF(show_alarms)), 3 SECONDS)
/mob/living/silicon/proc/show_alarms()
if(alarms_to_show.len < 5)
if(length(alarms_to_show) < 5)
for(var/msg in alarms_to_show)
to_chat(src, msg)
else if(length(alarms_to_show))
@@ -173,11 +173,11 @@
var/msg_text = msg.Join("")
to_chat(src, msg_text)
if(alarms_to_clear.len < 3)
if(length(alarms_to_clear) < 3)
for(var/msg in alarms_to_clear)
to_chat(src, msg)
else if(alarms_to_clear.len)
else if(length(alarms_to_clear))
var/list/msg = list("--- ")
if(alarm_types_clear["Motion"])

Some files were not shown because too many files have changed in this diff Show More