[MIRROR] default tgui alert input handling (#8891)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
Co-authored-by: Kashargul <KashL@t-online.de>
This commit is contained in:
CHOMPStation2
2024-09-01 15:28:35 -07:00
committed by GitHub
parent ec8834f9e5
commit 9f42148ab1
106 changed files with 675 additions and 178 deletions

View File

@@ -180,7 +180,7 @@
if(s_icon_state_off == "Upload Own Sprite")
s_icon = input(usr, "Choose an image file to upload. Images that are not 32x32 will need to have their positions offset.","Upload Icon") as null|file
var/check_activatable = tgui_alert(src, "Allow it to be turned on?", "activatable", list("Yes", "No", "Cancel"))
if(check_activatable == "Cancel")
if(!check_activatable || check_activatable == "Cancel")
return
if(check_activatable == "No")
s_activatable = 0
@@ -188,7 +188,7 @@
s_activatable = 1
s_text_activated = tgui_input_text(src, "Activation text:", "Activation Text")
check_togglable = tgui_alert(src, "Allow it to be turned back off again?", "togglable", list("Yes", "No", "Cancel"))
if(check_togglable == "Cancel")
if(!check_togglable || check_togglable == "Cancel")
return
if(check_togglable == "No")
s_togglable = 0
@@ -200,7 +200,7 @@
s_icon2 = input(usr, "Choose an image file to upload. Images that are not 32x32 will need to have their positions offset.","Upload Icon") as null|file
s_delay = tgui_input_number(src, "Do you want it to take time to put turn on? Choose a number of deciseconds to activate, or 0 for instant.", "Delay")
var/check_effect = tgui_alert(src, "Produce an effect on activation?", "Effect?", list("No", "Spark", "Flicker Lights", "Flash", "Spawn Item", "Cancel"))
if(check_effect == "Cancel")
if(!check_effect || check_effect == "Cancel")
return
if(check_effect == "No")
s_effect = 0
@@ -214,7 +214,7 @@
s_effect = 4
s_object = get_path_from_partial_text()
var/check_sound = tgui_alert(src, "Play a sound when turning on?", "Sound", list("Yes", "No", "Cancel"))
if(check_sound == "Cancel")
if(!check_sound || check_sound == "Cancel")
return
if(check_sound == "Yes")
s_sound = tgui_input_list(src, "Choose a sound to play on activation:", "Sound", sound_options)

View File

@@ -225,21 +225,21 @@
var/s_name = tgui_input_text(src, "Structure Name:", "Name")
var/s_desc = tgui_input_text(src, "Structure Description:", "Description")
var/check_anchored = tgui_alert(src, "Start anchored?", "anchored", list("Yes", "No", "Cancel"))
if(check_anchored == "Cancel")
if(!check_anchored || check_anchored == "Cancel")
return
if(check_anchored == "No")
s_anchored = 0
if(check_anchored == "Yes")
s_anchored = 1
var/check_density = tgui_alert(src, "Start dense?", "density", list("Yes", "No", "Cancel"))
if(check_density == "Cancel")
if(!check_density || check_density == "Cancel")
return
if(check_density == "No")
s_density = 0
if(check_density == "Yes")
s_density = 1
var/check_wrenchable = tgui_alert(src, "Allow it to be fastened and unfastened with a wrench?", "wrenchable", list("Yes", "No", "Cancel"))
if(check_wrenchable == "Cancel")
if(!check_wrenchable || check_wrenchable == "Cancel")
return
if(check_wrenchable == "No")
s_wrenchable = 0
@@ -249,7 +249,7 @@
if(s_icon_state_off == "Upload Own Sprite")
s_icon = input(usr, "Choose an image file to upload. Images that are not 32x32 will need to have their positions offset.","Upload Icon") as null|file
var/check_activatable = tgui_alert(src, "Allow it to be turned on?", "activatable", list("Yes", "No", "Cancel"))
if(check_activatable == "Cancel")
if(!check_activatable || check_activatable == "Cancel")
return
if(check_activatable == "No")
s_activatable = 0
@@ -257,7 +257,7 @@
s_activatable = 1
s_text_activated = tgui_input_text(src, "Activation text:", "Activation Text")
check_togglable = tgui_alert(src, "Allow it to be turned back off again?", "togglable", list("Yes", "No", "Cancel"))
if(check_togglable == "Cancel")
if(!check_togglable || check_togglable == "Cancel")
return
if(check_togglable == "No")
s_togglable = 0
@@ -269,7 +269,7 @@
s_icon2 = input(usr, "Choose an image file to upload. Images that are not 32x32 will need to have their positions offset.","Upload Icon") as null|file
s_delay = tgui_input_number(src, "Do you want it to take time to put turn on? Choose a number of deciseconds to activate, or 0 for instant.", "Delay")
var/check_effect = tgui_alert(src, "Produce an effect on activation?", "Effect?", list("No", "Spark", "Flicker Lights", "Flash", "Spawn Item", "Cancel"))
if(check_effect == "Cancel")
if(!check_effect || check_effect == "Cancel")
return
if(check_effect == "No")
s_effect = 0
@@ -283,7 +283,7 @@
s_effect = 4
s_object = get_path_from_partial_text()
var/check_sound = tgui_alert(src, "Play a sound when turning on?", "Sound", list("Yes", "No", "Cancel"))
if(check_sound == "Cancel")
if(!check_sound || check_sound == "Cancel")
return
if(check_sound == "Yes")
s_sound = tgui_input_list(src, "Choose a sound to play on activation:", "Sound", sound_options)
@@ -335,4 +335,4 @@
result = matches[1]
else
result = tgui_input_list(usr, "Select an atom type", "Spawn Atom", matches, strict_modern = TRUE)
return result
return result

View File

@@ -73,7 +73,7 @@ Invoked by vv topic "fakepdapropconvo" in code\modules\admin\view_variables\topi
return
var/choice = tgui_alert(M,"Use TGUI or dialogue boxes?", "TGUI?", list("TGUI", "Dialogue", "Cancel"))
if(choice == "Cancel") return
if(!choice || choice == "Cancel") return
var/datum/data/pda/app/messenger/ourPDA = find_program(/datum/data/pda/app/messenger)
@@ -88,7 +88,10 @@ Invoked by vv topic "fakepdapropconvo" in code\modules\admin\view_variables\topi
var/message = sanitize(tgui_input_text(M, "Input fake message. Leave empty to cancel. Can create up to 30 messages in a row",null),
MAX_MESSAGE_LEN)
if(!message) return
var/receipent = ((tgui_alert(M, "Received or Sent?", "Direction", list("Received", "Sent"))=="Sent") ? 1 : 0)
var/input = tgui_alert(M, "Received or Sent?", "Direction", list("Received", "Sent"))
if(!input)
return
var/receipent = ((input=="Sent") ? 1 : 0)
ourPDA.createFakeMessage(name,identity,job,receipent, message)
if(choice == "TGUI")