mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
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:
co-authored by
Deniz
FunnyMan3595
parent
bdd417ada0
commit
bad8b31afa
@@ -53,7 +53,7 @@
|
||||
return statements
|
||||
|
||||
/datum/ai_laws/proc/sort_laws()
|
||||
if(sorted_laws.len)
|
||||
if(length(sorted_laws))
|
||||
return
|
||||
|
||||
if(zeroth_law)
|
||||
@@ -65,7 +65,7 @@
|
||||
var/index = 1
|
||||
for(var/datum/ai_law/inherent_law in inherent_laws)
|
||||
inherent_law.index = index++
|
||||
if(supplied_laws.len < inherent_law.index || !istype(supplied_laws[inherent_law.index], /datum/ai_law))
|
||||
if(length(supplied_laws) < inherent_law.index || !istype(supplied_laws[inherent_law.index], /datum/ai_law))
|
||||
sorted_laws += inherent_law
|
||||
|
||||
for(var/datum/ai_law/AL in supplied_laws)
|
||||
@@ -77,11 +77,11 @@
|
||||
if(change_zeroth)
|
||||
S.sync_zeroth(zeroth_law, zeroth_law_borg)
|
||||
|
||||
if(full_sync || ion_laws.len)
|
||||
if(full_sync || length(ion_laws))
|
||||
S.laws.clear_ion_laws()
|
||||
if(full_sync || inherent_laws.len)
|
||||
if(full_sync || length(inherent_laws))
|
||||
S.laws.clear_inherent_laws()
|
||||
if(full_sync || supplied_laws.len)
|
||||
if(full_sync || length(supplied_laws))
|
||||
S.laws.clear_supplied_laws()
|
||||
|
||||
for(var/datum/ai_law/law in ion_laws)
|
||||
@@ -130,7 +130,7 @@
|
||||
|
||||
var/new_law = new/datum/ai_law/ion(law)
|
||||
ion_laws += new_law
|
||||
if(state_ion.len < ion_laws.len)
|
||||
if(length(state_ion) < length(ion_laws))
|
||||
state_ion += 1
|
||||
|
||||
sorted_laws.Cut()
|
||||
@@ -145,7 +145,7 @@
|
||||
|
||||
var/new_law = new/datum/ai_law/inherent(law)
|
||||
inherent_laws += new_law
|
||||
if(state_inherent.len < inherent_laws.len)
|
||||
if(length(state_inherent) < length(inherent_laws))
|
||||
state_inherent += 1
|
||||
|
||||
sorted_laws.Cut()
|
||||
@@ -154,22 +154,22 @@
|
||||
if(!law)
|
||||
return
|
||||
|
||||
if(supplied_laws.len >= number)
|
||||
if(length(supplied_laws) >= number)
|
||||
var/datum/ai_law/existing_law = supplied_laws[number]
|
||||
if(existing_law && existing_law.law == law)
|
||||
return
|
||||
|
||||
if(supplied_laws.len >= number && supplied_laws[number])
|
||||
if(length(supplied_laws) >= number && supplied_laws[number])
|
||||
delete_law(supplied_laws[number])
|
||||
|
||||
while(src.supplied_laws.len < number)
|
||||
while(length(src.supplied_laws) < number)
|
||||
src.supplied_laws += ""
|
||||
if(state_supplied.len < supplied_laws.len)
|
||||
if(length(state_supplied) < length(supplied_laws))
|
||||
state_supplied += 1
|
||||
|
||||
var/new_law = new/datum/ai_law/supplied(law, number)
|
||||
supplied_laws[number] = new_law
|
||||
if(state_supplied.len < supplied_laws.len)
|
||||
if(length(state_supplied) < length(supplied_laws))
|
||||
state_supplied += 1
|
||||
|
||||
sorted_laws.Cut()
|
||||
@@ -203,7 +203,7 @@
|
||||
var/index = laws.Find(law)
|
||||
if(index)
|
||||
laws -= law
|
||||
for(index, index < state.len, index++)
|
||||
for(index, index < length(state), index++)
|
||||
state[index] = state[index+1]
|
||||
sorted_laws.Cut()
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
components_of_type = test
|
||||
if(I == our_type) //exact match, take priority
|
||||
var/inserted = FALSE
|
||||
for(var/J in 1 to components_of_type.len)
|
||||
for(var/J in 1 to length(components_of_type))
|
||||
var/datum/component/C = components_of_type[J]
|
||||
if(C.type != our_type) //but not over other exact matches
|
||||
components_of_type.Insert(J, I)
|
||||
@@ -127,13 +127,13 @@
|
||||
var/list/components_of_type = dc[I]
|
||||
if(length(components_of_type)) //
|
||||
var/list/subtracted = components_of_type - src
|
||||
if(subtracted.len == 1) //only 1 guy left
|
||||
if(length(subtracted) == 1) //only 1 guy left
|
||||
dc[I] = subtracted[1] //make him special
|
||||
else
|
||||
dc[I] = subtracted
|
||||
else //just us
|
||||
dc -= I
|
||||
if(!dc.len)
|
||||
if(!length(dc))
|
||||
P.datum_components = null
|
||||
|
||||
UnregisterFromParent()
|
||||
@@ -241,7 +241,7 @@
|
||||
lookup[sig] -= src
|
||||
|
||||
signal_procs[target] -= sig_type_or_types
|
||||
if(!signal_procs[target].len)
|
||||
if(!length(signal_procs[target]))
|
||||
signal_procs -= target
|
||||
|
||||
/// Registers multiple signals to the same proc.
|
||||
|
||||
@@ -184,7 +184,7 @@
|
||||
//For consuming material
|
||||
//mats is a list of types of material to use and the corresponding amounts, example: list(MAT_METAL=100, MAT_GLASS=200)
|
||||
/datum/component/material_container/proc/use_amount(list/mats, multiplier=1)
|
||||
if(!mats || !mats.len)
|
||||
if(!mats || !length(mats))
|
||||
return FALSE
|
||||
|
||||
var/datum/material/M
|
||||
@@ -292,7 +292,7 @@
|
||||
return (total_amount + amt) <= max_amount
|
||||
|
||||
/datum/component/material_container/proc/has_materials(list/mats, multiplier=1)
|
||||
if(!mats || !mats.len)
|
||||
if(!mats || !length(mats))
|
||||
return FALSE
|
||||
|
||||
var/datum/material/M
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
/datum/component/spawner/proc/try_spawn_mob()
|
||||
var/atom/P = parent
|
||||
if(spawned_mobs.len >= max_mobs)
|
||||
if(length(spawned_mobs) >= max_mobs)
|
||||
return 0
|
||||
if(spawn_delay > world.time)
|
||||
return 0
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
for(var/other in swarm_members)
|
||||
var/datum/component/swarming/other_swarm = other
|
||||
other_swarm.swarm_members -= src
|
||||
if(!other_swarm.swarm_members.len)
|
||||
if(!length(other_swarm.swarm_members))
|
||||
other_swarm.unswarm()
|
||||
swarm_members = null
|
||||
return ..()
|
||||
@@ -36,10 +36,10 @@
|
||||
if(!other_swarm || !(other_swarm in swarm_members))
|
||||
return
|
||||
swarm_members -= other_swarm
|
||||
if(!swarm_members.len)
|
||||
if(!length(swarm_members))
|
||||
unswarm()
|
||||
other_swarm.swarm_members -= src
|
||||
if(!other_swarm.swarm_members.len)
|
||||
if(!length(other_swarm.swarm_members))
|
||||
other_swarm.unswarm()
|
||||
|
||||
/datum/component/swarming/proc/swarm()
|
||||
|
||||
+17
-17
@@ -15,7 +15,7 @@ using /datum/datacore/proc/manifest_inject(), or manifest_insert()
|
||||
GLOBAL_LIST_EMPTY(PDA_Manifest)
|
||||
|
||||
/datum/datacore/proc/get_manifest_json()
|
||||
if(GLOB.PDA_Manifest.len)
|
||||
if(length(GLOB.PDA_Manifest))
|
||||
return
|
||||
var/heads[0]
|
||||
var/sec[0]
|
||||
@@ -38,44 +38,44 @@ GLOBAL_LIST_EMPTY(PDA_Manifest)
|
||||
heads[++heads.len] = list("name" = name, "rank" = rank, "active" = isactive)
|
||||
department = 1
|
||||
depthead = 1
|
||||
if(rank == "Captain" && heads.len != 1)
|
||||
heads.Swap(1, heads.len)
|
||||
if(rank == "Captain" && length(heads) != 1)
|
||||
heads.Swap(1, length(heads))
|
||||
|
||||
if(real_rank in GLOB.active_security_positions)
|
||||
sec[++sec.len] = list("name" = name, "rank" = rank, "active" = isactive)
|
||||
department = 1
|
||||
if(depthead && sec.len != 1)
|
||||
sec.Swap(1, sec.len)
|
||||
if(depthead && length(sec) != 1)
|
||||
sec.Swap(1, length(sec))
|
||||
|
||||
if(real_rank in GLOB.engineering_positions)
|
||||
eng[++eng.len] = list("name" = name, "rank" = rank, "active" = isactive)
|
||||
department = 1
|
||||
if(depthead && eng.len != 1)
|
||||
eng.Swap(1, eng.len)
|
||||
if(depthead && length(eng) != 1)
|
||||
eng.Swap(1, length(eng))
|
||||
|
||||
if(real_rank in GLOB.medical_positions)
|
||||
med[++med.len] = list("name" = name, "rank" = rank, "active" = isactive)
|
||||
department = 1
|
||||
if(depthead && med.len != 1)
|
||||
med.Swap(1, med.len)
|
||||
if(depthead && length(med) != 1)
|
||||
med.Swap(1, length(med))
|
||||
|
||||
if(real_rank in GLOB.science_positions)
|
||||
sci[++sci.len] = list("name" = name, "rank" = rank, "active" = isactive)
|
||||
department = 1
|
||||
if(depthead && sci.len != 1)
|
||||
sci.Swap(1, sci.len)
|
||||
if(depthead && length(sci) != 1)
|
||||
sci.Swap(1, length(sci))
|
||||
|
||||
if(real_rank in GLOB.service_positions)
|
||||
ser[++ser.len] = list("name" = name, "rank" = rank, "active" = isactive)
|
||||
department = 1
|
||||
if(depthead && ser.len != 1)
|
||||
ser.Swap(1, ser.len)
|
||||
if(depthead && length(ser) != 1)
|
||||
ser.Swap(1, length(ser))
|
||||
|
||||
if(real_rank in GLOB.supply_positions)
|
||||
sup[++sup.len] = list("name" = name, "rank" = rank, "active" = isactive)
|
||||
department = 1
|
||||
if(depthead && sup.len != 1)
|
||||
sup.Swap(1, sup.len)
|
||||
if(depthead && length(sup) != 1)
|
||||
sup.Swap(1, length(sup))
|
||||
|
||||
if(real_rank in GLOB.nonhuman_positions)
|
||||
bot[++bot.len] = list("name" = name, "rank" = rank, "active" = isactive)
|
||||
@@ -105,7 +105,7 @@ GLOBAL_LIST_EMPTY(PDA_Manifest)
|
||||
manifest_inject(H)
|
||||
|
||||
/datum/datacore/proc/manifest_modify(name, assignment)
|
||||
if(GLOB.PDA_Manifest.len)
|
||||
if(length(GLOB.PDA_Manifest))
|
||||
GLOB.PDA_Manifest.Cut()
|
||||
var/datum/data/record/foundrecord
|
||||
var/real_title = assignment
|
||||
@@ -137,7 +137,7 @@ GLOBAL_LIST_EMPTY(PDA_Manifest)
|
||||
|
||||
GLOBAL_VAR_INIT(record_id_num, 1001)
|
||||
/datum/datacore/proc/manifest_inject(mob/living/carbon/human/H)
|
||||
if(GLOB.PDA_Manifest.len)
|
||||
if(length(GLOB.PDA_Manifest))
|
||||
GLOB.PDA_Manifest.Cut()
|
||||
|
||||
if(H.mind && (H.mind.assigned_role != H.mind.special_role))
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
var/list/variable_html = list()
|
||||
if(islist)
|
||||
var/list/L = D
|
||||
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))
|
||||
@@ -511,8 +511,8 @@
|
||||
var/list/L = value
|
||||
var/list/items = list()
|
||||
|
||||
if(L.len > 0 && !(name == "underlays" || name == "overlays" || name == "vars" || L.len > (IS_NORMAL_LIST(L) ? 250 : 300)))
|
||||
for(var/i in 1 to L.len)
|
||||
if(length(L) > 0 && !(name == "underlays" || name == "overlays" || name == "vars" || length(L) > (IS_NORMAL_LIST(L) ? 250 : 300)))
|
||||
for(var/i in 1 to length(L))
|
||||
var/key = L[i]
|
||||
var/val
|
||||
if(IS_NORMAL_LIST(L) && !isnum(key))
|
||||
@@ -523,10 +523,10 @@
|
||||
|
||||
items += debug_variable(key, val, level + 1, sanitize = sanitize)
|
||||
|
||||
item = "<a href='byond://?_src_=vars;VarsList=\ref[L]'>[VV_HTML_ENCODE(name)] = /list ([L.len])</a><ul>[items.Join()]</ul>"
|
||||
item = "<a href='byond://?_src_=vars;VarsList=\ref[L]'>[VV_HTML_ENCODE(name)] = /list ([length(L)])</a><ul>[items.Join()]</ul>"
|
||||
|
||||
else
|
||||
item = "<a href='byond://?_src_=vars;VarsList=\ref[L]'>[VV_HTML_ENCODE(name)] = /list ([L.len])</a>"
|
||||
item = "<a href='byond://?_src_=vars;VarsList=\ref[L]'>[VV_HTML_ENCODE(name)] = /list ([length(L)])</a>"
|
||||
|
||||
else
|
||||
item = "[VV_HTML_ENCODE(name)] = <span class='value'>[VV_HTML_ENCODE(value)]</span>"
|
||||
@@ -1049,7 +1049,7 @@
|
||||
to_chat(usr, "This can only be done to instances of type /mob")
|
||||
return
|
||||
|
||||
if(!H.languages.len)
|
||||
if(!length(H.languages))
|
||||
to_chat(usr, "This mob knows no languages.")
|
||||
return
|
||||
|
||||
@@ -1400,9 +1400,9 @@
|
||||
return TRUE
|
||||
|
||||
L.len = value["value"]
|
||||
log_world("### ListVarEdit by [src]: /list len: [L.len]")
|
||||
log_admin("[key_name(src)] modified list's len: [L.len]")
|
||||
message_admins("[key_name_admin(src)] modified list's len: [L.len]")
|
||||
log_world("### ListVarEdit by [src]: /list len: [length(L)]")
|
||||
log_admin("[key_name(src)] modified list's len: [length(L)]")
|
||||
message_admins("[key_name_admin(src)] modified list's len: [length(L)]")
|
||||
return TRUE
|
||||
|
||||
if(href_list["listshuffle"])
|
||||
|
||||
@@ -49,9 +49,9 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
D = null
|
||||
// Generate symptoms if we weren't given any.
|
||||
|
||||
if(!symptoms || !symptoms.len)
|
||||
if(!symptoms || !length(symptoms))
|
||||
|
||||
if(!D || !D.symptoms || !D.symptoms.len)
|
||||
if(!D || !D.symptoms || !length(D.symptoms))
|
||||
symptoms = GenerateSymptoms(0, 2)
|
||||
else
|
||||
for(var/datum/symptom/S in D.symptoms)
|
||||
@@ -71,7 +71,7 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
/datum/disease/advance/stage_act()
|
||||
if(!..())
|
||||
return FALSE
|
||||
if(symptoms && symptoms.len)
|
||||
if(symptoms && length(symptoms))
|
||||
|
||||
if(!processing)
|
||||
processing = TRUE
|
||||
@@ -162,7 +162,7 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
if(!HasSymptom(S))
|
||||
possible_symptoms += S
|
||||
|
||||
if(!possible_symptoms.len)
|
||||
if(!length(possible_symptoms))
|
||||
return generated
|
||||
|
||||
// Random chance to get more than one symptom
|
||||
@@ -172,7 +172,7 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
while(prob(20))
|
||||
number_of += 1
|
||||
|
||||
for(var/i = 1; number_of >= i && possible_symptoms.len; i++)
|
||||
for(var/i = 1; number_of >= i && length(possible_symptoms); i++)
|
||||
generated += pick_n_take(possible_symptoms)
|
||||
|
||||
return generated
|
||||
@@ -194,7 +194,7 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
//Generate disease properties based on the effects. Returns an associated list.
|
||||
/datum/disease/advance/proc/GenerateProperties()
|
||||
|
||||
if(!symptoms || !symptoms.len)
|
||||
if(!symptoms || !length(symptoms))
|
||||
CRASH("We did not have any symptoms before generating properties.")
|
||||
|
||||
var/list/properties = list("resistance" = 1, "stealth" = 0, "stage rate" = 1, "transmittable" = 1, "severity" = 0)
|
||||
@@ -212,7 +212,7 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
// Assign the properties that are in the list.
|
||||
/datum/disease/advance/proc/AssignProperties(list/properties = list())
|
||||
|
||||
if(properties && properties.len)
|
||||
if(properties && length(properties))
|
||||
switch(properties["stealth"])
|
||||
if(2)
|
||||
visibility_flags = HIDDEN_SCANNER
|
||||
@@ -220,7 +220,7 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
visibility_flags = HIDDEN_SCANNER|HIDDEN_PANDEMIC
|
||||
|
||||
// The more symptoms we have, the less transmittable it is but some symptoms can make up for it.
|
||||
SetSpread(clamp(2 ** (properties["transmittable"] - symptoms.len), BLOOD, AIRBORNE))
|
||||
SetSpread(clamp(2 ** (properties["transmittable"] - length(symptoms)), BLOOD, AIRBORNE))
|
||||
permeability_mod = max(CEILING(0.4 * properties["transmittable"], 1), 1)
|
||||
cure_chance = 15 - clamp(properties["resistance"], -5, 5) // can be between 10 and 20
|
||||
stage_prob = max(properties["stage rate"], 2)
|
||||
@@ -266,8 +266,8 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
|
||||
// Will generate a random cure, the less resistance the symptoms have, the harder the cure.
|
||||
/datum/disease/advance/proc/GenerateCure(list/properties = list())
|
||||
if(properties && properties.len)
|
||||
var/res = clamp(properties["resistance"] - (symptoms.len / 2), 1, GLOB.advance_cures.len)
|
||||
if(properties && length(properties))
|
||||
var/res = clamp(properties["resistance"] - (length(symptoms) / 2), 1, length(GLOB.advance_cures))
|
||||
// to_chat(world, "Res = [res]")
|
||||
cures = list(GLOB.advance_cures[res])
|
||||
|
||||
@@ -288,7 +288,7 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
|
||||
// Randomly remove a symptom.
|
||||
/datum/disease/advance/proc/Devolve()
|
||||
if(symptoms.len > 1)
|
||||
if(length(symptoms) > 1)
|
||||
var/s = safepick(symptoms)
|
||||
if(s)
|
||||
RemoveSymptom(s)
|
||||
@@ -319,7 +319,7 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
if(HasSymptom(S))
|
||||
return
|
||||
|
||||
if(symptoms.len < (VIRUS_SYMPTOM_LIMIT - 1) + rand(-1, 1))
|
||||
if(length(symptoms) < (VIRUS_SYMPTOM_LIMIT - 1) + rand(-1, 1))
|
||||
symptoms += S
|
||||
else
|
||||
RemoveSymptom(pick(symptoms))
|
||||
@@ -347,14 +347,14 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
for(var/datum/disease/advance/A in D_list)
|
||||
diseases += A.Copy()
|
||||
|
||||
if(!diseases.len)
|
||||
if(!length(diseases))
|
||||
return null
|
||||
if(diseases.len <= 1)
|
||||
if(length(diseases) <= 1)
|
||||
return pick(diseases) // Just return the only entry.
|
||||
|
||||
var/i = 0
|
||||
// Mix our diseases until we are left with only one result.
|
||||
while(i < 20 && diseases.len > 1)
|
||||
while(i < 20 && length(diseases) > 1)
|
||||
|
||||
i++
|
||||
|
||||
@@ -377,7 +377,7 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
for(var/datum/disease/A in data["viruses"])
|
||||
preserve += A.Copy()
|
||||
R.data = data.Copy()
|
||||
if(preserve.len)
|
||||
if(length(preserve))
|
||||
R.data["viruses"] = preserve
|
||||
|
||||
/proc/AdminCreateVirus(client/user)
|
||||
@@ -407,7 +407,7 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
i -= 1
|
||||
while(i > 0)
|
||||
|
||||
if(D.symptoms.len > 0)
|
||||
if(length(D.symptoms) > 0)
|
||||
|
||||
var/new_name = stripped_input(user, "Name your new disease.", "New Name")
|
||||
if(!new_name)
|
||||
|
||||
@@ -42,7 +42,7 @@ Bonus
|
||||
|
||||
var/list/parts = H.get_damaged_organs(TRUE, TRUE, AFFECT_ORGANIC_ORGAN) //1,1 because it needs inputs.
|
||||
|
||||
if(!parts.len)
|
||||
if(!length(parts))
|
||||
return
|
||||
var/healed = 0
|
||||
for(var/obj/item/organ/external/E in parts)
|
||||
|
||||
@@ -82,7 +82,7 @@ Bonus
|
||||
// Remove all the diseases we cured.
|
||||
var/mob/living/M = A.affected_mob
|
||||
if(istype(M))
|
||||
if(cured_diseases.len)
|
||||
if(length(cured_diseases))
|
||||
for(var/res in M.resistances)
|
||||
if(res in cured_diseases)
|
||||
M.resistances -= res
|
||||
|
||||
@@ -18,7 +18,7 @@ GLOBAL_LIST_INIT(list_symptoms, subtypesof(/datum/symptom))
|
||||
|
||||
/datum/symptom/New()
|
||||
var/list/S = GLOB.list_symptoms
|
||||
for(var/i = 1; i <= S.len; i++)
|
||||
for(var/i = 1; i <= length(S); i++)
|
||||
if(type == S[i])
|
||||
id = "[i]"
|
||||
return
|
||||
|
||||
@@ -110,11 +110,11 @@
|
||||
/datum/async_input/ranked/render_choices()
|
||||
var/dat = "<div>"
|
||||
dat += "<table id='choices' uid=[UID()] style='margin: auto; text-align: left;'>"
|
||||
for(var/i = 1, i <= choices.len, i++)
|
||||
for(var/i = 1, i <= length(choices), i++)
|
||||
var/choice = choices[i]
|
||||
dat += "<tr>"
|
||||
dat += "<td>[button("+", i != 1 ? "upvote=[i]" : "", null, i == 1)]</td>"
|
||||
dat += "<td>[button("-", i != choices.len ? "downvote=[i]" : "", null, i == choices.len)]</td>"
|
||||
dat += "<td>[button("-", i != length(choices) ? "downvote=[i]" : "", null, i == length(choices))]</td>"
|
||||
dat += "<td style='cursor: move;' index='[i]' ondrop='drop(event)' ondragover='allowDrop(event)' draggable='true' ondragstart='drag(event)'>[i]. [choice]</td>"
|
||||
dat += "</tr>"
|
||||
dat += "</table>"
|
||||
@@ -157,7 +157,7 @@
|
||||
..()
|
||||
popup.add_script("autocomplete.js", 'html/browser/autocomplete.js')
|
||||
|
||||
for(var/i=1, i <= choices.len, i++)
|
||||
for(var/i=1, i <= length(choices), i++)
|
||||
var/C = choices[choices[i]]
|
||||
choices[i] = url_encode(choices[i], TRUE)
|
||||
choices[choices[i]] = C
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
if(!holder) //don't want this without a holder
|
||||
spawn
|
||||
qdel(src)
|
||||
set_desc(steps.len)
|
||||
set_desc(length(steps))
|
||||
return
|
||||
|
||||
/datum/construction/proc/next_step(mob/user as mob)
|
||||
steps.len--
|
||||
if(!steps.len)
|
||||
if(!length(steps))
|
||||
spawn_result(user)
|
||||
else
|
||||
set_desc(steps.len)
|
||||
set_desc(length(steps))
|
||||
return
|
||||
|
||||
/datum/construction/proc/action(atom/used_atom,mob/user as mob)
|
||||
@@ -37,9 +37,9 @@
|
||||
return 0
|
||||
|
||||
/datum/construction/proc/is_right_key(atom/used_atom) // returns current step num if used_atom is of the right type.
|
||||
var/list/L = steps[steps.len]
|
||||
var/list/L = steps[length(steps)]
|
||||
if(do_tool_or_atom_check(used_atom, L["key"]))
|
||||
return steps.len
|
||||
return length(steps)
|
||||
return 0
|
||||
|
||||
|
||||
@@ -67,12 +67,12 @@
|
||||
return 1
|
||||
|
||||
/datum/construction/proc/check_all_steps(atom/used_atom,mob/user as mob) //check all steps, remove matching one.
|
||||
for(var/i=1;i<=steps.len;i++)
|
||||
for(var/i=1;i<=length(steps);i++)
|
||||
var/list/L = steps[i]
|
||||
if(do_tool_or_atom_check(used_atom, L["key"]) && custom_action(i, used_atom, user))
|
||||
steps[i]=null;//stupid byond list from list removal...
|
||||
listclearnulls(steps)
|
||||
if(!steps.len)
|
||||
if(!length(steps))
|
||||
spawn_result(user)
|
||||
return 1
|
||||
return 0
|
||||
@@ -130,7 +130,7 @@
|
||||
|
||||
/datum/construction/reversible/New(atom)
|
||||
..()
|
||||
index = steps.len
|
||||
index = length(steps)
|
||||
return
|
||||
|
||||
/datum/construction/reversible/proc/update_index(diff as num, mob/user as mob)
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
precision = rand(1, 100)
|
||||
|
||||
var/list/bagholding = teleatom.search_contents_for(/obj/item/storage/backpack/holding)
|
||||
if(bagholding.len)
|
||||
if(length(bagholding))
|
||||
if(safe_turf_first) //If this is true, this is already a random teleport. Make it unsafe but do not touch the precision.
|
||||
safe_turf_first = FALSE
|
||||
else
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
LAZYADD(H.holo_calls, src)
|
||||
H.atom_say("[area] pad beeps: Incoming call from [caller]!")
|
||||
|
||||
if(!dialed_holopads.len)
|
||||
if(!length(dialed_holopads))
|
||||
calling_holopad.atom_say("Connection failure.")
|
||||
qdel(src)
|
||||
return
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
LAZYREMOVE(H.holo_calls, src)
|
||||
dialed_holopads -= H
|
||||
if(!dialed_holopads.len)
|
||||
if(!length(dialed_holopads))
|
||||
if(graceful)
|
||||
calling_holopad.atom_say("Call rejected.")
|
||||
qdel(src)
|
||||
|
||||
+8
-8
@@ -485,12 +485,12 @@
|
||||
if(istype(robot) && robot.emagged)
|
||||
. += "<br>Cyborg: <b><font color='red'>Is emagged!</font></b> <a href='byond://?src=[UID()];silicon=unemag'>Unemag!</a><br>0th law: [robot.laws.zeroth_law]"
|
||||
var/mob/living/silicon/ai/ai = current
|
||||
if(istype(ai) && ai.connected_robots.len)
|
||||
if(istype(ai) && length(ai.connected_robots))
|
||||
var/n_e_robots = 0
|
||||
for(var/mob/living/silicon/robot/R in ai.connected_robots)
|
||||
if(R.emagged)
|
||||
n_e_robots++
|
||||
. += "<br>[n_e_robots] of [ai.connected_robots.len] slaved cyborgs are emagged. <a href='byond://?src=[UID()];silicon=unemagcyborgs'>Unemag</a>"
|
||||
. += "<br>[n_e_robots] of [length(ai.connected_robots)] slaved cyborgs are emagged. <a href='byond://?src=[UID()];silicon=unemagcyborgs'>Unemag</a>"
|
||||
|
||||
/datum/mind/proc/memory_edit_uplink()
|
||||
. = ""
|
||||
@@ -685,7 +685,7 @@
|
||||
|
||||
if("destroy")
|
||||
var/list/possible_targets = active_ais(1)
|
||||
if(possible_targets.len)
|
||||
if(length(possible_targets))
|
||||
var/mob/new_target = input("Select target:", "Objective target") as null|anything in possible_targets
|
||||
new_objective = new /datum/objective/destroy
|
||||
new_objective.target = new_target.mind
|
||||
@@ -1104,10 +1104,10 @@
|
||||
if(!(src in SSticker.mode.syndicates))
|
||||
SSticker.mode.syndicates += src
|
||||
SSticker.mode.update_synd_icons_added(src)
|
||||
if(SSticker.mode.syndicates.len==1)
|
||||
if(length(SSticker.mode.syndicates) == 1)
|
||||
SSticker.mode.prepare_syndicate_leader(src)
|
||||
else
|
||||
current.real_name = "[syndicate_name()] Operative #[SSticker.mode.syndicates.len-1]"
|
||||
current.real_name = "[syndicate_name()] Operative #[length(SSticker.mode.syndicates) - 1]"
|
||||
special_role = SPECIAL_ROLE_NUKEOPS
|
||||
to_chat(current, "<span class='notice'>You are a [syndicate_name()] agent!</span>")
|
||||
SSticker.mode.forge_syndicate_objectives(src)
|
||||
@@ -1134,7 +1134,7 @@
|
||||
if(!SSticker.mode.equip_syndicate(current))
|
||||
to_chat(usr, "<span class='warning'>Equipping a syndicate failed!</span>")
|
||||
return
|
||||
SSticker.mode.update_syndicate_id(current.mind, SSticker.mode.syndicates.len == 1)
|
||||
SSticker.mode.update_syndicate_id(current.mind, length(SSticker.mode.syndicates) == 1)
|
||||
log_admin("[key_name(usr)] has equipped [key_name(current)] as a nuclear operative")
|
||||
message_admins("[key_name_admin(usr)] has equipped [key_name_admin(current)] as a nuclear operative")
|
||||
|
||||
@@ -1593,10 +1593,10 @@
|
||||
if(!(src in SSticker.mode.syndicates))
|
||||
SSticker.mode.syndicates += src
|
||||
SSticker.mode.update_synd_icons_added(src)
|
||||
if(SSticker.mode.syndicates.len==1)
|
||||
if(length(SSticker.mode.syndicates) == 1)
|
||||
SSticker.mode.prepare_syndicate_leader(src)
|
||||
else
|
||||
current.real_name = "[syndicate_name()] Operative #[SSticker.mode.syndicates.len-1]"
|
||||
current.real_name = "[syndicate_name()] Operative #[length(SSticker.mode.syndicates) - 1]"
|
||||
special_role = SPECIAL_ROLE_NUKEOPS
|
||||
assigned_role = SPECIAL_ROLE_NUKEOPS
|
||||
to_chat(current, "<span class='notice'>You are a [syndicate_name()] agent!</span>")
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
for(var/edit in vedits)
|
||||
if(istext(vedits[edit]) || isnum(vedits[edit]) || isnull(vedits[edit]))
|
||||
stripped_edits[edit] = vedits[edit]
|
||||
if(stripped_edits.len)
|
||||
if(length(stripped_edits))
|
||||
stripped_vv[slot] = stripped_edits
|
||||
.["vv_values"] = stripped_vv
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
LAZYINITLIST(user.progressbars[bar.loc])
|
||||
var/list/bars = user.progressbars[bar.loc]
|
||||
bars.Add(src)
|
||||
listindex = bars.len
|
||||
listindex = length(bars)
|
||||
animate(bar, pixel_y = 32 + (PROGRESSBAR_HEIGHT * (listindex - 1)), alpha = 255, time = 5, easing = SINE_EASING)
|
||||
|
||||
/datum/progressbar/proc/update(progress)
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
var/list/bars = user.progressbars[bar.loc]
|
||||
bars.Remove(src)
|
||||
if(!bars.len)
|
||||
if(!length(bars))
|
||||
LAZYREMOVE(user.progressbars, bar.loc)
|
||||
animate(bar, alpha = 0, time = 5)
|
||||
spawn(5)
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
width--
|
||||
width = 1 + (2 * width)
|
||||
|
||||
for(var/k in 1 to atoms.len)
|
||||
for(var/k in 1 to length(atoms))
|
||||
var/atom/thing = atoms[k]
|
||||
if(!thing)
|
||||
continue
|
||||
|
||||
@@ -47,9 +47,9 @@
|
||||
return
|
||||
devices_line += device
|
||||
// var/list/obj/devices_line___ = devices[filter_str]
|
||||
// var/l = devices_line___.len
|
||||
//log_admin("DEBUG: devices_line.len=[devices_line.len]")
|
||||
//log_admin("DEBUG: devices(filter_str).len=[l]")
|
||||
// var/l = length(devices_line___)
|
||||
//log_admin("DEBUG: length(devices_line)=[length(devices_line)]")
|
||||
//log_admin("DEBUG: length(devices(filter_str))=[l]")
|
||||
|
||||
/datum/radio_frequency/proc/remove_listener(obj/device)
|
||||
for(var/devices_filter in devices)
|
||||
@@ -57,7 +57,7 @@
|
||||
devices_line-=device
|
||||
while(null in devices_line)
|
||||
devices_line -= null
|
||||
if(devices_line.len==0)
|
||||
if(length(devices_line) == 0)
|
||||
devices -= devices_filter
|
||||
qdel(devices_line)
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
. = -1
|
||||
else
|
||||
return 0
|
||||
if((reagents?(reagents.len):(0)) < avail_reagents.reagent_list.len)
|
||||
if((reagents?(length(reagents)):(0)) < length(avail_reagents.reagent_list))
|
||||
return -1
|
||||
return .
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
break
|
||||
if(!found)
|
||||
. = -1
|
||||
if(checklist.len)
|
||||
if(length(checklist))
|
||||
return 0
|
||||
return .
|
||||
|
||||
@@ -103,17 +103,17 @@
|
||||
for(var/datum/recipe/recipe in available_recipes)
|
||||
if(recipe.check_reagents(obj.reagents) == exact && recipe.check_items(obj, ignored_items) == exact)
|
||||
possible_recipes += recipe
|
||||
if(possible_recipes.len == 0)
|
||||
if(length(possible_recipes) == 0)
|
||||
return null
|
||||
else if(possible_recipes.len == 1)
|
||||
else if(length(possible_recipes) == 1)
|
||||
return possible_recipes[1]
|
||||
else //okay, let's select the most complicated recipe
|
||||
var/r_count = 0
|
||||
var/i_count = 0
|
||||
. = possible_recipes[1]
|
||||
for(var/datum/recipe/recipe in possible_recipes)
|
||||
var/N_i = (recipe.items)?(recipe.items.len):0
|
||||
var/N_r = (recipe.reagents)?(recipe.reagents.len):0
|
||||
var/N_i = (recipe.items)?(length(recipe.items)):0
|
||||
var/N_r = (recipe.reagents)?(length(recipe.reagents)):0
|
||||
if(N_i > i_count || (N_i== i_count && N_r > r_count))
|
||||
r_count = N_r
|
||||
i_count = N_i
|
||||
@@ -128,6 +128,6 @@
|
||||
|
||||
/datum/recipe/proc/count_n_items()
|
||||
var/count = 0
|
||||
if(items && items.len)
|
||||
count += items.len
|
||||
if(items && length(items))
|
||||
count += length(items)
|
||||
return count
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
if(clear)
|
||||
L+=T
|
||||
|
||||
if(!L.len)
|
||||
if(!length(L))
|
||||
to_chat(usr, "The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry.")
|
||||
return
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
var/list/tempL = L
|
||||
var/attempt = null
|
||||
var/success = 0
|
||||
while(tempL.len)
|
||||
while(length(tempL))
|
||||
attempt = pick(tempL)
|
||||
success = target.Move(attempt)
|
||||
if(!success)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
if(L.pulling && (isliving(L.pulling)))
|
||||
var/mob/living/M = L.pulling
|
||||
if(M.mob_spell_list.len != 0 || (M.mind && M.mind.spell_list.len != 0))
|
||||
if(length(M.mob_spell_list) != 0 || (M.mind && length(M.mind.spell_list) != 0))
|
||||
for(var/datum/spell/S in M.mob_spell_list)
|
||||
S.cooldown_handler.revert_cast()
|
||||
if(M.mind)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
if(delay <= 0 || do_after(user, delay, target = user))
|
||||
for(var/i=0,i<summon_amt,i++)
|
||||
if(!targets.len)
|
||||
if(!length(targets))
|
||||
break
|
||||
var/summoned_object_type = pick(summon_type)
|
||||
var/spawn_place = pick(targets)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
/datum/spell/horsemask/cast(list/targets, mob/user = usr)
|
||||
if(!targets.len)
|
||||
if(!length(targets))
|
||||
to_chat(user, "<span class='notice'>No target found in range.</span>")
|
||||
return
|
||||
|
||||
|
||||
@@ -50,18 +50,18 @@ Also, you never added distance checking after target is selected. I've went ahea
|
||||
var/mob/living/caster = user//The wizard/whomever doing the body transferring.
|
||||
|
||||
//MIND TRANSFER BEGIN
|
||||
if(caster.mind.special_verbs.len)//If the caster had any special verbs, remove them from the mob verb list.
|
||||
if(length(caster.mind.special_verbs))//If the caster had any special verbs, remove them from the mob verb list.
|
||||
for(var/V in caster.mind.special_verbs)//Since the caster is using an object spell system, this is mostly moot.
|
||||
remove_verb(caster, V) //But a safety nontheless.
|
||||
|
||||
if(victim.mind.special_verbs.len)//Now remove all of the victim's verbs.
|
||||
if(length(victim.mind.special_verbs))//Now remove all of the victim's verbs.
|
||||
for(var/V in victim.mind.special_verbs)
|
||||
remove_verb(victim, V)
|
||||
|
||||
var/mob/dead/observer/ghost = victim.ghostize(0)
|
||||
caster.mind.transfer_to(victim)
|
||||
|
||||
if(victim.mind.special_verbs.len)//To add all the special verbs for the original caster.
|
||||
if(length(victim.mind.special_verbs))//To add all the special verbs for the original caster.
|
||||
for(var/V in caster.mind.special_verbs)//Not too important but could come into play.
|
||||
add_verb(caster, V)
|
||||
|
||||
@@ -71,7 +71,7 @@ Also, you never added distance checking after target is selected. I've went ahea
|
||||
caster.key = ghost.key //have to transfer the key since the mind was not active
|
||||
qdel(ghost)
|
||||
|
||||
if(caster.mind.special_verbs.len)//If they had any special verbs, we add them here.
|
||||
if(length(caster.mind.special_verbs))//If they had any special verbs, we add them here.
|
||||
for(var/V in caster.mind.special_verbs)
|
||||
add_verb(caster, V)
|
||||
//MIND TRANSFER END
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
continue
|
||||
turfs += T
|
||||
|
||||
if(!turfs.len)
|
||||
if(!length(turfs))
|
||||
var/list/turfs_to_pick_from = list()
|
||||
for(var/turf/T in orange(target,outer_tele_radius))
|
||||
if(!(T in orange(target,inner_tele_radius)))
|
||||
|
||||
@@ -6,7 +6,7 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item))
|
||||
var/list/uplink_items = list()
|
||||
var/list/sales_items = list()
|
||||
var/newreference = 1
|
||||
if(!uplink_items.len)
|
||||
if(!length(uplink_items))
|
||||
|
||||
var/list/last = list()
|
||||
for(var/path in GLOB.uplink_items)
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
if(!golemShuttleOnPlanet)
|
||||
eligible_areas -= get_areas(/area/shuttle/freegolem)
|
||||
|
||||
for(var/i in 1 to eligible_areas.len)
|
||||
for(var/i in 1 to length(eligible_areas))
|
||||
var/area/place = eligible_areas[i]
|
||||
if(place.outdoors)
|
||||
outside_areas += place
|
||||
|
||||
Reference in New Issue
Block a user