mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
cleanup _HELPERS/_lists.dm and all the necessary files (#61827)
Bring _HELPERS/_lists.dm to latest standards by: -Adding proper documentation and fixing existing one -Giving vars proper names -Procs now use snake case as per standard (many files that use those procs will be affected)
This commit is contained in:
@@ -304,5 +304,5 @@
|
||||
|
||||
if(!valids.len)
|
||||
finish_action(controller, FALSE)
|
||||
controller.blackboard[set_key] = pickweight(valids)
|
||||
controller.blackboard[set_key] = pick_weight(valids)
|
||||
finish_action(controller, TRUE)
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
if(HAS_TRAIT(SSstation, STATION_TRAIT_UNIQUE_AI))
|
||||
law_weights -= AI_LAWS_ASIMOV
|
||||
while(!lawtype && law_weights.len)
|
||||
var/possible_id = pickweightAllowZero(law_weights)
|
||||
var/possible_id = pick_weight_allow_zero(law_weights)
|
||||
lawtype = lawid_to_type(possible_id)
|
||||
if(!lawtype)
|
||||
law_weights -= possible_id
|
||||
@@ -328,7 +328,7 @@
|
||||
replaceable_groups[LAW_INHERENT] = inherent.len
|
||||
if(supplied.len && (LAW_SUPPLIED in groups))
|
||||
replaceable_groups[LAW_SUPPLIED] = supplied.len
|
||||
var/picked_group = pickweight(replaceable_groups)
|
||||
var/picked_group = pick_weight(replaceable_groups)
|
||||
switch(picked_group)
|
||||
if(LAW_ZEROTH)
|
||||
. = zeroth
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
var/list/data = list( "dates" = list() )
|
||||
var/regex/ymlRegex = regex(@"\.yml", "g")
|
||||
|
||||
for(var/archive_file in sortList(flist("html/changelogs/archive/")))
|
||||
for(var/archive_file in sort_list(flist("html/changelogs/archive/")))
|
||||
var/archive_date = ymlRegex.Replace(archive_file, "")
|
||||
data["dates"] = list(archive_date) + data["dates"]
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
var/usedSlots = NONE
|
||||
for(var/i in 1 to max(1, abs(quality))) // We want at least 1 affix applied
|
||||
var/datum/fantasy_affix/affix = pickweight(affixListing)
|
||||
var/datum/fantasy_affix/affix = pick_weight(affixListing)
|
||||
if(affix.placement & usedSlots)
|
||||
continue
|
||||
if(!(affix.alignment & alignment))
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
/obj/projectile/temp/hot = 15,
|
||||
/obj/projectile/beam/disabler = 15)
|
||||
|
||||
var/obj/projectile/picked_projectiletype = pickweight(weighted_projectile_types)
|
||||
var/obj/projectile/picked_projectiletype = pick_weight(weighted_projectile_types)
|
||||
|
||||
var/obj/item/master = comp.parent
|
||||
comp.appliedComponents += master.AddComponent(/datum/component/mirv, picked_projectiletype)
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
source.name = initial(source.name)
|
||||
else
|
||||
var/name_to_use = filled_name || initial(source.name)
|
||||
var/list/unique_list = uniqueList(scoops)
|
||||
var/list/unique_list = unique_list(scoops)
|
||||
if(scoops_len > 1 && length(unique_list) == 1) // multiple flavours, and all of the same type
|
||||
source.name = "[make_tuple(scoops_len)] [scoops[1]] [name_to_use]" // "double vanilla" sounds cooler than just "vanilla"
|
||||
else
|
||||
@@ -94,7 +94,7 @@
|
||||
var/scoops_len = length(scoops)
|
||||
if(!scoops_len)
|
||||
source.desc = initial(source.desc)
|
||||
else if(scoops_len == 1 || length(uniqueList(scoops)) == 1) /// Only one flavour.
|
||||
else if(scoops_len == 1 || length(unique_list(scoops)) == 1) /// Only one flavour.
|
||||
var/key = scoops[1]
|
||||
var/datum/ice_cream_flavour/flavour = GLOB.ice_cream_flavours[LAZYACCESS(special_scoops, key) || key]
|
||||
if(!flavour?.desc) //I scream.
|
||||
@@ -107,7 +107,7 @@
|
||||
/datum/component/ice_cream_holder/proc/on_examine_more(atom/source, mob/mob, list/examine_list)
|
||||
SIGNAL_HANDLER
|
||||
var/scoops_len = length(scoops)
|
||||
if(scoops_len == 1 || length(uniqueList(scoops)) == 1) /// Only one flavour.
|
||||
if(scoops_len == 1 || length(unique_list(scoops)) == 1) /// Only one flavour.
|
||||
var/key = scoops[1]
|
||||
var/datum/ice_cream_flavour/flavour = GLOB.ice_cream_flavours[LAZYACCESS(special_scoops, key) || key]
|
||||
if(flavour?.desc) //I scream.
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
/datum/component/sound_player/proc/play_sound()
|
||||
SIGNAL_HANDLER
|
||||
playsound(parent, pickweight(sounds), volume, TRUE)
|
||||
playsound(parent, pick_weight(sounds), volume, TRUE)
|
||||
switch(amount_left)
|
||||
if(-1)
|
||||
return
|
||||
|
||||
@@ -75,9 +75,9 @@
|
||||
|
||||
if(prob(squeak_chance))
|
||||
if(!override_squeak_sounds)
|
||||
playsound(parent, pickweight(default_squeak_sounds), volume, TRUE, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
|
||||
playsound(parent, pick_weight(default_squeak_sounds), volume, TRUE, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
|
||||
else
|
||||
playsound(parent, pickweight(override_squeak_sounds), volume, TRUE, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
|
||||
playsound(parent, pick_weight(override_squeak_sounds), volume, TRUE, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
|
||||
|
||||
/datum/component/squeak/proc/step_squeak()
|
||||
SIGNAL_HANDLER
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
name2subtype[initial(subtype.name)] = subtype
|
||||
built_radial_list += list(initial(subtype.name) = option)
|
||||
built_radial_list = sortList(built_radial_list)
|
||||
built_radial_list = sort_list(built_radial_list)
|
||||
|
||||
/**
|
||||
* pick_subtype: called from on_attack_self, shows a user a radial menu of all available null rod reskins and replaces the current null rod with the user's chosen reskinned variant
|
||||
|
||||
@@ -362,7 +362,7 @@
|
||||
L += "[S.id]N"
|
||||
else
|
||||
L += S.id
|
||||
L = sortList(L) // Sort the list so it doesn't matter which order the symptoms are in.
|
||||
L = sort_list(L) // Sort the list so it doesn't matter which order the symptoms are in.
|
||||
var/result = jointext(L, ":")
|
||||
id = result
|
||||
return id
|
||||
@@ -451,7 +451,7 @@
|
||||
symptoms += SSdisease.list_symptoms.Copy()
|
||||
do
|
||||
if(user)
|
||||
var/symptom = input(user, "Choose a symptom to add ([i] remaining)", "Choose a Symptom") in sortList(symptoms, /proc/cmp_typepaths_asc)
|
||||
var/symptom = input(user, "Choose a symptom to add ([i] remaining)", "Choose a Symptom") in sort_list(symptoms, /proc/cmp_typepaths_asc)
|
||||
if(isnull(symptom))
|
||||
return
|
||||
else if(istext(symptom))
|
||||
@@ -473,7 +473,7 @@
|
||||
D.name = new_name //Updates our copy
|
||||
|
||||
var/list/targets = list("Random")
|
||||
targets += sortNames(GLOB.human_list)
|
||||
targets += sort_names(GLOB.human_list)
|
||||
var/target = input(user, "Pick a viable human target for the disease.", "Disease Target") as null|anything in targets
|
||||
|
||||
var/mob/living/carbon/human/H
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
if(!available_surgeries.len)
|
||||
return
|
||||
|
||||
var/pick_your_surgery = input("Begin which procedure?", "Surgery", null, null) as null|anything in sortList(available_surgeries)
|
||||
var/pick_your_surgery = input("Begin which procedure?", "Surgery", null, null) as null|anything in sort_list(available_surgeries)
|
||||
if(pick_your_surgery && user?.Adjacent(livingtarget) && (source in user))
|
||||
var/datum/surgery/surgeryinstance_notonmob = available_surgeries[pick_your_surgery]
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
/datum/looping_sound/proc/get_sound(starttime, _mid_sounds)
|
||||
. = _mid_sounds || mid_sounds
|
||||
while(!isfile(.) && !isnull(.))
|
||||
. = pickweight(.)
|
||||
. = pick_weight(.)
|
||||
|
||||
/datum/looping_sound/proc/on_start()
|
||||
var/start_wait = 0
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
if(gen_turf.turf_flags & NO_RUINS)
|
||||
stored_flags |= NO_RUINS
|
||||
|
||||
var/turf/new_turf = pickweight(closed ? closed_turf_types : open_turf_types)
|
||||
var/turf/new_turf = pick_weight(closed ? closed_turf_types : open_turf_types)
|
||||
|
||||
new_turf = gen_turf.ChangeTurf(new_turf, initial(new_turf.baseturfs), CHANGETURF_DEFER_CHANGE)
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
if(!(A.area_flags & FLORA_ALLOWED))
|
||||
can_spawn = FALSE
|
||||
if(can_spawn)
|
||||
spawned_flora = pickweight(flora_spawn_list)
|
||||
spawned_flora = pick_weight(flora_spawn_list)
|
||||
spawned_flora = new spawned_flora(new_open_turf)
|
||||
|
||||
//FEATURE SPAWNING HERE
|
||||
@@ -94,7 +94,7 @@
|
||||
if(!(A.area_flags & FLORA_ALLOWED)) //checks the same flag because lol dunno
|
||||
can_spawn = FALSE
|
||||
|
||||
var/atom/picked_feature = pickweight(feature_spawn_list)
|
||||
var/atom/picked_feature = pick_weight(feature_spawn_list)
|
||||
|
||||
for(var/obj/structure/F in range(7, new_open_turf))
|
||||
if(istype(F, picked_feature))
|
||||
@@ -111,13 +111,13 @@
|
||||
if(!(A.area_flags & MOB_SPAWN_ALLOWED))
|
||||
can_spawn = FALSE
|
||||
|
||||
var/atom/picked_mob = pickweight(mob_spawn_list)
|
||||
var/atom/picked_mob = pick_weight(mob_spawn_list)
|
||||
|
||||
if(picked_mob == SPAWN_MEGAFAUNA) //
|
||||
if((A.area_flags & MEGAFAUNA_SPAWN_ALLOWED) && megafauna_spawn_list?.len) //this is danger. it's boss time.
|
||||
picked_mob = pickweight(megafauna_spawn_list)
|
||||
picked_mob = pick_weight(megafauna_spawn_list)
|
||||
else //this is not danger, don't spawn a boss, spawn something else
|
||||
picked_mob = pickweight(mob_spawn_list - SPAWN_MEGAFAUNA) //What if we used 100% of the brain...and did something (slightly) less shit than a while loop?
|
||||
picked_mob = pick_weight(mob_spawn_list - SPAWN_MEGAFAUNA) //What if we used 100% of the brain...and did something (slightly) less shit than a while loop?
|
||||
|
||||
for(var/thing in urange(12, new_open_turf)) //prevents mob clumps
|
||||
if(!ishostile(thing) && !istype(thing, /obj/structure/spawner))
|
||||
|
||||
+2
-2
@@ -484,7 +484,7 @@
|
||||
A.admin_remove(usr)
|
||||
|
||||
if (href_list["role_edit"])
|
||||
var/new_role = input("Select new role", "Assigned role", assigned_role.title) as null|anything in sortList(SSjob.station_jobs)
|
||||
var/new_role = input("Select new role", "Assigned role", assigned_role.title) as null|anything in sort_list(SSjob.station_jobs)
|
||||
if(isnull(new_role))
|
||||
return
|
||||
var/datum/job/new_job = SSjob.GetJob(new_role)
|
||||
@@ -522,7 +522,7 @@
|
||||
if(1)
|
||||
target_antag = antag_datums[1]
|
||||
else
|
||||
var/datum/antagonist/target = input("Which antagonist gets the objective:", "Antagonist", "(new custom antag)") as null|anything in sortList(antag_datums) + "(new custom antag)"
|
||||
var/datum/antagonist/target = input("Which antagonist gets the objective:", "Antagonist", "(new custom antag)") as null|anything in sort_list(antag_datums) + "(new custom antag)"
|
||||
if (QDELETED(target))
|
||||
return
|
||||
else if(target == "(new custom antag)")
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
if(!length(possible))
|
||||
to_chat(user,span_warning("Despite your best efforts, there are no scents to be found on [sniffed]..."))
|
||||
return
|
||||
tracking_target = input(user, "Choose a scent to remember.", "Scent Tracking") as null|anything in sortNames(possible)
|
||||
tracking_target = input(user, "Choose a scent to remember.", "Scent Tracking") as null|anything in sort_names(possible)
|
||||
if(!tracking_target)
|
||||
if(!old_target)
|
||||
to_chat(user,span_warning("You decide against remembering any scents. Instead, you notice your own nose in your peripheral vision. This goes on to remind you of that one time you started breathing manually and couldn't stop. What an awful day that was."))
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
if(nlog_type & LOG_SAY)
|
||||
var/list/reversed = log_source[log_type]
|
||||
if(islist(reversed))
|
||||
say_log = reverseRange(reversed.Copy())
|
||||
say_log = reverse_range(reversed.Copy())
|
||||
break
|
||||
if(LAZYLEN(say_log))
|
||||
for(var/spoken_memory in say_log)
|
||||
|
||||
@@ -315,7 +315,7 @@
|
||||
var/list/types = list(uniform, suit, back, belt, gloves, shoes, head, mask, neck, ears, glasses, id, l_pocket, r_pocket, suit_store, r_hand, l_hand)
|
||||
types += chameleon_extras
|
||||
types += skillchips
|
||||
listclearnulls(types)
|
||||
list_clear_nulls(types)
|
||||
return types
|
||||
|
||||
/// Return a json list of this outfit
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
var/mob/living/carbon/human/species/monkey/punpun/punpun = locate()
|
||||
if(!punpun)
|
||||
return
|
||||
var/weapon_type = pickweight(weapon_types)
|
||||
var/weapon_type = pick_weight(weapon_types)
|
||||
var/obj/item/weapon = new weapon_type
|
||||
if(!punpun.put_in_l_hand(weapon) && !punpun.put_in_r_hand(weapon))
|
||||
// Guess they did all this with whatever they have in their hands already
|
||||
|
||||
Reference in New Issue
Block a user