Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: tgui list input #4074

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion code/__DEFINES/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@
// Yes I know this being an "enable to disable" is misleading, but it avoids having to tweak all existing pref entries
#define PREFTOGGLE_2_REVERB_DISABLE 1024
#define PREFTOGGLE_2_MC_TABS 2048
#define PREFTOGGLE_2_DISABLE_TGUI_LISTS 4096

#define TOGGLES_2_TOTAL 4095 // If you add or remove a preference toggle above, make sure you update this define with the total value of the toggles combined.
#define TOGGLES_2_TOTAL 8191 // If you add or remove a preference toggle above, make sure you update this define with the total value of the toggles combined.

#define TOGGLES_2_DEFAULT (PREFTOGGLE_2_FANCYUI|PREFTOGGLE_2_ITEMATTACK|PREFTOGGLE_2_WINDOWFLASHING|PREFTOGGLE_2_RUNECHAT|PREFTOGGLE_2_DEATHMESSAGE|PREFTOGGLE_2_SEE_ITEM_OUTLINES)

Expand Down
2 changes: 2 additions & 0 deletions code/__HELPERS/type2type.dm
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ GLOBAL_LIST_INIT(modulo_angle_to_dir, list(NORTH,NORTHEAST,EAST,SOUTHEAST,SOUTH,
return 'icons/mob/screen_operative.dmi'
if("White")
return 'icons/mob/screen_white.dmi'
if("Midnight")
return 'icons/mob/screen_midnight.dmi'
else
return 'icons/mob/screen_midnight.dmi'

Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

/obj/screen/ai/camera_list/Click()
var/mob/living/silicon/ai/AI = usr
var/camera = input(AI, "Choose which camera you want to view", "Cameras") as null|anything in AI.get_camera_list()
var/camera = tgui_input_list(AI, "Choose which camera you want to view", "Cameras", AI.get_camera_list())
AI.ai_camera_list(camera)

/obj/screen/ai/camera_track
Expand All @@ -26,7 +26,7 @@
/obj/screen/ai/camera_track/Click()
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
var/target_name = input(AI) as null|anything in AI.trackable_mobs()
var/target_name = tgui_input_list(AI, buttons = AI.trackable_mobs())
if(target_name)
AI.ai_camera_track(target_name)

Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ SUBSYSTEM_DEF(events)
var/datum/event_meta/EM = locate(href_list["set_name"])
EM.name = name
else if(href_list["set_type"])
var/type = input("Select event type.", "Select") as null|anything in allEvents
var/type = tgui_input_list(usr, "Select event type.", "Select", allEvents)
if(type)
var/datum/event_meta/EM = locate(href_list["set_type"])
EM.event_type = type
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/non-firing/titlescreen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SUBSYSTEM_DEF(title)

var/choice
if(user)
choice = input(user, "Choose new title screen", "Available Screens:") as null|anything in title_screens
choice = tgui_input_list(user, "Choose new title screen", "Available Screens:", title_screens)
if(!choice)
return FALSE
else
Expand Down
21 changes: 12 additions & 9 deletions code/datums/datumvars.dm
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@
var/datum/martial_art/M = i
artnames[initial(M.name)] = M

var/result = input(usr, "Choose the martial art to teach", "JUDO CHOP") as null|anything in artnames
var/result = tgui_input_list(usr, "Choose the martial art to teach", "JUDO CHOP", artnames)
if(!usr)
return
if(QDELETED(C))
Expand Down Expand Up @@ -677,7 +677,7 @@
if(!istype(M))
to_chat(usr, "This can only be used on instances of type /mob/living")
return
var/selected_job = input("Select a job", "Hud Job Selection") as null|anything in GLOB.all_taipan_jobs
var/selected_job = tgui_input_list(usr, "Select a job", "Hud Job Selection", GLOB.all_taipan_jobs)

if(!selected_job)
to_chat(usr, "No job selected!")
Expand Down Expand Up @@ -916,7 +916,7 @@
if(!valid_id)
to_chat(usr, "<span class='warning'>A reagent with that ID doesn't exist!</span>")
if("Choose ID")
chosen_id = input(usr, "Choose a reagent to add.", "Choose a reagent.") as null|anything in reagent_options
chosen_id = tgui_input_list(usr, "Choose a reagent to add.", "Choose a reagent.", reagent_options)
if(chosen_id)
var/amount = input(usr, "Choose the amount to add.", "Choose the amount.", A.reagents.maximum_volume) as num
if(amount)
Expand Down Expand Up @@ -1083,7 +1083,10 @@
to_chat(usr, "This can only be done to instances of type /mob/living/carbon/human")
return

var/new_species = input("Please choose a new species.","Species",null) as null|anything in GLOB.all_species
var/new_species = tgui_input_list(usr, "Please choose a new species.","Species", GLOB.all_species)

if(!new_species)
return

if(!H)
to_chat(usr, "Mob doesn't exist anymore")
Expand All @@ -1105,7 +1108,7 @@
to_chat(usr, "This can only be done to instances of type /mob")
return

var/new_language = input("Please choose a language to add.","Language",null) as null|anything in GLOB.all_languages
var/new_language = tgui_input_list(usr, "Please choose a language to add.","Language", GLOB.all_languages)

if(!new_language)
return
Expand All @@ -1132,7 +1135,7 @@
to_chat(usr, "This mob knows no languages.")
return

var/datum/language/rem_language = input("Please choose a language to remove.","Language",null) as null|anything in H.languages
var/datum/language/rem_language = tgui_input_list(usr, "Please choose a language to remove.","Language", H.languages)

if(!rem_language)
return
Expand Down Expand Up @@ -1218,7 +1221,7 @@
if(!istype(H))
to_chat(usr, "This can only be done to instances of type /mob")
return
var/verb = input("Please choose a verb to remove.","Verbs",null) as null|anything in H.verbs
var/verb = tgui_input_list(usr, "Please choose a verb to remove.","Verbs", H.verbs)
if(!H)
to_chat(usr, "Mob doesn't exist anymore")
return
Expand All @@ -1236,7 +1239,7 @@
to_chat(usr, "This can only be done to instances of type /mob/living/carbon")
return

var/new_organ = input("Please choose an organ to add.","Organ",null) as null|anything in subtypesof(/obj/item/organ)-/obj/item/organ
var/new_organ = tgui_input_list(usr, "Please choose an organ to add.","Organ", subtypesof(/obj/item/organ)-/obj/item/organ)
if(!new_organ) return

if(!M)
Expand All @@ -1258,7 +1261,7 @@
to_chat(usr, "This can only be done to instances of type /mob/living/carbon")
return

var/obj/item/organ/internal/rem_organ = input("Please choose an organ to remove.","Organ",null) as null|anything in M.internal_organs
var/obj/item/organ/internal/rem_organ = tgui_input_list(usr, "Please choose an organ to remove.", "Organ", M.internal_organs)

if(!M)
to_chat(usr, "Mob doesn't exist anymore")
Expand Down
2 changes: 1 addition & 1 deletion code/datums/emote/emote_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
var/fingers_count = src.dna?.species?.fingers_count
for(var/i = 1, i <= fingers_count, i++)
fingers += i
var/cnt = input("Руки должны быть свободны", "Показать несколько пальцев", 1) as null|anything in fingers
var/cnt = tgui_input_list(src, "Руки должны быть свободны", "Показать несколько пальцев", fingers, default = 1)
if(!cnt)
return
emote("signal-[cnt]")
Expand Down
8 changes: 4 additions & 4 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@
return

if(href_list["role_edit"])
var/new_role = input("Select new role", "Assigned role", assigned_role) as null|anything in GLOB.joblist
var/new_role = tgui_input_list(usr, "Select new role", "Assigned role", GLOB.joblist)
if(!new_role)
return
assigned_role = new_role
Expand Down Expand Up @@ -937,7 +937,7 @@
// Кастомная цель//
"custom")

var/new_obj_type = input("Select objective type:", "Objective type", def_value) as null|anything in objective_types
var/new_obj_type = tgui_input_list(usr, "Select objective type:", "Objective type", objective_types)
if(!new_obj_type)
return

Expand Down Expand Up @@ -1019,7 +1019,7 @@
if("destroy")
var/list/possible_targets = active_ais(1)
if(possible_targets.len)
var/mob/new_target = input("Select target:", "Objective target") as null|anything in possible_targets
var/mob/new_target = tgui_input_list(usr, "Select target:", "Objective target", possible_targets)
new_objective = new /datum/objective/destroy
new_objective.target = new_target.mind
new_objective.owner = src
Expand Down Expand Up @@ -1058,7 +1058,7 @@
var/list/roles = scan_objective.available_roles.Copy()
if(alert(usr, "Do you want to pick roles yourself? No will randomise it", "Pick roles", "Yes", "No") == "Yes")
for(var/i in 1 to 3)
var/role = input("Select role:", "Objective role") as null|anything in roles
var/role = tgui_input_list(usr, "Select role:", "Objective role", roles)
if(role)
roles -= role
scan_objective.possible_roles += role
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spell_targeting/matter_eater_targeting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
continue
possible_targets += O

var/atom/movable/target = input("Choose the target of your hunger.", "Targeting") as null|anything in possible_targets
var/atom/movable/target = tgui_input_list(user, "Choose the target of your hunger", "Targeting", possible_targets)

if(QDELETED(target))
return
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spell_targeting/remoteview_targeting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if(!length(remoteviewers))
return

var/mob/target = input("Choose the target to spy on.", "Targeting") as null|anything in remoteviewers
var/mob/target = tgui_input_list(user, "Choose the target to spy on", "Targeting", remoteviewers)

if(QDELETED(target))
return
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spell_targeting/targeted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
else if(max_targets == 1) // Only one target
var/atom/target
if(!random_target)
target = input("Choose the target for the spell.", "Targeting") as anything in possible_targets
target = tgui_input_list(user, "Choose the target for the spell", "Targeting", possible_targets)
//Adds a safety check post-input to make sure those targets are actually in range.
if(target in view_or_range(range, spell_location, selection_type))
targets += target
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spell_targeting/telepathic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
if(!length(valid_targets))
return

var/target_name = input("Choose the target to listen to.", "Targeting") as null|anything in valid_targets
var/target_name = tgui_input_list(user, "Choose the target to listen to.", "Targeting", valid_targets)

var/mob/living/target = valid_targets[target_name]
if(QDELETED(target))
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/area_teleport.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var/A

if(!randomise_selection)
A = input("Area to teleport to", "Teleport", A) as null|anything in GLOB.teleportlocs
A = tgui_input_list(user, "Area to teleport to", "Teleport", GLOB.teleportlocs)
else
A = pick(GLOB.teleportlocs)

Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/mimic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
forms += "Original Form"

forms += available_forms.Copy()
var/what = input(user, "Which form do you want to become?", "Mimic") as null|anything in forms
var/what = tgui_input_list(user, "Which form do you want to become?", "Mimic", forms)
if(!what)
to_chat(user, span_notice("You decide against changing forms."))
revert_cast(user)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/spells/shapeshift.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
for(var/path in possible_shapes)
var/mob/living/simple_animal/A = path
animal_list[initial(A.name)] = path
shapeshift_type = input(M, "Choose Your Animal Form!", "It's Morphing Time!", null) as anything in animal_list
shapeshift_type = tgui_input_list(M, "Choose Your Animal Form!", "It's Morphing Time!", animal_list)
if(!shapeshift_type) //If you aren't gonna decide I am!
shapeshift_type = pick(animal_list)
shapeshift_type = animal_list[shapeshift_type]
Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
else
tts_seeds = SStts.get_available_seeds(src)

var/new_tts_seed = input(user || src, "Choose your preferred voice:", "Character Preference", tts_seed) as null|anything in tts_seeds
var/new_tts_seed = tgui_input_list(user || src, "Choose your preferred voice:", "Character Preference", tts_seeds, tts_seed)
if(!new_tts_seed)
return null
if(!silent_target && ismob(src) && src != user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/clockwork/clockwork_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
to_chat(user, "<span class='warning'>You are not in the right dimension!</span>")
return

var/selected_altar = input(user, "Pick a credence teleport to...", "Teleporation") as null|anything in possible_altars
var/selected_altar = tgui_input_list(user, "Pick a credence teleport to...", "Teleporation", possible_altars)
if(!selected_altar)
return
var/turf/destination = possible_altars[selected_altar]
Expand Down
8 changes: 4 additions & 4 deletions code/game/gamemodes/cult/blood_magic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
possible_spells[cult_name] = J
if(length(spells))
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, "Pick a blood spell to prepare...", "Spell Choices", possible_spells)
if(entered_spell_name == "(REMOVE SPELL)")
remove_spell()
return
Expand Down Expand Up @@ -80,7 +80,7 @@
channeling = FALSE

/datum/action/innate/cult/blood_magic/proc/remove_spell(message = "Pick a spell to remove.")
var/nullify_spell = input(owner, message, "Current Spells") as null|anything in spells
var/nullify_spell = tgui_input_list(owner, message, "Current Spells", spells)
if(nullify_spell)
qdel(nullify_spell)

Expand Down Expand Up @@ -488,7 +488,7 @@
return

var/mob/living/L = target
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, "Choose a rune to teleport to.", "Rune to Teleport to", 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(!src || QDELETED(src) || !user || user.l_hand != src && user.r_hand != src || user.incapacitated() || !actual_selected_rune)
return
Expand Down Expand Up @@ -846,7 +846,7 @@

/obj/item/melee/blood_magic/manipulator/attack_self(mob/living/user)
var/list/options = list("Blood Orb (50)", "Blood Recharge (75)", "Blood Spear (150)", "Blood Bolt Barrage (300)")
var/choice = input(user, "Choose a greater blood rite...", "Greater Blood Rites") as null|anything in options
var/choice = tgui_input_list(user, "Choose a greater blood rite...", "Greater Blood Rites", options)
if(!Adjacent(user))
to_chat(user, "<span class='cultitalic'>Вы не можете использовать это заклинание без самого заклинания!</span>")
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/ritual.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
if(!length(possible_runes))
return

var/chosen_rune = input(user, "Choose a rite to scribe.", "Sigils of Power") as null|anything in possible_runes
var/chosen_rune = tgui_input_list(user, "Choose a rite to scribe", "Sigils of Power", possible_runes)
if(!chosen_rune)
return
var/obj/effect/rune/rune = possible_runes[chosen_rune]
Expand Down
6 changes: 3 additions & 3 deletions code/game/gamemodes/cult/runes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,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, "Choose a rune to teleport to.", "Rune to Teleport to", 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(!src || !Adjacent(user) || QDELETED(src) || user.incapacitated() || !actual_selected_rune)
fail_invoke()
Expand Down Expand Up @@ -575,7 +575,7 @@ structure_check() searches for nearby cultist structures required for the invoca
fail_invoke()
return
if(length(potential_revive_mobs) > 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, "Choose a cultist to revive", "Cultist to Revive", potential_revive_mobs)
else // If there's only one, no need for a menu
mob_to_revive = potential_revive_mobs[1]
if(!validness_checks(mob_to_revive, user))
Expand Down Expand Up @@ -686,7 +686,7 @@ structure_check() searches for nearby cultist structures required for the invoca
for(var/datum/mind/M in SSticker.mode.cult)
if(!(M.current in invokers) && M.current && M.current.stat != DEAD)
cultists[M.current.real_name] = M.current
var/input = input(user, "Who do you wish to call to [src]?", "Acolytes") as null|anything in cultists
var/input = tgui_input_list(user, "Who do you wish to call to [src]?", "Acolytes", cultists)
var/mob/living/cultist_to_summon = cultists[input]
if(!src || QDELETED(src) || !Adjacent(user) || user.incapacitated())
return
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/miniantags/borer/borer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
if(H.stat != DEAD && Adjacent(H) && !H.has_brain_worms())
choices += H

var/mob/living/carbon/human/M = input(src,"Who do you wish to infest?") in null|choices
var/mob/living/carbon/human/M = tgui_input_list(src,"Who do you wish to infest?", "Infest", choices)

if(!M || !src)
return
Expand Down Expand Up @@ -513,7 +513,7 @@

attempting_to_dominate = TRUE

var/mob/living/carbon/M = input(src,"Who do you wish to dominate?") in null|choices
var/mob/living/carbon/M = tgui_input_list(src,"Who do you wish to dominate?", "Dominate", choices)

if(!M)
attempting_to_dominate = FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/miniantags/demons/demon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
to_chat(usr, span_warning("There are no valid targets!"))
return

var/mob/living/target = input("Choose the target to talk to.", "Targeting") as null|mob in validtargets
var/mob/living/target = tgui_input_list(user, "Choose the target to talk to", "Targeting", validtargets)
return target


Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/miniantags/guardian/guardian.dm
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
picked_random_type = pick(possible_guardians)
guardian_type = picked_random_type
else
guardian_type = input(user, "Выберите тип [mob_name]", "Создание [mob_name] ") as null|anything in possible_guardians
guardian_type = tgui_input_list(user, "Выберите тип [mob_name]", "Создание [mob_name] ", possible_guardians)
if(!guardian_type)
to_chat(user, span_warning("Вы решили не использовать [name]."))
used = FALSE
Expand Down
Loading
Loading