Convert almost all alert() to tgui_alert()

This commit is contained in:
Aronai Sieyes
2021-06-25 17:03:35 -04:00
parent 70bff20384
commit 0da0c54388
191 changed files with 509 additions and 521 deletions
@@ -62,7 +62,7 @@
else if(href_list["add_language"])
var/datum/species/S = GLOB.all_species[pref.species]
if(pref.alternate_languages.len >= S.num_alternate_languages)
alert(user, "You have already selected the maximum number of alternate languages for this species!")
tgui_alert_async(user, "You have already selected the maximum number of alternate languages for this species!")
else
var/list/available_languages = S.secondary_langs.Copy()
for(var/L in GLOB.all_languages)
@@ -76,7 +76,7 @@
available_languages -= pref.alternate_languages
if(!available_languages.len)
alert(user, "There are no additional languages available to select.")
tgui_alert_async(user, "There are no additional languages available to select.")
else
var/new_lang = input(user, "Select an additional language", "Character Generation", null) as null|anything in available_languages
if(new_lang && pref.alternate_languages.len < S.num_alternate_languages)
@@ -90,13 +90,13 @@
char = input("Enter a single special character.\nYou may re-select the same characters.\nThe following characters are already in use by radio: ; : .\nThe following characters are already in use by special say commands: ! * ^", "Enter Character - [3 - keys.len] remaining") as null|text
if(char)
if(length(char) > 1)
alert(user, "Only single characters allowed.", "Error", "Ok")
tgui_alert_async(user, "Only single characters allowed.", "Error")
else if(char in list(";", ":", "."))
alert(user, "Radio character. Rejected.", "Error", "Ok")
tgui_alert_async(user, "Radio character. Rejected.", "Error")
else if(char in list("!","*","^","-"))
alert(user, "Say character. Rejected.", "Error", "Ok")
tgui_alert_async(user, "Say character. Rejected.", "Error")
else if(contains_az09(char))
alert(user, "Non-special character. Rejected.", "Error", "Ok")
tgui_alert_async(user, "Non-special character. Rejected.", "Error")
else
keys.Add(char)
while(char && keys.len < 3)
@@ -78,7 +78,7 @@
swear to god I will find you and I will punch you for not reading these directions!\n\
([WEIGHT_MIN]-[WEIGHT_MAX])", "Character Preference") as num|null
if(new_weight)
var/unit_of_measurement = alert(user, "Is that number in pounds (lb) or kilograms (kg)?", "Confirmation", "Pounds", "Kilograms")
var/unit_of_measurement = tgui_alert(user, "Is that number in pounds (lb) or kilograms (kg)?", "Confirmation", list("Pounds", "Kilograms"))
if(unit_of_measurement == "Pounds")
new_weight = round(text2num(new_weight),4)
if(unit_of_measurement == "Kilograms")
@@ -186,12 +186,6 @@
return TOPIC_NOACTION
else if(href_list["custom_species"])
/*if(pref.species != "Custom Species")
alert(usr, "You cannot set a custom species name unless you set your character to use the 'Custom Species' \
species on the 'General' tab. If you have this set to something, it's because you had it set before the \
Trait system was implemented. If you wish to change it, set your species to 'Custom Species' and configure \
the species completely.")
return TOPIC_REFRESH*/ //There was no reason to have this.
var/raw_choice = sanitize(input(user, "Input your custom species name:",
"Character Preference", pref.custom_species) as null|text, MAX_NAME_LEN)
if (CanUseTopic(user))
@@ -214,28 +208,28 @@
return TOPIC_REFRESH
else if(href_list["blood_reset"])
var/choice = alert(usr, "Reset blood color to human default (#A10808)?","Reset Blood Color","Reset","Cancel")
var/choice = tgui_alert(usr, "Reset blood color to human default (#A10808)?","Reset Blood Color",list("Reset","Cancel"))
if(choice == "Reset")
pref.blood_color = "#A10808"
return TOPIC_REFRESH
else if(href_list["clicked_pos_trait"])
var/datum/trait/trait = text2path(href_list["clicked_pos_trait"])
var/choice = alert(usr, "Remove [initial(trait.name)] and regain [initial(trait.cost)] points?","Remove Trait","Remove","Cancel")
var/choice = tgui_alert(usr, "Remove [initial(trait.name)] and regain [initial(trait.cost)] points?","Remove Trait",list("Remove","Cancel"))
if(choice == "Remove")
pref.pos_traits -= trait
return TOPIC_REFRESH
else if(href_list["clicked_neu_trait"])
var/datum/trait/trait = text2path(href_list["clicked_neu_trait"])
var/choice = alert(usr, "Remove [initial(trait.name)]?","Remove Trait","Remove","Cancel")
var/choice = tgui_alert(usr, "Remove [initial(trait.name)]?","Remove Trait",list("Remove","Cancel"))
if(choice == "Remove")
pref.neu_traits -= trait
return TOPIC_REFRESH
else if(href_list["clicked_neg_trait"])
var/datum/trait/trait = text2path(href_list["clicked_neg_trait"])
var/choice = alert(usr, "Remove [initial(trait.name)] and lose [initial(trait.cost)] points?","Remove Trait","Remove","Cancel")
var/choice = tgui_alert(usr, "Remove [initial(trait.name)] and lose [initial(trait.cost)] points?","Remove Trait",list("Remove","Cancel"))
if(choice == "Remove")
pref.neg_traits -= trait
return TOPIC_REFRESH
@@ -310,7 +304,7 @@
done = TRUE
if(trait_choice in nicelist)
var/datum/trait/path = nicelist[trait_choice]
var/choice = alert(usr, "\[Cost:[initial(path.cost)]\] [initial(path.desc)]",initial(path.name),"Take Trait","Cancel","Go Back")
var/choice = tgui_alert(usr, "\[Cost:[initial(path.cost)]\] [initial(path.desc)]",initial(path.name),"Take Trait",list("Cancel","Go Back"))
if(choice == "Cancel")
trait_choice = null
if(choice != "Go Back")
@@ -325,21 +319,21 @@
var/conflict = FALSE
if(pref.dirty_synth && !(instance.can_take & SYNTHETICS))
alert(usr, "The trait you've selected can only be taken by organic characters!","Error")
tgui_alert_async(usr, "The trait you've selected can only be taken by organic characters!","Error")
pref.dirty_synth = 0 //Just to be sure
return TOPIC_REFRESH
if(pref.gross_meatbag && !(instance.can_take & ORGANICS))
alert(usr, "The trait you've selected can only be taken by synthetic characters!","Error")
tgui_alert_async(usr, "The trait you've selected can only be taken by synthetic characters!","Error")
pref.gross_meatbag = 0 //Just to be sure
return TOPIC_REFRESH
if(pref.species in instance.banned_species)
alert(usr, "The trait you've selected cannot be taken by the species you've chosen!","Error")
tgui_alert_async(usr, "The trait you've selected cannot be taken by the species you've chosen!","Error")
return TOPIC_REFRESH
if( LAZYLEN(instance.allowed_species) && !(pref.species in instance.allowed_species)) //Adding white list handling -shark
alert(usr, "The trait you've selected cannot be taken by the species you've chosen!","Error")
tgui_alert_async(usr, "The trait you've selected cannot be taken by the species you've chosen!","Error")
return TOPIC_REFRESH
if(trait_choice in pref.pos_traits + pref.neu_traits + pref.neg_traits)
@@ -358,8 +352,7 @@
break varconflict
if(conflict)
alert(usr, "You cannot take this trait and [conflict] at the same time. \
Please remove that trait, or pick another trait to add.","Error")
tgui_alert_async(usr, "You cannot take this trait and [conflict] at the same time. Please remove that trait, or pick another trait to add.", "Error")
return TOPIC_REFRESH
mylist += path