This commit is contained in:
Fordoxia
2024-04-20 01:54:46 +01:00
482 changed files with 5217 additions and 3247 deletions

View File

@@ -586,6 +586,26 @@ SS13 has a lot of legacy code that's never been updated. Here are some examples
- Files and path accessed and referenced by code above simply being #included should be strictly lowercase to avoid issues on filesystems where case matters.
#### Modular Code in a File
Code should be modular where possible; if you are working on a new addition, then strongly consider putting it in its own file unless it makes sense to put it with similar ones (i.e. a new tool would go in the `tools.dm` file)
Our codebase also has support for checking files so that they only contain one specific typepath, including none of its subtypes. This can be done by adding a specific header at the beginning of the file, which the CI will look for when running. An example can be seen below. You can also run this test locally using `/tools/ci/restrict_file_types.py`
```dm
RESTRICT_TYPE(/datum/foo)
/datum/proc/do_thing() // Error: '/datum' proc found in a file restricted to '/datum/foo'
/datum/foo
/datum/foo/do_thing()
/datum/foo/bar // Error: '/datum/foo/bar' type definition found in a file restricted to '/datum/foo'
/datum/foo/bar/do_thing() // Error: '/datum/foo/bar' proc found in a file restricted to '/datum/foo'
```
### SQL
- Do not use the shorthand sql insert format (where no column names are specified) because it unnecessarily breaks all queries on minor column changes and prevents using these tables for tracking outside related info such as in a connected site/forum.
@@ -679,7 +699,6 @@ SS13 has a lot of legacy code that's never been updated. Here are some examples
### Other Notes
- Code should be modular where possible; if you are working on a new addition, then strongly consider putting it in its own file unless it makes sense to put it with similar ones (i.e. a new tool would go in the `tools.dm` file)
- Bloated code may be necessary to add a certain feature, which means there has to be a judgement over whether the feature is worth having or not. You can help make this decision easier by making sure your code is modular.
- You are expected to help maintain the code that you add, meaning that if there is a problem then you are likely to be approached in order to fix any issues, runtimes, or bugs.

View File

@@ -48,6 +48,7 @@ jobs:
python tools/ci/unticked_files.py ${GITHUB_WORKSPACE}
python tools/ci/illegal_dme_files.py ${GITHUB_WORKSPACE}
python tools/ci/define_sanity.py
python tools/ci/restrict_file_types.py
python -m tools.ci.check_icon_conflicts
python -m tools.ci.check_icon_dupenames
python -m tools.maplint.source --github

View File

