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
+3 -3
View File
@@ -6,7 +6,7 @@
/proc/chem_splash(turf/epicenter, affected_range = 3, list/datum/reagents/reactants = list(), extra_heat = 0, threatscale = 1, adminlog = 1)
if(!isturf(epicenter) || !reactants.len || threatscale <= 0)
if(!isturf(epicenter) || !length(reactants) || threatscale <= 0)
return
var/has_reagents
var/total_reagents
@@ -25,7 +25,7 @@
for(var/datum/reagents/R in reactants)
R.trans_to(splash_holder, R.total_volume, threatscale, 1, 1)
total_temp += R.chem_temp
splash_holder.set_reagent_temp((total_temp / reactants.len) + extra_heat) // Average temperature of reagents + extra heat.
splash_holder.set_reagent_temp((total_temp / length(reactants)) + extra_heat) // Average temperature of reagents + extra heat.
if(splash_holder.total_volume && affected_range >= 0) //The possible reactions didnt use up all reagents, so we spread it around.
var/datum/effect_system/steam_spread/steam = new /datum/effect_system/steam_spread()
@@ -63,7 +63,7 @@
reactable |= A
if(extra_heat >= 300)
T.hotspot_expose(extra_heat*2, 5)
if(!reactable.len) //Nothing to react with. Probably means we're in nullspace.
if(!length(reactable)) //Nothing to react with. Probably means we're in nullspace.
return
for(var/thing in reactable)
var/atom/A = thing
@@ -165,7 +165,7 @@
var/beakerContents[0]
var/beakerCurrentVolume = 0
if(beaker && beaker.reagents && beaker.reagents.reagent_list.len)
if(beaker && beaker.reagents && length(beaker.reagents.reagent_list))
for(var/datum/reagent/R in beaker.reagents.reagent_list)
beakerContents.Add(list(list("name" = R.name, "id"=R.id, "volume" = R.volume))) // list in a list because Byond merges the first list...
beakerCurrentVolume += R.volume
@@ -435,7 +435,7 @@
data["loaded_pill_bottle"] = loaded_pill_bottle ? TRUE : FALSE
if(loaded_pill_bottle)
data["loaded_pill_bottle_name"] = loaded_pill_bottle.name
data["loaded_pill_bottle_contents_len"] = loaded_pill_bottle.contents.len
data["loaded_pill_bottle_contents_len"] = length(loaded_pill_bottle.contents)
data["loaded_pill_bottle_storage_slots"] = loaded_pill_bottle.storage_slots
data["loaded_pill_bottle_style"] = loaded_pill_bottle.wrapper_color
@@ -28,7 +28,7 @@
/obj/machinery/computer/pandemic/proc/GetVirusByIndex(index)
if(beaker && beaker.reagents)
if(beaker.reagents.reagent_list.len)
if(length(beaker.reagents.reagent_list))
var/datum/reagent/blood/BL = locate() in beaker.reagents.reagent_list
if(BL)
if(BL.data && BL.data["viruses"])
@@ -37,7 +37,7 @@
/obj/machinery/computer/pandemic/proc/GetResistancesByIndex(index)
if(beaker && beaker.reagents)
if(beaker.reagents.reagent_list.len)
if(length(beaker.reagents.reagent_list))
var/datum/reagent/blood/BL = locate() in beaker.reagents.reagent_list
if(BL)
if(BL.data && BL.data["resistances"])
@@ -258,7 +258,7 @@
if(B)
Blood = B
break
if(!R.total_volume||!R.reagent_list.len)
if(!R.total_volume||!length(R.reagent_list))
dat += "The beaker is empty<BR>"
else if(!Blood)
dat += "No blood sample found in beaker."
@@ -272,7 +272,7 @@
if(Blood.data["viruses"])
var/list/vir = Blood.data["viruses"]
if(vir.len)
if(length(vir))
var/i = 0
for(var/thing in Blood.data["viruses"])
var/datum/disease/D = thing
@@ -314,7 +314,7 @@
dat += "<BR><b>Contains antibodies to:</b> "
if(Blood.data["resistances"])
var/list/res = Blood.data["resistances"]
if(res.len)
if(length(res))
dat += "<ul>"
var/i = 0
for(var/type in Blood.data["resistances"])
@@ -335,7 +335,7 @@
dat += "nothing<BR>"
else
dat += "nothing<BR>"
dat += "<BR><A href='byond://?src=[UID()];eject=1'>Eject beaker</A>[((R.total_volume&&R.reagent_list.len) ? "-- <A href='byond://?src=[UID()];empty_beaker=1'>Empty and eject beaker</A>":"")]<BR>"
dat += "<BR><A href='byond://?src=[UID()];eject=1'>Eject beaker</A>[((R.total_volume&&length(R.reagent_list)) ? "-- <A href='byond://?src=[UID()];empty_beaker=1'>Empty and eject beaker</A>":"")]<BR>"
dat += "<A href='byond://?src=[user.UID()];mach_close=pandemic'>Close</A>"
var/datum/browser/popup = new(user, "pandemic", name, 575, 400)
@@ -1454,7 +1454,7 @@
alcohol_description = "watery" //How the hell did you get negative boozepwr?
var/list/fruits = list()
if(names_in_order.len <= 3)
if(length(names_in_order) <= 3)
fruits = names_in_order
else
for(var/i in 1 to 3)
@@ -1464,10 +1464,10 @@
description = "A [alcohol_description] wine brewed from [fruit_list]."
var/flavor = ""
if(!primary_tastes.len)
if(!length(primary_tastes))
primary_tastes = list("[alcohol_description] alcohol")
flavor += english_list(primary_tastes)
if(secondary_tastes.len)
if(length(secondary_tastes))
flavor += ", with a hint of "
flavor += english_list(secondary_tastes)
taste_description = flavor
@@ -52,7 +52,7 @@
data = counterlist_normalise(supplied_data)
/datum/reagent/consumable/nutriment/on_merge(list/newdata, newvolume)
if(!islist(newdata) || !newdata.len)
if(!islist(newdata) || !length(newdata))
return
var/list/taste_amounts = list()
var/list/other_taste_amounts = newdata.Copy()
@@ -163,7 +163,7 @@
/obj/item/reagent_containers/hypospray/autoinjector/examine()
. = ..()
if(reagents && reagents.reagent_list.len)
if(reagents && length(reagents.reagent_list))
. += "<span class='notice'>It is currently loaded.</span>"
else
. += "<span class='notice'>It is spent.</span>"
@@ -57,7 +57,7 @@
if(reagents.chem_temp > 300 || reagents.chem_temp < 280) //harmful temperature
attack_log_type = ATKLOG_MOST
if(reagents.reagent_list.len == 1 && reagents.has_reagent("cleaner")) // Only create space cleaner logs if it's burning people from being too hot or cold
if(length(reagents.reagent_list) == 1 && reagents.has_reagent("cleaner")) // Only create space cleaner logs if it's burning people from being too hot or cold
if(attack_log_type == ATKLOG_ALMOSTALL)
return
@@ -245,7 +245,7 @@
var/turf/T2 = get_step(T,turn(direction, -90))
var/list/the_targets = list(T,T1,T2)
for(var/i=1, i<=Sprays.len, i++)
for(var/i=1, i<=length(Sprays), i++)
spawn()
var/obj/effect/decal/chempuff/D = Sprays[i]
if(!D) continue