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
+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"])
@@ -254,7 +254,7 @@
return
if(!istype(src, /obj/item/storage/toolbox))
return
if(contents.len >= 1)
if(length(contents) >= 1)
to_chat(user, "<span class='warning'>They won't fit in, as there is already stuff inside.</span>")
return
if(T.use(10))
@@ -332,7 +332,7 @@
robot_arm = I.type
//Making a medibot!
if(contents.len)
if(length(contents))
to_chat(user, "<span class='warning'>You need to empty [src] out first!</span>")
return
@@ -618,7 +618,7 @@
else
robot_arm = W.type
if(contents.len)
if(length(contents))
to_chat(user, "<span class='warning'>You need to empty [src] out first!</span>")
return
@@ -482,7 +482,7 @@
if(C.stat==2)
continue
targets += C
if(targets.len)
if(length(targets))
if(prob(50))
var/mob/toshoot = pick(targets)
if(toshoot)
@@ -496,7 +496,7 @@
else
shootAt(toshoot)
else if(prob(50))
if(targets.len)
if(length(targets))
var/mob/toarrest = pick(targets)
if(toarrest)
target = toarrest
@@ -672,7 +672,7 @@
var/obj/effect/decal/cleanable/blood/tracks/B = locate() in next
if(!B)
B = new /obj/effect/decal/cleanable/blood/tracks(loc)
if(blood_DNA && blood_DNA.len)
if(blood_DNA && length(blood_DNA))
B.blood_DNA |= blood_DNA.Copy()
B.basecolor = currentBloodColor
var/newdir = get_dir(next, loc)
@@ -173,7 +173,7 @@
if(stat != CONSCIOUS)
return FALSE
if(donors.len < evolve_donors)
if(length(donors) < evolve_donors)
to_chat(src, "<span class='warning'>You need more blood in order to ascend to a new state of consciousness...</span>")
return FALSE
@@ -259,12 +259,12 @@
update_progression()
/mob/living/simple_animal/diona/proc/update_progression()
if(stat != CONSCIOUS || !donors.len)
if(stat != CONSCIOUS || !length(donors))
return FALSE
if(donors.len == evolve_donors)
if(length(donors) == evolve_donors)
to_chat(src, "<span class='noticealien'>You feel ready to move on to your next stage of growth.</span>")
else if(donors.len == awareness_donors)
else if(length(donors) == awareness_donors)
universal_understand = TRUE
to_chat(src, "<span class='noticealien'>You feel your awareness expand, and realize you know how to understand the creatures around you.</span>")
else
@@ -43,10 +43,10 @@
/mob/living/simple_animal/hostile/retaliate/goat/handle_automated_movement()
. = ..()
//chance to go crazy and start wacking stuff
if(!enemies.len && prob(1))
if(!length(enemies) && prob(1))
Retaliate()
if(enemies.len && prob(10))
if(length(enemies) && prob(10))
enemies = list()
LoseTarget()
visible_message("<span class='notice'>[src] calms down.</span>")
@@ -236,7 +236,7 @@
target = beehome
if(!beehome) //add ourselves to a beebox (of the same reagent) if we have no home
for(var/obj/structure/beebox/BB in view(vision_range, src))
if(reagent_incompatible(BB.queen_bee) || BB.bees.len >= BB.get_max_bees())
if(reagent_incompatible(BB.queen_bee) || length(BB.bees) >= BB.get_max_bees())
continue
BB.bees |= src
beehome = BB
@@ -151,7 +151,7 @@
/mob/living/simple_animal/hostile/floor_cluwne/proc/Acquire_Victim(specific)
var/list/players_copy = GLOB.player_list.Copy()
while(players_copy.len)
while(length(players_copy))
var/mob/living/carbon/human/H = pick_n_take(players_copy)
if(!ishuman(H))
continue
@@ -179,7 +179,7 @@
var/possible_target_distance = get_dist(targets_from, A)
if(target_dist < possible_target_distance)
Targets -= A
if(!Targets.len)//We didnt find nothin!
if(!length(Targets))//We didnt find nothin!
return
var/chosen_target = pick(Targets)//Pick the remaining targets (if any) at random
return chosen_target
@@ -333,7 +333,7 @@
/mob/living/simple_animal/hostile/proc/Aggro()
vision_range = aggro_vision_range
if(target && emote_taunt.len && prob(taunt_chance))
if(target && length(emote_taunt) && prob(taunt_chance))
custom_emote(EMOTE_VISIBLE, "[pick(emote_taunt)] at [target].")
taunt_chance = max(taunt_chance-7,2)
@@ -537,7 +537,7 @@
if(!T)
return
if(!length(SSmobs.clients_by_zlevel[T.z])) // It's fine to use .len here but doesn't compile on 511
if(!length(SSmobs.clients_by_zlevel[T.z]))
toggle_ai(AI_Z_OFF)
return
@@ -254,12 +254,12 @@ Difficulty: Hard
. = list()
for(var/mob/living/L in targets)
var/list/bloodpool = get_pools(get_turf(L), 0)
if(bloodpool.len && (!faction_check_mob(L) || L.stat == DEAD))
if(length(bloodpool) && (!faction_check_mob(L) || L.stat == DEAD))
. += L
/mob/living/simple_animal/hostile/megafauna/bubblegum/proc/try_bloodattack()
var/list/targets = get_mobs_on_blood()
if(targets.len)
if(length(targets))
INVOKE_ASYNC(src, PROC_REF(bloodattack), targets, prob(enraged ? 75 : 50))
return TRUE
return FALSE
@@ -268,7 +268,7 @@ Difficulty: Hard
var/mob/living/target_one = pick_n_take(targets)
var/turf/target_one_turf = get_turf(target_one)
var/mob/living/target_two
if(targets.len)
if(length(targets))
target_two = pick_n_take(targets)
var/turf/target_two_turf = get_turf(target_two)
if(target_two.stat != CONSCIOUS || prob(10))
@@ -278,7 +278,7 @@ Difficulty: Hard
if(target_one)
var/list/pools = get_pools(get_turf(target_one), 0)
if(pools.len)
if(length(pools))
target_one_turf = get_turf(target_one)
if(target_one_turf)
if(target_one.stat != CONSCIOUS || prob(10))
@@ -288,7 +288,7 @@ Difficulty: Hard
if(!target_two && target_one)
var/list/poolstwo = get_pools(get_turf(target_one), 0)
if(poolstwo.len)
if(length(poolstwo))
target_one_turf = get_turf(target_one)
if(target_one_turf)
if(target_one.stat != CONSCIOUS || prob(10))
@@ -333,13 +333,13 @@ Difficulty: Hard
if(Adjacent(target))
return FALSE
var/list/can_jaunt = get_pools(get_turf(src), 1)
if(!can_jaunt.len)
if(!length(can_jaunt))
return FALSE
var/list/pools = get_pools(get_turf(target), 5)
var/list/pools_to_remove = get_pools(get_turf(target), 4)
pools -= pools_to_remove
if(!pools.len)
if(!length(pools))
return FALSE
var/obj/effect/temp_visual/decoy/DA = new /obj/effect/temp_visual/decoy(loc,src)
@@ -357,7 +357,7 @@ Difficulty: Hard
pools = get_pools(get_turf(target), 5)
pools_to_remove = get_pools(get_turf(target), 4)
pools -= pools_to_remove
if(pools.len)
if(length(pools))
shuffle_inplace(pools)
found_bloodpool = pick(pools)
if(found_bloodpool)
@@ -175,7 +175,7 @@ Difficulty: Hard
possibilities = list("chaser_swarm")
else
possibilities += "chaser_swarm"
if(possibilities.len)
if(length(possibilities))
switch(pick(possibilities))
if("blink_spam") //blink either once or multiple times.
blink_spam(blink_counter, target_slowness, cross_counter)
@@ -277,9 +277,9 @@ Difficulty: Hard
SLEEP_CHECK_DEATH(6)
var/list/targets = ListTargets()
var/list/cardinal_copy = GLOB.cardinal.Copy()
while(targets.len && cardinal_copy.len)
while(length(targets) && length(cardinal_copy))
var/mob/living/pickedtarget = pick(targets)
if(targets.len >= cardinal_copy.len)
if(length(targets) >= length(cardinal_copy))
pickedtarget = pick_n_take(targets)
if(!istype(pickedtarget) || pickedtarget.stat == DEAD)
pickedtarget = target
@@ -315,11 +315,11 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca
visible_message("<span class='danger'>The <b>[src]</b> clears a jam!</span>")
Pewgun.chambered.loc = loc //rip revolver immersions, blame shotgun snowflake procs
Pewgun.chambered = null
if(Pewgun.magazine && Pewgun.magazine.stored_ammo.len)
if(Pewgun.magazine && length(Pewgun.magazine.stored_ammo))
Pewgun.chambered = Pewgun.magazine.get_round(0)
Pewgun.chambered.loc = Pewgun
Pewgun.update_icon()
else if(Pewgun.magazine && Pewgun.magazine.stored_ammo.len) //only true for pumpguns i think
else if(Pewgun.magazine && length(Pewgun.magazine.stored_ammo)) //only true for pumpguns i think
Pewgun.chambered = Pewgun.magazine.get_round(0)
Pewgun.chambered.loc = Pewgun
visible_message("<span class='danger'>The <b>[src]</b> cocks itself!</span>")
@@ -42,7 +42,7 @@
/mob/living/simple_animal/hostile/asteroid/goldgrub/GiveTarget(new_target)
target = new_target
if(target != null)
if(istype(target, /obj/item/stack/ore) && loot.len < 10)
if(istype(target, /obj/item/stack/ore) && length(loot) < 10)
visible_message("<span class='notice'>[src] looks at [target.name] with hungry eyes.</span>")
else if(isliving(target))
Aggro()
@@ -14,7 +14,7 @@
return A
/mob/living/simple_animal/hostile/retaliate/ListTargets()
if(!enemies.len)
if(!length(enemies))
return list()
var/list/see = ..()
see &= enemies // Remove all entries that aren't in enemies
@@ -126,7 +126,7 @@
if(!ranged)
playsound(loc, 'sound/weapons/saberon.ogg', 35, 1)
if(alert_on_shield_breach)
if(depotarea.shield_list.len)
if(length(depotarea.shield_list))
raise_alert("[name] reports that [target] is trying to breach the armory shield!")
alert_on_shield_breach = FALSE
raised_alert = FALSE
@@ -282,7 +282,7 @@
var/list/key_candidates = list()
for(var/mob/living/simple_animal/hostile/syndicate/melee/autogib/depot/officer/O in GLOB.alive_mob_list)
key_candidates += O
if(key_candidates.len)
if(length(key_candidates))
var/mob/living/simple_animal/hostile/syndicate/melee/autogib/depot/officer/O = pick(key_candidates)
O.shield_key = TRUE
depotarea.shields_up()
@@ -111,7 +111,7 @@
if(temp_vent.welded) // no point considering a vent we can't even use
continue
vents.Add(temp_vent)
if(!vents.len)
if(!length(vents))
entry_vent = null
return
var/obj/machinery/atmospherics/unary/vent_pump/exit_vent = pick(vents)
@@ -68,9 +68,9 @@
targets2 += M
else
targets3 += M
if(targets1.len)
if(length(targets1))
return targets1
if(targets2.len)
if(length(targets2))
return targets2
return targets3
@@ -275,7 +275,7 @@
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in entry_vent.parent.other_atmosmch)
vents.Add(temp_vent)
if(!vents.len)
if(!length(vents))
entry_vent = null
return
var/obj/machinery/atmospherics/unary/vent_pump/exit_vent = pick(vents)
@@ -377,7 +377,7 @@ GLOBAL_LIST_EMPTY(ts_infected_list)
to_chat(T, "<span class='terrorspider'>TerrorSense: [msgtext]</span>")
/mob/living/simple_animal/hostile/poison/terror_spider/proc/CheckFaction()
if(faction.len != 2 || (!("terrorspiders" in faction)) || master_commander != null)
if(length(faction) != 2 || (!("terrorspiders" in faction)) || master_commander != null)
to_chat(src, "<span class='userdanger'>Your connection to the hive mind has been severed!</span>")
stack_trace("Terror spider with incorrect faction list at: [atom_loc_line(src)]")
gib()
@@ -90,7 +90,7 @@
step(L,get_dir(L,src)) //reel them in
L.Weaken(6 SECONDS) //you can't get away now~
if(grasping.len < max_grasps)
if(length(grasping) < max_grasps)
grasping:
for(var/mob/living/L in view(grasp_range, src))
if(L == src || faction_check_mob(L) || (L in grasping) || L == target)
@@ -249,8 +249,8 @@
Phrases that the parrot hears in mob/living/say() get added to speach_buffer.
Every once in a while, the parrot picks one of the lines from the buffer and replaces an element of the 'speech' list.
Then it clears the buffer to make sure they dont magically remember something from hours ago. */
if(speech_buffer.len && prob(10))
if(clean_speak.len)
if(length(speech_buffer) && prob(10))
if(length(clean_speak))
clean_speak -= pick(clean_speak)
clean_speak += pick(speech_buffer)
@@ -258,33 +258,33 @@
set waitfor = FALSE
if(speak_chance)
if(prob(speak_chance) || override)
if(speak && speak.len)
if((emote_hear && emote_hear.len) || (emote_see && emote_see.len))
var/length = speak.len
if(emote_hear && emote_hear.len)
length += emote_hear.len
if(emote_see && emote_see.len)
length += emote_see.len
if(speak && length(speak))
if((emote_hear && length(emote_hear)) || (emote_see && length(emote_see)))
var/length = length(speak)
if(emote_hear && length(emote_hear))
length += length(emote_hear)
if(emote_see && length(emote_see))
length += length(emote_see)
var/randomValue = rand(1,length)
if(randomValue <= speak.len)
if(randomValue <= length(speak))
say(pick(speak))
else
randomValue -= speak.len
if(emote_see && randomValue <= emote_see.len)
randomValue -= length(speak)
if(emote_see && randomValue <= length(emote_see))
custom_emote(EMOTE_VISIBLE, pick(emote_see))
else
custom_emote(EMOTE_AUDIBLE, pick(emote_hear))
else
say(pick(speak))
else
if(!(emote_hear && emote_hear.len) && (emote_see && emote_see.len))
if(!(emote_hear && length(emote_hear)) && (emote_see && length(emote_see)))
custom_emote(EMOTE_VISIBLE, pick(emote_see))
if((emote_hear && emote_hear.len) && !(emote_see && emote_see.len))
if((emote_hear && length(emote_hear)) && !(emote_see && length(emote_see)))
custom_emote(EMOTE_AUDIBLE, pick(emote_hear))
if((emote_hear && emote_hear.len) && (emote_see && emote_see.len))
var/length = emote_hear.len + emote_see.len
if((emote_hear && length(emote_hear)) && (emote_see && length(emote_see)))
var/length = length(emote_hear) + length(emote_see)
var/pick = rand(1,length)
if(pick <= emote_see.len)
if(pick <= length(emote_see))
custom_emote(EMOTE_VISIBLE, pick(emote_see))
else
custom_emote(EMOTE_AUDIBLE, pick(emote_hear))
@@ -361,7 +361,7 @@
/mob/living/simple_animal/say_quote(message)
var/verb = "says"
if(speak_emote.len)
if(length(speak_emote))
verb = pick(speak_emote)
return verb
@@ -9,7 +9,7 @@
handle_nutrition()
if(QDELETED(src)) // Stop if the slime split during handle_nutrition()
return
reagents.remove_all(0.5 * REAGENTS_METABOLISM * reagents.reagent_list.len) //Slimes are such snowflakes
reagents.remove_all(0.5 * REAGENTS_METABOLISM * length(reagents.reagent_list)) //Slimes are such snowflakes
handle_targets()
if(!ckey)
handle_mood()
@@ -319,7 +319,7 @@
targets += L // Possible target found!
if(targets.len > 0)
if(length(targets) > 0)
if(attacked || rabid || hungry == 2)
Target = targets[1] // I am attacked and am fighting back or so hungry I don't even care
else
@@ -337,7 +337,7 @@
discipline_slime(M)
else
if(stat == DEAD && surgeries.len)
if(stat == DEAD && length(surgeries))
if(M.a_intent == INTENT_HELP || M.a_intent == INTENT_DISARM)
for(var/datum/surgery/S in surgeries)
if(S.next_step(M, src))
@@ -353,7 +353,7 @@
/mob/living/simple_animal/slime/attackby(obj/item/I, mob/living/user, params)
if(stat == DEAD && surgeries.len)
if(stat == DEAD && length(surgeries))
if(user.a_intent == INTENT_HELP || user.a_intent == INTENT_DISARM)
for(var/datum/surgery/S in surgeries)
if(S.next_step(user, src))
+4 -4
View File
@@ -523,7 +523,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
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 && w_class <= B.max_w_class)
if(length(B.contents) < B.storage_slots && w_class <= B.max_w_class)
return 1
return 0
return 0 //Unsupported slot
@@ -1221,8 +1221,8 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
//That makes the logs easier to read, but because all of this is stored in strings, weird things have to be used to get it all out.
var/new_log = "\[[time_stamp()]] [text]"
if(target.len)//if there are other logs already present
var/previous_log = target[target.len]//get the latest log
if(length(target))//if there are other logs already present
var/previous_log = target[length(target)]//get the latest log
var/last_log_is_range = (copytext(previous_log, 10, 11) == "-") //whether the last log is a time range or not. The "-" will be an indicator that it is.
var/x_sign_position = findtext(previous_log, "x")
@@ -1247,7 +1247,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
rep = text2num(copytext(previous_log, 44, x_sign_position))//get whatever number is right before the 'x'
new_log = "\[[old_timestamp]-[time_stamp()]]<font color='purple'><b>[rep?rep+1:2]x</b></font> [text]"
target -= target[target.len]//remove the last log
target -= target[length(target)]//remove the last log
target += new_log
+1 -1
View File
@@ -15,7 +15,7 @@
/obj/item/holder/process()
if(isturf(loc) || !(contents.len))
if(isturf(loc) || !(length(contents)))
for(var/mob/M in contents)
+1 -1
View File
@@ -74,7 +74,7 @@
add_click_catcher()
if(viewing_alternate_appearances && viewing_alternate_appearances.len)
if(viewing_alternate_appearances && length(viewing_alternate_appearances))
for(var/datum/alternate_appearance/AA in viewing_alternate_appearances)
AA.display_to(list(src))
+1 -1
View File
@@ -197,7 +197,7 @@
///Called by client/Move()
///Checks to see if you are being grabbed and if so attemps to break it
/client/proc/Process_Grab()
if(mob.grabbed_by.len)
if(length(mob.grabbed_by))
if(mob.incapacitated(FALSE, TRUE)) // Can't break out of grabs if you're incapacitated
return TRUE
if(HAS_TRAIT(mob, TRAIT_IMMOBILIZED))
+2 -2
View File
@@ -389,7 +389,7 @@
for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list)
if(A.announce_arrivals)
ailist += A
if(ailist.len)
if(length(ailist))
var/mob/living/silicon/ai/announcer = pick(ailist)
if(character.mind)
if((character.mind.assigned_role != "Cyborg") && (character.mind.assigned_role != character.mind.special_role))
@@ -421,7 +421,7 @@
var/ailist[] = list()
for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list)
ailist += A
if(ailist.len)
if(length(ailist))
var/mob/living/silicon/ai/announcer = pick(ailist)
if(character.mind)
if(character.mind.assigned_role != character.mind.special_role)