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
@@ -3,9 +3,9 @@
var/list/RGB2 = rgb2num(rgb2)
// add missing alpha if needed
if(RGB1.len < RGB2.len) RGB1 += 255
else if(RGB2.len < RGB1.len) RGB2 += 255
var/usealpha = RGB1.len > 3
if(length(RGB1) < length(RGB2)) RGB1 += 255
else if(length(RGB2) < length(RGB1)) RGB2 += 255
var/usealpha = length(RGB1) > 3
var/r = round(RGB1[1] + (RGB2[1] - RGB1[1]) * amount, 1)
var/g = round(RGB1[2] + (RGB2[2] - RGB1[2]) * amount, 1)
+5 -5
View File
@@ -314,7 +314,7 @@
var/roletext = get_roletext(be_special_type)
var/list/candidates = list()
// Keep looping until we find a non-afk candidate within the time bracket (we limit the bracket to 10 minutes (6000))
while(!candidates.len && afk_bracket < 6000)
while(!length(candidates) && afk_bracket < 6000)
for(var/mob/dead/observer/G in GLOB.player_list)
if(G.client != null)
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
@@ -330,7 +330,7 @@
var/roletext = get_roletext(be_special_type)
var/list/candidates = list()
// Keep looping until we find a non-afk candidate within the time bracket (we limit the bracket to 10 minutes (6000))
while(!candidates.len && afk_bracket < 6000)
while(!length(candidates) && afk_bracket < 6000)
for(var/mob/dead/observer/G in GLOB.player_list)
if(G.client != null)
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
@@ -362,7 +362,7 @@
/proc/get_active_player_count()
// Get active players who are playing in the round
var/active_players = 0
for(var/i = 1; i <= GLOB.player_list.len; i++)
for(var/i = 1; i <= length(GLOB.player_list); i++)
var/mob/M = GLOB.player_list[i]
if(M && M.client)
if(isnewplayer(M)) // exclude people in the lobby
@@ -447,7 +447,7 @@
/proc/pollCandidatesWithVeto(adminclient, adminusr, max_slots, Question, be_special_type, antag_age_check = FALSE, poll_time = 300, ignore_respawnability = FALSE, min_hours = FALSE, flashwindow = TRUE, check_antaghud = TRUE, source, role_cleanname)
var/list/willing_ghosts = SSghost_spawns.poll_candidates(Question, be_special_type, antag_age_check, poll_time, ignore_respawnability, min_hours, flashwindow, check_antaghud, source, role_cleanname)
var/list/selected_ghosts = list()
if(!willing_ghosts.len)
if(!length(willing_ghosts))
return selected_ghosts
var/list/candidate_ghosts = willing_ghosts.Copy()
@@ -459,7 +459,7 @@
else
candidate_ghosts -= G
for(var/i = max_slots, (i > 0 && candidate_ghosts.len), i--)
for(var/i = max_slots, (i > 0 && length(candidate_ghosts)), i--)
var/this_ghost = input("Pick players. This will go on until there either no more ghosts to pick from or the [i] remaining slot(s) are full.", "Candidates") as null|anything in candidate_ghosts
candidate_ghosts -= this_ghost
selected_ghosts += this_ghost
+7 -7
View File
@@ -12,23 +12,23 @@
cmp = compare
/datum/heap/proc/IsEmpty()
return !L.len
return !length(L)
//Insert and place at its position a new node in the heap
/datum/heap/proc/Insert(atom/A)
L.Add(A)
Swim(L.len)
Swim(length(L))
//removes and returns the first element of the heap
//(i.e the max or the min dependant on the comparison function)
/datum/heap/proc/Pop()
if(!L.len)
if(!length(L))
return null
. = L[1]
L[1] = L[L.len]
L.Cut(L.len)
L[1] = L[length(L)]
L.Cut(length(L))
Sink(1)
@@ -53,10 +53,10 @@
//Returns the greater (relative to the comparison proc) of a node children
//or 0 if there's no child
/datum/heap/proc/GetGreaterChild(index)
if(index * 2 > L.len)
if(index * 2 > length(L))
return 0
if(index * 2 + 1 > L.len)
if(index * 2 + 1 > length(L))
return index * 2
if(call(cmp)(L[index * 2], L[index * 2 + 1]) < 0)
+3 -3
View File
@@ -86,7 +86,7 @@
var/curblend = A.blend_mode || defblend
if(A.overlays.len || A.underlays.len)
if(length(A.overlays) || length(A.underlays))
var/icon/flat = BLANK
// Layers will be a sorted list of icons/overlays, based on the order in which they are displayed
var/list/layers = list()
@@ -102,7 +102,7 @@
// Loop through the underlays, then overlays, sorting them into the layers list
for(var/process_set in 0 to 1)
var/list/process = process_set? A.overlays : A.underlays
for(var/i in 1 to process.len)
for(var/i in 1 to length(process))
var/image/current = process[i]
if(!current)
continue
@@ -114,7 +114,7 @@
return flat
current_layer = process_set + A.layer + current_layer / 1000
for(var/p in 1 to layers.len)
for(var/p in 1 to length(layers))
var/image/cmp = layers[p]
if(current_layer < layers[cmp])
layers.Insert(p, current)
+1 -1
View File
@@ -266,7 +266,7 @@ DEFINE_BITFIELD(smoothing_junction, list(
A.bottom_left_corner = se
new_overlays += se
if(new_overlays.len)
if(length(new_overlays))
A.add_overlay(new_overlays)
///Scans direction to find targets to smooth with.
+62 -62
View File
@@ -101,9 +101,9 @@
//Returns list element or null. Should prevent "index out of bounds" error.
/proc/listgetindex(list/list, index)
if(istype(list) && list.len)
if(istype(list) && length(list))
if(isnum(index))
if(InRange(index,1,list.len))
if(InRange(index,1,length(list)))
return list[index]
else if(index in list)
return list[index]
@@ -111,13 +111,13 @@
//Return either pick(list) or null if list is not of type /list or is empty
/proc/safepick(list/list)
if(!islist(list) || !list.len)
if(!islist(list) || !length(list))
return
return pick(list)
//Checks if the list is empty
/proc/isemptylist(list/list)
if(!list.len)
if(!length(list))
return 1
return 0
@@ -132,7 +132,7 @@
//Checks for specific types in specifically structured (Assoc "type" = TRUE) lists ('typecaches')
/proc/is_type_in_typecache(atom/A, list/L)
if(!L || !L.len || !A)
if(!L || !length(L) || !A)
return 0
return L[A.type]
@@ -250,7 +250,7 @@
//Pick a random element from the list and remove it from the list.
/proc/pick_n_take(list/listfrom)
if(listfrom.len > 0)
if(length(listfrom) > 0)
var/picked = pick(listfrom)
listfrom -= picked
return picked
@@ -275,12 +275,12 @@
//Returns the top(last) element from the list and removes it from the list (typical stack function)
/proc/pop(list/L)
if(L.len)
. = L[L.len]
if(length(L))
. = L[length(L)]
L.len--
/proc/popleft(list/L)
if(L.len)
if(length(L))
. = L[1]
L.Cut(1,2)
@@ -293,7 +293,7 @@
/proc/reverselist(list/L)
var/list/output = list()
if(L)
for(var/i = L.len; i >= 1; i--)
for(var/i = length(L); i >= 1; i--)
output += L[i]
return output
@@ -303,8 +303,8 @@
return
L = L.Copy()
for(var/i=1, i<L.len, ++i)
L.Swap(i,rand(i,L.len))
for(var/i=1, i<length(L), ++i)
L.Swap(i,rand(i,length(L)))
return L
@@ -316,9 +316,9 @@
//Mergesort: divides up the list into halves to begin the sort
/proc/sortKey(list/client/L, order = 1)
if(isnull(L) || L.len < 2)
if(isnull(L) || length(L) < 2)
return L
var/middle = L.len / 2 + 1
var/middle = length(L) / 2 + 1
return mergeKey(sortKey(L.Copy(0,middle)), sortKey(L.Copy(middle)), order)
//Mergsort: does the actual sorting and returns the results back to sortAtom
@@ -326,7 +326,7 @@
var/Li=1
var/Ri=1
var/list/result = new()
while(Li <= L.len && Ri <= R.len)
while(Li <= length(L) && Ri <= length(R))
var/client/rL = L[Li]
var/client/rR = R[Ri]
if(sorttext(rL.ckey, rR.ckey) == order)
@@ -334,16 +334,16 @@
else
result += R[Ri++]
if(Li <= L.len)
if(Li <= length(L))
return (result + L.Copy(Li, 0))
return (result + R.Copy(Ri, 0))
//Mergesort: divides up the list into halves to begin the sort
/proc/sortAtom(list/atom/L, order = 1)
listclearnulls(L)
if(isnull(L) || L.len < 2)
if(isnull(L) || length(L) < 2)
return L
var/middle = L.len / 2 + 1
var/middle = length(L) / 2 + 1
return mergeAtoms(sortAtom(L.Copy(0,middle)), sortAtom(L.Copy(middle)), order)
//Mergsort: does the actual sorting and returns the results back to sortAtom
@@ -352,7 +352,7 @@
var/Li=1
var/Ri=1
var/list/result = new()
while(Li <= L.len && Ri <= R.len)
while(Li <= length(L) && Ri <= length(R))
var/atom/rL = L[Li]
var/atom/rR = R[Ri]
if(sorttext(rL.name, rR.name) == order)
@@ -360,7 +360,7 @@
else
result += R[Ri++]
if(Li <= L.len)
if(Li <= length(L))
return (result + L.Copy(Li, 0))
return (result + R.Copy(Ri, 0))
@@ -371,9 +371,9 @@
/proc/sortRecord(list/datum/data/record/L, field = "name", order = 1)
if(isnull(L))
return list()
if(L.len < 2)
if(length(L) < 2)
return L
var/middle = L.len / 2 + 1
var/middle = length(L) / 2 + 1
return mergeRecordLists(sortRecord(L.Copy(0, middle), field, order), sortRecord(L.Copy(middle), field, order), field, order)
//Mergsort: does the actual sorting and returns the results back to sortRecord
@@ -382,7 +382,7 @@
var/Ri=1
var/list/result = new()
if(!isnull(L) && !isnull(R))
while(Li <= L.len && Ri <= R.len)
while(Li <= length(L) && Ri <= length(R))
var/datum/data/record/rL = L[Li]
if(isnull(rL))
L -= rL
@@ -396,7 +396,7 @@
else
result += R[Ri++]
if(Li <= L.len)
if(Li <= length(L))
return (result + L.Copy(Li, 0))
return (result + R.Copy(Ri, 0))
@@ -405,69 +405,69 @@
//Mergesort: any value in a list
/proc/sortList(list/L)
if(L.len < 2)
if(length(L) < 2)
return L
var/middle = L.len / 2 + 1 // Copy is first,second-1
var/middle = length(L) / 2 + 1 // Copy is first,second-1
return mergeLists(sortList(L.Copy(0,middle)), sortList(L.Copy(middle))) //second parameter null = to end of list
/proc/mergeLists(list/L, list/R)
var/Li=1
var/Ri=1
var/list/result = new()
while(Li <= L.len && Ri <= R.len)
while(Li <= length(L) && Ri <= length(R))
if(sorttext(L[Li], R[Ri]) < 1)
result += R[Ri++]
else
result += L[Li++]
if(Li <= L.len)
if(Li <= length(L))
return (result + L.Copy(Li, 0))
return (result + R.Copy(Ri, 0))
// List of lists, sorts by element[key] - for things like crew monitoring computer sorting records by name.
/proc/sortByKey(list/L, key)
if(L.len < 2)
if(length(L) < 2)
return L
var/middle = L.len / 2 + 1
var/middle = length(L) / 2 + 1
return mergeKeyedLists(sortByKey(L.Copy(0, middle), key), sortByKey(L.Copy(middle), key), key)
/proc/mergeKeyedLists(list/L, list/R, key)
var/Li=1
var/Ri=1
var/list/result = new()
while(Li <= L.len && Ri <= R.len)
while(Li <= length(L) && Ri <= length(R))
if(sorttext(L[Li][key], R[Ri][key]) < 1)
// Works around list += list2 merging lists; it's not pretty but it works
result += "temp item"
result[result.len] = R[Ri++]
result[length(result)] = R[Ri++]
else
result += "temp item"
result[result.len] = L[Li++]
result[length(result)] = L[Li++]
if(Li <= L.len)
if(Li <= length(L))
return (result + L.Copy(Li, 0))
return (result + R.Copy(Ri, 0))
//Mergesort: any value in a list, preserves key=value structure
/proc/sortAssoc(list/L)
if(L.len < 2)
if(length(L) < 2)
return L
var/middle = L.len / 2 + 1 // Copy is first,second-1
var/middle = length(L) / 2 + 1 // Copy is first,second-1
return mergeAssoc(sortAssoc(L.Copy(0,middle)), sortAssoc(L.Copy(middle))) //second parameter null = to end of list
/proc/mergeAssoc(list/L, list/R)
var/Li=1
var/Ri=1
var/list/result = new()
while(Li <= L.len && Ri <= R.len)
while(Li <= length(L) && Ri <= length(R))
if(sorttext(L[Li], R[Ri]) < 1)
result += R&R[Ri++]
else
result += L&L[Li++]
if(Li <= L.len)
if(Li <= length(L))
return (result + L.Copy(Li, 0))
return (result + R.Copy(Ri, 0))
@@ -475,7 +475,7 @@
/proc/bitfield2list(bitfield = 0, list/wordlist)
var/list/r = list()
if(istype(wordlist,/list))
var/max = min(wordlist.len,16)
var/max = min(length(wordlist),16)
var/bit = 1
for(var/i=1, i<=max, i++)
if(bitfield & bit)
@@ -506,12 +506,12 @@
//Don't use this on lists larger than half a dozen or so
/proc/insertion_sort_numeric_list_ascending(list/L)
//log_world("ascending len input: [L.len]")
//log_world("ascending len input: [length(L)]")
var/list/out = list(pop(L))
for(var/entry in L)
if(isnum(entry))
var/success = 0
for(var/i=1, i<=out.len, i++)
for(var/i=1, i<=length(out), i++)
if(entry <= out[i])
success = 1
out.Insert(i, entry)
@@ -519,13 +519,13 @@
if(!success)
out.Add(entry)
//log_world(" output: [out.len]")
//log_world(" output: [length(out)]")
return out
/proc/insertion_sort_numeric_list_descending(list/L)
//log_world("descending len input: [L.len]")
//log_world("descending len input: [length(L)]")
var/list/out = insertion_sort_numeric_list_ascending(L)
//log_world(" output: [out.len]")
//log_world(" output: [length(out)]")
return reverselist(out)
//Copies a list, and all lists inside it recusively
@@ -534,21 +534,21 @@
if(!islist(l))
return l
. = l.Copy()
for(var/i = 1 to l.len)
for(var/i = 1 to length(l))
if(islist(.[i]))
.[i] = .(.[i])
/proc/dd_sortedObjectList(list/L, list/cache = list())
if(L.len < 2)
if(length(L) < 2)
return L
var/middle = L.len / 2 + 1 // Copy is first,second-1
var/middle = length(L) / 2 + 1 // Copy is first,second-1
return dd_mergeObjectList(dd_sortedObjectList(L.Copy(0,middle), cache), dd_sortedObjectList(L.Copy(middle), cache), cache) //second parameter null = to end of list
/proc/dd_mergeObjectList(list/L, list/R, list/cache)
var/Li=1
var/Ri=1
var/list/result = new()
while(Li <= L.len && Ri <= R.len)
while(Li <= length(L) && Ri <= length(R))
var/LLi = L[Li]
var/RRi = R[Ri]
var/LLiV = cache[LLi]
@@ -564,14 +564,14 @@
else
result += R[Ri++]
if(Li <= L.len)
if(Li <= length(L))
return (result + L.Copy(Li, 0))
return (result + R.Copy(Ri, 0))
// Insert an object into a sorted list, preserving sortedness
/proc/dd_insertObjectList(list/L, O)
var/min = 1
var/max = L.len
var/max = length(L)
var/Oval = O:dd_SortValue()
while(1)
@@ -610,7 +610,7 @@
var/current_sort_text
for(current_sort_text in incoming)
low_index = 1
high_index = sorted_text.len
high_index = length(sorted_text)
while(low_index <= high_index)
// Figure out the midpoint, rounding up for fractions. (BYOND rounds down, so add 1 if necessary.)
midway_calc = (low_index + high_index) / 2
@@ -637,7 +637,7 @@
insert_index = low_index
// Special case adding to end of list.
if(insert_index > sorted_text.len)
if(insert_index > length(sorted_text))
sorted_text += current_sort_text
continue
@@ -673,13 +673,13 @@
#define LAZYINITLIST(L) if(!L) { L = list() }
#define UNSETEMPTY(L) if(L && !L.len) L = null
#define LAZYREMOVE(L, I) if(L) { L -= I; if(!L.len) { L = null; } }
#define UNSETEMPTY(L) if(L && !length(L)) L = null
#define LAZYREMOVE(L, I) if(L) { L -= I; if(!length(L)) { L = null; } }
#define LAZYADD(L, I) if(!L) { L = list(); } L += I;
#define LAZYOR(L, I) if(!L) { L = list(); } L |= I;
/// Adds I to L, initializing L if necessary, if I is not already in L
#define LAZYDISTINCTADD(L, I) if(!L) { L = list(); } L |= I;
#define LAZYACCESS(L, I) (L ? (isnum(I) ? (I > 0 && I <= L.len ? L[I] : null) : L[I]) : null)
#define LAZYACCESS(L, I) (L ? (isnum(I) ? (I > 0 && I <= length(L) ? L[I] : null) : L[I]) : null)
#define LAZYLEN(L) length(L) // Despite how pointless this looks, it's still needed in order to convey that the list is specificially a 'Lazy' list.
#define LAZYCLEARLIST(L) if(L) L.Cut()
@@ -707,8 +707,8 @@
if(!L)
return
for(var/i=1, i<L.len, ++i)
L.Swap(i,rand(i,L.len))
for(var/i=1, i<length(L), ++i)
L.Swap(i,rand(i,length(L)))
//Return a list with no duplicate entries
/proc/uniqueList(list/L)
@@ -792,13 +792,13 @@
//replaces reverseList ~Carnie
/proc/reverseRange(list/L, start = 1, end = 0)
if(L.len)
start = start % L.len
end = end % (L.len + 1)
if(length(L))
start = start % length(L)
end = end % (length(L) + 1)
if(start <= 0)
start += L.len
start += length(L)
if(end <= 0)
end += L.len + 1
end += length(L) + 1
--end
while(start < end)
+6 -6
View File
@@ -30,7 +30,7 @@
continue
valid_picks += test
if(!valid_picks.len) valid_picks += "Nude"
if(!length(valid_picks)) valid_picks += "Nude"
return pick(valid_picks)
@@ -58,7 +58,7 @@
if(species in S.species_allowed) //If the user's head is of a species the hairstyle allows, add it to the list.
valid_hairstyles += hairstyle
if(valid_hairstyles.len)
if(length(valid_hairstyles))
h_style = pick(valid_hairstyles)
return h_style
@@ -87,7 +87,7 @@
if(species in S.species_allowed) //If the user's head is of a species the facial hair style allows, add it to the list.
valid_facial_hairstyles += facialhairstyle
if(valid_facial_hairstyles.len)
if(length(valid_facial_hairstyles))
f_style = pick(valid_facial_hairstyles)
return f_style
@@ -102,7 +102,7 @@
continue
valid_head_accessories += head_accessory
if(valid_head_accessories.len)
if(length(valid_head_accessories))
ha_style = pick(valid_head_accessories)
return ha_style
@@ -141,7 +141,7 @@
continue
valid_markings += marking
if(valid_markings.len)
if(length(valid_markings))
m_style = pick(valid_markings)
return m_style
@@ -631,7 +631,7 @@ GLOBAL_LIST_EMPTY(do_after_once_tracker)
var/static/list/mob_spawn_meancritters = list() // list of possible hostile mobs
var/static/list/mob_spawn_nicecritters = list() // and possible friendly mobs
if(mob_spawn_meancritters.len <= 0 || mob_spawn_nicecritters.len <= 0)
if(length(mob_spawn_meancritters) <= 0 || length(mob_spawn_nicecritters) <= 0)
for(var/T in typesof(/mob/living/simple_animal))
var/mob/living/simple_animal/SA = T
switch(initial(SA.gold_core_spawnable))
+1 -1
View File
@@ -14,7 +14,7 @@
/proc/sanitize_inlist(value, list/List, default)
if(value in List) return value
if(default) return default
if(List && List.len)return pick(List)
if(length(List)) return pick(List)
/proc/sanitize_json(json_input)
if(length(json_input) && istext(json_input))
+5 -5
View File
@@ -1,12 +1,12 @@
//simple insertion sort - generally faster than merge for runs of 7 or smaller
/proc/sortInsert(list/L, cmp = GLOBAL_PROC_REF(cmp_numeric_asc), associative, fromIndex = 1, toIndex = 0)
if(L && L.len >= 2)
fromIndex = fromIndex % L.len
toIndex = toIndex % (L.len + 1)
if(length(L) >= 2)
fromIndex = fromIndex % length(L)
toIndex = toIndex % (length(L) + 1)
if(fromIndex <= 0)
fromIndex += L.len
fromIndex += length(L)
if(toIndex <= 0)
toIndex += L.len + 1
toIndex += length(L) + 1
var/datum/sortInstance/SI = GLOB.sortInstance
if(!SI)
+5 -5
View File
@@ -1,12 +1,12 @@
//merge-sort - gernerally faster than insert sort, for runs of 7 or larger
/proc/sortMerge(list/L, cmp = GLOBAL_PROC_REF(cmp_numeric_asc), associative, fromIndex = 1, toIndex)
if(L && L.len >= 2)
fromIndex = fromIndex % L.len
toIndex = toIndex % (L.len + 1)
if(L && length(L) >= 2)
fromIndex = fromIndex % length(L)
toIndex = toIndex % (length(L) + 1)
if(fromIndex <= 0)
fromIndex += L.len
fromIndex += length(L)
if(toIndex <= 0)
toIndex += L.len + 1
toIndex += length(L) + 1
var/datum/sortInstance/SI = GLOB.sortInstance
if(!SI)
+5 -5
View File
@@ -1,12 +1,12 @@
//TimSort interface
/proc/sortTim(list/L, cmp = GLOBAL_PROC_REF(cmp_numeric_asc), associative, fromIndex = 1, toIndex = 0)
if(L && L.len >= 2)
fromIndex = fromIndex % L.len
toIndex = toIndex % (L.len + 1)
if(L && length(L) >= 2)
fromIndex = fromIndex % length(L)
toIndex = toIndex % (length(L) + 1)
if(fromIndex <= 0)
fromIndex += L.len
fromIndex += length(L)
if(toIndex <= 0)
toIndex += L.len + 1
toIndex += length(L) + 1
var/datum/sortInstance/SI = GLOB.sortInstance
if(!SI)
+11 -11
View File
@@ -75,7 +75,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sortInstance, new())
//Merge all remaining runs to complete sort
//ASSERT(start == end)
mergeForceCollapse();
//ASSERT(runBases.len == 1)
//ASSERT(length(runBases) == 1)
//reset minGallop, for successive calls
minGallop = MIN_GALLOP
@@ -177,8 +177,8 @@ reverse a descending sequence without violating stability.
//This method is called each time a new run is pushed onto the stack.
//So the invariants are guaranteed to hold for i<stackSize upon entry to the method
/datum/sortInstance/proc/mergeCollapse()
while(runBases.len >= 2)
var/n = runBases.len - 1
while(length(runBases) >= 2)
var/n = length(runBases) - 1
if(n > 1 && runLens[n - 1] <= runLens[n] + runLens[n + 1])
if(runLens[n - 1] < runLens[n + 1])
--n
@@ -192,8 +192,8 @@ reverse a descending sequence without violating stability.
//Merges all runs on the stack until only one remains.
//Called only once, to finalise the sort
/datum/sortInstance/proc/mergeForceCollapse()
while(runBases.len >= 2)
var/n = runBases.len - 1
while(length(runBases) >= 2)
var/n = length(runBases) - 1
if(n > 1 && runLens[n - 1] < runLens[n + 1])
--n
mergeAt(n)
@@ -203,9 +203,9 @@ reverse a descending sequence without violating stability.
//Run i must be the penultimate or antepenultimate run on the stack
//In other words, i must be equal to stackSize-2 or stackSize-3
/datum/sortInstance/proc/mergeAt(i)
//ASSERT(runBases.len >= 2)
//ASSERT(length(runBases) >= 2)
//ASSERT(i >= 1)
//ASSERT(i == runBases.len - 1 || i == runBases.len - 2)
//ASSERT(i == length(runBases) - 1 || i == length(runBases) - 2)
var/base1 = runBases[i]
var/base2 = runBases[i + 1]
@@ -590,8 +590,8 @@ reverse a descending sequence without violating stability.
while(remaining > 0)
while(runBases.len >= 2)
var/n = runBases.len - 1
while(length(runBases) >= 2)
var/n = length(runBases) - 1
if(n > 1 && runLens[n - 1] <= runLens[n] + runLens[n + 1])
if(runLens[n - 1] < runLens[n + 1])
--n
@@ -601,8 +601,8 @@ reverse a descending sequence without violating stability.
else
break //Invariant is established
while(runBases.len >= 2)
var/n = runBases.len - 1
while(length(runBases) >= 2)
var/n = length(runBases) - 1
if(n > 1 && runLens[n - 1] < runLens[n + 1])
--n
mergeAt2(n)
+2 -2
View File
@@ -553,9 +553,9 @@
if(tag == "img")
var/list/img_props = splittext(arg, ";")
if(img_props.len == 3)
if(length(img_props) == 3)
return "<img src='[img_props[1]]' width='[img_props[2]]' height='[img_props[3]]'>"
if(img_props.len == 2)
if(length(img_props) == 2)
return "<img src='[img_props[1]]' width='[img_props[2]]'>"
return "<img src='[arg]'>"
+1 -1
View File
@@ -313,7 +313,7 @@
if(entry == null)
return null
matrix_list += entry
if(matrix_list.len < 6)
if(length(matrix_list) < 6)
return null
var/a = matrix_list[1]
var/b = matrix_list[2]
+2 -2
View File
@@ -776,10 +776,10 @@ so as to remain in compliance with the most up-to-date laws."
return FALSE
var/icon_pref
if(!hud_shown)
for(var/i in 1 to alerts.len)
for(var/i in 1 to length(alerts))
mymob.client.screen -= alerts[alerts[i]]
return TRUE
for(var/i in 1 to alerts.len)
for(var/i in 1 to length(alerts))
var/atom/movable/screen/alert/alert = alerts[alerts[i]]
if(alert.icon_state == "template")
if(!icon_pref)
+12 -12
View File
@@ -90,9 +90,9 @@ GLOBAL_LIST_EMPTY(radial_menus)
zone = 360 - starting_angle + ending_angle
max_elements = round(zone / min_angle)
var/paged = max_elements < choices.len
if(elements.len < max_elements)
var/elements_to_add = max_elements - elements.len
var/paged = max_elements < length(choices)
if(length(elements) < max_elements)
var/elements_to_add = max_elements - length(elements)
for(var/i in 1 to elements_to_add) //Create all elements
var/atom/movable/screen/radial/new_element = new /atom/movable/screen/radial/slice
new_element.parent = src
@@ -102,18 +102,18 @@ GLOBAL_LIST_EMPTY(radial_menus)
page_data = list(null)
var/list/current = list()
var/list/choices_left = choices.Copy()
while(choices_left.len)
if(current.len == max_elements)
while(length(choices_left))
if(length(current) == max_elements)
page_data[page] = current
page++
page_data.len++
current = list()
if(paged && current.len == max_elements - 1)
if(paged && length(current) == max_elements - 1)
current += NEXT_PAGE_ID
continue
else
current += popleft(choices_left)
if(paged && current.len < max_elements)
if(paged && length(current) < max_elements)
current += NEXT_PAGE_ID
page_data[page] = current
@@ -123,14 +123,14 @@ GLOBAL_LIST_EMPTY(radial_menus)
/datum/radial_menu/proc/update_screen_objects()
var/list/page_choices = page_data[current_page]
var/angle_per_element = round(zone / page_choices.len)
var/angle_per_element = round(zone / length(page_choices))
if(current_user.mob.z && anchor.z)
pixel_x_difference = ((world.icon_size * anchor.x) + anchor.step_x + anchor.pixel_x) - ((world.icon_size * current_user.mob.x) + current_user.mob.step_x + current_user.mob.pixel_x)
pixel_y_difference = ((world.icon_size * anchor.y) + anchor.step_y + anchor.pixel_y) - ((world.icon_size * current_user.mob.y) + current_user.mob.step_y + current_user.mob.pixel_y)
for(var/i in 1 to elements.len)
for(var/i in 1 to length(elements))
var/atom/movable/screen/radial/E = elements[i]
var/angle = WRAP(starting_angle + (i - 1) * angle_per_element, 0, 360)
if(i > page_choices.len)
if(i > length(page_choices))
HideElement(E)
else
SetElement(E,page_choices[i], angle)
@@ -187,10 +187,10 @@ GLOBAL_LIST_EMPTY(radial_menus)
selected_choice = choices_values[choice_id]
/datum/radial_menu/proc/get_next_id()
return "c_[choices.len]"
return "c_[length(choices)]"
/datum/radial_menu/proc/set_choices(list/new_choices)
if(choices.len)
if(length(choices))
Reset()
for(var/E in new_choices)
var/id = get_next_id()
+1 -1
View File
@@ -216,7 +216,7 @@
if(!R.robot_modules_background)
return
var/display_rows = CEILING(R.module.modules.len / 8, 1)
var/display_rows = CEILING(length(R.module.modules) / 8, 1)
R.robot_modules_background.screen_loc = "CENTER-4:16,SOUTH+1:7 to CENTER+3:16,SOUTH+[display_rows]:7"
R.client.screen += R.robot_modules_background
+1 -1
View File
@@ -204,7 +204,7 @@
return
if(I in S.contents) // If the item is already in the storage, move them to the end of the list
if(S.contents[S.contents.len] == I) // No point moving them at the end if they're already there!
if(S.contents[length(S.contents)] == I) // No point moving them at the end if they're already there!
return
var/list/new_contents = S.contents.Copy()
+1 -1
View File
@@ -145,7 +145,7 @@
if(I.discrete)
return
var/message_verb = "attacked"
if(I.attack_verb && I.attack_verb.len)
if(I.attack_verb && length(I.attack_verb))
message_verb = "[pick(I.attack_verb)]"
else if(!I.force)
return
+4 -4
View File
@@ -52,10 +52,10 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars)
gvars_datum_init_order = list()
gvars_datum_protected_varlist = list("gvars_datum_protected_varlist" = TRUE)
var/list/global_procs = typesof(/datum/controller/global_vars/proc)
var/expected_len = vars.len - gvars_datum_in_built_vars.len
if(global_procs.len != expected_len)
warning("Unable to detect all global initialization procs! Expected [expected_len] got [global_procs.len]!")
if(global_procs.len)
var/expected_len = length(vars) - length(gvars_datum_in_built_vars)
if(length(global_procs) != expected_len)
warning("Unable to detect all global initialization procs! Expected [expected_len] got [length(global_procs)]!")
if(length(global_procs))
var/list/expected_global_procs = vars - gvars_datum_in_built_vars
for(var/I in global_procs)
expected_global_procs -= replacetext("[I]", "InitGlobal", "")
+2 -2
View File
@@ -332,9 +332,9 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
var/ss_runlevels = SS.runlevels
var/added_to_any = FALSE
for(var/I in 1 to GLOB.bitflags.len)
for(var/I in 1 to length(GLOB.bitflags))
if(ss_runlevels & GLOB.bitflags[I])
while(runlevel_sorted_subsystems.len < I)
while(length(runlevel_sorted_subsystems) < I)
runlevel_sorted_subsystems += list(list())
runlevel_sorted_subsystems[I] += SS
added_to_any = TRUE
+2 -2
View File
@@ -25,8 +25,8 @@ SUBSYSTEM_DEF(acid)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/O = currentrun[currentrun.len]
while(length(currentrun))
var/obj/O = currentrun[length(currentrun)]
currentrun.len--
if(!O || QDELETED(O))
processing -= O
+1 -1
View File
@@ -86,7 +86,7 @@ SUBSYSTEM_DEF(afk)
/datum/controller/subsystem/afk/proc/removeFromWatchList(list/toRemove)
for(var/C in toRemove)
for(var/i in 1 to afk_players.len)
for(var/i in 1 to length(afk_players))
if(afk_players[i] == C)
afk_players.Cut(i, i + 1)
break
+23 -23
View File
@@ -59,13 +59,13 @@ SUBSYSTEM_DEF(air)
msg += "DPN:[round(cost_deferred_pipenets,1)]|"
msg += "AM:[round(cost_atmos_machinery,1)]"
msg += "} "
msg += "AT:[active_turfs.len]|"
msg += "EG:[excited_groups.len]|"
msg += "HS:[hotspots.len]|"
msg += "PN:[networks.len]|"
msg += "HP:[high_pressure_delta.len]|"
msg += "AS:[active_super_conductivity.len]|"
msg += "AT/MS:[round((cost ? active_turfs.len/cost : 0),0.1)]"
msg += "AT:[length(active_turfs)]|"
msg += "EG:[length(excited_groups)]|"
msg += "HS:[length(hotspots)]|"
msg += "PN:[length(networks)]|"
msg += "HP:[length(high_pressure_delta)]|"
msg += "AS:[length(active_super_conductivity)]|"
msg += "AT/MS:[round((cost ? length(active_turfs)/cost : 0),0.1)]"
return msg.Join("")
/datum/controller/subsystem/air/get_metrics()
@@ -179,8 +179,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = deferred_pipenet_rebuilds.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/machinery/atmospherics/A = currentrun[currentrun.len]
while(length(currentrun))
var/obj/machinery/atmospherics/A = currentrun[length(currentrun)]
currentrun.len--
if(A)
A.build_network(remove_deferral = TRUE)
@@ -194,8 +194,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = networks.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/datum/pipeline/thing = currentrun[currentrun.len]
while(length(currentrun))
var/datum/pipeline/thing = currentrun[length(currentrun)]
currentrun.len--
if(thing)
thing.process()
@@ -210,8 +210,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = atmos_machinery.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/machinery/atmospherics/M = currentrun[currentrun.len]
while(length(currentrun))
var/obj/machinery/atmospherics/M = currentrun[length(currentrun)]
currentrun.len--
if(!M || (M.process_atmos(seconds) == PROCESS_KILL))
atmos_machinery.Remove(M)
@@ -223,8 +223,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = active_super_conductivity.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/turf/simulated/T = currentrun[currentrun.len]
while(length(currentrun))
var/turf/simulated/T = currentrun[length(currentrun)]
currentrun.len--
T.super_conduct()
if(MC_TICK_CHECK)
@@ -235,8 +235,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = hotspots.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/effect/hotspot/H = currentrun[currentrun.len]
while(length(currentrun))
var/obj/effect/hotspot/H = currentrun[length(currentrun)]
currentrun.len--
if(H)
H.process()
@@ -246,8 +246,8 @@ SUBSYSTEM_DEF(air)
return
/datum/controller/subsystem/air/proc/process_high_pressure_delta(resumed = 0)
while(high_pressure_delta.len)
var/turf/simulated/T = high_pressure_delta[high_pressure_delta.len]
while(length(high_pressure_delta))
var/turf/simulated/T = high_pressure_delta[length(high_pressure_delta)]
high_pressure_delta.len--
T.high_pressure_movements()
T.pressure_difference = 0
@@ -261,8 +261,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = active_turfs.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/turf/simulated/T = currentrun[currentrun.len]
while(length(currentrun))
var/turf/simulated/T = currentrun[length(currentrun)]
currentrun.len--
if(T)
T.process_cell(fire_count)
@@ -274,8 +274,8 @@ SUBSYSTEM_DEF(air)
src.currentrun = excited_groups.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/datum/excited_group/EG = currentrun[currentrun.len]
while(length(currentrun))
var/datum/excited_group/EG = currentrun[length(currentrun)]
currentrun.len--
EG.breakdown_cooldown++
if(EG.breakdown_cooldown == 10)
+5 -5
View File
@@ -68,10 +68,10 @@ SUBSYSTEM_DEF(blackbox)
/datum/controller/subsystem/blackbox/Shutdown()
sealed = FALSE
for(var/obj/machinery/message_server/MS in GLOB.message_servers)
if(MS.pda_msgs.len)
record_feedback("tally", "radio_usage", MS.pda_msgs.len, "PDA")
if(MS.rc_msgs.len)
record_feedback("tally", "radio_usage", MS.rc_msgs.len, "request console")
if(length(MS.pda_msgs))
record_feedback("tally", "radio_usage", length(MS.pda_msgs), "PDA")
if(length(MS.rc_msgs))
record_feedback("tally", "radio_usage", length(MS.rc_msgs), "request console")
if(length(research_levels))
record_feedback("associative", "high_research_level", 1, research_levels)
@@ -248,7 +248,7 @@ SUBSYSTEM_DEF(blackbox)
* * depth - Depth to use
*/
/datum/controller/subsystem/blackbox/proc/record_feedback_recurse_list(list/L, list/key_list, increment, depth = 1)
if(depth == key_list.len)
if(depth == length(key_list))
if(L.Find(key_list[depth]))
L["[key_list[depth]]"] += increment
else
+2 -2
View File
@@ -26,8 +26,8 @@ SUBSYSTEM_DEF(fires)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/O = currentrun[currentrun.len]
while(length(currentrun))
var/obj/O = currentrun[length(currentrun)]
currentrun.len--
if(!O || QDELETED(O))
processing -= O
+1 -1
View File
@@ -275,7 +275,7 @@ SUBSYSTEM_DEF(garbage)
/datum/controller/subsystem/garbage/Recover()
InitQueues() //We first need to create the queues before recovering data
if(istype(SSgarbage.queues))
for(var/i in 1 to SSgarbage.queues.len)
for(var/i in 1 to length(SSgarbage.queues))
queues[i] |= SSgarbage.queues[i]
+3 -3
View File
@@ -10,13 +10,13 @@ SUBSYSTEM_DEF(icon_smooth)
var/list/smooth_queue = list()
/datum/controller/subsystem/icon_smooth/fire()
while(smooth_queue.len)
var/atom/A = smooth_queue[smooth_queue.len]
while(length(smooth_queue))
var/atom/A = smooth_queue[length(smooth_queue)]
smooth_queue.len--
A.smooth_icon()
if(MC_TICK_CHECK)
return
if(!smooth_queue.len)
if(!length(smooth_queue))
can_fire = 0
/datum/controller/subsystem/icon_smooth/Initialize()
+2 -2
View File
@@ -24,8 +24,8 @@ SUBSYSTEM_DEF(idlenpcpool)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/mob/living/simple_animal/SA = currentrun[currentrun.len]
while(length(currentrun))
var/mob/living/simple_animal/SA = currentrun[length(currentrun)]
--currentrun.len
if(!SA)
log_debug("idlenpcpool encountered an invalid entry, resumed: [resumed], SA [SA], type of SA [SA?.type], null [SA == null], qdelled [QDELETED(SA)], SA in AI_IDLE list: [SA in GLOB.simple_animals[AI_IDLE]]")
+9 -9
View File
@@ -44,7 +44,7 @@ SUBSYSTEM_DEF(jobs)
/datum/controller/subsystem/jobs/proc/SetupOccupations(list/faction = list("Station"))
occupations = list()
var/list/all_jobs = subtypesof(/datum/job)
if(!all_jobs.len)
if(!length(all_jobs))
to_chat(world, "<span class='warning'>Error setting up jobs, no job datums found.</span>")
return 0
@@ -63,12 +63,12 @@ SUBSYSTEM_DEF(jobs)
job_debug.Add(text)
/datum/controller/subsystem/jobs/proc/GetJob(rank)
if(!occupations.len)
if(!length(occupations))
SetupOccupations()
return name_occupations[rank]
/datum/controller/subsystem/jobs/proc/GetJobType(jobtype)
if(!occupations.len)
if(!length(occupations))
SetupOccupations()
return type_occupations[jobtype]
@@ -235,7 +235,7 @@ SUBSYSTEM_DEF(jobs)
if(!job)
continue
var/list/candidates = FindOccupationCandidates(job, level)
if(!candidates.len)
if(!length(candidates))
continue
var/list/filteredCandidates = list()
@@ -246,7 +246,7 @@ SUBSYSTEM_DEF(jobs)
continue
filteredCandidates += V
if(!filteredCandidates.len)
if(!length(filteredCandidates))
continue
var/mob/new_player/candidate = pick(filteredCandidates)
@@ -263,7 +263,7 @@ SUBSYSTEM_DEF(jobs)
if(!job)
continue
var/list/candidates = FindOccupationCandidates(job, level)
if(!candidates.len)
if(!length(candidates))
continue
var/mob/new_player/candidate = pick(candidates)
AssignRole(candidate, command_position)
@@ -282,7 +282,7 @@ SUBSYSTEM_DEF(jobs)
for(var/level = 1 to 3)
var/list/candidates = list()
candidates = FindOccupationCandidates(job, level)
if(candidates.len)
if(length(candidates))
var/mob/new_player/candidate = pick(candidates)
if(AssignRole(candidate, "AI"))
ai_selected++
@@ -317,7 +317,7 @@ SUBSYSTEM_DEF(jobs)
if(player.ready && player.mind && !player.mind.assigned_role)
unassigned += player
Debug("DO, Len: [unassigned.len]")
Debug("DO, Len: [length(unassigned)]")
if(!length(unassigned))
return FALSE
@@ -330,7 +330,7 @@ SUBSYSTEM_DEF(jobs)
Debug("DO, Running Assistant Check 1")
var/datum/job/ast = new /datum/job/assistant()
var/list/assistant_candidates = FindOccupationCandidates(ast, 3)
Debug("AC1, Candidates: [assistant_candidates.len]")
Debug("AC1, Candidates: [length(assistant_candidates)]")
for(var/mob/new_player/player in assistant_candidates)
Debug("AC1 pass, Player: [player]")
AssignRole(player, "Assistant")
+7 -7
View File
@@ -39,15 +39,15 @@ SUBSYSTEM_DEF(machines)
propagate_network(PC, PC.powernet)
/datum/controller/subsystem/machines/get_stat_details()
return "Machines: [processing.len] | Powernets: [powernets.len] | Deferred: [deferred_powernet_rebuilds.len]"
return "Machines: [length(processing)] | Powernets: [length(powernets)] | Deferred: [length(deferred_powernet_rebuilds)]"
/datum/controller/subsystem/machines/proc/process_defered_powernets(resumed = 0)
if(!resumed)
src.currentrun = deferred_powernet_rebuilds.Copy()
//cache for sanid speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/O = currentrun[currentrun.len]
while(length(currentrun))
var/obj/O = currentrun[length(currentrun)]
currentrun.len--
if(O && !QDELETED(O))
var/datum/regional_powernet/newPN = new() // create a new powernet...
@@ -62,8 +62,8 @@ SUBSYSTEM_DEF(machines)
src.currentrun = powernets.Copy()
//cache for sanid speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/datum/regional_powernet/P = currentrun[currentrun.len]
while(length(currentrun))
var/datum/regional_powernet/P = currentrun[length(currentrun)]
currentrun.len--
if(P)
P.process_power() // reset the power state
@@ -78,8 +78,8 @@ SUBSYSTEM_DEF(machines)
src.currentrun = processing.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/obj/machinery/thing = currentrun[currentrun.len]
while(length(currentrun))
var/obj/machinery/thing = currentrun[length(currentrun)]
currentrun.len--
if(!QDELETED(thing) && thing.process(seconds) != PROCESS_KILL)
if(prob(MACHINE_FLICKER_CHANCE))
+2 -2
View File
@@ -35,8 +35,8 @@ SUBSYSTEM_DEF(mobs)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
var/times_fired = src.times_fired
while(currentrun.len)
var/mob/living/L = currentrun[currentrun.len]
while(length(currentrun))
var/mob/living/L = currentrun[length(currentrun)]
currentrun.len--
if(L)
L.Life(seconds, times_fired)
@@ -21,7 +21,7 @@ SUBSYSTEM_DEF(mob_hunt)
if(!server_status)
return
client_mob_update()
if(normal_spawns.len < max_normal_spawns)
if(length(normal_spawns) < max_normal_spawns)
spawn_mob()
//leaving this here in case admins want to use it for a random mini-event or something
@@ -51,7 +51,7 @@ SUBSYSTEM_DEF(mob_hunt)
if(!H || H != connected_clients[client])
ex_players |= connected_clients[client]
connected_clients[client] = H
if(ex_players.len) //to make sure we don't do this if we didn't lose any player since the last update
if(length(ex_players)) //to make sure we don't do this if we didn't lose any player since the last update
for(var/obj/effect/nanomob/N in (normal_spawns + trap_spawns))
N.conceal(ex_players)
@@ -59,7 +59,7 @@ SUBSYSTEM_DEF(mob_hunt)
if(server_status != 0)
return
server_status = 1
while(normal_spawns.len < max_normal_spawns) //repopulate the server's spawns completely if we auto-recover from crash
while(length(normal_spawns) < max_normal_spawns) //repopulate the server's spawns completely if we auto-recover from crash
spawn_mob()
/datum/controller/subsystem/mob_hunt/proc/manual_reboot()
@@ -94,7 +94,7 @@ SUBSYSTEM_DEF(mob_hunt)
var/obj/effect/nanomob/new_mob = new /obj/effect/nanomob(mob_info.spawn_point, mob_info)
trap_spawns += new_mob
new_mob.reveal()
if(trap_spawns.len > max_trap_spawns)
if(length(trap_spawns) > max_trap_spawns)
var/obj/effect/nanomob/old_trap = trap_spawns[1]
old_trap.despawn()
return 1
+2 -2
View File
@@ -18,8 +18,8 @@ SUBSYSTEM_DEF(npcpool)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/mob/living/simple_animal/SA = currentrun[currentrun.len]
while(length(currentrun))
var/mob/living/simple_animal/SA = currentrun[length(currentrun)]
--currentrun.len
if(!SA)
log_debug("npcpool encountered an invalid entry, resumed: [resumed], SA [SA], type of SA [SA?.type], null [SA == null], qdelled [QDELETED(SA)], SA in AI_ON list: [SA in GLOB.simple_animals[AI_ON]]")
+12 -12
View File
@@ -113,7 +113,7 @@ SUBSYSTEM_DEF(overlays)
priority_overlays.Cut()
//If not already queued for work and there are overlays to remove
if(NOT_QUEUED_ALREADY && remove_overlays.len)
if(NOT_QUEUED_ALREADY && length(remove_overlays))
QUEUE_FOR_COMPILE
/atom/proc/cut_overlay(list/overlays, priority)
@@ -123,9 +123,9 @@ SUBSYSTEM_DEF(overlays)
LAZYINITLIST(add_overlays) //always initialized after this point
LAZYINITLIST(priority_overlays)
LAZYINITLIST(remove_overlays)
var/a_len = add_overlays.len
var/r_len = remove_overlays.len
var/p_len = priority_overlays.len
var/a_len = length(add_overlays)
var/r_len = length(remove_overlays)
var/p_len = length(priority_overlays)
remove_overlays += overlays
add_overlays -= overlays
@@ -133,9 +133,9 @@ SUBSYSTEM_DEF(overlays)
var/list/cached_priority = priority_overlays
LAZYREMOVE(cached_priority, overlays)
var/fa_len = add_overlays.len
var/fr_len = remove_overlays.len
var/fp_len = priority_overlays.len
var/fa_len = length(add_overlays)
var/fr_len = length(remove_overlays)
var/fp_len = length(priority_overlays)
//If not already queued and there is work to be done
if(NOT_QUEUED_ALREADY && (fa_len != a_len || fr_len != r_len || fp_len != p_len))
@@ -149,17 +149,17 @@ SUBSYSTEM_DEF(overlays)
LAZYINITLIST(add_overlays) //always initialized after this point
LAZYINITLIST(priority_overlays)
var/a_len = add_overlays.len
var/p_len = priority_overlays.len
var/a_len = length(add_overlays)
var/p_len = length(priority_overlays)
if(priority)
priority_overlays += overlays //or in the image. Can we use [image] = image?
var/fp_len = priority_overlays.len
var/fp_len = length(priority_overlays)
if(NOT_QUEUED_ALREADY && fp_len != p_len)
QUEUE_FOR_COMPILE
else
add_overlays += overlays
var/fa_len = add_overlays.len
var/fa_len = length(add_overlays)
if(NOT_QUEUED_ALREADY && fa_len != a_len)
QUEUE_FOR_COMPILE
@@ -200,7 +200,7 @@ SUBSYSTEM_DEF(overlays)
var/list/cached_other = other.overlays.Copy()
if(cached_other)
if(cut_old || !overlays.len)
if(cut_old || !length(overlays))
overlays = cached_other
else
overlays |= cached_other
+1 -1
View File
@@ -31,7 +31,7 @@ SUBSYSTEM_DEF(parallax)
var/list/currentrun = src.currentrun
while(length(currentrun))
var/client/C = currentrun[currentrun.len]
var/client/C = currentrun[length(currentrun)]
currentrun.len--
if(!C || !C.eye)
if(MC_TICK_CHECK)
+1 -1
View File
@@ -27,7 +27,7 @@ SUBSYSTEM_DEF(ping)
var/list/current_run = src.current_run
while(length(current_run))
var/client/client = current_run[current_run.len]
var/client/client = current_run[length(current_run)]
current_run.len--
if(client?.tgui_panel?.is_ready())
+3 -3
View File
@@ -246,7 +246,7 @@ SUBSYSTEM_DEF(shuttle)
/datum/controller/subsystem/shuttle/proc/get_dock_overlap(x0, y0, x1, y1, z)
. = list()
var/list/stationary_cache = stationary
for(var/i in 1 to stationary_cache.len)
for(var/i in 1 to length(stationary_cache))
var/obj/docking_port/port = stationary_cache[i]
if(!port || port.z != z)
continue
@@ -254,7 +254,7 @@ SUBSYSTEM_DEF(shuttle)
var/list/overlap = get_overlap(x0, y0, x1, y1, bounds[1], bounds[2], bounds[3], bounds[4])
var/list/xs = overlap[1]
var/list/ys = overlap[2]
if(xs.len && ys.len)
if(length(xs) && length(ys))
.[port] = overlap
/datum/controller/subsystem/shuttle/proc/update_hidden_docking_ports(list/remove_turfs, list/add_turfs)
@@ -272,7 +272,7 @@ SUBSYSTEM_DEF(shuttle)
for(var/V in add_turfs)
var/turf/T = V
var/image/I
if(remove_images.len)
if(length(remove_images))
//we can just reuse any images we are about to delete instead of making new ones
I = remove_images[1]
remove_images.Cut(1, 2)
+2 -2
View File
@@ -26,8 +26,8 @@ SUBSYSTEM_DEF(spacedrift)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
var/atom/movable/AM = currentrun[currentrun.len]
while(length(currentrun))
var/atom/movable/AM = currentrun[length(currentrun)]
currentrun.len--
if(!AM)
processing -= AM
+2 -2
View File
@@ -42,8 +42,8 @@ SUBSYSTEM_DEF(tgui)
src.current_run = open_uis.Copy()
// Cache for sanic speed (lists are references anyways)
var/list/current_run = src.current_run
while(current_run.len)
var/datum/tgui/ui = current_run[current_run.len]
while(length(current_run))
var/datum/tgui/ui = current_run[length(current_run)]
current_run.len--
// TODO: Move user/src_object check to process()
if(ui && ui.user && ui.src_object)
+1 -1
View File
@@ -30,7 +30,7 @@ SUBSYSTEM_DEF(throwing)
var/list/currentrun = src.currentrun
while(length(currentrun))
var/atom/movable/AM = currentrun[currentrun.len]
var/atom/movable/AM = currentrun[length(currentrun)]
var/datum/thrownthing/TT = currentrun[AM]
currentrun.len--
if(!AM || !TT)
+4 -4
View File
@@ -529,9 +529,9 @@ SUBSYSTEM_DEF(ticker)
else
var/list/randomtips = file2list("strings/tips.txt")
var/list/memetips = file2list("strings/sillytips.txt")
if(randomtips.len && prob(95))
if(length(randomtips) && prob(95))
m = pick(randomtips)
else if(memetips.len)
else if(length(memetips))
m = pick(memetips)
if(m)
@@ -706,8 +706,8 @@ SUBSYSTEM_DEF(ticker)
for(var/loc_type in subtypesof(/datum/trade_destination))
var/datum/trade_destination/D = new loc_type
GLOB.weighted_randomevent_locations[D] = D.viable_random_events.len
GLOB.weighted_mundaneevent_locations[D] = D.viable_mundane_events.len
GLOB.weighted_randomevent_locations[D] = length(D.viable_random_events)
GLOB.weighted_mundaneevent_locations[D] = length(D.viable_mundane_events)
// Easy handler to make rebooting the world not a massive sleep in world/Reboot()
/datum/controller/subsystem/ticker/proc/reboot_helper(reason, end_string, delay)
@@ -36,7 +36,7 @@ SUBSYSTEM_DEF(atoms)
var/count
var/list/mapload_arg = list(TRUE)
if(atoms)
count = atoms.len
count = length(atoms)
for(var/I in atoms)
var/atom/A = I
if(A && !A.initialized)
@@ -58,7 +58,7 @@ SUBSYSTEM_DEF(atoms)
initialized = INITIALIZATION_INNEW_REGULAR
if(late_loaders.len)
if(length(late_loaders))
watch = start_watch()
if(noisy)
log_startup_progress("Late-initializing atoms...")
@@ -203,7 +203,7 @@ SUBSYSTEM_DEF(mapping)
log_startup_progress("Loaded Lavaland in [stop_watch(watch)]s")
/datum/controller/subsystem/mapping/proc/seedRuins(list/z_levels = null, budget = 0, whitelist = /area/space, list/potentialRuins)
if(!z_levels || !z_levels.len)
if(!z_levels || !length(z_levels))
WARNING("No Z levels provided - Not generating ruins")
return
@@ -230,10 +230,10 @@ SUBSYSTEM_DEF(mapping)
continue
ruins_availible[R] = R.placement_weight
while(budget > 0 && (ruins_availible.len || forced_ruins.len))
while(budget > 0 && (length(ruins_availible) || length(forced_ruins)))
var/datum/map_template/ruin/current_pick
var/forced = FALSE
if(forced_ruins.len) //We have something we need to load right now, so just pick it
if(length(forced_ruins)) //We have something we need to load right now, so just pick it
for(var/ruin in forced_ruins)
current_pick = ruin
if(forced_ruins[ruin] > 0) //Load into designated z
@@ -85,7 +85,7 @@ SUBSYSTEM_DEF(radio)
if(frequency)
frequency.remove_listener(device)
if(frequency.devices.len == 0)
if(length(frequency.devices) == 0)
qdel(frequency)
frequencies -= f_text
@@ -10,10 +10,10 @@ SUBSYSTEM_DEF(title)
for(var/S in provisional_title_screens)
var/list/L = splittext(S,"+")
if(L.len == 1 && L[1] != "blank.png")
if(length(L) == 1 && L[1] != "blank.png")
title_screens += S
else if(L.len > 1)
else if(length(L) > 1)
if(use_rare_screens && lowertext(L[1]) == "rare")
title_screens += S
@@ -21,7 +21,7 @@ SUBSYSTEM_DEF(title)
if(length(title_screens) > 1)
for(var/S in title_screens)
var/list/L = splittext(S,".")
if(L.len != 2 || L[1] != "default")
if(length(L) != 2 || L[1] != "default")
continue
title_screens -= S
break
@@ -26,8 +26,8 @@ SUBSYSTEM_DEF(processing)
//cache for sanic speed (lists are references anyways)
var/list/current_run = currentrun
while(current_run.len)
var/datum/thing = current_run[current_run.len]
while(length(current_run))
var/datum/thing = current_run[length(current_run)]
current_run.len--
if(QDELETED(thing))
processing -= thing
@@ -334,7 +334,7 @@ SUBSYSTEM_DEF(tickets)
for(var/datum/ticket/T in allTickets)
if(T.client_ckey == C.ckey && (T.ticketState == TICKET_OPEN || T.ticketState == TICKET_STALE))
tickets += T
if(tickets.len)
if(length(tickets))
return tickets
return FALSE
+13 -13
View File
@@ -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()
+4 -4
View File
@@ -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.
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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
View File
@@ -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))
+9 -9
View File
@@ -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"])
+17 -17
View File
@@ -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
+3 -3
View File
@@ -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)
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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
View File
@@ -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>")
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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
+4 -4
View File
@@ -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)
+8 -8
View File
@@ -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
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
+4 -4
View File
@@ -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
+1 -1
View File
@@ -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)))
+1 -1
View File
@@ -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
+3 -3
View File
@@ -23,7 +23,7 @@
displayTo - a list of MOBS to show this appearance to
*/
/datum/alternate_appearance/proc/display_to(list/displayTo)
if(!displayTo || !displayTo.len)
if(!displayTo || !length(displayTo))
return
for(var/m in displayTo)
var/mob/M = m
@@ -47,7 +47,7 @@
var/mob/M = m
if(M.client)
M.client.images -= img
if(M.viewing_alternate_appearances && M.viewing_alternate_appearances.len)
if(M.viewing_alternate_appearances && length(M.viewing_alternate_appearances))
M.viewing_alternate_appearances -= src
viewers -= M
@@ -94,7 +94,7 @@
if(alternate_appearances[key])
qdel(alternate_appearances[key])
alternate_appearances[key] = AA
if(displayTo && displayTo.len)
if(displayTo && length(displayTo))
display_alt_appearance(key, displayTo)
+5 -5
View File
@@ -133,7 +133,7 @@
/area/syndicate_depot/core/proc/armory_locker_looted()
if(!run_finished && !used_self_destruct)
if(shield_list.len)
if(length(shield_list))
activate_self_destruct("Armory compromised despite armory shield being online.", FALSE)
return
declare_finished()
@@ -221,7 +221,7 @@
var/obj/effect/landmark/L = thing
if(L.name == "syndi_depot_bot")
possible_bot_spawns |= L
if(possible_bot_spawns.len)
if(length(possible_bot_spawns))
var/obj/effect/landmark/S = pick(possible_bot_spawns)
new /obj/effect/portal(get_turf(S))
var/mob/living/simple_animal/bot/ed209/syndicate/B = new /mob/living/simple_animal/bot/ed209/syndicate(get_turf(S))
@@ -345,7 +345,7 @@
SEND_SOUND(R, sound('sound/misc/notice1.ogg'))
/area/syndicate_depot/core/proc/shields_up()
if(shield_list.len)
if(length(shield_list))
return
for(var/thing in GLOB.landmarks_list)
var/obj/effect/landmark/L = thing
@@ -362,7 +362,7 @@
A.lock()
/area/syndicate_depot/core/proc/shields_key_check()
if(!shield_list.len)
if(!length(shield_list))
return
if(detected_mech || detected_pod || detected_double_agent)
return
@@ -485,7 +485,7 @@
var/list/shield_list = list()
/area/syndicate_depot/perimeter/proc/perimeter_shields_up()
if(shield_list.len)
if(length(shield_list))
return
for(var/turf/T in src)
var/obj/machinery/shieldwall/syndicate/S = new /obj/machinery/shieldwall/syndicate(T)
+10 -10
View File
@@ -368,7 +368,7 @@
pass |= istype(A, type)
if(!pass)
continue
if(A.contents.len)
if(length(A.contents))
found += A.search_contents_for(path, filter_path)
return found
@@ -393,13 +393,13 @@
if(reagents)
if(container_type & TRANSPARENT)
. += "<span class='notice'>It contains:</span>"
if(reagents.reagent_list.len)
if(length(reagents.reagent_list))
if(user.can_see_reagents()) //Show each individual reagent
for(var/I in reagents.reagent_list)
var/datum/reagent/R = I
. += "<span class='notice'>[R.volume] units of [R.name]</span>"
else //Otherwise, just show the total volume
if(reagents && reagents.reagent_list.len)
if(reagents && length(reagents.reagent_list))
. += "<span class='notice'>[reagents.total_volume] units of various reagents.</span>"
else
. += "<span class='notice'>Nothing.</span>"
@@ -845,9 +845,9 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
/atom/proc/transfer_blood_dna(list/blood_dna)
if(!blood_DNA)
blood_DNA = list()
var/old_length = blood_DNA.len
var/old_length = length(blood_DNA)
blood_DNA |= blood_dna
if(blood_DNA.len > old_length)
if(length(blood_DNA) > old_length)
return TRUE//some new blood DNA was added
//to add blood from a mob onto something, and transfer their dna info
@@ -1027,7 +1027,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
var/cur_x = null
var/cur_y = null
var/list/y_arr = null
for(cur_x in 1 to GLOB.global_map.len)
for(cur_x in 1 to length(GLOB.global_map))
y_arr = GLOB.global_map[cur_x]
cur_y = y_arr.Find(src.z)
if(cur_y)
@@ -1155,12 +1155,12 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
Adds an instance of colour_type to the atom's atom_colours list
*/
/atom/proc/add_atom_colour(coloration, colour_priority)
if(!atom_colours || !atom_colours.len)
if(!atom_colours || !length(atom_colours))
atom_colours = list()
atom_colours.len = COLOUR_PRIORITY_AMOUNT //four priority levels currently.
if(!coloration)
return
if(colour_priority > atom_colours.len)
if(colour_priority > length(atom_colours))
return
atom_colours[colour_priority] = coloration
update_atom_colour()
@@ -1172,7 +1172,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
if(!atom_colours)
atom_colours = list()
atom_colours.len = COLOUR_PRIORITY_AMOUNT //four priority levels currently.
if(colour_priority > atom_colours.len)
if(colour_priority > length(atom_colours))
return
if(coloration && atom_colours[colour_priority] != coloration)
return //if we don't have the expected color (for a specific priority) to remove, do nothing
@@ -1191,7 +1191,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
for(var/C in atom_colours)
if(islist(C))
var/list/L = C
if(L.len)
if(length(L))
color = L
return
else if(C)
+4 -4
View File
@@ -126,9 +126,9 @@ GLOBAL_LIST_EMPTY(bad_blocks)
SetUIValueRange(DNA_UI_SKIN_TONE, 35-character.s_tone, 220, 1) // Value can be negative.
SetUIValueRange(DNA_UI_HEAD_MARK_STYLE, head_marks, GLOB.marking_styles_list.len, 1)
SetUIValueRange(DNA_UI_BODY_MARK_STYLE, body_marks, GLOB.marking_styles_list.len, 1)
SetUIValueRange(DNA_UI_TAIL_MARK_STYLE, tail_marks, GLOB.marking_styles_list.len, 1)
SetUIValueRange(DNA_UI_HEAD_MARK_STYLE, head_marks, length(GLOB.marking_styles_list), 1)
SetUIValueRange(DNA_UI_BODY_MARK_STYLE, body_marks, length(GLOB.marking_styles_list), 1)
SetUIValueRange(DNA_UI_TAIL_MARK_STYLE, tail_marks, length(GLOB.marking_styles_list), 1)
SetUIValueRange(DNA_UI_PHYSIQUE, GLOB.character_physiques.Find(character.physique), length(GLOB.character_physiques), 1)
SetUIValueRange(DNA_UI_HEIGHT, GLOB.character_heights.Find(character.height), length(GLOB.character_heights), 1)
@@ -393,7 +393,7 @@ GLOBAL_LIST_EMPTY(bad_blocks)
// Just checks our character has all the crap it needs.
/datum/dna/proc/check_integrity(mob/living/carbon/human/character)
if(character)
if(UI.len != DNA_UI_LENGTH)
if(length(UI) != DNA_UI_LENGTH)
ResetUIFrom(character)
if(length(struc_enzymes)!= 3 * DNA_SE_LENGTH)
+12 -12
View File
@@ -163,16 +163,16 @@
H.change_gender(PLURAL, FALSE)
//Head Markings
var/head_marks = dna.GetUIValueRange(DNA_UI_HEAD_MARK_STYLE, GLOB.marking_styles_list.len)
if((head_marks > 0) && (head_marks <= GLOB.marking_styles_list.len))
var/head_marks = dna.GetUIValueRange(DNA_UI_HEAD_MARK_STYLE, length(GLOB.marking_styles_list))
if((head_marks > 0) && (head_marks <= length(GLOB.marking_styles_list)))
H.m_styles["head"] = GLOB.marking_styles_list[head_marks]
//Body Markings
var/body_marks = dna.GetUIValueRange(DNA_UI_BODY_MARK_STYLE, GLOB.marking_styles_list.len)
if((body_marks > 0) && (body_marks <= GLOB.marking_styles_list.len))
var/body_marks = dna.GetUIValueRange(DNA_UI_BODY_MARK_STYLE, length(GLOB.marking_styles_list))
if((body_marks > 0) && (body_marks <= length(GLOB.marking_styles_list)))
H.m_styles["body"] = GLOB.marking_styles_list[body_marks]
//Tail Markings
var/tail_marks = dna.GetUIValueRange(DNA_UI_TAIL_MARK_STYLE, GLOB.marking_styles_list.len)
if((tail_marks > 0) && (tail_marks <= GLOB.marking_styles_list.len))
var/tail_marks = dna.GetUIValueRange(DNA_UI_TAIL_MARK_STYLE, length(GLOB.marking_styles_list))
if((tail_marks > 0) && (tail_marks <= length(GLOB.marking_styles_list)))
H.m_styles["tail"] = GLOB.marking_styles_list[tail_marks]
// Physique (examine fluff)
@@ -207,8 +207,8 @@
/datum/dna/proc/write_head_attributes(obj/item/organ/external/head/head_organ)
//Hair
var/hair = GetUIValueRange(DNA_UI_HAIR_STYLE,GLOB.hair_styles_full_list.len)
if((hair > 0) && (hair <= GLOB.hair_styles_full_list.len))
var/hair = GetUIValueRange(DNA_UI_HAIR_STYLE,length(GLOB.hair_styles_full_list))
if((hair > 0) && (hair <= length(GLOB.hair_styles_full_list)))
head_organ.h_style = GLOB.hair_styles_full_list[hair]
head_organ.hair_colour = rgb(head_organ.dna.GetUIValueRange(DNA_UI_HAIR_R, 255), head_organ.dna.GetUIValueRange(DNA_UI_HAIR_G, 255), head_organ.dna.GetUIValueRange(DNA_UI_HAIR_B, 255))
@@ -223,8 +223,8 @@
head_organ.h_grad_colour = rgb(head_organ.dna.GetUIValueRange(DNA_UI_HAIR_GRADIENT_R, 255), head_organ.dna.GetUIValueRange(DNA_UI_HAIR_GRADIENT_G, 255), head_organ.dna.GetUIValueRange(DNA_UI_HAIR_GRADIENT_B, 255))
//Facial Hair
var/beard = GetUIValueRange(DNA_UI_BEARD_STYLE,GLOB.facial_hair_styles_list.len)
if((beard > 0) && (beard <= GLOB.facial_hair_styles_list.len))
var/beard = GetUIValueRange(DNA_UI_BEARD_STYLE,length(GLOB.facial_hair_styles_list))
if((beard > 0) && (beard <= length(GLOB.facial_hair_styles_list)))
head_organ.f_style = GLOB.facial_hair_styles_list[beard]
head_organ.facial_colour = rgb(head_organ.dna.GetUIValueRange(DNA_UI_BEARD_R, 255), head_organ.dna.GetUIValueRange(DNA_UI_BEARD_G, 255), head_organ.dna.GetUIValueRange(DNA_UI_BEARD_B, 255))
@@ -308,8 +308,8 @@
SetUIValueRange(DNA_UI_HAIR_GRADIENT_X, head_organ.h_grad_offset_x + 16, 32, 1)
SetUIValueRange(DNA_UI_HAIR_GRADIENT_Y, head_organ.h_grad_offset_y + 16, 32, 1)
SetUIValueRange(DNA_UI_HAIR_STYLE, hair, GLOB.hair_styles_full_list.len, 1)
SetUIValueRange(DNA_UI_BEARD_STYLE, beard, GLOB.facial_hair_styles_list.len, 1)
SetUIValueRange(DNA_UI_HAIR_STYLE, hair, length(GLOB.hair_styles_full_list), 1)
SetUIValueRange(DNA_UI_BEARD_STYLE, beard, length(GLOB.facial_hair_styles_list), 1)
SetUIValueRange(DNA_UI_HAIR_GRADIENT_STYLE, gradient, length(GLOB.hair_gradients_list), 1)
var/list/available = character.generate_valid_head_accessories()
+2 -2
View File
@@ -351,7 +351,7 @@
/obj/machinery/computer/scan_consolenew/proc/all_dna_blocks(list/buffer)
var/list/arr = list()
for(var/i = 1, i <= buffer.len, i++)
for(var/i = 1, i <= length(buffer), i++)
arr += "[i]:[EncodeDNABlock(buffer[i])]"
return arr
@@ -468,7 +468,7 @@
data["beakerVolume"] = 0
if(connected.beaker)
data["beakerLabel"] = connected.beaker.label_text ? connected.beaker.label_text : null
if(connected.beaker.reagents && connected.beaker.reagents.reagent_list.len)
if(length(connected.beaker.reagents.reagent_list))
for(var/datum/reagent/R in connected.beaker.reagents.reagent_list)
data["beakerVolume"] += R.volume
+1 -1
View File
@@ -435,7 +435,7 @@
var/list/words = splittext(message," ")
var/list/rearranged = list()
for(var/i=1;i<=words.len;i++)
for(var/i=1;i<=length(words);i++)
var/cword = pick(words)
words.Remove(cword)
var/suffix = copytext(cword,length(cword)-1,length(cword))
+7 -7
View File
@@ -391,7 +391,7 @@
/datum/spell/eat/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
@@ -700,8 +700,8 @@
if(H.mind && H.mind.initial_account)
numbers += H.mind.initial_account.account_number
numbers += H.mind.initial_account.account_pin
if(numbers.len>0)
to_chat(user, "<span class='notice'><b>Numbers</b>: You sense the number[numbers.len>1?"s":""] [english_list(numbers)] [numbers.len>1?"are":"is"] important to [M.name].</span>")
if(length(numbers)>0)
to_chat(user, "<span class='notice'><b>Numbers</b>: You sense the number[length(numbers)>1?"s":""] [english_list(numbers)] [length(numbers)>1?"are":"is"] important to [M.name].</span>")
to_chat(user, "<span class='notice'><b>Thoughts</b>: [M.name] is currently [thoughts].</span>")
if(M.dna?.GetSEState(GLOB.empathblock))
@@ -867,10 +867,10 @@
M.change_skin_tone(new_tone)
if(M.dna.species.bodyflags & HAS_ICON_SKIN_TONE)
var/prompt = "Please select skin tone: 1-[M.dna.species.icon_skin_tones.len] ("
for(var/i = 1 to M.dna.species.icon_skin_tones.len)
var/prompt = "Please select skin tone: 1-[length(M.dna.species.icon_skin_tones)] ("
for(var/i = 1 to length(M.dna.species.icon_skin_tones))
prompt += "[i] = [M.dna.species.icon_skin_tones[i]]"
if(i != M.dna.species.icon_skin_tones.len)
if(i != length(M.dna.species.icon_skin_tones))
prompt += ", "
prompt += ")"
@@ -878,7 +878,7 @@
if(!new_tone)
new_tone = 0
else
new_tone = max(min(round(text2num(new_tone)), M.dna.species.icon_skin_tones.len), 1)
new_tone = max(min(round(text2num(new_tone)), length(M.dna.species.icon_skin_tones)), 1)
M.change_skin_tone(new_tone)
//Skin colour.
@@ -32,7 +32,7 @@
traitor_prob = (num_players - (max_traitors - 1) * 10) * 10
// Stop setup if no possible traitors
if(!possible_traitors.len)
if(!length(possible_traitors))
return 0
if(GLOB.configuration.gamemode.traitor_scaling)
@@ -56,7 +56,7 @@
traitor.special_role = SPECIAL_ROLE_TRAITOR
traitor.restricted_roles = restricted_jobs
// if(!traitors.len)
// if(!length(traitors))
// return 0
return 1
@@ -120,7 +120,7 @@
if(prob(traitor_prob))
message_admins("Making a new Traitor.")
if(!possible_traitors.len)
if(!length(possible_traitors))
message_admins("No potential traitors. Cancelling new traitor.")
traitorcheckloop()
return
+1 -1
View File
@@ -481,7 +481,7 @@
goal_weights += initial(picked.weight)
station_goals += new picked
if(station_goals.len)
if(length(station_goals))
send_station_goals_message()
/datum/game_mode/proc/send_station_goals_message()
+2 -2
View File
@@ -93,7 +93,7 @@
if(!man.mind) continue
if(man.mind.assigned_role == man.mind.special_role) continue
dudes += man
if(dudes.len==0)
if(length(dudes)==0)
return null
return pick(dudes)
@@ -119,7 +119,7 @@
if(man.dna.species.name in SSticker.mode.protected_species)
return
dudes += man
for(var/i = 0, i < max(GLOB.player_list.len/10,2), i++)
for(var/i = 0, i < max(length(GLOB.player_list)/10,2), i++)
dudes += pick(GLOB.player_list)
return pick(dudes)
@@ -35,7 +35,7 @@
for(var/datum/job/J in jobs)
if(J.current_positions < 1)
jobs -= J
if(jobs.len > 0)
if(length(jobs) > 0)
var/datum/job/target = pick(jobs)
explanation_text += " a [target.title]."
else
@@ -27,11 +27,11 @@
/datum/game_mode/abduction/pre_setup()
possible_abductors = get_players_for_role(ROLE_ABDUCTOR)
if(!possible_abductors.len)
if(!length(possible_abductors))
return 0
abductor_teams = max(1, min(max_teams,round(num_players()/15)))
var/possible_teams = max(1,round(possible_abductors.len / 2))
var/possible_teams = max(1,round(length(possible_abductors) / 2))
abductor_teams = min(abductor_teams,possible_teams)
abductors.len = 2*abductor_teams
@@ -56,7 +56,7 @@
//Team Members
if(!preset_agent || !preset_scientist)
if(possible_abductors.len <=2)
if(length(possible_abductors) <=2)
return 0
var/datum/mind/scientist
@@ -133,7 +133,7 @@
..()
spawn(5)
var/list/demon_candidates = SSghost_spawns.poll_candidates("Do you want to play as a slaughter demon?", ROLE_DEMON, TRUE, 10 SECONDS, source = /mob/living/simple_animal/demon/slaughter/cult)
if(!demon_candidates.len)
if(!length(demon_candidates))
visible_message("<span class='warning'>[src] disappears in a flash of red light!</span>")
qdel(src)
return
@@ -182,7 +182,7 @@
validtargets += M
if(!validtargets.len)
if(!length(validtargets))
to_chat(usr, "<span class='warning'>There are no valid targets!</span>")
return
@@ -305,7 +305,7 @@
var/list/mob/dead/observer/candidates = SSghost_spawns.poll_candidates("Do you want to play as the [mob_name] ([guardian_type]) of [user.real_name]?", ROLE_GUARDIAN, FALSE, 10 SECONDS, source = src, role_cleanname = "[mob_name] ([guardian_type])")
var/mob/dead/observer/theghost = null
if(candidates.len)
if(length(candidates))
theghost = pick(candidates)
if(has_guardian(user))
to_chat(user, "You already have a [mob_name]!")
@@ -35,7 +35,7 @@
var/datum/beam/B = chain
if(B.target == target)
return //oh this guy already HAS a chain, let's not chain again
if(enemychains.len > 2)
if(length(enemychains) > 2)
var/datum/beam/C = pick(enemychains)
qdel(C)
enemychains -= C
@@ -64,7 +64,7 @@
/mob/living/simple_animal/hostile/guardian/beam/proc/cleardeletedchains()
if(summonerchain && QDELETED(summonerchain))
summonerchain = null
if(enemychains.len)
if(length(enemychains))
for(var/chain in enemychains)
var/datum/cd = chain
if(!chain || QDELETED(cd))
@@ -77,14 +77,14 @@
if(!summonerchain)
summonerchain = Beam(summoner, "lightning[rand(1,12)]", 'icons/effects/effects.dmi', time=INFINITY, maxdistance=INFINITY, beam_type=/obj/effect/ebeam/chain)
. += chainshock(summonerchain)
if(enemychains.len)
if(length(enemychains))
for(var/chain in enemychains)
. += chainshock(chain)
/mob/living/simple_animal/hostile/guardian/beam/proc/removechains()
if(summonerchain)
QDEL_NULL(summonerchain)
if(enemychains.len)
if(length(enemychains))
for(var/chain in enemychains)
qdel(chain)
enemychains = list()
@@ -4,7 +4,7 @@
/datum/event/spawn_morph/proc/get_morph()
spawn()
var/list/candidates = SSghost_spawns.poll_candidates("Do you want to play as a morph?", ROLE_MORPH, TRUE, source = /mob/living/simple_animal/hostile/morph)
if(!candidates.len)
if(!length(candidates))
key_of_morph = null
kill()
return
@@ -162,7 +162,7 @@
else
var/list/mob/dead/observer/candidates = SSghost_spawns.poll_candidates("Do you want to play as a revenant?", poll_time = 15 SECONDS, source = /mob/living/simple_animal/revenant)
var/mob/dead/observer/theghost = null
if(candidates.len)
if(length(candidates))
theghost = pick(candidates)
message_admins("[key_name_admin(theghost)] has taken control of a revenant created without a mind")
key = theghost.key
@@ -14,7 +14,7 @@
spawn()
var/list/candidates = SSghost_spawns.poll_candidates("Do you want to play as a revenant?", ROLE_REVENANT, TRUE, source = /mob/living/simple_animal/revenant)
if(!candidates.len)
if(!length(candidates))
key_of_revenant = null
kill()
return
+5 -5
View File
@@ -34,13 +34,13 @@
var/list/possible_syndicates = get_players_for_role(ROLE_OPERATIVE)
var/agent_number = 0
if(possible_syndicates.len < 1)
if(length(possible_syndicates) < 1)
return 0
if(LAZYLEN(possible_syndicates) > agents_possible)
agent_number = agents_possible
else
agent_number = possible_syndicates.len
agent_number = length(possible_syndicates)
var/n_players = num_players()
if(agent_number > n_players)
@@ -115,7 +115,7 @@
break
for(var/datum/mind/synd_mind in syndicates)
if(spawnpos > synd_spawn.len)
if(spawnpos > length(synd_spawn))
spawnpos = 2
synd_mind.current.loc = synd_spawn[spawnpos]
synd_mind.offstation_role = TRUE
@@ -151,8 +151,8 @@
var/player_tc
var/remainder
player_tc = round(total_tc / GLOB.nuclear_uplink_list.len) //round to get an integer and not floating point
remainder = total_tc % GLOB.nuclear_uplink_list.len
player_tc = round(total_tc / length(GLOB.nuclear_uplink_list)) //round to get an integer and not floating point
remainder = total_tc % length(GLOB.nuclear_uplink_list)
for(var/obj/item/radio/uplink/nuclear/U in GLOB.nuclear_uplink_list)
U.hidden_uplink.uses += player_tc
@@ -68,8 +68,8 @@
var/player_tc
var/remainder
player_tc = round(total_tc / GLOB.nuclear_uplink_list.len) //round to get an integer and not floating point
remainder = total_tc % GLOB.nuclear_uplink_list.len
player_tc = round(total_tc / length(GLOB.nuclear_uplink_list)) //round to get an integer and not floating point
remainder = total_tc % length(GLOB.nuclear_uplink_list)
for(var/obj/item/radio/uplink/nuclear/U in GLOB.nuclear_uplink_list)
U.hidden_uplink.uses += player_tc
@@ -84,7 +84,7 @@
if(declaring_war)
to_chat(user, "You are already in the process of declaring war! Make your mind up.")
return FALSE
if(GLOB.player_list.len < CHALLENGE_MIN_PLAYERS)
if(length(GLOB.player_list) < CHALLENGE_MIN_PLAYERS)
to_chat(user, "The enemy crew is too small to be worth declaring war on.")
return FALSE
if(!is_admin_level(user.z))
+1 -1
View File
@@ -488,7 +488,7 @@
names[name] = H
name_counts[name] = 1
if(!names.len)
if(!length(names))
user.visible_message("<span class='notice'>[user]'s pinpointer fails to detect a signal.</span>", "<span class='notice'>Your pinpointer fails to detect a signal.</span>")
return
+1 -1
View File
@@ -121,7 +121,7 @@ GLOBAL_LIST_INIT(potential_theft_objectives, (subtypesof(/datum/theft_objective)
possible_targets += possible_target
if(possible_targets.len > 0)
if(length(possible_targets) > 0)
target = pick(possible_targets)
SEND_SIGNAL(src, COMSIG_OBJECTIVE_TARGET_FOUND, target)

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