cleanup _HELPERS/_lists.dm and all the necessary files (#61827)

Bring _HELPERS/_lists.dm to latest standards by:
-Adding proper documentation and fixing existing one
-Giving vars proper names
-Procs now use snake case as per standard (many files that use those procs will be affected)
This commit is contained in:
Ghilker
2021-10-12 14:48:51 +01:00
committed by GitHub
parent 56d21164d0
commit 95c8e00af7
207 changed files with 551 additions and 522 deletions
+1 -1
View File
@@ -229,7 +229,7 @@ GLOBAL_LIST_EMPTY(bloody_footprints_cache)
#define ORBITRON "Orbitron"
#define SHARE "Share Tech Mono"
GLOBAL_LIST_INIT(pda_styles, sortList(list(MONO, VT, ORBITRON, SHARE)))
GLOBAL_LIST_INIT(pda_styles, sort_list(list(MONO, VT, ORBITRON, SHARE)))
/////////////////////////////////////
// atom.appearence_flags shortcuts //
+223 -194
View File
@@ -9,31 +9,46 @@
* Misc
*/
///Initialize the lazylist
#define LAZYINITLIST(L) if (!L) { L = list(); }
///If the provided list is empty, set it to null
#define UNSETEMPTY(L) if (L && !length(L)) L = null
///Like LAZYCOPY - copies an input list if the list has entries, If it doesn't the assigned list is nulled
#define LAZYLISTDUPLICATE(L) (L ? L.Copy() : null )
///Remove an item from the list, set the list to null if empty
#define LAZYREMOVE(L, I) if(L) { L -= I; if(!length(L)) { L = null; } }
///Add an item to the list, if the list is null it will initialize it
#define LAZYADD(L, I) if(!L) { L = list(); } L += I;
///Add an item to the list if not already present, if the list is null it will initialize it
#define LAZYOR(L, I) if(!L) { L = list(); } L |= I;
///Returns the key of the submitted item in the list
#define LAZYFIND(L, V) (L ? L.Find(V) : 0)
///returns L[I] if L exists and I is a valid index of L, runtimes if L is not a list
#define LAZYACCESS(L, I) (L ? (isnum(I) ? (I > 0 && I <= length(L) ? L[I] : null) : L[I]) : null)
///Sets the item K to the value V, if the list is null it will initialize it
#define LAZYSET(L, K, V) if(!L) { L = list(); } L[K] = V;
///Returns the lenght of the list
#define LAZYLEN(L) length(L)
///Sets a list to null
#define LAZYNULL(L) L = null
///Adds to the item K the value V, if the list is null it will initialize it
#define LAZYADDASSOC(L, K, V) if(!L) { L = list(); } L[K] += V;
///This is used to add onto lazy assoc list when the value you're adding is a /list/. This one has extra safety over lazyaddassoc because the value could be null (and thus cant be used to += objects)
#define LAZYADDASSOCLIST(L, K, V) if(!L) { L = list(); } L[K] += list(V);
///Removes the value V from the item K, if the item K is empty will remove it from the list, if the list is empty will set the list to null
#define LAZYREMOVEASSOC(L, K, V) if(L) { if(L[K]) { L[K] -= V; if(!length(L[K])) L -= K; } if(!length(L)) L = null; }
///Accesses an associative list, returns null if nothing is found
#define LAZYACCESSASSOC(L, I, K) L ? L[I] ? L[I][K] ? L[I][K] : null : null : null
///Qdel every item in the list before setting the list to null
#define QDEL_LAZYLIST(L) for(var/I in L) qdel(I); L = null;
//These methods don't null the list
#define LAZYCOPY(L) (L ? L.Copy() : list() ) //Use LAZYLISTDUPLICATE instead if you want it to null with no entries
#define LAZYCLEARLIST(L) if(L) L.Cut() // Consider LAZYNULL instead
///Use LAZYLISTDUPLICATE instead if you want it to null with no entries
#define LAZYCOPY(L) (L ? L.Copy() : list() )
/// Consider LAZYNULL instead
#define LAZYCLEARLIST(L) if(L) L.Cut()
///Returns the list if it's actually a valid list, otherwise will initialize it
#define SANITIZE_LIST(L) ( islist(L) ? L : list() )
#define reverseList(L) reverseRange(L.Copy())
#define reverseList(L) reverse_range(L.Copy())
/// Performs an insertion on the given lazy list with the given key and value. If the value already exists, a new one will not be made.
#define LAZYORASSOCLIST(lazy_list, key, value) \
@@ -116,7 +131,7 @@
};\
} while(FALSE)
//Returns a list in plain english as a string
///Returns a list in plain english as a string
/proc/english_list(list/input, nothing_text = "nothing", and_text = " and ", comma_text = ", ", final_comma_text = "" )
var/total = length(input)
switch(total)
@@ -138,27 +153,28 @@
return "[output][and_text][input[index]]"
//Checks for specific types in a list
/proc/is_type_in_list(atom/A, list/L)
if(!LAZYLEN(L) || !A)
///Checks for specific types in a list
/proc/is_type_in_list(atom/type_to_check, list/list_to_check)
if(!LAZYLEN(list_to_check) || !type_to_check)
return FALSE
for(var/type in L)
if(istype(A, type))
for(var/type in list_to_check)
if(istype(type_to_check, type))
return TRUE
return FALSE
//Checks for specific types in specifically structured (Assoc "type" = TRUE) lists ('typecaches')
///Checks for specific types in specifically structured (Assoc "type" = TRUE) lists ('typecaches')
#define is_type_in_typecache(A, L) (A && length(L) && L[(ispath(A) ? A : A:type)])
//returns a new list with only atoms that are in typecache L
///returns a new list with only atoms that are in the typecache list
/proc/typecache_filter_list(list/atoms, list/typecache)
RETURN_TYPE(/list)
. = list()
for(var/thing in atoms)
var/atom/A = thing
if (typecache[A.type])
. += A
var/atom/atom_checked = thing
if (typecache[atom_checked.type])
. += atom_checked
///return a new list with atoms that are not in the typecache list
/proc/typecache_filter_list_reverse(list/atoms, list/typecache)
RETURN_TYPE(/list)
. = list()
@@ -166,6 +182,7 @@
if(!typecache[atom.type])
. += atom
///similar to typecache_filter_list and typecache_filter_list_reverse but it supports an inclusion list and and exclusion list
/proc/typecache_filter_multi_list_exclusion(list/atoms, list/typecache_include, list/typecache_exclude)
. = list()
for(var/atom/atom as anything in atoms)
@@ -202,13 +219,15 @@
output[subpath] = TRUE
return output
//Removes any null entries from the list
//Returns TRUE if the list had nulls, FALSE otherwise
/proc/listclearnulls(list/L)
var/start_len = L.len
var/list/N = new(start_len)
L -= N
return L.len < start_len
/**
* Removes any null entries from the list
* Returns TRUE if the list had nulls, FALSE otherwise
**/
/proc/list_clear_nulls(list/list_to_clear)
var/start_len = list_to_clear.len
var/list/new_list = new(start_len)
list_to_clear -= new_list
return list_to_clear.len < start_len
/*
* Returns list containing all the entries from first list that are not present in second.
@@ -232,7 +251,7 @@
* If skipref = 1, repeated elements are treated as one.
* If either of arguments is not a list, returns null
*/
/proc/uniquemergelist(list/first, list/second, skiprep=0)
/proc/unique_merge_list(list/first, list/second, skiprep=0)
if(!islist(first) || !islist(second))
return
var/list/result = new
@@ -242,53 +261,55 @@
result = first ^ second
return result
//Picks a random element from a list based on a weighting system:
//1. Adds up the total of weights for each element
//2. Gets a number between 1 and that total
//3. For each element in the list, subtracts its weighting from that number
//4. If that makes the number 0 or less, return that element.
//Will output null sometimes if you use decimals (e.g. 0.1 instead of 10) as rand() uses integers, not floats
/proc/pickweight(list/L)
/**
* Picks a random element from a list based on a weighting system:
* 1. Adds up the total of weights for each element
* 2. Gets a number between 1 and that total
* 3. For each element in the list, subtracts its weighting from that number
* 4. If that makes the number 0 or less, return that element.
* Will output null sometimes if you use decimals (e.g. 0.1 instead of 10) as rand() uses integers, not floats
**/
/proc/pick_weight(list/list_to_pick)
var/total = 0
var/item
for (item in L)
if (!L[item])
L[item] = 1
total += L[item]
for(item in list_to_pick)
if(!list_to_pick[item])
list_to_pick[item] = 1
total += list_to_pick[item]
total = rand(1, total)
for (item in L)
total -=L [item]
if (total <= 0)
for(item in list_to_pick)
total -= list_to_pick[item]
if(total <= 0)
return item
return null
/proc/pickweightAllowZero(list/L) //The original pickweight proc will sometimes pick entries with zero weight. I'm not sure if changing the original will break anything, so I left it be.
///The original pickweight proc will sometimes pick entries with zero weight. I'm not sure if changing the original will break anything, so I left it be.
/proc/pick_weight_allow_zero(list/list_to_pick)
var/total = 0
var/item
for (item in L)
if (!L[item])
L[item] = 0
total += L[item]
for(item in list_to_pick)
if(!list_to_pick[item])
list_to_pick[item] = 0
total += list_to_pick[item]
total = rand(0, total)
for (item in L)
total -=L [item]
if (total <= 0 && L[item])
for(item in list_to_pick)
total -= list_to_pick[item]
if(total <= 0 && list_to_pick[item])
return item
return null
/// Pick a random element from the list and remove it from the list.
/proc/pick_n_take(list/L)
RETURN_TYPE(L[_].type)
if(L.len)
var/picked = rand(1,L.len)
. = L[picked]
L.Cut(picked,picked+1) //Cut is far more efficient that Remove()
/proc/pick_n_take(list/list_to_pick)
RETURN_TYPE(list_to_pick[_].type)
if(list_to_pick.len)
var/picked = rand(1,list_to_pick.len)
. = list_to_pick[picked]
list_to_pick.Cut(picked,picked+1) //Cut is far more efficient that Remove()
//Returns the top(last) element from the list and removes it from the list (typical stack function)
///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]
@@ -305,233 +326,239 @@
pos--
L.Insert(pos+1, thing)
// Returns the next item in a list
/proc/next_list_item(item, list/L)
/// Returns the next item in a list
/proc/next_list_item(item, list/inserted_list)
var/i
i = L.Find(item)
if(i == L.len)
i = inserted_list.Find(item)
if(i == inserted_list.len)
i = 1
else
i++
return L[i]
return inserted_list[i]
// Returns the previous item in a list
/proc/previous_list_item(item, list/L)
/// Returns the previous item in a list
/proc/previous_list_item(item, list/inserted_list)
var/i
i = L.Find(item)
i = inserted_list.Find(item)
if(i == 1)
i = L.len
i = inserted_list.len
else
i--
return L[i]
return inserted_list[i]
//Randomize: Return the list in a random order
/proc/shuffle(list/L)
if(!L)
///Randomize: Return the list in a random order
/proc/shuffle(list/inserted_list)
if(!inserted_list)
return
L = L.Copy()
inserted_list = inserted_list.Copy()
for(var/i=1, i<L.len, ++i)
L.Swap(i,rand(i,L.len))
for(var/i = 1, i < inserted_list.len, ++i)
inserted_list.Swap(i, rand(i, inserted_list.len))
return L
return inserted_list
//same, but returns nothing and acts on list in place
/proc/shuffle_inplace(list/L)
if(!L)
///same as shuffle, but returns nothing and acts on list in place
/proc/shuffle_inplace(list/inserted_list)
if(!inserted_list)
return
for(var/i=1, i<L.len, ++i)
L.Swap(i,rand(i,L.len))
for(var/i = 1, i < inserted_list.len, ++i)
inserted_list.Swap(i, rand(i, inserted_list.len))
//Return a list with no duplicate entries
/proc/uniqueList(list/L)
///Return a list with no duplicate entries
/proc/unique_list(list/inserted_list)
. = list()
for(var/i in L)
for(var/i in inserted_list)
. |= i
//same, but returns nothing and acts on list in place (also handles associated values properly)
/proc/uniqueList_inplace(list/L)
var/temp = L.Copy()
L.len = 0
///same as unique_list, but returns nothing and acts on list in place (also handles associated values properly)
/proc/unique_list_in_place(list/inserted_list)
var/temp = inserted_list.Copy()
inserted_list.len = 0
for(var/key in temp)
if (isnum(key))
L |= key
inserted_list |= key
else
L[key] = temp[key]
inserted_list[key] = temp[key]
//for sorting clients or mobs by ckey
/proc/sortKey(list/L, order=1)
return sortTim(L, order >= 0 ? /proc/cmp_ckey_asc : /proc/cmp_ckey_dsc)
///for sorting clients or mobs by ckey
/proc/sort_key(list/ckey_list, order=1)
return sortTim(ckey_list, order >= 0 ? /proc/cmp_ckey_asc : /proc/cmp_ckey_dsc)
//Specifically for record datums in a list.
/proc/sortRecord(list/L, field = "name", order = 1)
///Specifically for record datums in a list.
/proc/sort_record(list/record_list, field = "name", order = 1)
GLOB.cmp_field = field
return sortTim(L, order >= 0 ? /proc/cmp_records_asc : /proc/cmp_records_dsc)
return sortTim(record_list, order >= 0 ? /proc/cmp_records_asc : /proc/cmp_records_dsc)
//any value in a list
/proc/sortList(list/L, cmp=/proc/cmp_text_asc)
return sortTim(L.Copy(), cmp)
///sort any value in a list
/proc/sort_list(list/list_to_sort, cmp=/proc/cmp_text_asc)
return sortTim(list_to_sort.Copy(), cmp)
//uses sortList() but uses the var's name specifically. This should probably be using mergeAtom() instead
/proc/sortNames(list/L, order=1)
return sortTim(L.Copy(), order >= 0 ? /proc/cmp_name_asc : /proc/cmp_name_dsc)
///uses sort_list() but uses the var's name specifically. This should probably be using mergeAtom() instead
/proc/sort_names(list/list_to_sort, order=1)
return sortTim(list_to_sort.Copy(), order >= 0 ? /proc/cmp_name_asc : /proc/cmp_name_dsc)
//Converts a bitfield to a list of numbers (or words if a wordlist is provided)
/proc/bitfield2list(bitfield = 0, list/wordlist)
var/list/r = list()
///Converts a bitfield to a list of numbers (or words if a wordlist is provided)
/proc/bitfield_to_list(bitfield = 0, list/wordlist)
var/list/return_list = list()
if(islist(wordlist))
var/max = min(wordlist.len,24)
var/max = min(wordlist.len, 24)
var/bit = 1
for(var/i=1, i<=max, i++)
for(var/i = 1, i <= max, i++)
if(bitfield & bit)
r += wordlist[i]
return_list += wordlist[i]
bit = bit << 1
else
for(var/bit=1, bit<=(1<<24), bit = bit << 1)
for(var/bit = 1, bit <= (1<<24), bit = bit << 1)
if(bitfield & bit)
r += bit
return_list += bit
return r
return return_list
// Returns the key based on the index
/// Returns the key based on the index
#define KEYBYINDEX(L, index) (((index <= length(L)) && (index > 0)) ? L[index] : null)
/proc/count_by_type(list/L, type)
///return the amount of items of the same type inside a list
/proc/count_by_type(list/inserted_list, type)
var/i = 0
for(var/T in L)
if(istype(T, type))
for(var/item_type in inserted_list)
if(istype(item_type, type))
i++
return i
/// Returns datum/data/record
/proc/find_record(field, value, list/L)
for(var/datum/data/record/R in L)
if(R.fields[field] == value)
return R
/proc/find_record(field, value, list/inserted_list)
for(var/datum/data/record/record_to_check in inserted_list)
if(record_to_check.fields[field] == value)
return record_to_check
return null
//Move a single element from position fromIndex within a list, to position toIndex
//All elements in the range [1,toIndex) before the move will be before the pivot afterwards
//All elements in the range [toIndex, L.len+1) before the move will be after the pivot afterwards
//In other words, it's as if the range [fromIndex,toIndex) have been rotated using a <<< operation common to other languages.
//fromIndex and toIndex must be in the range [1,L.len+1]
//This will preserve associations ~Carnie
/proc/moveElement(list/L, fromIndex, toIndex)
if(fromIndex == toIndex || fromIndex+1 == toIndex) //no need to move
/**
* Move a single element from position from_index within a list, to position to_index
* All elements in the range [1,to_index) before the move will be before the pivot afterwards
* All elements in the range [to_index, L.len+1) before the move will be after the pivot afterwards
* In other words, it's as if the range [from_index,to_index) have been rotated using a <<< operation common to other languages.
* from_index and to_index must be in the range [1,L.len+1]
* This will preserve associations ~Carnie
**/
/proc/move_element(list/inserted_list, from_index, to_index)
if(from_index == to_index || from_index + 1 == to_index) //no need to move
return
if(fromIndex > toIndex)
++fromIndex //since a null will be inserted before fromIndex, the index needs to be nudged right by one
if(from_index > to_index)
++from_index //since a null will be inserted before from_index, the index needs to be nudged right by one
L.Insert(toIndex, null)
L.Swap(fromIndex, toIndex)
L.Cut(fromIndex, fromIndex+1)
inserted_list.Insert(to_index, null)
inserted_list.Swap(from_index, to_index)
inserted_list.Cut(from_index, from_index + 1)
//Move elements [fromIndex,fromIndex+len) to [toIndex-len, toIndex)
//Same as moveElement but for ranges of elements
//This will preserve associations ~Carnie
/proc/moveRange(list/L, fromIndex, toIndex, len=1)
var/distance = abs(toIndex - fromIndex)
/**
* Move elements [from_index,from_index+len) to [to_index-len, to_index)
* Same as moveElement but for ranges of elements
* This will preserve associations ~Carnie
**/
/proc/move_range(list/inserted_list, from_index, to_index, len = 1)
var/distance = abs(to_index - from_index)
if(len >= distance) //there are more elements to be moved than the distance to be moved. Therefore the same result can be achieved (with fewer operations) by moving elements between where we are and where we are going. The result being, our range we are moving is shifted left or right by dist elements
if(fromIndex <= toIndex)
if(from_index <= to_index)
return //no need to move
fromIndex += len //we want to shift left instead of right
from_index += len //we want to shift left instead of right
for(var/i=0, i<distance, ++i)
L.Insert(fromIndex, null)
L.Swap(fromIndex, toIndex)
L.Cut(toIndex, toIndex+1)
for(var/i = 0, i < distance, ++i)
inserted_list.Insert(from_index, null)
inserted_list.Swap(from_index, to_index)
inserted_list.Cut(to_index, to_index + 1)
else
if(fromIndex > toIndex)
fromIndex += len
if(from_index > to_index)
from_index += len
for(var/i=0, i<len, ++i)
L.Insert(toIndex, null)
L.Swap(fromIndex, toIndex)
L.Cut(fromIndex, fromIndex+1)
for(var/i = 0, i < len, ++i)
inserted_list.Insert(to_index, null)
inserted_list.Swap(from_index, to_index)
inserted_list.Cut(from_index, from_index + 1)
//Move elements from [fromIndex, fromIndex+len) to [toIndex, toIndex+len)
//Move any elements being overwritten by the move to the now-empty elements, preserving order
//Note: if the two ranges overlap, only the destination order will be preserved fully, since some elements will be within both ranges ~Carnie
/proc/swapRange(list/L, fromIndex, toIndex, len=1)
var/distance = abs(toIndex - fromIndex)
///Move elements from [from_index, from_index+len) to [to_index, to_index+len)
///Move any elements being overwritten by the move to the now-empty elements, preserving order
///Note: if the two ranges overlap, only the destination order will be preserved fully, since some elements will be within both ranges ~Carnie
/proc/swap_range(list/inserted_list, from_index, to_index, len=1)
var/distance = abs(to_index - from_index)
if(len > distance) //there is an overlap, therefore swapping each element will require more swaps than inserting new elements
if(fromIndex < toIndex)
toIndex += len
if(from_index < to_index)
to_index += len
else
fromIndex += len
from_index += len
for(var/i=0, i<distance, ++i)
L.Insert(fromIndex, null)
L.Swap(fromIndex, toIndex)
L.Cut(toIndex, toIndex+1)
for(var/i = 0, i < distance, ++i)
inserted_list.Insert(from_index, null)
inserted_list.Swap(from_index, to_index)
inserted_list.Cut(to_index, to_index + 1)
else
if(toIndex > fromIndex)
var/a = toIndex
toIndex = fromIndex
fromIndex = a
if(to_index > from_index)
var/a = to_index
to_index = from_index
from_index = a
for(var/i=0, i<len, ++i)
L.Swap(fromIndex++, toIndex++)
for(var/i = 0, i < len, ++i)
inserted_list.Swap(from_index++, to_index++)
//replaces reverseList ~Carnie
/proc/reverseRange(list/L, start=1, end=0)
if(L.len)
start = start % L.len
end = end % (L.len+1)
///replaces reverseList ~Carnie
/proc/reverse_range(list/inserted_list, start = 1, end = 0)
if(inserted_list.len)
start = start % inserted_list.len
end = end % (inserted_list.len + 1)
if(start <= 0)
start += L.len
start += inserted_list.len
if(end <= 0)
end += L.len + 1
end += inserted_list.len + 1
--end
while(start < end)
L.Swap(start++,end--)
inserted_list.Swap(start++, end--)
return L
return inserted_list
//return first thing in L which has var/varname == value
//this is typecaste as list/L, but you could actually feed it an atom instead.
//completely safe to use
/proc/getElementByVar(list/L, varname, value)
///return first thing in L which has var/varname == value
///this is typecaste as list/L, but you could actually feed it an atom instead.
///completely safe to use
/proc/get_element_by_var(list/inserted_list, varname, value)
varname = "[varname]"
for(var/datum/D in L)
if(D.vars.Find(varname))
if(D.vars[varname] == value)
return D
for(var/datum/checked_datum in inserted_list)
if(!checked_datum.vars.Find(varname))
continue
if(checked_datum.vars[varname] == value)
return checked_datum
//remove all nulls from a list
/proc/removeNullsFromList(list/L)
while(L.Remove(null))
///remove all nulls from a list
/proc/remove_nulls_from_list(list/inserted_list)
while(inserted_list.Remove(null))
continue
return L
return inserted_list
//Copies a list, and all lists inside it recusively
//Does not copy any other reference type
/proc/deepCopyList(list/l)
if(!islist(l))
return l
. = l.Copy()
for(var/i = 1 to l.len)
///Copies a list, and all lists inside it recusively
///Does not copy any other reference type
/proc/deep_copy_list(list/inserted_list)
if(!islist(inserted_list))
return inserted_list
. = inserted_list.Copy()
for(var/i in 1 to inserted_list.len)
var/key = .[i]
if(isnum(key))
// numbers cannot ever be associative keys
continue
var/value = .[key]
if(islist(value))
value = deepCopyList(value)
value = deep_copy_list(value)
.[key] = value
if(islist(key))
key = deepCopyList(key)
key = deep_copy_list(key)
.[i] = key
.[key] = value
//takes an input_key, as text, and the list of keys already used, outputting a replacement key in the format of "[input_key] ([number_of_duplicates])" if it finds a duplicate
//use this for lists of things that might have the same name, like mobs or objects, that you plan on giving to a player as input
///takes an input_key, as text, and the list of keys already used, outputting a replacement key in the format of "[input_key] ([number_of_duplicates])" if it finds a duplicate
///use this for lists of things that might have the same name, like mobs or objects, that you plan on giving to a player as input
/proc/avoid_assoc_duplicate_keys(input_key, list/used_key_list)
if(!input_key || !istype(used_key_list))
return
@@ -542,7 +569,7 @@
used_key_list[input_key] = 1
return input_key
//Flattens a keyed list into a list of it's contents
///Flattens a keyed list into a list of it's contents
/proc/flatten_list(list/key_list)
if(!islist(key_list))
return null
@@ -550,12 +577,13 @@
for(var/key in key_list)
. |= key_list[key]
///Make a normal list an associative one
/proc/make_associative(list/flat_list)
. = list()
for(var/thing in flat_list)
.[thing] = TRUE
//Picks from the list, with some safeties, and returns the "default" arg if it fails
///Picks from the list, with some safeties, and returns the "default" arg if it fails
#define DEFAULTPICK(L, default) ((islist(L) && length(L)) ? pick(L) : default)
/* Definining a counter as a series of key -> numeric value entries
@@ -596,6 +624,7 @@
keys += key
return keys
///compare two lists, returns TRUE if they are the same
/proc/compare_list(list/l,list/d)
if(!islist(l) || !islist(d))
return FALSE
+1 -1
View File
@@ -1,5 +1,5 @@
#define pick_list(FILE, KEY) (pick(strings(FILE, KEY)))
#define pick_list_weighted(FILE, KEY) (pickweight(strings(FILE, KEY)))
#define pick_list_weighted(FILE, KEY) (pick_weight(strings(FILE, KEY)))
#define pick_list_replacements(FILE, KEY) (strings_replacement(FILE, KEY))
#define json_load(FILE) (json_decode(file2text(FILE)))
+1 -1
View File
@@ -268,7 +268,7 @@ rough example of the "cone" made by the 3 dirs checked
else if(random)
chosen = pick(matches) || null
else
chosen = input("Select a type", "Pick Type", matches[1]) as null|anything in sortList(matches)
chosen = input("Select a type", "Pick Type", matches[1]) as null|anything in sort_list(matches)
if(!chosen)
return
chosen = matches[chosen]
+1 -1
View File
@@ -21,7 +21,7 @@ GLOBAL_VAR_INIT(fileaccess_timer, 0)
if(path != root)
choices.Insert(1,"/")
var/choice = input(src,"Choose a file to access:","Download",null) as null|anything in sortList(choices)
var/choice = input(src,"Choose a file to access:","Download",null) as null|anything in sort_list(choices)
switch(choice)
if(null)
return
+3 -3
View File
@@ -37,7 +37,7 @@
get_area(get_ranged_target_turf(center, EAST, 1)),
get_area(get_ranged_target_turf(center, WEST, 1))
)
listclearnulls(.)
list_clear_nulls(.)
///Returns the open turf next to the center in a specific direction
/proc/get_open_turf_in_dir(atom/center, dir)
@@ -53,7 +53,7 @@
get_open_turf_in_dir(center, EAST),
get_open_turf_in_dir(center, WEST)
)
listclearnulls(.)
list_clear_nulls(.)
///Returns a list with all the adjacent areas by getting the adjacent open turfs
/proc/get_adjacent_open_areas(atom/center)
@@ -449,7 +449,7 @@
if(!asking_mob.key || !asking_mob.client)
result -= asking_mob
listclearnulls(result)
list_clear_nulls(result)
return result
+3 -3
View File
@@ -38,12 +38,12 @@
for(var/spath in subtypesof(/datum/species))
var/datum/species/S = new spath()
GLOB.species_list[S.id] = spath
sortList(GLOB.species_list, /proc/cmp_typepaths_asc)
sort_list(GLOB.species_list, /proc/cmp_typepaths_asc)
//Surgeries
for(var/path in subtypesof(/datum/surgery))
GLOB.surgeries_list += new path()
sortList(GLOB.surgeries_list, /proc/cmp_typepaths_asc)
sort_list(GLOB.surgeries_list, /proc/cmp_typepaths_asc)
// Hair Gradients - Initialise all /datum/sprite_accessory/hair_gradient into an list indexed by gradient-style name
for(var/path in subtypesof(/datum/sprite_accessory/hair_gradient))
@@ -63,7 +63,7 @@
/proc/init_crafting_recipes(list/crafting_recipes)
for(var/path in subtypesof(/datum/crafting_recipe))
var/datum/crafting_recipe/recipe = new path()
recipe.reqs = sortList(recipe.reqs, /proc/cmp_crafting_req_priority)
recipe.reqs = sort_list(recipe.reqs, /proc/cmp_crafting_req_priority)
crafting_recipes += recipe
return crafting_recipes
+4 -4
View File
@@ -139,7 +139,7 @@
/proc/random_skin_tone()
return pick(GLOB.skin_tones)
GLOBAL_LIST_INIT(skin_tones, sortList(list(
GLOBAL_LIST_INIT(skin_tones, sort_list(list(
"albino",
"caucasian1",
"caucasian2",
@@ -646,7 +646,7 @@ GLOBAL_LIST_EMPTY(species_list)
var/list/borgs = active_free_borgs()
if(borgs.len)
if(user)
. = input(user,"Unshackled cyborg signals detected:", "Cyborg Selection", borgs[1]) in sortList(borgs)
. = input(user,"Unshackled cyborg signals detected:", "Cyborg Selection", borgs[1]) in sort_list(borgs)
else
. = pick(borgs)
return .
@@ -655,7 +655,7 @@ GLOBAL_LIST_EMPTY(species_list)
var/list/ais = active_ais(FALSE, z)
if(ais.len)
if(user)
. = input(user,"AI signals detected:", "AI Selection", ais[1]) in sortList(ais)
. = input(user,"AI signals detected:", "AI Selection", ais[1]) in sort_list(ais)
else
. = pick(ais)
return .
@@ -683,7 +683,7 @@ GLOBAL_LIST_EMPTY(species_list)
///Orders mobs by type then by name. Accepts optional arg to sort a custom list, otherwise copies GLOB.mob_list.
/proc/sort_mobs()
var/list/moblist = list()
var/list/sortmob = sortNames(GLOB.mob_list)
var/list/sortmob = sort_names(GLOB.mob_list)
for(var/mob/living/silicon/ai/mob_to_sort in sortmob)
moblist += mob_to_sort
for(var/mob/camera/mob_to_sort in sortmob)
+2 -2
View File
@@ -15,7 +15,7 @@ GLOBAL_LIST_INIT(pipe_paint_colors, list(
))
///List that sorts the colors and is used for setting up the pipes layer so that they overlap correctly
GLOBAL_LIST_INIT(pipe_colors_ordered, sortList(list(
GLOBAL_LIST_INIT(pipe_colors_ordered, sort_list(list(
COLOR_AMETHYST = -6,
COLOR_BLUE = -5,
COLOR_BROWN = -4,
@@ -31,7 +31,7 @@ GLOBAL_LIST_INIT(pipe_colors_ordered, sortList(list(
)))
///Names shown in the examine for every colored atmos component
GLOBAL_LIST_INIT(pipe_color_name, sortList(list(
GLOBAL_LIST_INIT(pipe_color_name, sort_list(list(
COLOR_VERY_LIGHT_GRAY = "omni",
COLOR_BLUE = "blue",
COLOR_RED = "red",
+1 -1
View File
@@ -316,7 +316,7 @@
//Economy & Money
parts += market_report()
listclearnulls(parts)
list_clear_nulls(parts)
return parts.Join()
+17 -17
View File
@@ -119,7 +119,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
left = mid+1
//ASSERT(left == right)
moveElement(L, start, left) //move pivot element to correct location in the sorted range
move_element(L, start, left) //move pivot element to correct location in the sorted range
/*
Returns the length of the run beginning at the specified position and reverses the run if it is back-to-front
@@ -150,7 +150,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
if(call(cmp)(current, last) >= 0)
break
++runHi
reverseRange(L, lo, runHi)
reverse_range(L, lo, runHi)
else
while(runHi < hi)
last = current
@@ -371,16 +371,16 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
//degenerate cases
if(len2 == 1)
moveElement(L, cursor2, cursor1)
move_element(L, cursor2, cursor1)
return
if(len1 == 1)
moveElement(L, cursor1, cursor2+len2)
move_element(L, cursor1, cursor2+len2)
return
//Move first element of second run
moveElement(L, cursor2++, cursor1++)
move_element(L, cursor2++, cursor1++)
--len2
outer:
@@ -393,7 +393,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
do
//ASSERT(len1 > 1 && len2 > 0)
if(call(cmp)(fetchElement(L,cursor2), fetchElement(L,cursor1)) < 0)
moveElement(L, cursor2++, cursor1++)
move_element(L, cursor2++, cursor1++)
--len2
++count2
@@ -426,7 +426,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
if(len1 <= 1)
break outer
moveElement(L, cursor2, cursor1)
move_element(L, cursor2, cursor1)
++cursor2
++cursor1
if(--len2 == 0)
@@ -434,7 +434,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
count2 = gallopLeft(fetchElement(L,cursor1), cursor2, len2, 0)
if(count2)
moveRange(L, cursor2, cursor1, count2)
move_range(L, cursor2, cursor1, count2)
cursor2 += count2
cursor1 += count2
@@ -458,7 +458,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
if(len1 == 1)
//ASSERT(len2 > 0)
moveElement(L, cursor1, cursor2+len2)
move_element(L, cursor1, cursor2+len2)
//else
//ASSERT(len2 == 0)
@@ -473,14 +473,14 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
//degenerate cases
if(len2 == 1)
moveElement(L, base2, base1)
move_element(L, base2, base1)
return
if(len1 == 1)
moveElement(L, base1, cursor2+1)
move_element(L, base1, cursor2+1)
return
moveElement(L, cursor1--, cursor2-- + 1)
move_element(L, cursor1--, cursor2-- + 1)
--len1
outer:
@@ -492,7 +492,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
do
//ASSERT(len1 > 0 && len2 > 1)
if(call(cmp)(fetchElement(L,cursor2), fetchElement(L,cursor1)) < 0)
moveElement(L, cursor1--, cursor2-- + 1)
move_element(L, cursor1--, cursor2-- + 1)
--len1
++count1
@@ -520,7 +520,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
if(count1)
cursor1 -= count1
moveRange(L, cursor1+1, cursor2+1, count1) //cursor1+1 == cursor2 by definition
move_range(L, cursor1+1, cursor2+1, count1) //cursor1+1 == cursor2 by definition
cursor2 -= count1
len1 -= count1
@@ -541,7 +541,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
if(len2 <= 1)
break outer
moveElement(L, cursor1--, cursor2-- + 1)
move_element(L, cursor1--, cursor2-- + 1)
--len1
if(len1 == 0)
@@ -558,7 +558,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
//ASSERT(len1 > 0)
cursor1 -= len1
moveRange(L, cursor1+1, cursor2+1, len1)
move_range(L, cursor1+1, cursor2+1, len1)
//else
//ASSERT(len1 == 0)
@@ -625,7 +625,7 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
break
val1 = fetchElement(L,cursor1)
else
moveElement(L,cursor2,cursor1)
move_element(L,cursor2,cursor1)
if(++cursor2 >= end2)
break
+1 -1
View File
@@ -712,7 +712,7 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
var/list/finalized = list()
finalized = accepted.Copy() + oldentries.Copy() //we keep old and unreferenced phrases near the bottom for culling
listclearnulls(finalized)
list_clear_nulls(finalized)
if(length(finalized) > storemax)
finalized.Cut(storemax + 1)
fdel(log)
+1 -1
View File
@@ -46,7 +46,7 @@
/proc/get_fancy_list_of_datum_types()
var/static/list/pre_generated_list
if (!pre_generated_list) //init
pre_generated_list = make_types_fancy(sortList(typesof(/datum) - typesof(/atom)))
pre_generated_list = make_types_fancy(sort_list(typesof(/datum) - typesof(/atom)))
return pre_generated_list
+2 -2
View File
@@ -118,7 +118,7 @@ GLOBAL_LIST_INIT(ghost_forms_with_accessories_list, list(
"ghost_camo",))
//stores the ghost forms that support hair and other such things
GLOBAL_LIST_INIT(ai_core_display_screens, sortList(list(
GLOBAL_LIST_INIT(ai_core_display_screens, sort_list(list(
":thinking:",
"Alien",
"Angel",
@@ -179,7 +179,7 @@ GLOBAL_LIST_INIT(ai_core_display_screens, sortList(list(
return resolve_ai_icon_sync(input)
GLOBAL_LIST_INIT(security_depts_prefs, sortList(list(
GLOBAL_LIST_INIT(security_depts_prefs, sort_list(list(
SEC_DEPT_NONE,
SEC_DEPT_ENGINEERING,
SEC_DEPT_MEDICAL,
+1 -1
View File
@@ -2,7 +2,7 @@
/// Phobia types that can be pulled randomly for brain traumas.
/// Also determines what phobias you can choose as your preference with the quirk.
GLOBAL_LIST_INIT(phobia_types, sortList(list(
GLOBAL_LIST_INIT(phobia_types, sort_list(list(
"aliens",
"anime",
"authority",
+1 -1
View File
@@ -127,7 +127,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
/datum/controller/master/Shutdown()
processing = FALSE
sortTim(subsystems, /proc/cmp_subsystem_init)
reverseRange(subsystems)
reverse_range(subsystems)
for(var/datum/controller/subsystem/ss in subsystems)
log_world("Shutting down [ss.name] subsystem...")
ss.Shutdown()
+1 -1
View File
@@ -63,7 +63,7 @@ SUBSYSTEM_DEF(blackbox)
//no touchie
/datum/controller/subsystem/blackbox/vv_get_var(var_name)
if(var_name == "feedback")
return debug_variable(var_name, deepCopyList(feedback), 0, src)
return debug_variable(var_name, deep_copy_list(feedback), 0, src)
return ..()
/datum/controller/subsystem/blackbox/vv_edit_var(var_name, var_value)
+1 -1
View File
@@ -49,6 +49,6 @@ PROCESSING_SUBSYSTEM_DEF(dcs)
fullid += "[key]"
if(length(named_arguments))
named_arguments = sortList(named_arguments)
named_arguments = sort_list(named_arguments)
fullid += named_arguments
return list2params(fullid)
+2 -2
View File
@@ -366,7 +366,7 @@ GLOBAL_LIST_EMPTY(the_station_areas)
if(pmv)
mapvotes[map] = mapvotes[map]*VM.voteweight
var/pickedmap = pickweight(mapvotes)
var/pickedmap = pick_weight(mapvotes)
if (!pickedmap)
return
var/datum/map_config/VM = global.config.maplist[pickedmap]
@@ -408,7 +408,7 @@ GLOBAL_LIST_EMPTY(the_station_areas)
banned += generateMapList("[global.config.directory]/spaceruinblacklist.txt")
banned += generateMapList("[global.config.directory]/iceruinblacklist.txt")
for(var/item in sortList(subtypesof(/datum/map_template/ruin), /proc/cmp_ruincost_priority))
for(var/item in sort_list(subtypesof(/datum/map_template/ruin), /proc/cmp_ruincost_priority))
var/datum/map_template/ruin/ruin_type = item
// screen out the abstract subtypes
if(!initial(ruin_type.id))
+1 -1
View File
@@ -138,7 +138,7 @@ SUBSYSTEM_DEF(materials)
fullid += "[key]"
if(length(named_arguments))
named_arguments = sortList(named_arguments)
named_arguments = sort_list(named_arguments)
fullid += named_arguments
return list2params(fullid)
@@ -42,7 +42,7 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
/datum/controller/subsystem/processing/quirks/proc/SetupQuirks()
// Sort by Positive, Negative, Neutral; and then by name
var/list/quirk_list = sortList(subtypesof(/datum/quirk), /proc/cmp_quirk_asc)
var/list/quirk_list = sort_list(subtypesof(/datum/quirk), /proc/cmp_quirk_asc)
for(var/type in quirk_list)
var/datum/quirk/quirk_type = type
@@ -69,7 +69,7 @@ PROCESSING_SUBSYSTEM_DEF(station)
if(!amount)
return
for(var/iterator in 1 to amount)
var/datum/station_trait/trait_type = pickweight(selectable_traits_by_types[trait_sign]) //Rolls from the table for the specific trait type
var/datum/station_trait/trait_type = pick_weight(selectable_traits_by_types[trait_sign]) //Rolls from the table for the specific trait type
setup_trait(trait_type)
///Creates a given trait of a specific type, while also removing any blacklisted ones from the future pool.
+2 -2
View File
@@ -34,7 +34,7 @@ SUBSYSTEM_DEF(server_maint)
/datum/controller/subsystem/server_maint/fire(resumed = FALSE)
if(!resumed)
if(listclearnulls(GLOB.clients))
if(list_clear_nulls(GLOB.clients))
log_world("Found a null in clients list!")
src.currentrun = GLOB.clients.Copy()
@@ -42,7 +42,7 @@ SUBSYSTEM_DEF(server_maint)
if(!(position_in_loop % 1)) //If it's a whole number
var/listname = lists_to_clear[position_in_loop]
if(listclearnulls(lists_to_clear[listname]))
if(list_clear_nulls(lists_to_clear[listname]))
log_world("Found a null in [listname]!")
cleanup_ticker++
+1 -1
View File
@@ -834,7 +834,7 @@ SUBSYSTEM_DEF(shuttle)
templates[S.port_id]["templates"] += list(L)
data["templates_tabs"] = sortList(data["templates_tabs"])
data["templates_tabs"] = sort_list(data["templates_tabs"])
data["existing_shuttle"] = null
+2 -2
View File
@@ -466,7 +466,7 @@ SUBSYSTEM_DEF(ticker)
return
var/hpc = CONFIG_GET(number/hard_popcap)
if(!hpc)
listclearnulls(queued_players)
list_clear_nulls(queued_players)
for (var/mob/dead/new_player/NP in queued_players)
to_chat(NP, span_userdanger("The alive players limit has been released!<br><a href='?src=[REF(NP)];late_join=override'>[html_encode(">>Join Game<<")]</a>"))
SEND_SOUND(NP, sound('sound/misc/notice1.ogg'))
@@ -480,7 +480,7 @@ SUBSYSTEM_DEF(ticker)
switch(queue_delay)
if(5) //every 5 ticks check if there is a slot available
listclearnulls(queued_players)
list_clear_nulls(queued_players)
if(living_player_count() < hpc)
if(next_in_line?.client)
to_chat(next_in_line, span_userdanger("A slot has opened! You have approximately 20 seconds to join. <a href='?src=[REF(next_in_line)];late_join=override'>\>\>Join Game\<\<</a>"))
+1 -1
View File
@@ -488,7 +488,7 @@ SUBSYSTEM_DEF(timer)
/datum/timedevent/proc/bucketJoin()
// Generate debug-friendly name for timer
var/static/list/bitfield_flags = list("TIMER_UNIQUE", "TIMER_OVERRIDE", "TIMER_CLIENT_TIME", "TIMER_STOPPABLE", "TIMER_NO_HASH_WAIT", "TIMER_LOOP")
name = "Timer: [id] (\ref[src]), TTR: [timeToRun], wait:[wait] Flags: [jointext(bitfield2list(flags, bitfield_flags), ", ")], \
name = "Timer: [id] (\ref[src]), TTR: [timeToRun], wait:[wait] Flags: [jointext(bitfield_to_list(flags, bitfield_flags), ", ")], \
callBack: \ref[callBack], callBack.object: [callBack.object]\ref[callBack.object]([getcallingtype()]), \
callBack.delegate:[callBack.delegate]([callBack.arguments ? callBack.arguments.Join(", ") : ""]), source: [source]"
+1 -1
View File
@@ -26,7 +26,7 @@ SUBSYSTEM_DEF(weather)
// start random weather on relevant levels
for(var/z in eligible_zlevels)
var/possible_weather = eligible_zlevels[z]
var/datum/weather/our_event = pickweight(possible_weather)
var/datum/weather/our_event = pick_weight(possible_weather)
run_weather(our_event, list(text2num(z)))
eligible_zlevels -= z
var/randTime = rand(3000, 6000)
+1 -1
View File
@@ -304,5 +304,5 @@
if(!valids.len)
finish_action(controller, FALSE)
controller.blackboard[set_key] = pickweight(valids)
controller.blackboard[set_key] = pick_weight(valids)
finish_action(controller, TRUE)
+2 -2
View File
@@ -261,7 +261,7 @@
if(HAS_TRAIT(SSstation, STATION_TRAIT_UNIQUE_AI))
law_weights -= AI_LAWS_ASIMOV
while(!lawtype && law_weights.len)
var/possible_id = pickweightAllowZero(law_weights)
var/possible_id = pick_weight_allow_zero(law_weights)
lawtype = lawid_to_type(possible_id)
if(!lawtype)
law_weights -= possible_id
@@ -328,7 +328,7 @@
replaceable_groups[LAW_INHERENT] = inherent.len
if(supplied.len && (LAW_SUPPLIED in groups))
replaceable_groups[LAW_SUPPLIED] = supplied.len
var/picked_group = pickweight(replaceable_groups)
var/picked_group = pick_weight(replaceable_groups)
switch(picked_group)
if(LAW_ZEROTH)
. = zeroth
+1 -1
View File
@@ -25,7 +25,7 @@
var/list/data = list( "dates" = list() )
var/regex/ymlRegex = regex(@"\.yml", "g")
for(var/archive_file in sortList(flist("html/changelogs/archive/")))
for(var/archive_file in sort_list(flist("html/changelogs/archive/")))
var/archive_date = ymlRegex.Replace(archive_file, "")
data["dates"] = list(archive_date) + data["dates"]
+1 -1
View File
@@ -80,7 +80,7 @@
var/usedSlots = NONE
for(var/i in 1 to max(1, abs(quality))) // We want at least 1 affix applied
var/datum/fantasy_affix/affix = pickweight(affixListing)
var/datum/fantasy_affix/affix = pick_weight(affixListing)
if(affix.placement & usedSlots)
continue
if(!(affix.alignment & alignment))
+1 -1
View File
@@ -154,7 +154,7 @@
/obj/projectile/temp/hot = 15,
/obj/projectile/beam/disabler = 15)
var/obj/projectile/picked_projectiletype = pickweight(weighted_projectile_types)
var/obj/projectile/picked_projectiletype = pick_weight(weighted_projectile_types)
var/obj/item/master = comp.parent
comp.appliedComponents += master.AddComponent(/datum/component/mirv, picked_projectiletype)
@@ -80,7 +80,7 @@
source.name = initial(source.name)
else
var/name_to_use = filled_name || initial(source.name)
var/list/unique_list = uniqueList(scoops)
var/list/unique_list = unique_list(scoops)
if(scoops_len > 1 && length(unique_list) == 1) // multiple flavours, and all of the same type
source.name = "[make_tuple(scoops_len)] [scoops[1]] [name_to_use]" // "double vanilla" sounds cooler than just "vanilla"
else
@@ -94,7 +94,7 @@
var/scoops_len = length(scoops)
if(!scoops_len)
source.desc = initial(source.desc)
else if(scoops_len == 1 || length(uniqueList(scoops)) == 1) /// Only one flavour.
else if(scoops_len == 1 || length(unique_list(scoops)) == 1) /// Only one flavour.
var/key = scoops[1]
var/datum/ice_cream_flavour/flavour = GLOB.ice_cream_flavours[LAZYACCESS(special_scoops, key) || key]
if(!flavour?.desc) //I scream.
@@ -107,7 +107,7 @@
/datum/component/ice_cream_holder/proc/on_examine_more(atom/source, mob/mob, list/examine_list)
SIGNAL_HANDLER
var/scoops_len = length(scoops)
if(scoops_len == 1 || length(uniqueList(scoops)) == 1) /// Only one flavour.
if(scoops_len == 1 || length(unique_list(scoops)) == 1) /// Only one flavour.
var/key = scoops[1]
var/datum/ice_cream_flavour/flavour = GLOB.ice_cream_flavours[LAZYACCESS(special_scoops, key) || key]
if(flavour?.desc) //I scream.
+1 -1
View File
@@ -31,7 +31,7 @@
*/
/datum/component/sound_player/proc/play_sound()
SIGNAL_HANDLER
playsound(parent, pickweight(sounds), volume, TRUE)
playsound(parent, pick_weight(sounds), volume, TRUE)
switch(amount_left)
if(-1)
return
+2 -2
View File
@@ -75,9 +75,9 @@
if(prob(squeak_chance))
if(!override_squeak_sounds)
playsound(parent, pickweight(default_squeak_sounds), volume, TRUE, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
playsound(parent, pick_weight(default_squeak_sounds), volume, TRUE, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
else
playsound(parent, pickweight(override_squeak_sounds), volume, TRUE, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
playsound(parent, pick_weight(override_squeak_sounds), volume, TRUE, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
/datum/component/squeak/proc/step_squeak()
SIGNAL_HANDLER
+1 -1
View File
@@ -49,7 +49,7 @@
name2subtype[initial(subtype.name)] = subtype
built_radial_list += list(initial(subtype.name) = option)
built_radial_list = sortList(built_radial_list)
built_radial_list = sort_list(built_radial_list)
/**
* pick_subtype: called from on_attack_self, shows a user a radial menu of all available null rod reskins and replaces the current null rod with the user's chosen reskinned variant
+3 -3
View File
@@ -362,7 +362,7 @@
L += "[S.id]N"
else
L += S.id
L = sortList(L) // Sort the list so it doesn't matter which order the symptoms are in.
L = sort_list(L) // Sort the list so it doesn't matter which order the symptoms are in.
var/result = jointext(L, ":")
id = result
return id
@@ -451,7 +451,7 @@
symptoms += SSdisease.list_symptoms.Copy()
do
if(user)
var/symptom = input(user, "Choose a symptom to add ([i] remaining)", "Choose a Symptom") in sortList(symptoms, /proc/cmp_typepaths_asc)
var/symptom = input(user, "Choose a symptom to add ([i] remaining)", "Choose a Symptom") in sort_list(symptoms, /proc/cmp_typepaths_asc)
if(isnull(symptom))
return
else if(istext(symptom))
@@ -473,7 +473,7 @@
D.name = new_name //Updates our copy
var/list/targets = list("Random")
targets += sortNames(GLOB.human_list)
targets += sort_names(GLOB.human_list)
var/target = input(user, "Pick a viable human target for the disease.", "Disease Target") as null|anything in targets
var/mob/living/carbon/human/H
+1 -1
View File
@@ -65,7 +65,7 @@
if(!available_surgeries.len)
return
var/pick_your_surgery = input("Begin which procedure?", "Surgery", null, null) as null|anything in sortList(available_surgeries)
var/pick_your_surgery = input("Begin which procedure?", "Surgery", null, null) as null|anything in sort_list(available_surgeries)
if(pick_your_surgery && user?.Adjacent(livingtarget) && (source in user))
var/datum/surgery/surgeryinstance_notonmob = available_surgeries[pick_your_surgery]
+1 -1
View File
@@ -94,7 +94,7 @@
/datum/looping_sound/proc/get_sound(starttime, _mid_sounds)
. = _mid_sounds || mid_sounds
while(!isfile(.) && !isnull(.))
. = pickweight(.)
. = pick_weight(.)
/datum/looping_sound/proc/on_start()
var/start_wait = 0
+6 -6
View File
@@ -63,7 +63,7 @@
if(gen_turf.turf_flags & NO_RUINS)
stored_flags |= NO_RUINS
var/turf/new_turf = pickweight(closed ? closed_turf_types : open_turf_types)
var/turf/new_turf = pick_weight(closed ? closed_turf_types : open_turf_types)
new_turf = gen_turf.ChangeTurf(new_turf, initial(new_turf.baseturfs), CHANGETURF_DEFER_CHANGE)
@@ -83,7 +83,7 @@
if(!(A.area_flags & FLORA_ALLOWED))
can_spawn = FALSE
if(can_spawn)
spawned_flora = pickweight(flora_spawn_list)
spawned_flora = pick_weight(flora_spawn_list)
spawned_flora = new spawned_flora(new_open_turf)
//FEATURE SPAWNING HERE
@@ -94,7 +94,7 @@
if(!(A.area_flags & FLORA_ALLOWED)) //checks the same flag because lol dunno
can_spawn = FALSE
var/atom/picked_feature = pickweight(feature_spawn_list)
var/atom/picked_feature = pick_weight(feature_spawn_list)
for(var/obj/structure/F in range(7, new_open_turf))
if(istype(F, picked_feature))
@@ -111,13 +111,13 @@
if(!(A.area_flags & MOB_SPAWN_ALLOWED))
can_spawn = FALSE
var/atom/picked_mob = pickweight(mob_spawn_list)
var/atom/picked_mob = pick_weight(mob_spawn_list)
if(picked_mob == SPAWN_MEGAFAUNA) //
if((A.area_flags & MEGAFAUNA_SPAWN_ALLOWED) && megafauna_spawn_list?.len) //this is danger. it's boss time.
picked_mob = pickweight(megafauna_spawn_list)
picked_mob = pick_weight(megafauna_spawn_list)
else //this is not danger, don't spawn a boss, spawn something else
picked_mob = pickweight(mob_spawn_list - SPAWN_MEGAFAUNA) //What if we used 100% of the brain...and did something (slightly) less shit than a while loop?
picked_mob = pick_weight(mob_spawn_list - SPAWN_MEGAFAUNA) //What if we used 100% of the brain...and did something (slightly) less shit than a while loop?
for(var/thing in urange(12, new_open_turf)) //prevents mob clumps
if(!ishostile(thing) && !istype(thing, /obj/structure/spawner))
+2 -2
View File
@@ -484,7 +484,7 @@
A.admin_remove(usr)
if (href_list["role_edit"])
var/new_role = input("Select new role", "Assigned role", assigned_role.title) as null|anything in sortList(SSjob.station_jobs)
var/new_role = input("Select new role", "Assigned role", assigned_role.title) as null|anything in sort_list(SSjob.station_jobs)
if(isnull(new_role))
return
var/datum/job/new_job = SSjob.GetJob(new_role)
@@ -522,7 +522,7 @@
if(1)
target_antag = antag_datums[1]
else
var/datum/antagonist/target = input("Which antagonist gets the objective:", "Antagonist", "(new custom antag)") as null|anything in sortList(antag_datums) + "(new custom antag)"
var/datum/antagonist/target = input("Which antagonist gets the objective:", "Antagonist", "(new custom antag)") as null|anything in sort_list(antag_datums) + "(new custom antag)"
if (QDELETED(target))
return
else if(target == "(new custom antag)")
+1 -1
View File
@@ -61,7 +61,7 @@
if(!length(possible))
to_chat(user,span_warning("Despite your best efforts, there are no scents to be found on [sniffed]..."))
return
tracking_target = input(user, "Choose a scent to remember.", "Scent Tracking") as null|anything in sortNames(possible)
tracking_target = input(user, "Choose a scent to remember.", "Scent Tracking") as null|anything in sort_names(possible)
if(!tracking_target)
if(!old_target)
to_chat(user,span_warning("You decide against remembering any scents. Instead, you notice your own nose in your peripheral vision. This goes on to remind you of that one time you started breathing manually and couldn't stop. What an awful day that was."))
+1 -1
View File
@@ -79,7 +79,7 @@
if(nlog_type & LOG_SAY)
var/list/reversed = log_source[log_type]
if(islist(reversed))
say_log = reverseRange(reversed.Copy())
say_log = reverse_range(reversed.Copy())
break
if(LAZYLEN(say_log))
for(var/spoken_memory in say_log)
+1 -1
View File
@@ -315,7 +315,7 @@
var/list/types = list(uniform, suit, back, belt, gloves, shoes, head, mask, neck, ears, glasses, id, l_pocket, r_pocket, suit_store, r_hand, l_hand)
types += chameleon_extras
types += skillchips
listclearnulls(types)
list_clear_nulls(types)
return types
/// Return a json list of this outfit
@@ -193,7 +193,7 @@
var/mob/living/carbon/human/species/monkey/punpun/punpun = locate()
if(!punpun)
return
var/weapon_type = pickweight(weapon_types)
var/weapon_type = pick_weight(weapon_types)
var/obj/item/weapon = new weapon_type
if(!punpun.put_in_l_hand(weapon) && !punpun.put_in_r_hand(weapon))
// Guess they did all this with whatever they have in their hands already
+1 -1
View File
@@ -1259,7 +1259,7 @@
if(!valid_id)
to_chat(usr, span_warning("A reagent with that ID doesn't exist!"))
if("Choose from a list")
chosen_id = input(usr, "Choose a reagent to add.", "Choose a reagent.") as null|anything in sortList(subtypesof(/datum/reagent), /proc/cmp_typepaths_asc)
chosen_id = input(usr, "Choose a reagent to add.", "Choose a reagent.") as null|anything in sort_list(subtypesof(/datum/reagent), /proc/cmp_typepaths_asc)
if("I'm feeling lucky")
chosen_id = pick(subtypesof(/datum/reagent))
if(chosen_id)
+3 -3
View File
@@ -222,7 +222,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
else if (href_list["stacking_limit"])
GLOB.dynamic_stacking_limit = input(usr,"Change the threat limit at which round-endings rulesets will start to stack.", "Change stacking limit", null) as num
else if(href_list["force_latejoin_rule"])
var/added_rule = input(usr,"What ruleset do you want to force upon the next latejoiner? This will bypass threat level and population restrictions.", "Rigging Latejoin", null) as null|anything in sortNames(init_rulesets(/datum/dynamic_ruleset/latejoin))
var/added_rule = input(usr,"What ruleset do you want to force upon the next latejoiner? This will bypass threat level and population restrictions.", "Rigging Latejoin", null) as null|anything in sort_names(init_rulesets(/datum/dynamic_ruleset/latejoin))
if (!added_rule)
return
forced_latejoin_rule = added_rule
@@ -233,7 +233,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
log_admin("[key_name(usr)] cleared the forced latejoin ruleset.")
message_admins("[key_name(usr)] cleared the forced latejoin ruleset.")
else if(href_list["force_midround_rule"])
var/added_rule = input(usr,"What ruleset do you want to force right now? This will bypass threat level and population restrictions.", "Execute Ruleset", null) as null|anything in sortNames(init_rulesets(/datum/dynamic_ruleset/midround))
var/added_rule = input(usr,"What ruleset do you want to force right now? This will bypass threat level and population restrictions.", "Execute Ruleset", null) as null|anything in sort_names(init_rulesets(/datum/dynamic_ruleset/midround))
if (!added_rule)
return
log_admin("[key_name(usr)] executed the [added_rule] ruleset.")
@@ -470,7 +470,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
var/round_start_budget_left = round_start_budget
while (round_start_budget_left > 0)
var/datum/dynamic_ruleset/roundstart/ruleset = pickweightAllowZero(drafted_rules)
var/datum/dynamic_ruleset/roundstart/ruleset = pick_weight_allow_zero(drafted_rules)
if (isnull(ruleset))
log_game("DYNAMIC: No more rules can be applied, stopping with [round_start_budget] left.")
break
@@ -4,7 +4,7 @@
/datum/dynamic_ruleset
/// For admin logging and round end screen.
// If you want to change this variable name, the force latejoin/midround rulesets
// to not use sortNames.
// to not use sort_names.
var/name = ""
/// For admin logging and round end screen, do not change this unless making a new rule type.
var/ruletype = ""
@@ -7,7 +7,7 @@
return null
while (TRUE)
var/datum/dynamic_ruleset/rule = pickweight(drafted_rules)
var/datum/dynamic_ruleset/rule = pick_weight(drafted_rules)
if (!rule)
return null
+4 -4
View File
@@ -40,7 +40,7 @@ GLOBAL_LIST_EMPTY(objectives)
if ((possible_target != src) && ishuman(possible_target.current))
possible_targets += possible_target.current
possible_targets = list("Free objective", "Random") + sortNames(possible_targets)
possible_targets = list("Free objective", "Random") + sort_names(possible_targets)
if(target?.current)
@@ -595,7 +595,7 @@ GLOBAL_LIST_EMPTY(possible_items)
/datum/objective/steal/admin_edit(mob/admin)
var/list/possible_items_all = GLOB.possible_items
var/new_target = input(admin,"Select target:", "Objective target", steal_target) as null|anything in sortNames(possible_items_all)+"custom"
var/new_target = input(admin,"Select target:", "Objective target", steal_target) as null|anything in sort_names(possible_items_all)+"custom"
if (!new_target)
return
@@ -829,7 +829,7 @@ GLOBAL_LIST_EMPTY(possible_items_special)
/datum/objective/destroy/admin_edit(mob/admin)
var/list/possible_targets = active_ais(1)
if(possible_targets.len)
var/mob/new_target = input(admin,"Select target:", "Objective target") as null|anything in sortNames(possible_targets)
var/mob/new_target = input(admin,"Select target:", "Objective target") as null|anything in sort_names(possible_targets)
target = new_target.mind
else
to_chat(admin, span_boldwarning("No active AIs with minds."))
@@ -902,7 +902,7 @@ GLOBAL_LIST_EMPTY(possible_items_special)
/proc/generate_admin_objective_list()
GLOB.admin_objective_list = list()
var/list/allowed_types = sortList(list(
var/list/allowed_types = sort_list(list(
/datum/objective/assassinate,
/datum/objective/maroon,
/datum/objective/debrain,
+1 -1
View File
@@ -627,7 +627,7 @@
if(user_unbuckle_mob(buckled_mobs[1],user))
return TRUE
var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sortNames(buckled_mobs)
var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sort_names(buckled_mobs)
if(user_unbuckle_mob(unbuckled,user))
return TRUE
+1 -1
View File
@@ -206,7 +206,7 @@
if(materials.materials[i] > 0)
list_to_show += i
used_material = input("Choose [used_material]", "Custom Material") as null|anything in sortList(list_to_show, /proc/cmp_typepaths_asc)
used_material = input("Choose [used_material]", "Custom Material") as null|anything in sort_list(list_to_show, /proc/cmp_typepaths_asc)
if(!used_material)
return //Didn't pick any material, so you can't build shit either.
custom_materials[used_material] += amount_needed
+1 -1
View File
@@ -225,7 +225,7 @@
droppable_parts += assembly.proxy_module
if(!droppable_parts.len)
return
var/obj/item/choice = input(user, "Select a part to remove:", src) as null|obj in sortNames(droppable_parts)
var/obj/item/choice = input(user, "Select a part to remove:", src) as null|obj in sort_names(droppable_parts)
if(!choice || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
to_chat(user, span_notice("You remove [choice] from [src]."))
@@ -202,7 +202,7 @@
droppable_parts += proxy_module
if(!droppable_parts.len)
return
var/obj/item/choice = input(user, "Select a part to remove:", src) as null|obj in sortNames(droppable_parts)
var/obj/item/choice = input(user, "Select a part to remove:", src) as null|obj in sort_names(droppable_parts)
if(!choice || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
to_chat(user, span_notice("You remove [choice] from [src]."))
+1 -1
View File
@@ -53,7 +53,7 @@
else
track.others[name] = WEAKREF(L)
var/list/targets = sortList(track.humans) + sortList(track.others)
var/list/targets = sort_list(track.humans) + sort_list(track.others)
return targets
@@ -99,9 +99,9 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list(
var/prizeselect
if(prize_override)
prizeselect = pickweight(prize_override)
prizeselect = pick_weight(prize_override)
else
prizeselect = pickweight(GLOB.arcade_prize_pool)
prizeselect = pick_weight(GLOB.arcade_prize_pool)
var/atom/movable/the_prize = new prizeselect(get_turf(src))
playsound(src, 'sound/machines/machine_vend.ogg', 50, TRUE, extrarange = -3)
visible_message(span_notice("[src] dispenses [the_prize]!"), span_notice("You hear a chime and a clunk."))
@@ -124,9 +124,9 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list(
num_of_prizes = rand(0,2)
for(var/i = num_of_prizes; i > 0; i--)
if(override)
empprize = pickweight(prize_override)
empprize = pick_weight(prize_override)
else
empprize = pickweight(GLOB.arcade_prize_pool)
empprize = pick_weight(GLOB.arcade_prize_pool)
new empprize(loc)
explosion(src, devastation_range = -1, light_impact_range = 1+num_of_prizes, flame_range = 1+num_of_prizes)
+1 -1
View File
@@ -328,7 +328,7 @@ GLOBAL_LIST_INIT(orion_events, generate_orion_events())
*/
/obj/machinery/computer/arcade/orion_trail/proc/encounter_event(path, gamer, gamer_skill, gamer_skill_level, gamer_skill_rands)
if(!path)
event = pickweightAllowZero(events)
event = pick_weight_allow_zero(events)
else
for(var/datum/orion_event/instance as anything in events)
if(instance.type == path)
+1 -1
View File
@@ -168,7 +168,7 @@
var/list/keys = list()
for(var/mob/M in GLOB.player_list)
keys += M.client
var/client/selection = input("Please, select a player!", "Team member", null, null) as null|anything in sortKey(keys)
var/client/selection = input("Please, select a player!", "Team member", null, null) as null|anything in sort_key(keys)
//Could be freeform if you want to add disconnected i guess
if(!selection)
return
@@ -430,7 +430,7 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers)
IO |= text[1]
if(!IO.len)
to_chat(user, span_alert("No machinery detected."))
var/S = input("Select the device set: ", "Selection", IO[1]) as anything in sortList(IO)
var/S = input("Select the device set: ", "Selection", IO[1]) as anything in sort_list(IO)
if(src)
src.input_tag = "[S]_in"
src.output_tag = "[S]_out"
+1 -1
View File
@@ -63,7 +63,7 @@
if(!isnull(GLOB.data_core.general))
for(var/datum/data/record/R in sortRecord(GLOB.data_core.general, sortBy, order))
for(var/datum/data/record/R in sort_record(GLOB.data_core.general, sortBy, order))
var/blood_type = ""
var/b_dna = ""
for(var/datum/data/record/E in GLOB.data_core.medical)
+1 -1
View File
@@ -285,7 +285,7 @@
<th>Criminal Status</th>
</tr>"}
if(!isnull(GLOB.data_core.general))
for(var/datum/data/record/R in sortRecord(GLOB.data_core.general, sortBy, order))
for(var/datum/data/record/R in sort_record(GLOB.data_core.general, sortBy, order))
var/crimstat = ""
for(var/datum/data/record/E in GLOB.data_core.security)
if((E.fields["name"] == R.fields["name"]) && (E.fields["id"] == R.fields["id"]))
+2 -2
View File
@@ -183,7 +183,7 @@
var/list/targets = get_targets()
if (regime_set == "Teleporter")
var/desc = input("Please select a location to lock in.", "Locking Computer") as null|anything in sortList(targets)
var/desc = input("Please select a location to lock in.", "Locking Computer") as null|anything in sort_list(targets)
set_teleport_target(targets[desc])
var/turf/target_turf = get_turf(targets[desc])
log_game("[key_name(user)] has set the teleporter target to [targets[desc]] at [AREACOORD(target_turf)]")
@@ -192,7 +192,7 @@
to_chat(user, span_alert("No active connected stations located."))
return
var/desc = input("Please select a station to lock in.", "Locking Computer") as null|anything in sortList(targets)
var/desc = input("Please select a station to lock in.", "Locking Computer") as null|anything in sort_list(targets)
var/obj/machinery/teleport/station/target_station = targets[desc]
if(!target_station || !target_station.teleporter_hub)
return
+1 -1
View File
@@ -1192,7 +1192,7 @@
return
// reads from the airlock painter's `available paintjob` list. lets the player choose a paint option, or cancel painting
var/current_paintjob = input(user, "Please select a paintjob for this airlock.") as null|anything in sortList(painter.available_paint_jobs)
var/current_paintjob = input(user, "Please select a paintjob for this airlock.") as null|anything in sort_list(painter.available_paint_jobs)
if(!current_paintjob) // if the user clicked cancel on the popup, return
return
+1 -1
View File
@@ -295,7 +295,7 @@ Possible to do for anyone motivated enough:
if(A)
LAZYADD(callnames[A], I)
callnames -= get_area(src)
var/result = tgui_input_list(usr, "Choose an area to call", "Holocall", sortNames(callnames))
var/result = tgui_input_list(usr, "Choose an area to call", "Holocall", sort_names(callnames))
if(QDELETED(usr) || !result || outgoing_call)
return
if(usr.loc == loc)
+1 -1
View File
@@ -576,7 +576,7 @@ GLOBAL_LIST_EMPTY(allCasters)
for(var/datum/newscaster/feed_channel/F in GLOB.news_network.network_channels)
if( (!F.locked || F.author == scanned_user) && !F.censored)
available_channels += F.channel_name
channel_name = input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in sortList(available_channels)
channel_name = input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in sort_list(available_channels)
updateUsrDialog()
else if(href_list["set_new_message"])
var/temp_message = trim(stripped_multiline_input(usr, "Write your Feed story", "Network Channel Handler", msg))
+2 -2
View File
@@ -19,7 +19,7 @@
return
if(can_buckle && has_buckled_mobs())
if(buckled_mobs.len > 1)
var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sortNames(buckled_mobs)
var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sort_names(buckled_mobs)
if(user_unbuckle_mob(unbuckled,user))
return TRUE
else
@@ -45,7 +45,7 @@
return
if(Adjacent(user) && can_buckle && has_buckled_mobs())
if(buckled_mobs.len > 1)
var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sortNames(buckled_mobs)
var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sort_names(buckled_mobs)
return user_unbuckle_mob(unbuckled,user)
else
return user_unbuckle_mob(buckled_mobs[1], user)
@@ -62,9 +62,9 @@
if(loot?.len)
var/loot_spawned = 0
while((spawn_loot_count-loot_spawned) && loot.len)
var/lootspawn = pickweight(loot)
var/lootspawn = pick_weight(loot)
while(islist(lootspawn))
lootspawn = pickweight(lootspawn)
lootspawn = pick_weight(lootspawn)
if(!spawn_loot_double)
loot.Remove(lootspawn)
if(lootspawn && (spawn_scatter_radius == 0 || spawn_locations.len))
@@ -139,7 +139,7 @@
stat_table[item] /= loot_count
/obj/item/loot_table_maker/proc/pick_loot(lootpool) //selects path from loot table and returns it
var/lootspawn = pickweight(lootpool)
var/lootspawn = pick_weight(lootpool)
while(islist(lootspawn))
lootspawn = pickweight(lootspawn)
lootspawn = pick_weight(lootspawn)
return lootspawn
+1 -1
View File
@@ -261,7 +261,7 @@
option.image = image(icon = initial(spider.icon), icon_state = initial(spider.icon_state))
option.info = span_boldnotice("[initial(spider.menu_description)]")
display_spiders[initial(spider.name)] = option
sortList(display_spiders)
sort_list(display_spiders)
var/chosen_spider = show_radial_menu(user, egg, display_spiders, radius = 38)
chosen_spider = spider_list[chosen_spider]
if(QDELETED(src) || QDELETED(user) || !chosen_spider)
+1 -1
View File
@@ -15,7 +15,7 @@
/obj/item/cardboard_cutout/Initialize(mapload)
. = ..()
possible_appearances = sortList(list(
possible_appearances = sort_list(list(
"Assistant" = image(icon = src.icon, icon_state = "cutout_greytide"),
"Clown" = image(icon = src.icon, icon_state = "cutout_clown"),
"Mime" = image(icon = src.icon, icon_state = "cutout_mime"),
+1 -1
View File
@@ -1271,7 +1271,7 @@
trim_list[fake_trim_name] = trim_path
var/selected_trim_path
selected_trim_path = input("Select trim to apply to your card.\nNote: This will not grant any trim accesses.", "Forge Trim", selected_trim_path) as null|anything in sortList(trim_list, /proc/cmp_typepaths_asc)
selected_trim_path = input("Select trim to apply to your card.\nNote: This will not grant any trim accesses.", "Forge Trim", selected_trim_path) as null|anything in sort_list(trim_list, /proc/cmp_typepaths_asc)
if(selected_trim_path)
SSid_access.apply_trim_to_chameleon_card(src, trim_list[selected_trim_path])
+1 -1
View File
@@ -48,7 +48,7 @@
if(!initial(CM.weight))
break
chromosomes[A] = initial(CM.weight)
return pickweight(chromosomes)
return pick_weight(chromosomes)
/obj/item/chromosome/stabilizer
@@ -564,7 +564,7 @@
display_vending_names_paths = list()
for(var/path in vending_names_paths)
display_vending_names_paths[vending_names_paths[path]] = path
var/choice = input(user,"Choose a new brand","Select an Item") as null|anything in sortList(display_vending_names_paths)
var/choice = input(user,"Choose a new brand","Select an Item") as null|anything in sort_list(display_vending_names_paths)
set_type(display_vending_names_paths[choice])
else
return ..()
+2 -2
View File
@@ -1215,7 +1215,7 @@ GLOBAL_LIST_EMPTY(PDAs)
plist[avoid_assoc_duplicate_keys(pda.owner, namecounts)] = pda
var/choice = tgui_input_list(user, "Please select a PDA", "PDA Messenger", sortList(plist))
var/choice = tgui_input_list(user, "Please select a PDA", "PDA Messenger", sort_list(plist))
if (!choice)
return
@@ -1264,7 +1264,7 @@ GLOBAL_LIST_EMPTY(PDAs)
else
sortmode = /proc/cmp_pdaname_asc
for(var/obj/item/pda/P in sortList(GLOB.PDAs, sortmode))
for(var/obj/item/pda/P in sort_list(GLOB.PDAs, sortmode))
if(!P.owner || P.toff || P.hidden)
continue
. += P
+3 -3
View File
@@ -297,7 +297,7 @@ Code:
if (44) //medical records //This thing only displays a single screen so it's hard to really get the sub-menu stuff working.
menu = "<h4>[PDAIMG(medical)] Medical Record List</h4>"
if(GLOB.data_core.general)
for(var/datum/data/record/R in sortRecord(GLOB.data_core.general))
for(var/datum/data/record/R in sort_record(GLOB.data_core.general))
menu += "<a href='byond://?src=[REF(src)];choice=Medical Records;target=[R.fields["id"]]'>[R.fields["id"]]: [R.fields["name"]]<br>"
menu += "<br>"
if(441)
@@ -340,7 +340,7 @@ Code:
if (45) //security records
menu = "<h4>[PDAIMG(cuffs)] Security Record List</h4>"
if(GLOB.data_core.general)
for (var/datum/data/record/R in sortRecord(GLOB.data_core.general))
for (var/datum/data/record/R in sort_record(GLOB.data_core.general))
menu += "<a href='byond://?src=[REF(src)];choice=Security Records;target=[R.fields["id"]]'>[R.fields["id"]]: [R.fields["name"]]<br>"
menu += "<br>"
@@ -530,7 +530,7 @@ Code:
if(!emoji_table)
var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/chat)
var/list/collate = list("<br><table>")
for(var/emoji in sortList(icon_states(icon(EMOJI_SET))))
for(var/emoji in sort_list(icon_states(icon(EMOJI_SET))))
var/tag = sheet.icon_tag("emoji-[emoji]")
collate += "<tr><td>[emoji]</td><td>[tag]</td></tr>"
collate += "</table><br>"
@@ -87,7 +87,7 @@
if(!camera_ref || !camera.c_tag)
continue
bugged_cameras[camera.c_tag] = camera_ref
return sortList(bugged_cameras)
return sort_list(bugged_cameras)
/obj/item/camera_bug/proc/menu(list/cameras)
+1 -1
View File
@@ -844,7 +844,7 @@ GENE SCANNER
for(var/A in buffer)
options += get_display_name(A)
var/answer = input(user, "Analyze Potential", "Sequence Analyzer") as null|anything in sortList(options)
var/answer = input(user, "Analyze Potential", "Sequence Analyzer") as null|anything in sort_list(options)
if(answer && ready && user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
var/sequence
for(var/A in buffer) //this physically hurts but i dont know what anything else short of an assoc list
@@ -25,7 +25,7 @@
add_overlay("improvised_grenade_filled")
add_overlay("improvised_grenade_wired")
times = list("5" = 10, "-1" = 20, "[rand(30,80)]" = 50, "[rand(65,180)]" = 20)// "Premature, Dud, Short Fuse, Long Fuse"=[weighting value]
det_time = text2num(pickweight(times))
det_time = text2num(pick_weight(times))
if(det_time < 0) //checking for 'duds'
range = 1
det_time = rand(30,80)
+1 -1
View File
@@ -158,7 +158,7 @@
goodies += job_goodies
for(var/iterator = 0, iterator < goodie_count, iterator++)
var/target_good = pickweight(goodies)
var/target_good = pick_weight(goodies)
var/atom/movable/target_atom = new target_good(src)
body.log_message("[key_name(body)] received [target_atom.name] in the mail ([target_good])", LOG_GAME)
+1 -1
View File
@@ -143,7 +143,7 @@
user.visible_message(span_notice("[user]'s pinpointer fails to detect a signal."), span_notice("Your pinpointer fails to detect a signal."))
return
var/A = input(user, "Person to track", "Pinpoint") in sortList(names)
var/A = input(user, "Person to track", "Pinpoint") in sort_list(names)
if(!A || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated())
return
+1 -1
View File
@@ -929,7 +929,7 @@
/obj/item/storage/box/papersack/Initialize(mapload)
. = ..()
papersack_designs = sortList(list(
papersack_designs = sort_list(list(
"None" = image(icon = src.icon, icon_state = "paperbag_None"),
"NanotrasenStandard" = image(icon = src.icon, icon_state = "paperbag_NanotrasenStandard"),
"SyndiSnacks" = image(icon = src.icon, icon_state = "paperbag_SyndiSnacks"),
@@ -23,7 +23,7 @@
/obj/item/storage/box/syndicate
/obj/item/storage/box/syndicate/bundle_a/PopulateContents()
switch (pickweight(list(
switch (pick_weight(list(
KIT_RECON = 2,
KIT_BLOODY_SPAI = 3,
KIT_STEALTHY = 2,
@@ -153,7 +153,7 @@
new /obj/item/card/emag/doorjack(src) // 3 tc
/obj/item/storage/box/syndicate/bundle_b/PopulateContents()
switch (pickweight(list(
switch (pick_weight(list(
KIT_JAMES_BOND = 2,
KIT_NINJA = 1,
KIT_DARK_LORD = 1,
+3 -3
View File
@@ -304,7 +304,7 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices)
/obj/item/tcgcard_deck/proc/flip_deck()
flipped = !flipped
var/list/temp_deck = contents.Copy()
contents = reverseRange(temp_deck)
contents = reverse_range(temp_deck)
//Now flip the cards to their opposite positions.
for(var/a in 1 to contents.len)
var/obj/item/tcgcard/nu_card = contents[a]
@@ -437,7 +437,7 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices)
weight += rarity_table[chance]
var/random = rand(weight)
for(var/bracket in rarity_table)
//Steals blatently from pickweight(), sorry buddy I need the index
//Steals blatently from pick_weight(), sorry buddy I need the index
random -= rarity_table[bracket]
if(random <= 0)
rarity = bracket
@@ -565,7 +565,7 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices)
totalCards++
cardsByCount[id] += 1
var/toSend = "Out of [totalCards] cards"
for(var/id in sortList(cardsByCount, /proc/cmp_num_string_asc))
for(var/id in sort_list(cardsByCount, /proc/cmp_num_string_asc))
if(id)
var/datum/card/template = GLOB.cached_cards[pack.series]["ALL"][id]
toSend += "\nID:[id] [template.name] [(cardsByCount[id] * 100) / totalCards]% Total:[cardsByCount[id]]"
+1 -1
View File
@@ -1498,7 +1498,7 @@
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
icon_state = "shell[rand(1,3)]"
color = pickweight(possible_colors)
color = pick_weight(possible_colors)
setDir(pick(GLOB.cardinals))
/obj/item/toy/brokenradio
+1 -1
View File
@@ -262,7 +262,7 @@
to_chat(user, span_notice("Your pinpointer fails to detect a signal."))
return
var/A = input(user, "", "Pinpoint") as null|anything in sortList(beacons)
var/A = input(user, "", "Pinpoint") as null|anything in sort_list(beacons)
if(!A || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated())
return
+1 -1
View File
@@ -348,7 +348,7 @@
for(var/reskin_option in unique_reskin)
var/image/item_image = image(icon = src.icon, icon_state = unique_reskin[reskin_option])
items += list("[reskin_option]" = item_image)
sortList(items)
sort_list(items)
var/pick = show_radial_menu(M, src, items, custom_check = CALLBACK(src, .proc/check_reskin_menu, M), radius = 38, require_near = TRUE)
if(!pick)
+1 -1
View File
@@ -123,7 +123,7 @@
/obj/structure/sign/barsign/proc/pick_sign(mob/user)
var/picked_name = input(user, "Available Signage", "Bar Sign", name) as null|anything in sortList(get_bar_names())
var/picked_name = input(user, "Available Signage", "Bar Sign", name) as null|anything in sort_list(get_bar_names())
if(!picked_name)
return
chosen_sign = set_sign_by_name(picked_name)
+1 -1
View File
@@ -268,7 +268,7 @@ LINEN BINS
/obj/item/bedsheet/dorms/Initialize(mapload)
..()
var/type = pickweight(list("Colors" = 80, "Special" = 20))
var/type = pick_weight(list("Colors" = 80, "Special" = 20))
switch(type)
if("Colors")
type = pick(list(/obj/item/bedsheet,
@@ -234,7 +234,7 @@
for(var/atom/movable/AM in L)
if(AM != src && insert(AM) == LOCKER_FULL) // limit reached
break
for(var/i in reverseRange(L.get_all_contents()))
for(var/i in reverse_range(L.get_all_contents()))
var/atom/movable/thing = i
SEND_SIGNAL(thing, COMSIG_TRY_STORAGE_HIDE_ALL)
@@ -26,7 +26,7 @@
if (prob(40))
new /obj/item/storage/toolbox/emergency(src)
switch (pickweight(list("small" = 35, "aid" = 30, "tank" = 20, "both" = 10, "nothing" = 4, "delete" = 1)))
switch (pick_weight(list("small" = 35, "aid" = 30, "tank" = 20, "both" = 10, "nothing" = 4, "delete" = 1)))
if ("small")
new /obj/item/tank/internals/emergency_oxygen(src)
new /obj/item/tank/internals/emergency_oxygen(src)
+1 -1
View File
@@ -115,7 +115,7 @@
if(!length(items))
return
items = sortList(items)
items = sort_list(items)
var/pick = show_radial_menu(user, src, items, custom_check = CALLBACK(src, .proc/check_menu, user), radius = 38, require_near = TRUE)
if(!pick)
return
+1 -1
View File
@@ -32,7 +32,7 @@ at the cost of risking a vicious bite.**/
if(prob(40))
critter_infested = FALSE
if(prob(75))
var/picked_item = pickweight(loot)
var/picked_item = pick_weight(loot)
hidden_item = new picked_item(src)
loot = null
AddElement(/datum/element/swabable, CELL_LINE_TABLE_MOIST, CELL_VIRUS_TABLE_GENERIC, rand(2,4), 20)
+1 -1
View File
@@ -146,7 +146,7 @@
var/datum/species/S = speciestype
if(initial(S.changesource_flags) & MIRROR_MAGIC)
choosable_races += initial(S.id)
choosable_races = sortList(choosable_races)
choosable_races = sort_list(choosable_races)
/obj/structure/mirror/magic/lesser/Initialize(mapload)
choosable_races = get_selectable_species().Copy()
+1 -1
View File
@@ -65,7 +65,7 @@
if(!initial(potential_sign.is_editable))
continue
output[initial(potential_sign.sign_change_name)] = potential_sign
output = sortList(output) //Alphabetizes the results.
output = sort_list(output) //Alphabetizes the results.
return output
/obj/structure/sign/wrench_act(mob/living/user, obj/item/wrench/I)
+1 -1
View File
@@ -190,7 +190,7 @@
. = ..()
if (prob(mineralChance))
var/path = pickweight(mineralSpawnChanceList)
var/path = pick_weight(mineralSpawnChanceList)
if(ispath(path, /turf))
var/stored_flags = 0
if(turf_flags & NO_RUINS)
+2 -2
View File
@@ -92,11 +92,11 @@
C.user = user
C.next = null
if(deep_copy)
C.data = deepCopyList(data)
C.data = deep_copy_list(data)
else
C.data = data
return C
/datum/netdata/proc/json_to_data(json)
data = json_decode(json)
+1 -1
View File
@@ -22,7 +22,7 @@
else
logs_missing += "[subject] (empty)"
var/list/combined = sortList(logs_present) + sortList(logs_missing)
var/list/combined = sort_list(logs_present) + sort_list(logs_missing)
var/selected = input("Investigate what?", "Investigate") as null|anything in combined
+4 -4
View File
@@ -606,7 +606,7 @@ GLOBAL_PROTECT(admin_verbs_hideable)
if(!SStrading_card_game.loaded)
message_admins("The card subsystem is not currently loaded")
return
var/pack = input("Which pack should we test?", "You fucked it didn't you") as null|anything in sortList(SStrading_card_game.card_packs)
var/pack = input("Which pack should we test?", "You fucked it didn't you") as null|anything in sort_list(SStrading_card_game.card_packs)
var/batchCount = input("How many times should we open it?", "Don't worry, I understand") as null|num
var/batchSize = input("How many cards per batch?", "I hope you remember to check the validation") as null|num
var/guar = input("Should we use the pack's guaranteed rarity? If so, how many?", "We've all been there. Man you should have seen the old system") as null|num
@@ -626,7 +626,7 @@ GLOBAL_PROTECT(admin_verbs_hideable)
var/type_length = length_char("/obj/effect/proc_holder/spell") + 2
for(var/spell in GLOB.spells)
spell_list[copytext_char("[spell]", type_length)] = spell
var/spell_desc = input("Choose the spell to give to that guy", "ABRAKADABRA") as null|anything in sortList(spell_list)
var/spell_desc = input("Choose the spell to give to that guy", "ABRAKADABRA") as null|anything in sort_list(spell_list)
if(!spell_desc)
return
@@ -663,7 +663,7 @@ GLOBAL_PROTECT(admin_verbs_hideable)
if(!length(target_spell_list))
return
var/obj/effect/proc_holder/spell/removed_spell = input("Choose the spell to remove", "NO ABRAKADABRA") as null|anything in sortList(target_spell_list)
var/obj/effect/proc_holder/spell/removed_spell = input("Choose the spell to remove", "NO ABRAKADABRA") as null|anything in sort_list(target_spell_list)
if(removed_spell)
removal_target.mind.RemoveSpell(removed_spell)
log_admin("[key_name(usr)] removed the spell [removed_spell] from [key_name(removal_target)].")
@@ -677,7 +677,7 @@ GLOBAL_PROTECT(admin_verbs_hideable)
if(!istype(T))
to_chat(src, span_notice("You can only give a disease to a mob of type /mob/living."), confidential = TRUE)
return
var/datum/disease/D = input("Choose the disease to give to that guy", "ACHOO") as null|anything in sortList(SSdisease.diseases, /proc/cmp_typepaths_asc)
var/datum/disease/D = input("Choose the disease to give to that guy", "ACHOO") as null|anything in sort_list(SSdisease.diseases, /proc/cmp_typepaths_asc)
if(!D)
return
T.ForceContractDisease(new D, FALSE, TRUE)
+1 -1
View File
@@ -19,7 +19,7 @@
/obj/item, /obj/item/clothing, /obj/item/stack, /obj/item,
/obj/item/reagent_containers, /obj/item/gun)
var/path = input("Select the path of the object you wish to create.", "Path", /obj) in sortList(create_object_forms, /proc/cmp_typepaths_asc)
var/path = input("Select the path of the object you wish to create.", "Path", /obj) in sort_list(create_object_forms, /proc/cmp_typepaths_asc)
var/html_form = create_object_forms[path]
if (!html_form)
@@ -14,7 +14,7 @@
var/random_appearance
/datum/smite/custom_imaginary_friend/configure(client/user)
friend_candidate_client = tgui_input_list(user, "Pick the player to put in control.", "New Imaginary Friend", sortList(GLOB.clients))
friend_candidate_client = tgui_input_list(user, "Pick the player to put in control.", "New Imaginary Friend", sort_list(GLOB.clients))
if(QDELETED(friend_candidate_client))
to_chat(user, span_notice("Selected player no longer has a client, aborting."))
+1 -1
View File
@@ -403,7 +403,7 @@
if (SSstickyban.dbcacheexpire)
return SSstickyban.dbcache.Copy()
return sortList(world.GetConfig("ban"))
return sort_list(world.GetConfig("ban"))
/proc/get_stickyban_from_ckey(ckey)

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