@@ -214,7 +214,6 @@
/area/ruin/space/wreck_cargoship)
"jb" = (
/obj/structure/table,
/obj/structure/table,
/obj/item/paper{
name = "management's directive";
info = "Good day Captain Hardie. Your ship has been assigned to carry an extremely delicate cargo due to an unfortunate scheduling issue in behalf of our custormers. You will find the additional information on transporting procedure of this extremely delicate cargo attached to it. Management believes you will not mind this rather unconvenient last minute change after what happened last time. Make sure you and your crew doesn't mess it up this time as we hate to compensate the expenses from our esteemed already-in-debt employees. Pick the cargo from next destination and safely deliver it where it has to go."

File diff suppressed because it is too large Load Diff

View File

@@ -18926,6 +18926,7 @@
"bgB" = (
/obj/effect/turf_decal/delivery/hollow,
/obj/structure/table,
/obj/item/reagent_containers/condiment/enzyme,
/turf/simulated/floor/plasteel{
icon_state = "redfull"
},
@@ -19247,6 +19248,13 @@
/area/station/hallway/primary/fore/south)
"bhH" = (
/obj/machinery/smartfridge,
/obj/effect/mapping_helpers/airlock/windoor/access/all/service/hydroponics{
dir = 8
},
/obj/machinery/door/window/reinforced/reversed{
dir = 8;
name = "kitchen ingredient storage"
},
/turf/simulated/floor/plasteel,
/area/station/service/kitchen)
"bhI" = (
@@ -19325,6 +19333,7 @@
"bhR" = (
/obj/effect/turf_decal/delivery/hollow,
/obj/structure/table,
/obj/item/food/snacks/mint,
/turf/simulated/floor/plasteel{
icon_state = "white"
},
@@ -20748,8 +20757,6 @@
/turf/simulated/floor/plasteel,
/area/station/service/kitchen)
"blk" = (
/obj/item/food/snacks/mint,
/obj/item/reagent_containers/condiment/enzyme,
/obj/machinery/reagentgrinder,
/obj/effect/turf_decal/delivery/hollow,
/turf/simulated/floor/plasteel,

View File

@@ -8313,7 +8313,7 @@
dir = 4
},
/obj/machinery/camera{
c_tag = "Cargo - Quatermaster";
c_tag = "Cargo - Quartermaster";
dir = 1
},
/turf/simulated/floor/plasteel{
@@ -83619,7 +83619,6 @@
/area/station/public/fitness)
"tHm" = (
/obj/structure/table/reinforced,
/obj/structure/table/reinforced,
/obj/item/gavelblock,
/obj/item/gavelhammer,
/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{
@@ -92078,7 +92077,6 @@
/area/station/hallway/secondary/exit)
"xtZ" = (
/obj/structure/table,
/obj/structure/table,
/obj/item/wrench,
/obj/item/crowbar,
/obj/item/radio/intercom{

View File

@@ -61,3 +61,10 @@ GLOBAL_LIST(contractors)
* Pulse Demon
*/
#define PULSEDEMON_SOURCE_DRAIN_INVALID (-1)
/proc/ischangeling(mob/M) // TODO: Someone please convert these to proper defines some day.
return M.mind?.has_antag_datum(/datum/antagonist/changeling)
// Helper proc that determines if a mob is a mindslave.
/proc/ismindslave(mob/living/carbon/human/H)
return istype(H) && H.mind.has_antag_datum(/datum/antagonist/mindslave, FALSE)

View File

@@ -52,6 +52,9 @@
#define PRINTER_FONT "Times New Roman"
#define SIGNFONT "Times New Roman"
/// Emoji icon set
#define EMOJI_SET 'icons/ui_icons/emoji.dmi'
//some arbitrary defines to be used by self-pruning global lists. (see master_controller)
#define PROCESS_KILL 26 //Used to trigger removal from a processing list
@@ -692,3 +695,6 @@ do { \
#define TEAM_ADMIN_ADD_OBJ_SUCCESS (1<<0)
#define TEAM_ADMIN_ADD_OBJ_CANCEL_LOG (1<<1)
#define TEAM_ADMIN_ADD_OBJ_PURPOSEFUL_CANCEL (1<<2)
/// A helper used by `restrict_file_types.py` to identify types to restrict in a file. Not used by byond at all.
#define RESTRICT_TYPE(type) // do nothing

View File

@@ -41,7 +41,7 @@
#define TRANSMISSION_WIRE 0
#define TRANSMISSION_RADIO 1
//This filter is special because devices belonging to default also recieve signals sent to any other filter.
//This filter is special because devices belonging to default also receive signals sent to any other filter.
#define RADIO_DEFAULT "radio_default"
#define RADIO_TO_AIRALARM "radio_airalarm" //air alarms
#define RADIO_FROM_AIRALARM "radio_airalarm_rcvr" //devices interested in recieving signals from air alarms

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)

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

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)

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)

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.

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)

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))

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))

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)

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)

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)

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)

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]'>"

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]

View File

