removes a bunch of unused/bad helpers (#48969)

* a commit

* Update code/controllers/subsystem/persistence.dm

Co-Authored-By: Emmett Gaines <ninjanomnom@gmail.com>

* Update code/__HELPERS/text.dm

Co-Authored-By: Emmett Gaines <ninjanomnom@gmail.com>

* Update advance.dm

* Update security_officer.dm

* Update text.dm

* Update unsorted.dm

Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
This commit is contained in:
vuonojenmustaturska
2020-01-28 17:22:20 +02:00
committed by AnturK
parent f044bc1d70
commit 40657c9ccd
28 changed files with 136 additions and 179 deletions

View File

@@ -83,27 +83,6 @@
return "[output][and_text][input[index]]"
//Returns list element or null. Should prevent "index out of bounds" error.
/proc/listgetindex(list/L, index)
if(LAZYLEN(L))
if(isnum(index) && ISINTEGER(index))
if(ISINRANGE(index,1,L.len))
return L[index]
else if(index in L)
return L[index]
return
//Return either pick(list) or null if list is not of type /list or is empty
/proc/safepick(list/L)
if(LAZYLEN(L))
return pick(L)
//Checks if the list is empty
/proc/isemptylist(list/L)
if(!L.len)
return TRUE
return FALSE
//Checks for specific types in a list
/proc/is_type_in_list(atom/A, list/L)
if(!LAZYLEN(L) || !A)
@@ -116,24 +95,6 @@
//Checks for specific types in specifically structured (Assoc "type" = TRUE) lists ('typecaches')
#define is_type_in_typecache(A, L) (A && length(L) && L[(ispath(A) ? A : A:type)])
//Checks for a string in a list
/proc/is_string_in_list(string, list/L)
if(!LAZYLEN(L) || !string)
return
for(var/V in L)
if(string == V)
return TRUE
return
//Removes a string from a list
/proc/remove_strings_from_list(string, list/L)
if(!LAZYLEN(L) || !string)
return
for(var/V in L)
if(V == string)
L -= V //No return here so that it removes all strings of that type
return
//returns a new list with only atoms that are in typecache L
/proc/typecache_filter_list(list/atoms, list/typecache)
RETURN_TYPE(/list)
@@ -186,12 +147,6 @@
L[T] = TRUE
return L
//Empties the list by setting the length to 0. Hopefully the elements get garbage collected
/proc/clearlist(list/list)
if(istype(list))
list.len = 0
return
//Removes any null entries from the list
//Returns TRUE if the list had nulls, FALSE otherwise
/proc/listclearnulls(list/L)

View File

@@ -658,7 +658,7 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
if(fexists(log))
oldjson = json_decode(file2text(log))
oldentries = oldjson["data"]
if(!isemptylist(oldentries))
if(length(oldentries))
for(var/string in accepted)
for(var/old in oldentries)
if(string == old)
@@ -668,7 +668,7 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
var/list/finalized = list()
finalized = accepted.Copy() + oldentries.Copy() //we keep old and unreferenced phrases near the bottom for culling
listclearnulls(finalized)
if(!isemptylist(finalized) && length(finalized) > storemax)
if(length(finalized) > storemax)
finalized.Cut(storemax + 1)
fdel(log)

View File

@@ -1106,7 +1106,9 @@ B --><-- A
A.cut_overlay(O)
/proc/get_random_station_turf()
return safepick(get_area_turfs(pick(GLOB.the_station_areas)))
var/list/turfs = get_area_turfs(pick(GLOB.the_station_areas))
if (length(turfs))
return pick(turfs)
/proc/get_safe_random_station_turf() //excludes dense turfs (like walls) and areas that have valid_territory set to FALSE
for (var/i in 1 to 5)

View File

@@ -155,7 +155,7 @@ SUBSYSTEM_DEF(persistence)
var/list/chosen_trophy = trophy_data
if(!chosen_trophy || isemptylist(chosen_trophy)) //Malformed
if(!length(chosen_trophy)) //Malformed
continue
var/path = text2path(chosen_trophy["path"]) //If the item no longer exist, this returns null

View File

@@ -107,7 +107,7 @@ SUBSYSTEM_DEF(ticker)
continue
music -= S
if(isemptylist(music))
if(!length(music))
music = world.file2list(ROUND_START_MUSIC_LIST, "\n")
login_music = pick(music)
else

View File

@@ -178,7 +178,7 @@
// Will generate new unique symptoms, use this if there are none. Returns a list of symptoms that were generated.
/datum/disease/advance/proc/GenerateSymptoms(level_min, level_max, amount_get = 0)
var/list/generated = list() // Symptoms we generated.
. = list() // Symptoms we generated.
// Generate symptoms. By default, we only choose non-deadly symptoms.
var/list/possible_symptoms = list()
@@ -189,7 +189,7 @@
possible_symptoms += S
if(!possible_symptoms.len)
return generated
return
// Random chance to get more than one symptom
var/number_of = amount_get
@@ -199,9 +199,7 @@
number_of += 1
for(var/i = 1; number_of >= i && possible_symptoms.len; i++)
generated += pick_n_take(possible_symptoms)
return generated
. += pick_n_take(possible_symptoms)
/datum/disease/advance/proc/Refresh(new_name = FALSE)
GenerateProperties()
@@ -318,30 +316,30 @@
/datum/disease/advance/proc/Evolve(min_level, max_level, ignore_mutable = FALSE)
if(!mutable && !ignore_mutable)
return
var/s = safepick(GenerateSymptoms(min_level, max_level, 1))
if(s)
AddSymptom(s)
var/list/generated_symptoms = GenerateSymptoms(min_level, max_level, 1)
if(length(generated_symptoms))
var/datum/symptom/S = pick(generated_symptoms)
AddSymptom(S)
Refresh(TRUE)
return
// Randomly remove a symptom.
/datum/disease/advance/proc/Devolve(ignore_mutable = FALSE)
if(!mutable && !ignore_mutable)
return
if(symptoms.len > 1)
var/s = safepick(symptoms)
if(s)
RemoveSymptom(s)
if(length(symptoms) > 1)
var/datum/symptom/S = pick(symptoms)
if(S)
RemoveSymptom(S)
Refresh(TRUE)
// Randomly neuter a symptom.
/datum/disease/advance/proc/Neuter(ignore_mutable = FALSE)
if(!mutable && !ignore_mutable)
return
if(symptoms.len)
var/s = safepick(symptoms)
if(s)
NeuterSymptom(s)
if(length(symptoms))
var/datum/symptom/S = pick(symptoms)
if(S)
NeuterSymptom(S)
Refresh(TRUE)
// Name the disease.

View File

@@ -36,7 +36,8 @@
// Arguments: event_type as text, any number of additional arguments to pass to event handler
// Returns: null
/datum/events/proc/fireEvent(eventName, ...)
var/list/event = listgetindex(events,eventName)
var/list/event = LAZYACCESS(events,eventName)
if(istype(event))
for(var/E in event)
var/datum/callback/cb = E
@@ -48,7 +49,7 @@
/datum/events/proc/clearEvent(event_type as text, datum/callback/cb)
if(!event_type || !cb)
return FALSE
var/list/event = listgetindex(events,event_type)
var/list/event = LAZYACCESS(events,event_type)
event -= cb
qdel(cb)
return TRUE

View File

@@ -163,4 +163,6 @@
return posturfs
/proc/get_teleport_turf(turf/center, precision = 0)
return safepick(get_teleport_turfs(center, precision))
var/list/turfs = get_teleport_turfs(center, precision)
if (length(turfs))
return pick(turfs)

View File

@@ -493,7 +493,9 @@ GLOBAL_LIST_EMPTY(possible_items)
if(M.current.mind.assigned_role in possible_item.excludefromjob)
continue check_items
approved_targets += possible_item
return set_target(safepick(approved_targets))
if (length(approved_targets))
return set_target(pick(approved_targets))
return set_target(null)
/datum/objective/steal/proc/set_target(datum/objective_item/item)
if(item)

View File

@@ -283,7 +283,7 @@ GLOBAL_LIST_EMPTY(allCasters)
dat+="<BR><HR>The newscaster recognises you as: <FONT COLOR='green'>[scanned_user]</FONT>"
if(1)
dat+= "Station Feed Channels<HR>"
if( isemptylist(GLOB.news_network.network_channels) )
if( !length(GLOB.news_network.network_channels) )
dat+="<I>No active channels found...</I>"
else
for(var/datum/newscaster/feed_channel/CHANNEL in GLOB.news_network.network_channels)
@@ -363,7 +363,7 @@ GLOBAL_LIST_EMPTY(allCasters)
dat+="<FONT COLOR='red'><B>ATTENTION: </B></FONT>This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.<BR>"
dat+="No further feed story additions are allowed while the D-Notice is in effect.</FONT><BR><BR>"
else
if( isemptylist(viewing_channel.messages) )
if( !length(viewing_channel.messages) )
dat+="<I>No feed messages found in channel...</I><BR>"
else
var/i = 0
@@ -391,7 +391,7 @@ GLOBAL_LIST_EMPTY(allCasters)
dat+="<FONT SIZE=1>NOTE: Due to the nature of news Feeds, total deletion of a Feed Story is not possible.<BR>"
dat+="Keep in mind that users attempting to view a censored feed will instead see the \[REDACTED\] tag above it.</FONT>"
dat+="<HR>Select Feed channel to get Stories from:<BR>"
if(isemptylist(GLOB.news_network.network_channels))
if(!length(GLOB.news_network.network_channels))
dat+="<I>No feed channels found active...</I><BR>"
else
for(var/datum/newscaster/feed_channel/CHANNEL in GLOB.news_network.network_channels)
@@ -402,7 +402,7 @@ GLOBAL_LIST_EMPTY(allCasters)
dat+="<FONT SIZE=1>A D-Notice is to be bestowed upon the channel if the handling Authority deems it as harmful for the station's"
dat+="morale, integrity or disciplinary behaviour. A D-Notice will render a channel unable to be updated by anyone, without deleting any feed"
dat+="stories it might contain at the time. You can lift a D-Notice if you have the required access at any time.</FONT><HR>"
if(isemptylist(GLOB.news_network.network_channels))
if(!length(GLOB.news_network.network_channels))
dat+="<I>No feed channels found active...</I><BR>"
else
for(var/datum/newscaster/feed_channel/CHANNEL in GLOB.news_network.network_channels)
@@ -411,7 +411,7 @@ GLOBAL_LIST_EMPTY(allCasters)
if(12)
dat+="<B>[viewing_channel.channel_name]: </B><FONT SIZE=1>\[ created by: <FONT COLOR='maroon'>[viewing_channel.returnAuthor(-1)]</FONT> \]</FONT><BR>"
dat+="<FONT SIZE=2><A href='?src=[REF(src)];censor_channel_author=[REF(viewing_channel)]'>[(viewing_channel.authorCensor) ? ("Undo Author censorship") : ("Censor channel Author")]</A></FONT><HR>"
if(isemptylist(viewing_channel.messages))
if(!length(viewing_channel.messages))
dat+="<I>No feed messages found in channel...</I><BR>"
else
for(var/datum/newscaster/feed_message/MESSAGE in viewing_channel.messages)
@@ -428,7 +428,7 @@ GLOBAL_LIST_EMPTY(allCasters)
dat+="<FONT COLOR='red'><B>ATTENTION: </B></FONT>This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.<BR>"
dat+="No further feed story additions are allowed while the D-Notice is in effect.</FONT><BR><BR>"
else
if(isemptylist(viewing_channel.messages))
if(!length(viewing_channel.messages))
dat+="<I>No feed messages found in channel...</I><BR>"
else
for(var/datum/newscaster/feed_message/MESSAGE in viewing_channel.messages)
@@ -894,7 +894,7 @@ GLOBAL_LIST_EMPTY(allCasters)
if(0) //Cover
dat+="<DIV ALIGN='center'><B><FONT SIZE=6>The Griffon</FONT></B></div>"
dat+="<DIV ALIGN='center'><FONT SIZE=2>Nanotrasen-standard newspaper, for use on Nanotrasen? Space Facilities</FONT></div><HR>"
if(isemptylist(news_content))
if(!length(news_content))
if(wantedAuthor)
dat+="Contents:<BR><ul><B><FONT COLOR='red'>**</FONT>Important Security Announcement<FONT COLOR='red'>**</FONT></B> <FONT SIZE=2>\[page [pages+2]\]</FONT><BR></ul>"
else
@@ -921,7 +921,7 @@ GLOBAL_LIST_EMPTY(allCasters)
if(notContent(C.DclassCensorTime))
dat+="This channel was deemed dangerous to the general welfare of the station and therefore marked with a <B><FONT COLOR='red'>D-Notice</B></FONT>. Its contents were not transferred to the newspaper at the time of printing."
else
if(isemptylist(C.messages))
if(!length(C.messages))
dat+="No Feed stories stem from this channel..."
else
var/i = 0

View File

@@ -104,7 +104,6 @@
if(patient)
temp = "<br />\[Occupant: [patient] ([patient.stat > 1 ? "*DECEASED*" : "Health: [patient.health]%"])\]<br /><a href='?src=[REF(src)];view_stats=1'>View stats</a>|<a href='?src=[REF(src)];eject=1'>Eject</a>"
return "[output] [temp]"
return
/obj/item/mecha_parts/mecha_equipment/medical/sleeper/Topic(href,href_list)
..()
@@ -119,7 +118,6 @@
var/datum/reagent/R = locate(href_list["inject"]) in SG.reagents.reagent_list
if (istype(R))
inject_reagent(R, SG)
return
/obj/item/mecha_parts/mecha_equipment/medical/sleeper/proc/get_patient_stats()
if(!patient)
@@ -284,7 +282,6 @@
var/output = ..()
if(output)
return "[output] \[<a href=\"?src=[REF(src)];toggle_mode=1\">[mode? "Analyze" : "Launch"]</a>\]<br />\[Syringes: [syringes.len]/[max_syringes] | Reagents: [reagents.total_volume]/[reagents.maximum_volume]\]<br /><a href='?src=[REF(src)];show_reagents=1'>Reagents list</a>"
return
/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/action(atom/movable/target)
if(!action_checks(target))
@@ -322,8 +319,8 @@
var/list/mobs = new
for(var/mob/living/carbon/M in mechsyringe.loc)
mobs += M
var/mob/living/carbon/M = safepick(mobs)
if(M)
if(length(mobs))
var/mob/living/carbon/M = pick(mobs)
var/R
mechsyringe.visible_message("<span class=\"attack\"> [M] was hit by the syringe!</span>")
if(M.can_inject(null, 1))
@@ -385,8 +382,6 @@
return
if (href_list["purge_all"])
reagents.clear_reagents()
return
return
/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/proc/get_reagents_page()
var/output = {"<html>
@@ -496,12 +491,10 @@
send_byjax(chassis.occupant,"msyringegun.browser","reagents",get_current_reagents())
send_byjax(chassis.occupant,"msyringegun.browser","reagents_form",get_reagents_form())
return 1
return
/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/on_reagent_change(changetype)
..()
update_equip_info()
return
/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/process()

View File

@@ -218,7 +218,7 @@
remove_from_queue(1)
else
return FALSE
D = listgetindex(queue, 1)
D = LAZYACCESS(queue, 1)
say("Queue processing finished successfully.")
/obj/machinery/mecha_part_fabricator/proc/list_queue()

View File

@@ -255,7 +255,7 @@
if(cap)
cap.forceMove(src)
capacitor = cap
return
else
capacitor = new /obj/item/stock_parts/capacitor(src)
/obj/mecha/proc/add_cabin()
@@ -491,9 +491,9 @@
if(dir_to_target && !(dir_to_target & dir))//wrong direction
return
if(internal_damage & MECHA_INT_CONTROL_LOST)
target = safepick(view(3,target))
if(!target)
if (!target)
return
target = pick(view(3,target))
var/mob/living/L = user
if(!Adjacent(target))
@@ -511,7 +511,10 @@
selected.start_cooldown()
else
if(internal_damage & MECHA_INT_CONTROL_LOST)
target = safepick(oview(1,src))
var/list/possible_targets = oview(1,src)
if (!length(possible_targets))
return
target = pick(possible_targets)
if(!melee_can_hit || !istype(target, /atom))
return
target.mech_melee_attack(src)
@@ -624,20 +627,18 @@
/obj/mecha/proc/mechstep(direction)
var/current_dir = dir
var/result = step(src,direction)
. = step(src,direction)
if(strafe)
setDir(current_dir)
if(result && !step_silent)
if(. && !step_silent)
play_stepsound()
step_silent = FALSE
return result
/obj/mecha/proc/mechsteprand()
var/result = step_rand(src)
if(result && !step_silent)
. = step_rand(src)
if(. && !step_silent)
play_stepsound()
step_silent = FALSE
return result
/obj/mecha/Bump(var/atom/obstacle)
if(phasing && get_charge() >= phasing_energy_drain && !throwing)
@@ -676,29 +677,28 @@
///////////////////////////////////
/obj/mecha/proc/check_for_internal_damage(list/possible_int_damage,ignore_threshold=null)
if(!islist(possible_int_damage) || isemptylist(possible_int_damage))
if(!islist(possible_int_damage) || !length(possible_int_damage))
return
if(prob(20))
if(ignore_threshold || obj_integrity*100/max_integrity < internal_damage_threshold)
for(var/T in possible_int_damage)
if(internal_damage & T)
possible_int_damage -= T
var/int_dam_flag = safepick(possible_int_damage)
if (length(possible_int_damage))
var/int_dam_flag = pick(possible_int_damage)
if(int_dam_flag)
setInternalDamage(int_dam_flag)
if(prob(5))
if(ignore_threshold || obj_integrity*100/max_integrity < internal_damage_threshold)
var/obj/item/mecha_parts/mecha_equipment/ME = safepick(equipment)
if(ME)
if (length(equipment))
var/obj/item/mecha_parts/mecha_equipment/ME = pick(equipment)
qdel(ME)
return
/obj/mecha/proc/setInternalDamage(int_dam_flag)
internal_damage |= int_dam_flag
log_message("Internal damage of type [int_dam_flag].", LOG_MECHA)
SEND_SOUND(occupant, sound('sound/machines/warning-buzzer.ogg',wait=0))
diag_hud_set_mechstat()
return
/obj/mecha/proc/clearInternalDamage(int_dam_flag)
if(internal_damage & int_dam_flag)
@@ -867,13 +867,11 @@
var/datum/gas_mixture/t_air = return_air()
if(t_air)
. = t_air.return_pressure()
return
/obj/mecha/return_temperature()
var/datum/gas_mixture/t_air = return_air()
if(t_air)
. = t_air.return_temperature()
return
/obj/mecha/MouseDrop_T(mob/M, mob/user)
if((user != M) || user.incapacitated() || !Adjacent(user))
@@ -923,9 +921,9 @@
moved_inside(user)
else
to_chat(user, "<span class='warning'>You stop entering the exosuit!</span>")
return
/obj/mecha/proc/moved_inside(mob/living/carbon/human/H)
. = FALSE
if(H && H.client && (H in range(1)))
occupant = H
H.forceMove(src)
@@ -939,21 +937,20 @@
playsound(src, 'sound/machines/windowdoor.ogg', 50, TRUE)
if(!internal_damage)
SEND_SOUND(occupant, sound('sound/mecha/nominal.ogg',volume=50))
return 1
else
return 0
return TRUE
/obj/mecha/proc/mmi_move_inside(obj/item/mmi/M, mob/user)
. = FALSE
if(!M.brain_check(user))
return FALSE
return
var/mob/living/brain/B = M.brainmob
if(occupant)
to_chat(user, "<span class='warning'>Occupant detected!</span>")
return FALSE
return
if(dna_lock && (!B.stored_dna || (dna_lock != B.stored_dna.unique_enzymes)))
to_chat(user, "<span class='warning'>Access denied. [name] is secured with a DNA lock.</span>")
return FALSE
return
visible_message("<span class='notice'>[user] starts to insert an MMI into [name].</span>")
@@ -964,7 +961,6 @@
to_chat(user, "<span class='warning'>Occupant detected!</span>")
else
to_chat(user, "<span class='notice'>You stop inserting the MMI.</span>")
return FALSE
/obj/mecha/proc/mmi_moved_inside(obj/item/mmi/M, mob/user)
if(!(Adjacent(M) && Adjacent(user)))
@@ -1020,7 +1016,6 @@
armor = armor.modifyRating(energy = (capacitor.rating * -5)) //lose the energy armor if we lose this cap
capacitor = null
update_part_values()
return
/obj/mecha/proc/go_out(forced, atom/newloc = loc)
if(!occupant)
@@ -1104,7 +1099,6 @@
if(message)
if(occupant && occupant.client)
to_chat(occupant, "[icon2html(src, occupant)] [message]")
return
GLOBAL_VAR_INIT(year, time2text(world.realtime,"YYYY"))
GLOBAL_VAR_INIT(year_integer, text2num(year)) // = 2013???

View File

@@ -23,6 +23,9 @@
START_PROCESSING(SSobj, src)
impact_area = get_area(src)
if (!impact_area)
return INITIALIZE_HINT_QDEL
aSignal = new(src)
aSignal.name = "[name] core"
aSignal.code = rand(1,100)
@@ -188,7 +191,7 @@
do_teleport(AM, locate(AM.x, AM.y, AM.z), 8, channel = TELEPORT_CHANNEL_BLUESPACE)
/obj/effect/anomaly/bluespace/detonate()
var/turf/T = safepick(get_area_turfs(impact_area))
var/turf/T = pick(get_area_turfs(impact_area))
if(T)
// Calculate new position (searches through beacons in world)
var/obj/item/beacon/chosen

View File

@@ -225,7 +225,7 @@
dat+="<BR><HR><A href='?src=[REF(src)];[HrefToken()];ac_set_signature=1'>The newscaster recognises you as:<BR> <FONT COLOR='green'>[src.admin_signature]</FONT></A>"
if(1)
dat+= "Station Feed Channels<HR>"
if( isemptylist(GLOB.news_network.network_channels) )
if( !length(GLOB.news_network.network_channels) )
dat+="<I>No active channels found...</I>"
else
for(var/datum/newscaster/feed_channel/CHANNEL in GLOB.news_network.network_channels)
@@ -278,7 +278,7 @@
dat+="<FONT COLOR='red'><B>ATTENTION: </B></FONT>This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.<BR>"
dat+="No further feed story additions are allowed while the D-Notice is in effect.</FONT><BR><BR>"
else
if( isemptylist(src.admincaster_feed_channel.messages) )
if( !length(src.admincaster_feed_channel.messages) )
dat+="<I>No feed messages found in channel...</I><BR>"
else
var/i = 0
@@ -300,7 +300,7 @@
dat+="<FONT SIZE=1>NOTE: Due to the nature of news Feeds, total deletion of a Feed Story is not possible.<BR>"
dat+="Keep in mind that users attempting to view a censored feed will instead see the \[REDACTED\] tag above it.</FONT>"
dat+="<HR>Select Feed channel to get Stories from:<BR>"
if(isemptylist(GLOB.news_network.network_channels))
if(!length(GLOB.news_network.network_channels))
dat+="<I>No feed channels found active...</I><BR>"
else
for(var/datum/newscaster/feed_channel/CHANNEL in GLOB.news_network.network_channels)
@@ -311,7 +311,7 @@
dat+="<FONT SIZE=1>A D-Notice is to be bestowed upon the channel if the handling Authority deems it as harmful for the station's"
dat+="morale, integrity or disciplinary behaviour. A D-Notice will render a channel unable to be updated by anyone, without deleting any feed"
dat+="stories it might contain at the time. You can lift a D-Notice if you have the required access at any time.</FONT><HR>"
if(isemptylist(GLOB.news_network.network_channels))
if(!length(GLOB.news_network.network_channels))
dat+="<I>No feed channels found active...</I><BR>"
else
for(var/datum/newscaster/feed_channel/CHANNEL in GLOB.news_network.network_channels)
@@ -322,7 +322,7 @@
dat+="<B>[src.admincaster_feed_channel.channel_name]: </B><FONT SIZE=1>\[ created by: <FONT COLOR='maroon'>[src.admincaster_feed_channel.returnAuthor(-1)]</FONT> \]</FONT><BR>"
dat+="<FONT SIZE=2><A href='?src=[REF(src)];[HrefToken()];ac_censor_channel_author=[REF(src.admincaster_feed_channel)]'>[(src.admincaster_feed_channel.authorCensor) ? ("Undo Author censorship") : ("Censor channel Author")]</A></FONT><HR>"
if( isemptylist(src.admincaster_feed_channel.messages) )
if( !length(src.admincaster_feed_channel.messages) )
dat+="<I>No feed messages found in channel...</I><BR>"
else
for(var/datum/newscaster/feed_message/MESSAGE in src.admincaster_feed_channel.messages)
@@ -339,7 +339,7 @@
dat+="<FONT COLOR='red'><B>ATTENTION: </B></FONT>This channel has been deemed as threatening to the welfare of the station, and marked with a Nanotrasen D-Notice.<BR>"
dat+="No further feed story additions are allowed while the D-Notice is in effect.</FONT><BR><BR>"
else
if( isemptylist(src.admincaster_feed_channel.messages) )
if( !length(src.admincaster_feed_channel.messages) )
dat+="<I>No feed messages found in channel...</I><BR>"
else
for(var/datum/newscaster/feed_message/MESSAGE in src.admincaster_feed_channel.messages)

View File

@@ -15,14 +15,16 @@
continue
turfs.Add(T)
var/turf/T = safepick(turfs)
if(!T)
to_chat(src, "Nowhere to jump to!")
return
if(length(turfs))
var/turf/T = pick(turfs)
usr.forceMove(T)
log_admin("[key_name(usr)] jumped to [AREACOORD(A)]")
message_admins("[key_name_admin(usr)] jumped to [AREACOORD(A)]")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Jump To Area") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else
to_chat(src, "Nowhere to jump to!")
return
/client/proc/jumptoturf(turf/T in world)
set name = "Jump to Turf"
@@ -146,7 +148,8 @@
return
var/area/A = input(usr, "Pick an area.", "Pick an area") in GLOB.sortedAreas|null
if(A && istype(A))
if(M.forceMove(safepick(get_area_turfs(A))))
var/list/turfs = get_area_turfs(A)
if(length(turfs) && M.forceMove(pick(turfs)))
log_admin("[key_name(usr)] teleported [key_name(M)] to [AREACOORD(A)]")
var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(M)] to [AREACOORD(A)]"

View File

@@ -341,8 +341,11 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
for(var/area/A in world)
if(on_station)
var/turf/picked = safepick(get_area_turfs(A.type))
if(picked && is_station_level(picked.z))
var/list/area_turfs = get_area_turfs(A.type)
if (!length(area_turfs))
continue
var/turf/picked = pick(area_turfs)
if(is_station_level(picked.z))
if(!(A.type in areas_all) && !is_type_in_typecache(A, station_areas_blacklist))
areas_all.Add(A.type)
else if(!(A.type in areas_all))

View File

@@ -202,15 +202,14 @@
last_corrupt = world.time + corrupt_delay
var/turf/T = safepick(validturfs)
if(T)
if(length(validturfs))
var/turf/T = pick(validturfs)
if(istype(T, /turf/open/floor/plating))
T.PlaceOnTop(/turf/open/floor/engine/cult, flags = CHANGETURF_INHERIT_AIR)
else
T.ChangeTurf(/turf/open/floor/engine/cult, flags = CHANGETURF_INHERIT_AIR)
else
var/turf/open/floor/engine/cult/F = safepick(cultturfs)
if(F)
else if (length(cultturfs))
var/turf/open/floor/engine/cult/F = pick(cultturfs)
new /obj/effect/temp_visual/cult/turf/floor(F)
else
// Are we in space or something? No cult turfs or

View File

@@ -129,10 +129,10 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm
var/list/turfs = list()
for(var/turf/T in A)
turfs.Add(T) //Fill a list with turfs in the area
var/turf/T = safepick(turfs) //Only teleport if the list isn't empty
if(!T) //If the list is empty, error and cancel
if (!length(turfs)) //If the list is empty, error and cancel
to_chat(M, "Nowhere to jump to!")
return
return //Only teleport if the list isn't empty
var/turf/T = pick(turfs)
M.forceMove(T) //Perform the actual teleport
log_admin("[key_name(usr)] jumped to [AREACOORD(A)]")
message_admins("[key_name_admin(usr)] jumped to [AREACOORD(A)]")
@@ -504,7 +504,7 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm
to_chat(holder.mob, "No /area/centcom/supplypod/loading/one (or /two or /three or /four) in the world! You can make one yourself (then refresh) for now, but yell at a mapper to fix this, today!")
CRASH("No /area/centcom/supplypod/loading/one (or /two or /three or /four) has been mapped into the centcom z-level!")
orderedArea = list()
if (!isemptylist(A.contents)) //Go through the area passed into the proc, and figure out the top left and bottom right corners by calculating max and min values
if (length(A.contents)) //Go through the area passed into the proc, and figure out the top left and bottom right corners by calculating max and min values
var/startX = A.contents[1].x //Create the four values (we do it off a.contents[1] so they have some sort of arbitrary initial value. They should be overwritten in a few moments)
var/endX = A.contents[1].x
var/startY = A.contents[1].y
@@ -532,7 +532,7 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm
numTurfs ++
launchList = list() //Anything in launchList will go into the supplypod when it is launched
if (!isemptylist(acceptableTurfs) && !temp_pod.reversing && !temp_pod.effectMissile) //We dont fill the supplypod if acceptableTurfs is empty, if the pod is going in reverse (effectReverse=true), or if the pod is acitng like a missile (effectMissile=true)
if (length(acceptableTurfs) && !temp_pod.reversing && !temp_pod.effectMissile) //We dont fill the supplypod if acceptableTurfs is empty, if the pod is going in reverse (effectReverse=true), or if the pod is acitng like a missile (effectMissile=true)
switch(launchChoice)
if(0) //If we are launching all the turfs at once
for (var/turf/T in acceptableTurfs)
@@ -575,7 +575,7 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm
//If we aren't cloning objects, taking and removing the first item each time from the acceptableTurfs list will inherently iterate through the list in order
/datum/centcom_podlauncher/proc/updateSelector() //Ensures that the selector effect will showcase the next item if needed
if (launchChoice == 1 && !isemptylist(acceptableTurfs) && !temp_pod.reversing && !temp_pod.effectMissile) //We only show the selector if we are taking items from the bay
if (launchChoice == 1 && length(acceptableTurfs) && !temp_pod.reversing && !temp_pod.effectMissile) //We only show the selector if we are taking items from the bay
var/index = launchCounter + 1 //launchCounter acts as an index to the ordered acceptableTurfs list, so adding one will show the next item in the list
if (index > acceptableTurfs.len) //out of bounds check
index = 1
@@ -613,6 +613,6 @@ force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.adm
var/msg = "launched [podString] towards [whomString] [delayString][damageString][explosionString]"
message_admins("[key_name_admin(usr)] [msg] in [ADMIN_VERBOSEJMP(specificTarget)].")
if (!isemptylist(whoDyin))
if (length(whoDyin))
for (var/mob/living/M in whoDyin)
admin_ticket_log(M, "[key_name_admin(usr)] [msg]")

View File

@@ -29,8 +29,9 @@
var/list/unsafe_area_subtypes = typecacheof(list(/area/engine/break_room))
allowed_areas = make_associative(GLOB.the_station_areas) - safe_area_types + unsafe_area_subtypes
return safepick(typecache_filter_list(GLOB.sortedAreas,allowed_areas))
var/list/possible_areas = typecache_filter_list(GLOB.sortedAreas,allowed_areas)
if (length(possible_areas))
return pick(possible_areas)
/datum/round_event/anomaly/setup()
impact_area = findEventArea()
@@ -44,7 +45,7 @@
priority_announce("Localized energetic flux wave detected on long range scanners. Expected location of impact: [impact_area.name].", "Anomaly Alert")
/datum/round_event/anomaly/start()
var/turf/T = safepick(get_area_turfs(impact_area))
var/turf/T = pick(get_area_turfs(impact_area))
var/newAnomaly
if(T)
newAnomaly = new anomaly_path(T)

View File

@@ -66,15 +66,15 @@
/datum/round_event/portal_storm/tick()
spawn_effects(get_random_station_turf())
if(spawn_hostile())
var/type = safepick(hostile_types)
if(spawn_hostile() && length(hostile_types))
var/type = pick(hostile_types)
hostile_types[type] = hostile_types[type] - 1
spawn_mob(type, hostiles_spawn)
if(!hostile_types[type])
hostile_types -= type
if(spawn_boss())
var/type = safepick(boss_types)
if(spawn_boss() && length(boss_types))
var/type = pick(boss_types)
boss_types[type] = boss_types[type] - 1
spawn_mob(type, boss_spawn)
if(!boss_types[type])

View File

@@ -790,7 +790,7 @@
contents += P
update_snack_overlays(P)
P = I
clearlist(P.contents)
P.contents.Cut()
return
else if(contents.len)
var/obj/O = contents[contents.len]

View File

@@ -94,14 +94,13 @@ GLOBAL_LIST_INIT(available_depts, list(SEC_DEPT_ENGINEERING, SEC_DEPT_MEDICAL, S
T = get_turf(spawn_point)
H.Move(T)
else
var/safety = 0
while(safety < 25)
T = safepick(get_area_turfs(destination))
if(T && !H.Move(T))
safety += 1
continue
else
var/list/possible_turfs = get_area_turfs(destination)
while (length(possible_turfs))
var/I = rand(1, possible_turfs.len)
var/turf/target = possible_turfs[I]
if (H.Move(target))
break
possible_turfs.Cut(I,I+1)
if(department)
to_chat(M, "<b>You have been assigned to [department]!</b>")
else

View File

@@ -101,7 +101,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
var/list/all_mining_turfs = list()
for (var/z_level in SSmapping.levels_by_trait(ZTRAIT_MINING))
all_mining_turfs += Z_TURFS(z_level)
var/turf/LZ = safepick(all_mining_turfs) //Pick a random mining Z-level turf
var/turf/LZ = pick(all_mining_turfs) //Pick a random mining Z-level turf
if(!ismineralturf(LZ) && !istype(LZ, /turf/open/floor/plating/asteroid))
//Find a suitable mining turf. Reduces chance of landing in a bad area
to_chat(usr, "<span class='warning'>Landing zone scan failed. Please try again.</span>")

View File

@@ -243,7 +243,7 @@
ears = headset_to_add
to_chat(usr, "<span class='notice'>You fit the headset onto [src].</span>")
clearlist(available_channels)
available_channels.Cut()
for(var/ch in headset_to_add.channels)
switch(ch)
if(RADIO_CHANNEL_ENGINEERING)

View File

@@ -290,8 +290,8 @@
if(!can_hit_target(M, permutated, M == original, TRUE))
continue
mobs += M
var/mob/M = safepick(mobs)
if(M)
if (length(mobs))
var/mob/M = pick(mobs)
return M.lowest_buckled_mob()
var/list/obj/possible_objs = typecache_filter_list(T, GLOB.typecache_machine_or_structure)
var/list/obj/objs = list()
@@ -299,8 +299,8 @@
if(!can_hit_target(O, permutated, O == original, TRUE))
continue
objs += O
var/obj/O = safepick(objs)
if(O)
if (length(objs))
var/obj/O = pick(objs)
return O
//Nothing else is here that we can hit, hit the turf if we haven't.
if(!(T in permutated) && can_hit_target(T, permutated, T == original, TRUE))

View File

@@ -79,7 +79,8 @@
damaged = TRUE
if(console)
console.say("Alert, hull breach detected!")
var/obj/machinery/announcement_system/announcer = safepick(GLOB.announcement_systems)
if (length(GLOB.announcement_systems))
var/obj/machinery/announcement_system/announcer = pick(GLOB.announcement_systems)
if(!QDELETED(announcer))
announcer.announce("ARRIVALS_BROKEN", channels = list())
if(mode != SHUTTLE_CALL)

View File

@@ -42,9 +42,10 @@
if(!src || QDELETED(src))
return
var/turf/T = safepick(get_area_turfs(picked_area))
if(!T)
var/list/turfs = get_area_turfs(picked_area)
if (!length(turfs))
return
var/turf/T = pick(turfs)
var/obj/docking_port/stationary/landing_zone = new /obj/docking_port/stationary(T)
landing_zone.id = "assault_pod([REF(src)])"
landing_zone.name = "Landing Zone"