Fixes some issues with TGUI Alerts, and Text Input (#24282)

* Well... maybe that's not better way

* PDA and all_channels encryptionkey

* Alert fixes

* Bad style
This commit is contained in:
Aylong
2024-02-24 20:28:26 +02:00
committed by GitHub
parent a44f9ca128
commit 329398b4f0
27 changed files with 62 additions and 73 deletions
+3 -3
View File
@@ -43,8 +43,8 @@
/obj/effect/mob_spawn/attack_ghost(mob/user)
if(!valid_to_spawn(user))
return
var/ghost_role = tgui_alert(user, "Become [mob_name]? (Warning, You can no longer be cloned!)", "Respawn", list("Yes","No"))
if(ghost_role == "No")
var/ghost_role = tgui_alert(user, "Become [mob_name]? (Warning, You can no longer be cloned!)", "Respawn", list("Yes", "No"))
if(ghost_role != "Yes")
return
if(!species_prompt(user))
return
@@ -332,7 +332,7 @@
/obj/effect/mob_spawn/human/alive/space_bar_patron/attack_hand(mob/user)
var/despawn = tgui_alert(user, "Return to cryosleep? (Warning, Your mob will be deleted!)", "Leave Bar", list("Yes", "No"))
if(despawn == "No" || !loc || !Adjacent(user))
if(despawn != "Yes" || !loc || !Adjacent(user))
return
user.visible_message("<span class='notice'>[user.name] climbs back into cryosleep...</span>")
qdel(user)
@@ -65,34 +65,25 @@
user << browse(null, "window=records")
if(href_list["task"] == "med_record")
var/medmsg = tgui_input_text(usr, "Set your medical notes here.", "Medical Records", active_character.med_record, multiline = TRUE, encode = FALSE)
if(medmsg != null)
medmsg = copytext(medmsg, 1, MAX_PAPER_MESSAGE_LEN)
medmsg = html_encode(medmsg)
active_character.med_record = medmsg
active_character.SetRecords(user)
var/medmsg = tgui_input_text(usr, "Set your medical notes here.", "Medical Records", active_character.med_record, max_length = MAX_PAPER_MESSAGE_LEN, multiline = TRUE)
if(!medmsg)
return
active_character.med_record = medmsg
active_character.SetRecords(user)
if(href_list["task"] == "sec_record")
var/secmsg = tgui_input_text(usr, "Set your security notes here.", "Security Records", active_character.sec_record, multiline = TRUE, encode = FALSE)
if(secmsg != null)
secmsg = copytext(secmsg, 1, MAX_PAPER_MESSAGE_LEN)
secmsg = html_encode(secmsg)
active_character.sec_record = secmsg
active_character.SetRecords(user)
var/secmsg = tgui_input_text(usr, "Set your security notes here.", "Security Records", active_character.sec_record, max_length = MAX_PAPER_MESSAGE_LEN, multiline = TRUE)
if(!secmsg)
return
active_character.sec_record = secmsg
active_character.SetRecords(user)
if(href_list["task"] == "gen_record")
var/genmsg = tgui_input_text(usr, "Set your employment notes here.", "Employment Records", active_character.gen_record, multiline = TRUE, encode = FALSE)
if(genmsg != null)
genmsg = copytext(genmsg, 1, MAX_PAPER_MESSAGE_LEN)
genmsg = html_encode(genmsg)
active_character.gen_record = genmsg
active_character.SetRecords(user)
var/genmsg = tgui_input_text(usr, "Set your employment notes here.", "Employment Records", active_character.gen_record, max_length = MAX_PAPER_MESSAGE_LEN, multiline = TRUE)
if(!genmsg)
return
active_character.gen_record = genmsg
active_character.SetRecords(user)
if(href_list["preference"] == "gear")
if(href_list["toggle_gear"])
@@ -714,13 +705,10 @@
active_character.height = new_height
if("flavor_text")
var/msg = tgui_input_text(usr, "Set the flavor text in your 'examine' verb. The flavor text should be a physical descriptor of your character at a glance. SFW Drawn Art of your character is acceptable.", "Flavor Text", active_character.flavor_text, multiline = TRUE, encode = FALSE)
if(msg != null)
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = html_encode(msg)
active_character.flavor_text = msg
var/msg = tgui_input_text(usr, "Set the flavor text in your 'examine' verb. The flavor text should be a physical descriptor of your character at a glance. SFW Drawn Art of your character is acceptable.", "Flavor Text", active_character.flavor_text, max_length = MAX_PAPER_MESSAGE_LEN, multiline = TRUE)
if(!msg)
return
active_character.flavor_text = msg
if("limbs")
var/valid_limbs = list("Left Leg", "Right Leg", "Left Arm", "Right Arm", "Left Foot", "Right Foot", "Left Hand", "Right Hand")
+1 -1
View File
@@ -67,7 +67,7 @@
if(length(H.cards) > 1)
var/confirm = tgui_alert(user, "Are you sure you want to put your [length(H.cards)] cards back into the deck?", "Return Hand", list("Yes", "No"))
if(confirm == "No" || !Adjacent(user) || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))
if(confirm != "Yes" || !Adjacent(user) || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))
return
for(var/datum/playingcard/P in H.cards)
cards += P
+1 -1
View File
@@ -415,7 +415,7 @@
else
confirm = tgui_alert(user, "Are you sure you want to checkout [B] to [computer.user_data.patron_name]?", "Confirm Checkout", list("Yes", "No"))
if(confirm == "No")
if(confirm != "Yes")
return
if(computer.checkout(B))
playsound(src, 'sound/items/scannerbeep.ogg', 15, TRUE)
@@ -225,7 +225,7 @@
to_chat(user, "<span class='warning'>Upon using the antagHUD you forfeited the ability to join the round.</span>")
return
var/be_helper = tgui_alert(user, "Become a Lightgeist? (Warning, You can no longer be cloned!)", "Respawn", list("Yes","No"))
if(be_helper == "No")
if(be_helper != "Yes")
return
if(!loc || QDELETED(src) || QDELETED(user))
if(user)
@@ -50,7 +50,7 @@
var/obj/structure/elite_tumor/T = target
if(T.mychild == src && T.activity == TUMOR_PASSIVE)
var/response = tgui_alert(src, "Re-enter the tumor?", "Despawn yourself?", list("Yes", "No"))
if(response == "No" || QDELETED(src) || !Adjacent(T))
if(response != "Yes" || QDELETED(src) || !Adjacent(T))
return
T.clear_activator(src)
T.mychild = null
@@ -33,7 +33,7 @@
return
if(error_on_humanize == "")
var/spider_ask = tgui_alert(user, humanize_prompt, "Join as Terror Spider?", list("Yes", "No"))
if(spider_ask == "No" || !src || QDELETED(src))
if(spider_ask != "Yes" || !src || QDELETED(src))
return
else
to_chat(user, "Cannot inhabit spider: [error_on_humanize]")
+2 -2
View File
@@ -381,7 +381,7 @@ GLOBAL_LIST_EMPTY(PDAs)
O.show_message(text("[bicon(src)] *[ttone]*"))
/obj/item/pda/proc/set_ringtone(mob/user)
var/new_tone = tgui_input_text(user, "Please enter new ringtone", name, ttone)
var/new_tone = tgui_input_text(user, "Please enter new ringtone", name, ttone, max_length = 20, encode = FALSE)
new_tone = trim(new_tone)
if(!in_range(src, user) || loc != user)
@@ -396,7 +396,7 @@ GLOBAL_LIST_EMPTY(PDAs)
close(user)
return TRUE
ttone = sanitize(copytext(new_tone, 1, 20))
ttone = new_tone
return TRUE
/obj/item/pda/process()
+1 -1
View File
@@ -579,7 +579,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if("maxresearch")
if(!check_rights(R_ADMIN))
return
if(tgui_alert(usr, "Are you sure you want to maximize research levels?", "Confirmation", list("Yes", "No"))=="No")
if(tgui_alert(usr, "Are you sure you want to maximize research levels?", "Confirmation", list("Yes", "No")) != "Yes")
return
log_admin("[key_name(usr)] has maximized the research levels.")
message_admins("[key_name_admin(usr)] has maximized the research levels.")
@@ -305,7 +305,7 @@
return
prompted = TRUE
if(tgui_alert(user, "This will permanently transfer your consciousness to [SM]. Are you sure you want to do this?", "Consciousness Transfer", list("Yes", "No")) == "No")
if(tgui_alert(user, "This will permanently transfer your consciousness to [SM]. Are you sure you want to do this?", "Consciousness Transfer", list("Yes", "No")) != "Yes")
prompted = FALSE
return
+1 -1
View File
@@ -99,7 +99,7 @@
if(!istype(mob_to_delete) || !istype(user) || !Adjacent(user))
return
if(mob_to_delete.client)
if(tgui_alert(mob_to_delete, "Would you like to return to the realm of spirits? (This will delete your current character, but you can rejoin later)", "Ghost Bar", list("Yes", "No")) == "No")
if(tgui_alert(mob_to_delete, "Would you like to return to the realm of spirits? (This will delete your current character, but you can rejoin later)", "Ghost Bar", list("Yes", "No")) != "Yes")
return
mob_to_delete.visible_message("<span class='notice'>[mob_to_delete.name] climbs into [src]...</span>")
playsound(src, 'sound/machines/wooden_closet_close.ogg', 50)
@@ -155,7 +155,7 @@ GLOBAL_DATUM(necropolis_gate, /obj/structure/necropolis_gate/legion_gate)
/obj/structure/necropolis_gate/legion_gate/attack_hand(mob/user)
if(!open && !changing_openness)
var/safety = tgui_alert(user, "You think this might be a bad idea...", "Knock on the door?", list("Proceed", "Abort"))
if(safety == "Abort" || !in_range(src, user) || !src || open || changing_openness || user.incapacitated())
if(!safety || safety == "Abort" || !in_range(src, user) || !src || open || changing_openness || user.incapacitated())
return
user.visible_message("<span class='warning'>[user] knocks on [src]...</span>", "<span class='boldannounceic'>You tentatively knock on [src]...</span>")
playsound(user.loc, 'sound/effects/shieldbash.ogg', 100, 1)
+1 -1
View File
@@ -67,7 +67,7 @@ GLOBAL_DATUM_INIT(ghost_hud_panel, /datum/ui_module/ghost_hud_panel, new)
// Check if this is the first time they're turning on Antag HUD.
if(!check_rights(R_ADMIN | R_MOD, FALSE) && !ghost.is_roundstart_observer() && GLOB.configuration.general.restrict_antag_hud_rejoin && !ghost.has_ahudded())
var/response = tgui_alert(ghost, "If you turn this on, you will not be able to take any part in the round.", "Are you sure you want to enable antag HUD?", list("Yes", "No"))
if(response == "No")
if(response != "Yes")
return FALSE
ghost.can_reenter_corpse = FALSE
+1 -1
View File
@@ -123,7 +123,7 @@
data["max_length"] = max_length
data["message"] = message
data["multiline"] = multiline
data["placeholder"] = default // Default is a reserved keyword
data["placeholder"] = html_decode(default) // Default is a reserved keyword
data["large_buttons"] = user.client?.prefs?.toggles2 & PREFTOGGLE_2_LARGE_INPUT_BUTTONS
data["swapped_buttons"] = user.client?.prefs?.toggles2 & PREFTOGGLE_2_SWAP_INPUT_BUTTONS
data["title"] = title