@@ -40,7 +40,7 @@ FALSE if not
usr.ClickOn(src, params) // if not, we click object
/*
recieve a mousedrop
receive a mousedrop
called on object which was under the object you dragged and dropped
return TRUE if you want to prevent us click the object
actually if you do something in that proc like changing user location or whatever, you expected to return TRUE

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)

View File

@@ -252,3 +252,7 @@
/datum/hud/proc/update_locked_slots()
return
/datum/hud/proc/remove_vampire_hud()
static_inventory -= vampire_blood_display
QDEL_NULL(vampire_blood_display)

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()

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

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()

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

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", "")

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

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

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

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)

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

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

View File

@@ -89,6 +89,7 @@ SUBSYSTEM_DEF(garbage)
if(I.hard_deletes)
dellog += "\tTotal Hard Deletes [I.hard_deletes]"
dellog += "\tTime Spent Hard Deleting: [I.hard_delete_time]ms"
dellog += "\tAverage References During Hardel: [I.reference_average] references."
if(I.slept_destroy)
dellog += "\tSleeps: [I.slept_destroy]"
if(I.no_respect_force)
@@ -258,6 +259,7 @@ SUBSYSTEM_DEF(garbage)
I.hard_deletes++
I.hard_delete_time += TICK_DELTA_TO_MS(tick)
I.reference_average = (refcount(I) + I.reference_average) / I.hard_deletes
if(tick > highest_del_tickusage)
@@ -275,7 +277,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]
@@ -289,6 +291,8 @@ SUBSYSTEM_DEF(garbage)
var/no_respect_force = 0//Number of times it's not respected force=TRUE
var/no_hint = 0 //Number of times it's not even bother to give a qdel hint
var/slept_destroy = 0 //Number of times it's slept in its destroy
/// Average amount of references that the hard deleted item holds when hard deleted
var/reference_average = 0
/datum/qdel_item/New(mytype)
name = "[mytype]"

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()

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]]")

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")

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))

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)

View File

@@ -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

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]]")

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

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)

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())

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)

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

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)

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)

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)

View File

@@ -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...")

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

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()

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()
@@ -163,7 +163,7 @@
* Register to listen for a signal from the passed in target
*
* This sets up a listening relationship such that when the target object emits a signal
* the source datum this proc is called upon, will recieve a callback to the given proctype
* the source datum this proc is called upon, will receive a callback to the given proctype
* Return values from procs registered must be a bitfield
*
* Arguments:
@@ -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.

View File

@@ -37,7 +37,7 @@
UnregisterSignal(parent, COMSIG_HOSTILE_FOUND_TARGET)
return ..()
///Handles giving the boss music to a new target the fauna has recieved.
///Handles giving the boss music to a new target the fauna has received.
///Keeps track of them to not repeatedly overwrite its own track.
/datum/component/boss_music/proc/on_target_found(atom/source, mob/new_target)
SIGNAL_HANDLER

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

View File

@@ -68,7 +68,7 @@
* Arguments:
* * datum/source - this will be the `hasprox_receiver`
* * atom/old_loc - the location the receiver just moved from
* * dir - the direction the reciever just moved in
* * dir - the direction the receiver just moved in
*/
/datum/component/proximity_monitor/proc/on_receiver_move(datum/source, atom/old_loc, dir)
SIGNAL_HANDLER
@@ -120,7 +120,7 @@
/**
* Called when the receiver or an atom in the `nested_receiver_locs` list moves into a disposals holder object.
*
* This proc recieves arguments, but they aren't needed.
* This proc receives arguments, but they aren't needed.
*/
/datum/component/proximity_monitor/proc/on_disposal_enter(datum/source)
SIGNAL_HANDLER
@@ -130,7 +130,7 @@
/**
* Called when the receiver or an atom in the `nested_receiver_locs` list moves out of a disposals holder object.
*
* This proc recieves arguments, but they aren't needed.
* This proc receives arguments, but they aren't needed.
*/
/datum/component/proximity_monitor/proc/on_disposal_exit(datum/source)
SIGNAL_HANDLER

View File

