TGUI list input conversions (#63315)

Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>
Co-authored-by: Sealed101 <75863639+Sealed101@users.noreply.github.com>
This commit is contained in:
Jeremiah
2021-12-10 02:20:01 -08:00
committed by GitHub
parent 78cc356987
commit 60922e7cfc
30 changed files with 49 additions and 46 deletions
+1 -1
View File
@@ -33,7 +33,7 @@
if(..())
return
var/mob/living/silicon/ai/AI = usr
var/target_name = input(AI, "Choose who you want to track", "Tracking") as null|anything in AI.trackable_mobs()
var/target_name = tgui_input_list(AI, "Select a target", "Tracking", AI.trackable_mobs())
AI.ai_camera_track(target_name)
/atom/movable/screen/ai/camera_light
+1 -1
View File
@@ -258,7 +258,7 @@
stack_trace("[type] - [cultist] attempted to scribe a rune, but the global rune list is empty!")
return FALSE
entered_rune_name = input(cultist, "Choose a rite to scribe.", "Sigils of Power") as null|anything in GLOB.rune_types
entered_rune_name = tgui_input_list(cultist, "Choose a rite to scribe", "Sigils of Power", GLOB.rune_types)
if(!entered_rune_name || !can_scribe_rune(tool, cultist))
return FALSE
+1 -1
View File
@@ -65,7 +65,7 @@
if(!available_surgeries.len)
return
var/pick_your_surgery = input("Begin which procedure?", "Surgery", null, null) as null|anything in sort_list(available_surgeries)
var/pick_your_surgery = tgui_input_list(user, "Which procedure?", "Surgery", sort_list(available_surgeries))
if(pick_your_surgery && user?.Adjacent(livingtarget) && (source in user))
var/datum/surgery/surgeryinstance_notonmob = available_surgeries[pick_your_surgery]
+1 -1
View File
@@ -206,7 +206,7 @@
if(materials.materials[i] > 0)
list_to_show += i
used_material = input("Choose [used_material]", "Custom Material") as null|anything in sort_list(list_to_show, /proc/cmp_typepaths_asc)
used_material = tgui_input_list(usr, "Choose [used_material]", "Custom Material", sort_list(list_to_show, /proc/cmp_typepaths_asc))
if(!used_material)
return //Didn't pick any material, so you can't build shit either.
custom_materials[used_material] += amount_needed
+1 -1
View File
@@ -16,7 +16,7 @@
/mob/living/silicon/ai/proc/show_camera_list()
var/list/cameras = get_camera_list()
var/camera = input(src, "Choose which camera you want to view", "Cameras") as null|anything in cameras
var/camera = tgui_input_list(src, "Choose which camera you want to view", "Cameras", cameras)
switchCamera(cameras[camera])
/datum/trackable
@@ -288,7 +288,7 @@
T["[netcam.c_tag][netcam.can_use() ? null : " (Deactivated)"]"] = netcam
playsound(origin, 'sound/machines/terminal_prompt.ogg', 25, FALSE)
var/camera = input("Choose which camera you want to view", "Cameras") as null|anything in T
var/camera = tgui_input_list(usr, "Camera to view", "Cameras", T)
var/obj/machinery/camera/final = T[camera]
playsound(src, "terminal_type", 25, FALSE)
if(final)
+1 -1
View File
@@ -1198,7 +1198,7 @@
return
// reads from the airlock painter's `available paintjob` list. lets the player choose a paint option, or cancel painting
var/current_paintjob = input(user, "Please select a paintjob for this airlock.") as null|anything in sort_list(painter.available_paint_jobs)
var/current_paintjob = tgui_input_list(user, "Paintjob for this airlock", "Customize", sort_list(painter.available_paint_jobs))
if(!current_paintjob) // if the user clicked cancel on the popup, return
return
+1 -1
View File
@@ -608,7 +608,7 @@ GLOBAL_LIST_EMPTY(PDAs)
if(!silent)
playsound(src, 'sound/machines/terminal_select.ogg', 15, TRUE)
if("Drone Phone")
var/alert_s = input(U,"Alert severity level","Ping Drones",null) as null|anything in list("Low","Medium","High","Critical")
var/alert_s = tgui_input_list(U, "Alert severity level", "Ping Drones", list("Low","Medium","High","Critical"))
var/area/A = get_area(U)
if(A && alert_s && !QDELETED(U))
var/msg = span_boldnotice("NON-DRONE PING: [U.name]: [alert_s] priority alert in [A.name]!")
+1 -1
View File
@@ -845,7 +845,7 @@ GENE SCANNER
for(var/A in buffer)
options += get_display_name(A)
var/answer = input(user, "Analyze Potential", "Sequence Analyzer") as null|anything in sort_list(options)
var/answer = tgui_input_list(user, "Analyze Potential", "Sequence Analyzer", sort_list(options))
if(answer && ready && user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
var/sequence
for(var/A in buffer) //this physically hurts but i dont know what anything else short of an assoc list
+1 -1
View File
@@ -262,7 +262,7 @@
to_chat(user, span_notice("Your pinpointer fails to detect a signal."))
return
var/A = input(user, "", "Pinpoint") as null|anything in sort_list(beacons)
var/A = tgui_input_list(user, "Select a location", "Pinpoint", sort_list(beacons))
if(!A || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated())
return
+1 -1
View File
@@ -123,7 +123,7 @@
/obj/structure/sign/barsign/proc/pick_sign(mob/user)
var/picked_name = input(user, "Available Signage", "Bar Sign", name) as null|anything in sort_list(get_bar_names())
var/picked_name = tgui_input_list(user, "Available Signage", "Bar Sign", sort_list(get_bar_names()))
if(!picked_name)
return
chosen_sign = set_sign_by_name(picked_name)
@@ -15,7 +15,7 @@
for(var/datum/changelingprofile/prof in changeling.stored_profiles)
names += "[prof.name]"
var/chosen_name = input("Select the target DNA: ", "Target DNA", null) as null|anything in sort_list(names)
var/chosen_name = tgui_input_list(user, "Target DNA", "Transformation", sort_list(names))
if(!chosen_name)
return
+4 -4
View File
@@ -45,7 +45,7 @@
to_chat(owner, span_cultitalic("You cannot store more than [MAX_BLOODCHARGE] spells. <b>Pick a spell to remove.</b>"))
else
to_chat(owner, span_cultitalic("<b><u>You cannot store more than [RUNELESS_MAX_BLOODCHARGE] spells without an empowering rune! Pick a spell to remove.</b></u>"))
var/nullify_spell = input(owner, "Choose a spell to remove.", "Current Spells") as null|anything in spells
var/nullify_spell = tgui_input_list(owner, "Spell to remove", "Current Spells", spells)
if(nullify_spell)
qdel(nullify_spell)
return
@@ -57,9 +57,9 @@
var/cult_name = initial(J.name)
possible_spells[cult_name] = J
possible_spells += "(REMOVE SPELL)"
entered_spell_name = input(owner, "Pick a blood spell to prepare...", "Spell Choices") as null|anything in possible_spells
entered_spell_name = tgui_input_list(owner, "Blood spell to prepare", "Spell Choices", possible_spells)
if(entered_spell_name == "(REMOVE SPELL)")
var/nullify_spell = input(owner, "Choose a spell to remove.", "Current Spells") as null|anything in spells
var/nullify_spell = tgui_input_list(owner, "Spell to remove", "Current Spells", spells)
if(nullify_spell)
qdel(nullify_spell)
return
@@ -487,7 +487,7 @@
to_chat(user, span_cultitalic("You are not in the right dimension!"))
return
var/input_rune_key = input(user, "Choose a rune to teleport to.", "Rune to Teleport to") as null|anything in potential_runes //we know what key they picked
var/input_rune_key = tgui_input_list(user, "Rune to teleport to", "Teleportation Target", potential_runes) //we know what key they picked
var/obj/effect/rune/teleport/actual_selected_rune = potential_runes[input_rune_key] //what rune does that key correspond to?
if(QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated() || !actual_selected_rune || !proximity)
return
+1 -1
View File
@@ -665,7 +665,7 @@ Striking a noncultist, however, will tear their flesh."}
for(var/datum/mind/M as anything in get_antag_minds(/datum/antagonist/cult))
if(M.current && M.current.stat != DEAD)
cultists |= M.current
var/mob/living/cultist_to_receive = input(user, "Who do you wish to call to [src]?", "Followers of the Geometer") as null|anything in (cultists - user)
var/mob/living/cultist_to_receive = tgui_input_list(user, "Who do you wish to call to [src]?", "Followers of the Geometer", (cultists - user))
if(!Adjacent(user) || !src || QDELETED(src) || user.incapacitated())
return
if(!cultist_to_receive)
+3 -3
View File
@@ -408,7 +408,7 @@ structure_check() searches for nearby cultist structures required for the invoca
fail_invoke()
return
var/input_rune_key = input(user, "Choose a rune to teleport to.", "Rune to Teleport to") as null|anything in potential_runes //we know what key they picked
var/input_rune_key = tgui_input_list(user, "Rune to teleport to", "Teleportation Target", potential_runes) //we know what key they picked
var/obj/effect/rune/teleport/actual_selected_rune = potential_runes[input_rune_key] //what rune does that key correspond to?
if(!Adjacent(user) || !src || QDELETED(src) || user.incapacitated() || !actual_selected_rune)
fail_invoke()
@@ -567,7 +567,7 @@ structure_check() searches for nearby cultist structures required for the invoca
fail_invoke()
return
if(potential_revive_mobs.len > 1)
mob_to_revive = input(user, "Choose a cultist to revive.", "Cultist to Revive") as null|anything in potential_revive_mobs
mob_to_revive = tgui_input_list(user, "Cultist to revive", "Revive Cultist", potential_revive_mobs)
else
mob_to_revive = potential_revive_mobs[1]
if(QDELETED(src) || !validness_checks(mob_to_revive, user))
@@ -668,7 +668,7 @@ structure_check() searches for nearby cultist structures required for the invoca
for(var/datum/mind/M as anything in get_antag_minds(/datum/antagonist/cult))
if(!(M.current in invokers) && M.current && M.current.stat != DEAD)
cultists |= M.current
var/mob/living/cultist_to_summon = input(user, "Who do you wish to call to [src]?", "Followers of the Geometer") as null|anything in cultists
var/mob/living/cultist_to_summon = tgui_input_list(user, "Who do you wish to call to [src]?", "Followers of the Geometer", cultists)
if(!Adjacent(user) || !src || QDELETED(src) || user.incapacitated())
return
if(!cultist_to_summon)
@@ -340,7 +340,7 @@
drawing = TRUE
var/type = pick_list[input(user,"Choose the rune","Rune") as null|anything in pick_list ]
var/type = pick_list[tgui_input_list(user, "Choose the rune", "Rune", pick_list) ]
if(!type)
drawing = FALSE
return
@@ -151,7 +151,7 @@
return FALSE
return TRUE
/datum/eldritch_knowledge/curse/on_finished_recipe(mob/living/user,list/atoms,loc)
/datum/eldritch_knowledge/curse/on_finished_recipe(mob/living/user, list/atoms,loc)
var/list/compiled_list = list()
@@ -164,7 +164,7 @@
to_chat(user, span_warning("These items don't possess the required fingerprints or DNA."))
return FALSE
var/chosen_mob = input("Select the person you wish to curse","Your target") as null|anything in sort_list(compiled_list, /proc/cmp_mob_realname_dsc)
var/chosen_mob = tgui_input_list(user, "Select the person you wish to curse","Your target", sort_list(compiled_list, /proc/cmp_mob_realname_dsc))
if(!chosen_mob)
return FALSE
curse(compiled_list[chosen_mob])
@@ -620,7 +620,7 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister())
return
switch(action)
if("relabel")
var/label = input("New canister label:", name) as null|anything in GLOB.gas_id_to_canister
var/label = tgui_input_list(usr, "New canister label", name, GLOB.gas_id_to_canister)
if(label && !..())
var/newtype = GLOB.gas_id_to_canister[label]
if(newtype)
+1 -1
View File
@@ -406,7 +406,7 @@
return
var/list/possible_destinations = SSpoints_of_interest.get_mob_pois()
var/target = input("Select a mob! (Smiting does this automatically)", "Target", null, null) as null|anything in possible_destinations
var/target = tgui_input_list(usr, "Select a mob! (Smiting does this automatically)", "Target", possible_destinations)
if (isnull(target))
return
+1 -1
View File
@@ -447,7 +447,7 @@
/obj/item/seeds/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/pen))
var/choice = tgui_input_list(usr, "What would you like to change?",, list("Plant Name", "Seed Description", "Product Description", "Cancel"))
var/choice = tgui_input_list(usr, "What would you like to change?", "Seed Alteration", list("Plant Name", "Seed Description", "Product Description"))
if(!user.canUseTopic(src, BE_CLOSE))
return
switch(choice)
+1 -1
View File
@@ -69,7 +69,7 @@ INITIALIZE_IMMEDIATE(/mob/dead)
if(1)
pick = csa[1]
else
pick = input(src, "Pick a server to jump to", "Server Hop") as null|anything in csa
pick = tgui_input_list(src, "Server to jump to", "Server Hop", csa)
if(!pick)
return
+5 -5
View File
@@ -439,7 +439,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
var/area/A = V
if(!(A.area_flags & HIDDEN_AREA))
filtered += A
var/area/thearea = input("Area to jump to", "BOOYEA") as null|anything in filtered
var/area/thearea = tgui_input_list(usr, "Area to jump to", "BOOYEA", filtered)
if(!thearea)
return
@@ -509,7 +509,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
var/list/possible_destinations = SSpoints_of_interest.get_mob_pois()
var/target = null
target = input("Please, select a player!", "Jump to Mob", null, null) as null|anything in possible_destinations
target = tgui_input_list(usr, "Please, select a player!", "Jump to Mob", possible_destinations)
if (!target || !isobserver(usr))
return
@@ -543,7 +543,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
var/list/views = list()
for(var/i in 7 to max_view)
views |= i
var/new_view = input("Choose your new view", "Modify view range", 0) as null|anything in views
var/new_view = tgui_input_list(usr, "New view", "Modify view range", views)
if(new_view)
client.view_size.setTo(clamp(new_view, 7, max_view) - 7)
else
@@ -649,7 +649,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(!(L in GLOB.player_list) && !L.mind)
possessible += L
var/mob/living/target = input("Your new life begins today!", "Possess Mob", null, null) as null|anything in sort_names(possessible)
var/mob/living/target = tgui_input_list(usr, "Your new life begins today!", "Possess Mob", sort_names(possessible))
if(!target)
return FALSE
@@ -878,7 +878,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
var/list/possible_destinations = SSpoints_of_interest.get_mob_pois()
var/target = null
target = input("Please, select a player!", "Jump to Mob", null, null) as null|anything in possible_destinations
target = tgui_input_list(usr, "Please, select a player!", "Jump to Mob", possible_destinations)
if (!target || !isobserver(usr))
return
+5 -5
View File
@@ -562,7 +562,7 @@
for(var/i in C.network)
cameralist[i] = i
var/old_network = network
network = input(U, "Which network would you like to view?") as null|anything in sort_list(cameralist)
network = tgui_input_list(U, "Which network would you like to view?", sort_list(cameralist))
if(!U.eyeobj)
U.view_core()
@@ -599,7 +599,7 @@
personnel_list["[record_datum.fields["name"]]: [record_datum.fields["rank"]]"] = record_datum.fields["image"]//Pull names, rank, and image.
if(personnel_list.len)
input = input("Select a crew member:") as null|anything in sort_list(personnel_list)
input = tgui_input_list(usr, "Select a crew member", "Station Member", sort_list(personnel_list))
var/icon/character_icon = personnel_list[input]
if(character_icon)
qdel(holo_icon)//Clear old icon so we're not storing it in memory.
@@ -636,7 +636,7 @@
"spider" = 'icons/mob/animal.dmi'
)
input = input("Please select a hologram:") as null|anything in sort_list(icon_list)
input = tgui_input_list(usr, "Select a hologram", "Hologram", sort_list(icon_list))
if(input)
qdel(holo_icon)
switch(input)
@@ -657,7 +657,7 @@
"clock" = 'icons/mob/ai.dmi'
)
input = input("Please select a hologram:") as null|anything in sort_list(icon_list)
input = tgui_input_list(usr, "Select a hologram", "Hologram", sort_list(icon_list))
if(input)
qdel(holo_icon)
switch(input)
@@ -928,7 +928,7 @@
to_chat(src, "No usable AI shell beacons detected.")
if(!target || !(target in possible)) //If the AI is looking for a new shell, or its pre-selected shell is no longer valid
target = input(src, "Which body to control?") as null|anything in sort_names(possible)
target = tgui_input_list(src, "Which body to control?", "Direct Control", sort_names(possible))
if (!target || target.stat == DEAD || target.deployed || !(!target.connected_ai ||(target.connected_ai == src)))
return
+1 -1
View File
@@ -312,7 +312,7 @@
return
//Ask the user to pick a channel from what it has available.
var/Autochan = input("Select a channel:") as null|anything in list("Default","None") + radio.channels
var/Autochan = tgui_input_list(usr, "Select a channel", "Channel Selection", list("Default","None") + radio.channels)
if(!Autochan)
return
@@ -454,7 +454,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians
if(P.reset)
guardians -= P //clear out guardians that are already reset
if(guardians.len)
var/mob/living/simple_animal/hostile/guardian/G = input(src, "Pick the guardian you wish to reset", "Guardian Reset") as null|anything in sort_names(guardians)
var/mob/living/simple_animal/hostile/guardian/G = tgui_input_list(src, "Pick the guardian you wish to reset", "Guardian Reset", sort_names(guardians))
if(G)
to_chat(src, span_holoparasite("You attempt to reset <font color=\"[G.guardiancolor]\"><b>[G.real_name]</b></font>'s personality..."))
var/list/mob/dead/observer/candidates = poll_ghost_candidates("Do you want to play as [src.real_name]'s [G.real_name]?", ROLE_PAI, FALSE, 100)
@@ -552,7 +552,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians
if(random)
guardiantype = pick(possible_guardians)
else
guardiantype = input(user, "Pick the type of [mob_name]", "[mob_name] Creation") as null|anything in sort_list(possible_guardians)
guardiantype = tgui_input_list(user, "Pick the type of [mob_name]", "[mob_name] Creation", sort_list(possible_guardians))
if(!guardiantype || !candidate.client)
to_chat(user, "[failure_message]" )
used = FALSE
+1 -1
View File
@@ -147,7 +147,7 @@
. = ..()
//Changing name/description of items. Only works if they have the UNIQUE_RENAME object flag set
if(isobj(O) && proximity && (O.obj_flags & UNIQUE_RENAME))
var/penchoice = input(user, "What would you like to edit?", "Rename, change description or reset both?") as null|anything in list("Rename","Change description","Reset")
var/penchoice = tgui_input_list(user, "What would you like to edit?", "Pen Setting", list("Rename","Change description","Reset"))
if(QDELETED(O) || !user.canUseTopic(O, BE_CLOSE))
return
if(penchoice == "Rename")
+2 -2
View File
@@ -340,10 +340,10 @@ All the important duct code:
. += span_notice("It's current color and layer are [duct_color] and [duct_layer]. Use in-hand to change.")
/obj/item/stack/ducts/attack_self(mob/user)
var/new_layer = input("Select a layer", "Layer") as null|anything in layers
var/new_layer = tgui_input_list(user, "Select a layer", "Layer", layers)
if(new_layer)
duct_layer = new_layer
var/new_color = input("Select a color", "Color") as null|anything in GLOB.pipe_paint_colors
var/new_color = tgui_input_list(user, "Select a color", "Color", GLOB.pipe_paint_colors)
if(new_color)
duct_color = new_color
add_atom_colour(GLOB.pipe_paint_colors[new_color], FIXED_COLOUR_PRIORITY)
+1 -1
View File
@@ -395,7 +395,7 @@
if(!honormut.guilty.len)
to_chat(user, span_warning("[GLOB.deity] is holding no grudges to forgive."))
return FALSE
var/forgiven_choice = input(user, "Choose one of [GLOB.deity]'s guilty to forgive.", "Forgive") as null|anything in honormut.guilty
var/forgiven_choice = tgui_input_list(user, "Choose one of [GLOB.deity]'s guilty to forgive.", "Forgive", honormut.guilty)
if(!forgiven_choice)
return FALSE
who = forgiven_choice
+1 -1
View File
@@ -35,7 +35,7 @@
/obj/item/assault_pod/attack_self(mob/living/user)
var/target_area
target_area = input("Area to land", "Select a Landing Zone", target_area) as null|anything in GLOB.teleportlocs
target_area = tgui_input_list(user, "Area to land", "Landing Zone", GLOB.teleportlocs)
if(!target_area)
return
var/area/picked_area = GLOB.teleportlocs[target_area]
+4 -1
View File
@@ -9,7 +9,7 @@
* * buttons - The options that can be chosen by the user, each string is assigned a button on the UI.
* * timeout - The timeout of the input box, after which the input box will close and qdel itself. Set to zero for no timeout.
*/
/proc/tgui_input_list(mob/user, message, title, list/buttons, timeout = 0)
/proc/tgui_input_list(mob/user, message, title = "Select", list/buttons, timeout = 0)
if (!user)
user = usr
if(!length(buttons))
@@ -20,6 +20,9 @@
user = client.mob
else
return
/// Client does NOT have tgui_input on: Returns regular input
if(!user.client.prefs.read_preference(/datum/preference/toggle/tgui_input))
return input(user, message, title) as null|anything in buttons
var/datum/tgui_list_input/input = new(user, message, title, buttons, timeout)
input.ui_interact(user)
input.wait()