Adds sorting to most input() lists (#47117)

* Adds sorting to most input() lists.

* Sorted some global lists, added more input sorting

* Should now use correct sort everywhere.

* compiles

* Last fixes.
This commit is contained in:
skoglol
2019-10-22 13:28:42 +02:00
committed by Rob Bailey
parent 52be6b096a
commit 938e66f62c
108 changed files with 183 additions and 178 deletions
+1 -1
View File
@@ -22,7 +22,7 @@
else
logs_missing += "[subject] (empty)"
var/list/combined = logs_present + logs_missing
var/list/combined = sortList(logs_present) + sortList(logs_missing)
var/selected = input("Investigate what?", "Investigate") as null|anything in combined
+3 -3
View File
@@ -559,7 +559,7 @@ GLOBAL_PROTECT(admin_verbs_hideable)
var/type_length = length("/obj/effect/proc_holder/spell") + 2
for(var/A in GLOB.spells)
spell_list[copytext("[A]", type_length)] = A
var/obj/effect/proc_holder/spell/S = input("Choose the spell to give to that guy", "ABRAKADABRA") as null|anything in spell_list
var/obj/effect/proc_holder/spell/S = input("Choose the spell to give to that guy", "ABRAKADABRA") as null|anything in sortList(spell_list)
if(!S)
return
@@ -580,7 +580,7 @@ GLOBAL_PROTECT(admin_verbs_hideable)
set desc = "Remove a spell from the selected mob."
if(T && T.mind)
var/obj/effect/proc_holder/spell/S = input("Choose the spell to remove", "NO ABRAKADABRA") as null|anything in T.mind.spell_list
var/obj/effect/proc_holder/spell/S = input("Choose the spell to remove", "NO ABRAKADABRA") as null|anything in sortList(T.mind.spell_list)
if(S)
T.mind.RemoveSpell(S)
log_admin("[key_name(usr)] removed the spell [S] from [key_name(T)].")
@@ -594,7 +594,7 @@ GLOBAL_PROTECT(admin_verbs_hideable)
if(!istype(T))
to_chat(src, "<span class='notice'>You can only give a disease to a mob of type /mob/living.</span>")
return
var/datum/disease/D = input("Choose the disease to give to that guy", "ACHOO") as null|anything in SSdisease.diseases
var/datum/disease/D = input("Choose the disease to give to that guy", "ACHOO") as null|anything in sortList(SSdisease.diseases, /proc/cmp_typepaths_asc)
if(!D)
return
T.ForceContractDisease(new D, FALSE, TRUE)
+1 -1
View File
@@ -19,7 +19,7 @@
/obj/item, /obj/item/clothing, /obj/item/stack, /obj/item,
/obj/item/reagent_containers, /obj/item/gun)
var/path = input("Select the path of the object you wish to create.", "Path", /obj) in create_object_forms
var/path = input("Select the path of the object you wish to create.", "Path", /obj) in sortList(create_object_forms, /proc/cmp_typepaths_asc)
var/html_form = create_object_forms[path]
if (!html_form)
+1 -1
View File
@@ -446,7 +446,7 @@
if("Random")
E = new /datum/round_event/disease_outbreak()
if("Choose")
var/virus = input("Choose the virus to spread", "BIOHAZARD") as null|anything in typesof(/datum/disease)
var/virus = input("Choose the virus to spread", "BIOHAZARD") as null|anything in sortList(typesof(/datum/disease, /proc/cmp_typepaths_asc))
E = new /datum/round_event/disease_outbreak{}()
var/datum/round_event/disease_outbreak/DO = E
DO.virus_type = virus
+3 -3
View File
@@ -111,7 +111,7 @@
for(var/mob/M in GLOB.mob_list)
if(M.mind)
minds |= M.mind
var/datum/mind/value = input("Select new member:", "New team member", null) as null|anything in minds
var/datum/mind/value = input("Select new member:", "New team member", null) as null|anything in sortNames(minds)
if (!value)
return
@@ -169,7 +169,7 @@
//This is here if you want admin created teams to tell each other apart easily.
/datum/team/custom/proc/admin_force_hud(mob/user)
var/list/possible_icons = icon_states('icons/mob/hud.dmi')
var/new_hud_state = input(user,"Choose hud icon state","Custom HUD","traitor") as null|anything in possible_icons
var/new_hud_state = input(user,"Choose hud icon state","Custom HUD","traitor") as null|anything in sortList(possible_icons)
if(!new_hud_state)
return
//suppose could ask for color too
@@ -180,4 +180,4 @@
for(var/datum/mind/M in members)
custom_hud.join_hud(M.current)
set_antag_hud(M.current,custom_hud_state)
set_antag_hud(M.current,custom_hud_state)
+4 -4
View File
@@ -609,7 +609,7 @@
for (var/rule in subtypesof(/datum/dynamic_ruleset/roundstart))
var/datum/dynamic_ruleset/roundstart/newrule = new rule()
roundstart_rules[newrule.name] = newrule
var/added_rule = input(usr,"What ruleset do you want to force? This will bypass threat level and population restrictions.", "Rigging Roundstart", null) as null|anything in roundstart_rules
var/added_rule = input(usr,"What ruleset do you want to force? This will bypass threat level and population restrictions.", "Rigging Roundstart", null) as null|anything in sortNames(roundstart_rules)
if (added_rule)
GLOB.dynamic_forced_roundstart_ruleset += roundstart_rules[added_rule]
log_admin("[key_name(usr)] set [added_rule] to be a forced roundstart ruleset.")
@@ -644,7 +644,7 @@
for (var/rule in subtypesof(/datum/dynamic_ruleset/latejoin))
var/datum/dynamic_ruleset/latejoin/newrule = new rule()
latejoin_rules[newrule.name] = newrule
var/added_rule = input(usr,"What ruleset do you want to force upon the next latejoiner? This will bypass threat level and population restrictions.", "Rigging Latejoin", null) as null|anything in latejoin_rules
var/added_rule = input(usr,"What ruleset do you want to force upon the next latejoiner? This will bypass threat level and population restrictions.", "Rigging Latejoin", null) as null|anything in sortNames(latejoin_rules)
if (added_rule)
var/datum/game_mode/dynamic/mode = SSticker.mode
mode.forced_latejoin_rule = latejoin_rules[added_rule]
@@ -673,7 +673,7 @@
for (var/rule in subtypesof(/datum/dynamic_ruleset/midround))
var/datum/dynamic_ruleset/midround/newrule = new rule()
midround_rules[newrule.name] = rule
var/added_rule = input(usr,"What ruleset do you want to force right now? This will bypass threat level and population restrictions.", "Execute Ruleset", null) as null|anything in midround_rules
var/added_rule = input(usr,"What ruleset do you want to force right now? This will bypass threat level and population restrictions.", "Execute Ruleset", null) as null|anything in sortNames(midround_rules)
if (added_rule)
var/datum/game_mode/dynamic/mode = SSticker.mode
log_admin("[key_name(usr)] executed the [added_rule] ruleset.")
@@ -1742,7 +1742,7 @@
var/list/available_channels = list()
for(var/datum/newscaster/feed_channel/F in GLOB.news_network.network_channels)
available_channels += F.channel_name
src.admincaster_feed_channel.channel_name = adminscrub(input(usr, "Choose receiving Feed Channel.", "Network Channel Handler") in available_channels )
src.admincaster_feed_channel.channel_name = adminscrub(input(usr, "Choose receiving Feed Channel.", "Network Channel Handler") in sortList(available_channels) )
src.access_news_network()
else if(href_list["ac_set_new_message"])
+1 -1
View File
@@ -7,7 +7,7 @@
return
if (!istype(borgo, /mob/living/silicon/robot))
borgo = input("Select a borg", "Select a borg", null, null) as null|anything in GLOB.silicon_mobs
borgo = input("Select a borg", "Select a borg", null, null) as null|anything in sortNames(GLOB.silicon_mobs)
if (!istype(borgo, /mob/living/silicon/robot))
to_chat(usr, "<span class='warning'>Borg is required for borgpanel</span>")
+1 -1
View File
@@ -6,6 +6,6 @@
if(!SSticker)
return
var/datum/cinematic/choice = input(src,"Cinematic","Choose",null) as anything in subtypesof(/datum/cinematic)
var/datum/cinematic/choice = input(src,"Cinematic","Choose",null) as anything in sortList(subtypesof(/datum/cinematic), /proc/cmp_typepaths_asc)
if(choice)
Cinematic(initial(choice.id),world,null)
+12 -9
View File
@@ -96,7 +96,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
for(var/mob/C in GLOB.mob_list)
if(C.key)
available.Add(C)
var/mob/choice = input("Choose a player to play the pAI", "Spawn pAI") in available
var/mob/choice = input("Choose a player to play the pAI", "Spawn pAI") in sortNames(available)
if(!choice)
return 0
if(!isobserver(choice))
@@ -162,7 +162,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(matches.len==0)
return
var/hsbitem = input(usr, "Choose an object to delete.", "Delete:") as null|anything in matches
var/hsbitem = input(usr, "Choose an object to delete.", "Delete:") as null|anything in sortList(matches)
if(hsbitem)
hsbitem = matches[hsbitem]
var/counter = 0
@@ -494,14 +494,17 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
message_admins("<span class='adminnotice'>[key_name_admin(usr)] changed the equipment of [ADMIN_LOOKUPFLW(H)] to [dresscode].</span>")
/client/proc/robust_dress_shop()
var/list/outfits = list("Naked","Custom","As Job...", "As Plasmaman...")
var/list/baseoutfits = list("Naked","Custom","As Job...", "As Plasmaman...")
var/list/outfits = list()
var/list/paths = subtypesof(/datum/outfit) - typesof(/datum/outfit/job) - typesof(/datum/outfit/plasmaman)
for(var/path in paths)
var/datum/outfit/O = path //not much to initalize here but whatever
if(initial(O.can_be_admin_equipped))
outfits[initial(O.name)] = path
var/dresscode = input("Select outfit", "Robust quick dress shop") as null|anything in outfits
var/dresscode = input("Select outfit", "Robust quick dress shop") as null|anything in baseoutfits + sortList(outfits)
if (isnull(dresscode))
return
@@ -516,7 +519,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(initial(O.can_be_admin_equipped))
job_outfits[initial(O.name)] = path
dresscode = input("Select job equipment", "Robust quick dress shop") as null|anything in job_outfits
dresscode = input("Select job equipment", "Robust quick dress shop") as null|anything in sortList(job_outfits)
dresscode = job_outfits[dresscode]
if(isnull(dresscode))
return
@@ -529,7 +532,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(initial(O.can_be_admin_equipped))
plasmaman_outfits[initial(O.name)] = path
dresscode = input("Select plasmeme equipment", "Robust quick dress shop") as null|anything in plasmaman_outfits
dresscode = input("Select plasmeme equipment", "Robust quick dress shop") as null|anything in sortList(plasmaman_outfits)
dresscode = plasmaman_outfits[dresscode]
if(isnull(dresscode))
return
@@ -538,7 +541,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
var/list/custom_names = list()
for(var/datum/outfit/D in GLOB.custom_outfits)
custom_names[D.name] = D
var/selected_name = input("Select outfit", "Robust quick dress shop") as null|anything in custom_names
var/selected_name = input("Select outfit", "Robust quick dress shop") as null|anything in sortList(custom_names)
dresscode = custom_names[selected_name]
if(isnull(dresscode))
return
@@ -697,7 +700,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
names[name] = ruin_landmark
var/ruinname = input("Select ruin", "Jump to Ruin") as null|anything in names
var/ruinname = input("Select ruin", "Jump to Ruin") as null|anything in sortList(names)
var/obj/effect/landmark/ruin/landmark = names[ruinname]
@@ -728,7 +731,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
for(var/name in SSmapping.lava_ruins_templates)
names[name] = list(SSmapping.lava_ruins_templates[name], ZTRAIT_LAVA_RUINS, /area/lavaland/surface/outdoors/unexplored)
var/ruinname = input("Select ruin", "Spawn Ruin") as null|anything in names
var/ruinname = input("Select ruin", "Spawn Ruin") as null|anything in sortList(names)
var/data = names[ruinname]
if (!data)
return
@@ -4,7 +4,7 @@
var/datum/map_template/template
var/map = input(src, "Choose a Map Template to place at your CURRENT LOCATION","Place Map Template") as null|anything in SSmapping.map_templates
var/map = input(src, "Choose a Map Template to place at your CURRENT LOCATION","Place Map Template") as null|anything in sortList(SSmapping.map_templates)
if(!map)
return
template = SSmapping.map_templates[map]
+2 -2
View File
@@ -33,7 +33,7 @@
mapname += "\]"
maprotatechoices[mapname] = VM
var/chosenmap = input("Choose a map to change to", "Change Map") as null|anything in maprotatechoices
var/chosenmap = input("Choose a map to change to", "Change Map") as null|anything in sortList(maprotatechoices)
if (!chosenmap)
return
SSticker.maprotatechecked = 1
@@ -41,4 +41,4 @@
message_admins("[key_name_admin(usr)] is changing the map to [VM.map_name]")
log_admin("[key_name(usr)] is changing the map to [VM.map_name]")
if (SSmapping.changemap(VM) == 0)
message_admins("[key_name_admin(usr)] has changed the map to [VM.map_name]")
message_admins("[key_name_admin(usr)] has changed the map to [VM.map_name]")
+5 -5
View File
@@ -296,7 +296,7 @@
continue //we have a live body we are tied to
candidates += M.ckey
if(candidates.len)
ckey = input("Pick the player you want to respawn as a xeno.", "Suitable Candidates") as null|anything in candidates
ckey = input("Pick the player you want to respawn as a xeno.", "Suitable Candidates") as null|anything in sortKey(candidates)
else
to_chat(usr, "<span class='danger'>Error: create_xeno(): no suitable candidates.</span>")
if(!istext(ckey))
@@ -890,7 +890,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(!holder)
return
var/weather_type = input("Choose a weather", "Weather") as null|anything in subtypesof(/datum/weather)
var/weather_type = input("Choose a weather", "Weather") as null|anything in sortList(subtypesof(/datum/weather), /proc/cmp_typepaths_asc)
if(!weather_type)
return
@@ -1042,7 +1042,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
var/list/punishment_list = list(ADMIN_PUNISHMENT_LIGHTNING, ADMIN_PUNISHMENT_BRAINDAMAGE, ADMIN_PUNISHMENT_GIB, ADMIN_PUNISHMENT_BSA, ADMIN_PUNISHMENT_FIREBALL, ADMIN_PUNISHMENT_ROD, ADMIN_PUNISHMENT_SUPPLYPOD_QUICK, ADMIN_PUNISHMENT_SUPPLYPOD, ADMIN_PUNISHMENT_MAZING)
var/punishment = input("Choose a punishment", "DIVINE SMITING") as null|anything in punishment_list
var/punishment = input("Choose a punishment", "DIVINE SMITING") as null|anything in sortList(punishment_list)
if(QDELETED(target) || !punishment)
return
@@ -1205,7 +1205,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
var/name = GLOB.trait_name_map[trait] || trait
availible_traits[name] = trait
var/chosen_trait = input("Select trait to modify", "Trait") as null|anything in availible_traits
var/chosen_trait = input("Select trait to modify", "Trait") as null|anything in sortList(availible_traits)
if(!chosen_trait)
return
chosen_trait = availible_traits[chosen_trait]
@@ -1222,7 +1222,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
if("All")
source = null
if("Specific")
source = input("Source to be removed","Trait Remove/Add") as null|anything in D.status_traits[chosen_trait]
source = input("Source to be removed","Trait Remove/Add") as null|anything in sortList(D.status_traits[chosen_trait])
if(!source)
return
REMOVE_TRAIT(D,chosen_trait,source)
@@ -51,11 +51,11 @@
if(!check_rights(NONE))
return
var/list/names = list()
var/list/componentsubtypes = subtypesof(/datum/component)
var/list/componentsubtypes = sortList(subtypesof(/datum/component), /proc/cmp_typepaths_asc)
names += "---Components---"
names += componentsubtypes
names += "---Elements---"
names += subtypesof(/datum/element)
names += sortList(subtypesof(/datum/element), /proc/cmp_typepaths_asc)
var/result = input(usr, "Choose a component/element to add","better know what ur fuckin doin pal") as null|anything in names
if(!usr || !result || result == "---Components---" || result == "---Elements---")
return