@@ -45,7 +45,7 @@
UnregisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_ATOM_ENTERED))
/**
Called whenever the parent recieves either the `MOVABLE_CROSSED` signal or the `ATOM_ENTERED` signal.
Called whenever the parent receives either the `MOVABLE_CROSSED` signal or the `ATOM_ENTERED` signal.
Calls the `victim`'s `slip()` proc with the component's variables as arguments.
Additionally calls the parent's `after_slip()` proc on the `victim`.

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

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()

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))

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"])

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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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

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

View File

@@ -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)

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

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)

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>")

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

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)

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

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)

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

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)

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)

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)

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

View File

@@ -13,22 +13,12 @@
var/marked_item_uid
var/mob/living/current_body
var/resurrections = 0
var/existence_stops_round_end = FALSE
action_icon_state = "skeleton"
/datum/spell/lichdom/create_new_targeting()
return new /datum/spell_targeting/self
/datum/spell/lichdom/Destroy()
for(var/datum/mind/M in SSticker.mode.wizards) //Make sure no other bones are about
for(var/datum/spell/S in M.spell_list)
if(istype(S,/datum/spell/lichdom) && S != src)
return ..()
if(existence_stops_round_end)
GLOB.configuration.gamemode.disable_certain_round_early_end = FALSE
return ..()
/datum/spell/lichdom/cast(list/targets, mob/user = usr)
for(var/mob/M in targets)
if(stat_allowed)
@@ -89,7 +79,6 @@
lich.Weaken(stun_time)
user.mind.transfer_to(lich)
equip_lich(lich)
RegisterSignal(lich, list(COMSIG_PARENT_QDELETING, COMSIG_MOVABLE_Z_CHANGED), PROC_REF(check_revivability_handler))
current_body = lich
cooldown_handler.recharge_duration += 1 MINUTES
@@ -134,13 +123,8 @@
H.unEquip(H.head)
equip_lich(H)
RegisterSignal(target, list(COMSIG_PARENT_QDELETING, COMSIG_MOVABLE_Z_CHANGED), PROC_REF(check_revivability_handler))
RegisterSignal(current_body, list(COMSIG_PARENT_QDELETING, COMSIG_MOVABLE_Z_CHANGED), PROC_REF(check_revivability_handler))
to_chat(user, "<span class='userdanger'>With a hideous feeling of emptiness you watch in horrified fascination as skin sloughs off bone! Blood boils, nerves disintegrate, eyes boil in their sockets! As your organs crumble to dust in your fleshless chest you come to terms with your choice. You're a lich!</span>")
existence_stops_round_end = TRUE
GLOB.configuration.gamemode.disable_certain_round_early_end = TRUE
/datum/spell/lichdom/proc/is_revive_possible()
var/obj/item/marked_item = locateUID(marked_item_uid)
if(QDELETED(marked_item))
@@ -153,23 +137,6 @@
return FALSE
return TRUE
/datum/spell/lichdom/proc/check_revivability_handler()
SIGNAL_HANDLER
// There are other liches about, so round may still continue
for(var/datum/mind/M in SSticker.mode.wizards)
for(var/datum/spell/lichdom/S in M.spell_list)
if(S == src)
continue
// Other lich can still revive
if(S.is_revive_possible())
return
// Other lich is still alive
if(!QDELETED(S.current_body) && S.current_body.stat != DEAD)
return
GLOB.configuration.gamemode.disable_certain_round_early_end = is_revive_possible()
/datum/spell/lichdom/proc/equip_lich(mob/living/carbon/human/H)
H.equip_to_slot_or_del(new /obj/item/clothing/suit/wizrobe/black(H), SLOT_HUD_OUTER_SUIT)
H.equip_to_slot_or_del(new /obj/item/clothing/head/wizard/black(H), SLOT_HUD_HEAD)

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

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)))

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)

View File

@@ -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

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)

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)

View File

@@ -245,3 +245,9 @@
/area/station/public/quantum/cargo
name = "Cargo Quantum Pad"
/area/station/public/quantum/service
name = "Service Quantum Pad"
/area/station/public/quantum/medbay
name = "Medbay Quantum Pad"

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)

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)

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()

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

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))

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