From dcab86ba2cbc4abcccc1b59e75bc613a1bbb33d1 Mon Sep 17 00:00:00 2001 From: Jeremiah <42397676+jlsnow301@users.noreply.github.com> Date: Fri, 24 Dec 2021 03:04:18 -0800 Subject: [PATCH] More standard tgui input conversions (#63464) --- code/_onclick/hud/alert.dm | 2 +- code/datums/elements/spooky.dm | 10 ++--- code/game/machinery/camera/camera_assembly.dm | 7 ++- code/game/machinery/computer/arena.dm | 6 ++- code/game/machinery/doors/passworddoor.dm | 2 +- code/game/machinery/syndicatebomb.dm | 30 +++++++------ code/game/objects/items/credit_holochip.dm | 24 +++++----- .../objects/items/grenades/chem_grenade.dm | 15 ++++--- code/game/objects/items/grenades/grenade.dm | 21 +++++---- code/game/objects/items/stacks/stack.dm | 4 +- .../crates_lockers/closets/bodybag.dm | 2 +- code/game/objects/structures/morgue.dm | 2 +- code/game/objects/structures/reflector.dm | 10 +++-- .../objects/structures/windoor_assembly.dm | 2 +- code/modules/admin/outfit_editor.dm | 2 +- code/modules/admin/painting_manager.dm | 6 +-- code/modules/admin/sound_emitter.dm | 14 +++--- code/modules/admin/verbs/secrets.dm | 2 +- .../antagonists/wizard/equipment/spellbook.dm | 2 +- code/modules/art/paintings.dm | 2 +- .../machinery/portable/canister.dm | 11 ++--- code/modules/cargo/centcom_podlauncher.dm | 4 +- code/modules/cargo/orderconsole.dm | 2 +- code/modules/cargo/supplypod_beacon.dm | 17 +++---- code/modules/clothing/neck/_neck.dm | 2 +- code/modules/clothing/under/accessories.dm | 2 +- code/modules/economy/pay_stand.dm | 37 ++++++++------- code/modules/events/holiday/vday.dm | 4 +- .../kitchen_machinery/smartfridge.dm | 6 +-- code/modules/food_and_drinks/pizzabox.dm | 2 +- code/modules/hydroponics/seeds.dm | 45 +++++++------------ code/modules/mining/machine_redemption.dm | 10 ++++- .../modules/mob/dead/new_player/new_player.dm | 8 ++-- code/modules/mob/living/brain/posibrain.dm | 11 ++--- code/modules/mob/living/carbon/human/human.dm | 10 ++--- code/modules/mob/living/silicon/ai/ai.dm | 2 +- code/modules/mob/living/silicon/ai/ai_say.dm | 2 +- .../mob/living/simple_animal/friendly/cat.dm | 2 +- .../living/simple_animal/guardian/guardian.dm | 6 +-- .../simple_animal/guardian/types/standard.dm | 2 +- .../mob/living/simple_animal/hostile/bear.dm | 2 +- .../simple_animal/hostile/giant_spider.dm | 6 ++- .../simple_animal/hostile/space_dragon.dm | 2 +- .../file_system/programs/borg_monitor.dm | 2 +- .../file_system/programs/budgetordering.dm | 2 +- code/modules/paperwork/folders.dm | 2 +- code/modules/paperwork/handlabeler.dm | 2 +- code/modules/paperwork/pen.dm | 17 +++---- code/modules/photography/camera/camera.dm | 6 +-- code/modules/photography/photos/photo.dm | 4 +- .../reagents/chemistry/chem_wiki_render.dm | 2 +- .../chemistry/machinery/chem_dispenser.dm | 2 +- .../chemistry/machinery/chem_master.dm | 4 +- .../chemistry/machinery/chem_recipe_debug.dm | 2 +- .../reagents/reagent_containers/blood_pack.dm | 2 +- code/modules/recycling/sortingmachinery.dm | 4 +- .../xenobiology/crossbreeding/stabilized.dm | 2 +- .../research/xenobiology/xenobiology.dm | 6 +-- .../spells/spell_types/personality_commune.dm | 2 +- code/modules/swarmers/swarmer.dm | 2 +- code/modules/tgui/tgui_input_text.dm | 19 +++++--- .../vehicles/mecha/mecha_control_console.dm | 2 +- .../tgui/interfaces/NumberInputModal.tsx | 6 ++- .../tgui/interfaces/TextInputModal.tsx | 11 +++-- 64 files changed, 246 insertions(+), 215 deletions(-) diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index 41674a53f39..2e22c3d4edd 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -424,7 +424,7 @@ or shoot a gun to move around via Newton's 3rd Law of Motion." return var/mob/living/living_owner = owner - var/last_whisper = input("Do you have any last words?", "Final Words") as null | text + var/last_whisper = tgui_input_text(usr, "Do you have any last words?", "Final Words") if (isnull(last_whisper) || !CAN_SUCCUMB(living_owner)) return diff --git a/code/datums/elements/spooky.dm b/code/datums/elements/spooky.dm index 6e25889ec8a..5ff4c07219e 100644 --- a/code/datums/elements/spooky.dm +++ b/code/datums/elements/spooky.dm @@ -66,8 +66,8 @@ to_chat(H, span_boldnotice("A new life and identity has begun. Help your fellow skeletons into bringing out the spooky-pocalypse. You haven't forgotten your past life, and are still beholden to past loyalties.")) change_name(H) //time for a new name! -/datum/element/spooky/proc/change_name(mob/living/carbon/human/H) - var/t = sanitize_name(tgui_input_text(H, "Enter your new skeleton name", "Spookifier", H.real_name, MAX_NAME_LEN)) - if(!t) - t = "spooky skeleton" - H.fully_replace_character_name(null, t) +/datum/element/spooky/proc/change_name(mob/living/carbon/human/spooked) + var/skeleton_name = sanitize_name(tgui_input_text(spooked, "Enter your new skeleton name", "Spookifier", spooked.real_name, MAX_NAME_LEN)) + if(!skeleton_name) + skeleton_name = "spooky skeleton" + spooked.fully_replace_character_name(null, skeleton_name) diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm index f5e00d592e7..e506bca3ddf 100644 --- a/code/game/machinery/camera/camera_assembly.dm +++ b/code/game/machinery/camera/camera_assembly.dm @@ -219,12 +219,11 @@ return FALSE tool.play_tool_sound(src) - var/input = tgui_input_text(user, "Which networks would you like to connect this camera to? Separate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret", "Set Network", "SS13", multiline = TRUE) - if(!input) - to_chat(user, span_warning("No input found, please hang up and try your call again!")) + var/input = tgui_input_text(user, "Which networks would you like to connect this camera to? Separate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret", "Set Network", "SS13") + if(isnull(input)) return var/list/tempnetwork = splittext(input, ",") - if(tempnetwork.len < 1) + if(!length(tempnetwork)) to_chat(user, span_warning("No network found, please hang up and try your call again!")) return for(var/i in tempnetwork) diff --git a/code/game/machinery/computer/arena.dm b/code/game/machinery/computer/arena.dm index 52ef816ca35..b4c0cef5371 100644 --- a/code/game/machinery/computer/arena.dm +++ b/code/game/machinery/computer/arena.dm @@ -145,8 +145,10 @@ log_admin("[key_name(user)] uploaded new event arena: [friendly_name].") /obj/machinery/computer/arena/proc/load_team(user,team) - var/rawteam = tgui_input_text(user, "Enter team list (ckeys separated by newline)", "Team List", multiline = TRUE) - for(var/i in splittext(rawteam,"\n")) + var/rawteam = tgui_input_text(user, "Enter team member list (ckeys separated by comma)", "Team List", multiline = TRUE) + if(isnull(rawteam)) + return + for(var/i in splittext(rawteam, ",")) var/key = ckey(i) if(!i) continue diff --git a/code/game/machinery/doors/passworddoor.dm b/code/game/machinery/doors/passworddoor.dm index e0c250582ee..dc48ca40e93 100644 --- a/code/game/machinery/doors/passworddoor.dm +++ b/code/game/machinery/doors/passworddoor.dm @@ -59,7 +59,7 @@ playsound(src, 'sound/machines/buzz-sigh.ogg', 30, TRUE) /obj/machinery/door/password/proc/ask_for_pass(mob/user) - var/guess = stripped_input(user,"Enter the password:", "Password", "") + var/guess = tgui_input_text(user, "Enter the password", "Password") if(guess == password) return TRUE return FALSE diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index efe36a291e1..727423390f1 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -194,24 +194,28 @@ /obj/machinery/syndicatebomb/proc/settings(mob/user) var/new_timer = tgui_input_number(user, "Set the timer", "Countdown", timer_set, maximum_timer, minimum_timer) - if (isnull(new_timer)) return - + new_timer = round(new_timer) if(in_range(src, user) && isliving(user)) //No running off and setting bombs from across the station timer_set = clamp(new_timer, minimum_timer, maximum_timer) loc.visible_message(span_notice("[icon2html(src, viewers(src))] timer set for [timer_set] seconds.")) - if(tgui_alert(user,"Would you like to start the countdown now?",,list("Yes","No")) == "Yes" && in_range(src, user) && isliving(user)) - if(!active) - visible_message(span_danger("[icon2html(src, viewers(loc))] [timer_set] seconds until detonation, please clear the area.")) - activate() - user.mind?.add_memory(MEMORY_BOMB_PRIMED, list(DETAIL_BOMB_TYPE = src), story_value = STORY_VALUE_AMAZING) - update_appearance() - add_fingerprint(user) - - if(payload && !istype(payload, /obj/item/bombcore/training)) - log_bomber(user, "has primed a", src, "for detonation (Payload: [payload.name])") - payload.adminlog = "The [name] that [key_name(user)] had primed detonated!" + var/choice = tgui_alert(user, "Would you like to start the countdown now?", "Bomb Timer", list("Yes","No")) + if(choice != "Yes") + return + if(!in_range(src, user) || !isliving(user)) + return + if(active) + to_chat(user, span_warning("The bomb is already active!")) + return + visible_message(span_danger("[icon2html(src, viewers(loc))] [timer_set] seconds until detonation, please clear the area.")) + activate() + user.mind?.add_memory(MEMORY_BOMB_PRIMED, list(DETAIL_BOMB_TYPE = src), story_value = STORY_VALUE_AMAZING) + update_appearance() + add_fingerprint(user) + if(payload && !istype(payload, /obj/item/bombcore/training)) + log_bomber(user, "has primed a", src, "for detonation (Payload: [payload.name])") + payload.adminlog = "The [name] that [key_name(user)] had primed detonated!" ///Bomb Subtypes/// diff --git a/code/game/objects/items/credit_holochip.dm b/code/game/objects/items/credit_holochip.dm index 66b70bbf839..34f99fb92a5 100644 --- a/code/game/objects/items/credit_holochip.dm +++ b/code/game/objects/items/credit_holochip.dm @@ -101,18 +101,20 @@ /obj/item/holochip/AltClick(mob/user) if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) return - var/split_amount = round(input(user,"How many credits do you want to extract from the holochip?") as null|num) - if(split_amount == null || split_amount <= 0 || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) + var/split_amount = tgui_input_number(user, "How many credits do you want to extract from the holochip?", "Holochip") + if(isnull(split_amount)) return - else - var/new_credits = spend(split_amount, TRUE) - var/obj/item/holochip/H = new(user ? user : drop_location(), new_credits) - if(user) - if(!user.put_in_hands(H)) - H.forceMove(user.drop_location()) - add_fingerprint(user) - H.add_fingerprint(user) - to_chat(user, span_notice("You extract [split_amount] credits into a new holochip.")) + if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) + return + split_amount = round(split_amount) + var/new_credits = spend(split_amount, TRUE) + var/obj/item/holochip/H = new(user ? user : drop_location(), new_credits) + if(user) + if(!user.put_in_hands(H)) + H.forceMove(user.drop_location()) + add_fingerprint(user) + H.add_fingerprint(user) + to_chat(user, span_notice("You extract [split_amount] credits into a new holochip.")) /obj/item/holochip/emp_act(severity) . = ..() diff --git a/code/game/objects/items/grenades/chem_grenade.dm b/code/game/objects/items/grenades/chem_grenade.dm index cdda65adf68..0d7e4c8ea6f 100644 --- a/code/game/objects/items/grenades/chem_grenade.dm +++ b/code/game/objects/items/grenades/chem_grenade.dm @@ -274,13 +274,14 @@ /obj/item/grenade/chem_grenade/adv_release/multitool_act(mob/living/user, obj/item/tool) if (active) return - var/newspread = tgui_input_number(user, "Please enter a new spread amount", name) - if (newspread != null && user.canUseTopic(src, BE_CLOSE)) - newspread = round(newspread) - unit_spread = clamp(newspread, 5, 100) - to_chat(user, span_notice("You set the time release to [unit_spread] units per detonation.")) - if (newspread != unit_spread) - to_chat(user, span_notice("The new value is out of bounds. Minimum spread is 5 units, maximum is 100 units.")) + var/newspread = tgui_input_number(user, "Please enter a new spread amount", "Grenade Spread", 5, 100, 5) + if(isnull(newspread)) + return + if(!user.canUseTopic(src, BE_CLOSE)) + return + newspread = round(newspread) + unit_spread = clamp(newspread, 5, 100) + to_chat(user, span_notice("You set the time release to [unit_spread] units per detonation.")) ..() /obj/item/grenade/chem_grenade/adv_release/detonate(mob/living/lanced_by) diff --git a/code/game/objects/items/grenades/grenade.dm b/code/game/objects/items/grenades/grenade.dm index 6d6e54d877a..43e6a488e3c 100644 --- a/code/game/objects/items/grenades/grenade.dm +++ b/code/game/objects/items/grenades/grenade.dm @@ -149,12 +149,17 @@ return ..() if(weapon.tool_behaviour == TOOL_MULTITOOL) - var/newtime = tgui_input_number(user, "Please enter a new detonation time", name) - if (newtime != null && user.canUseTopic(src, BE_CLOSE)) - if(change_det_time(newtime)) - to_chat(user, span_notice("You modify the time delay. It's set for [DisplayTimeText(det_time)].")) - if (round(newtime * 10) != det_time) - to_chat(user, span_warning("The new value is out of bounds. The lowest possible time is 3 seconds and highest is 5 seconds. Instant detonations are also possible.")) + var/newtime = tgui_input_list(user, "Please enter a new detonation time", "Detonation Timer", list("Instant", 3, 4, 5)) + if (isnull(newtime)) + return + if(!user.canUseTopic(src, BE_CLOSE)) + return + if(newtime == "Instant" && change_det_time(0)) + to_chat(user, span_notice("You modify the time delay. It's set to be instantaneous.")) + return + newtime = round(newtime) + if(change_det_time(newtime)) + to_chat(user, span_notice("You modify the time delay. It's set for [DisplayTimeText(det_time)].")) return else if(weapon.tool_behaviour == TOOL_SCREWDRIVER) if(change_det_time()) @@ -162,9 +167,7 @@ /obj/item/grenade/proc/change_det_time(time) //Time uses real time. . = TRUE - if(time != null) - if(time < 3) - time = 3 + if(!isnull(time)) det_time = round(clamp(time * 10, 0, 5 SECONDS)) else var/previous_time = det_time diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index 191d9286b75..50b334466bb 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -517,8 +517,10 @@ return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN var/max = get_amount() var/stackmaterial = round(tgui_input_number(user, "How many sheets do you wish to take out of this stack?", "Stack Split", max_value = max)) + if(isnull(stackmaterial)) + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN stackmaterial = min(max, stackmaterial) - if(stackmaterial == null || stackmaterial <= 0 || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) + if(stackmaterial <= 0 || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) return SECONDARY_ATTACK_CONTINUE_CHAIN split_stack(user, stackmaterial) to_chat(user, span_notice("You take [stackmaterial] sheets out of the stack.")) diff --git a/code/game/objects/structures/crates_lockers/closets/bodybag.dm b/code/game/objects/structures/crates_lockers/closets/bodybag.dm index f2e50f0c2d7..b696b86d7c9 100644 --- a/code/game/objects/structures/crates_lockers/closets/bodybag.dm +++ b/code/game/objects/structures/crates_lockers/closets/bodybag.dm @@ -33,7 +33,7 @@ if(!user.is_literate()) to_chat(user, span_notice("You scribble illegibly on [src]!")) return - var/t = stripped_input(user, "What would you like the label to be?", name, null, 53) + var/t = tgui_input_text(user, "What would you like the label to be?", name, max_length = 53) if(user.get_active_held_item() != interact_tool) return if(!user.canUseTopic(src, BE_CLOSE)) diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 309e200348e..f87a7d9a68c 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -84,7 +84,7 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an if(!user.is_literate()) to_chat(user, span_notice("You scribble illegibly on the side of [src]!")) return - var/t = stripped_input(user, "What would you like the label to be?", text("[]", name), null) + var/t = tgui_input_text(user, "What would you like the label to be?", text("[]", name), null) if (user.get_active_held_item() != P) return if(!user.canUseTopic(src, BE_CLOSE)) diff --git a/code/game/objects/structures/reflector.dm b/code/game/objects/structures/reflector.dm index 354bae8d4f6..c6bdd84c550 100644 --- a/code/game/objects/structures/reflector.dm +++ b/code/game/objects/structures/reflector.dm @@ -156,11 +156,13 @@ if (!can_rotate || admin) to_chat(user, span_warning("The rotation is locked!")) return FALSE - var/new_angle = input(user, "Input a new angle for primary reflection face.", "Reflector Angle", rotation_angle) as null|num + var/new_angle = tgui_input_number(user, "New angle for primary reflection face", "Reflector Angle", rotation_angle, 360) + if(isnull(new_angle)) + return FALSE if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) - return - if(!isnull(new_angle)) - set_angle(SIMPLIFY_DEGREES(new_angle)) + return FALSE + new_angle = round(new_angle) + set_angle(SIMPLIFY_DEGREES(new_angle)) return TRUE /obj/structure/reflector/AltClick(mob/user) diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index d5e3ff475a0..dde1f340b7f 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -245,7 +245,7 @@ ae.forceMove(drop_location()) else if(istype(W, /obj/item/pen)) - var/t = stripped_input(user, "Enter the name for the door.", name, created_name,MAX_NAME_LEN) + var/t = tgui_input_text(user, "Enter the name for the door.", "Windoor", created_name, MAX_NAME_LEN) if(!t) return if(!in_range(src, usr) && loc != usr) diff --git a/code/modules/admin/outfit_editor.dm b/code/modules/admin/outfit_editor.dm index 356dca2c097..afa547a96de 100644 --- a/code/modules/admin/outfit_editor.dm +++ b/code/modules/admin/outfit_editor.dm @@ -100,7 +100,7 @@ drip.vars[slot] = null if("rename") - var/newname = stripped_input(owner, "What do you want to name this outfit?", OUTFIT_EDITOR_NAME) + var/newname = tgui_input_text(owner, "What do you want to name this outfit?", OUTFIT_EDITOR_NAME) if(newname) drip.name = newname if("save") diff --git a/code/modules/admin/painting_manager.dm b/code/modules/admin/painting_manager.dm index eba5cb61a52..37c86b160f1 100644 --- a/code/modules/admin/painting_manager.dm +++ b/code/modules/admin/painting_manager.dm @@ -59,7 +59,7 @@ if("rename") //Modify the metadata var/old_title = chosen_painting.title - var/new_title = stripped_input(user, "New painting title?", "Painting rename", chosen_painting.title) + var/new_title = tgui_input_text(user, "New painting title?", "Painting Rename", chosen_painting.title) if(!new_title) return chosen_painting.title = new_title @@ -67,7 +67,7 @@ return TRUE if("rename_author") var/old_name = chosen_painting.creator_name - var/new_name = stripped_input(user, "New painting author name?", "Painting rename", chosen_painting.creator_name) + var/new_name = tgui_input_text(user, "New painting author name?", "Painting Rename", chosen_painting.creator_name) if(!new_name) return chosen_painting.creator_name = new_name @@ -86,7 +86,7 @@ log_admin("[key_name(user)] has removed tag [params["tag"]] from persistent painting made by [chosen_painting.creator_ckey] with id [chosen_painting.md5].") return TRUE if("add_tag") - var/tag_name = stripped_input(user, "New tag name?", "???") + var/tag_name = tgui_input_text(user, "New tag name?", "Add Tag") if(!tag_name) return if(!chosen_painting.tags) diff --git a/code/modules/admin/sound_emitter.dm b/code/modules/admin/sound_emitter.dm index 37980e04a6e..9827a7553ee 100644 --- a/code/modules/admin/sound_emitter.dm +++ b/code/modules/admin/sound_emitter.dm @@ -78,7 +78,7 @@ return var/mob/user = usr if(href_list["edit_label"]) - var/new_label = stripped_input(user, "Choose a new label.", "Sound Emitter") + var/new_label = tgui_input_text(user, "Choose a new label", "Sound Emitter") if(!new_label) return maptext = MAPTEXT(new_label) @@ -90,7 +90,7 @@ sound_file = new_file to_chat(user, span_notice("New sound file set to [sound_file]."), confidential = TRUE) if(href_list["edit_volume"]) - var/new_volume = input(user, "Choose a volume.", "Sound Emitter", sound_volume) as null|num + var/new_volume = tgui_input_number(user, "Choose a volume", "Sound Emitter", sound_volume, 100) if(isnull(new_volume)) return new_volume = clamp(new_volume, 0, 100) @@ -99,21 +99,21 @@ if(href_list["edit_mode"]) var/new_mode var/mode_list = list("Local (normal sound)" = SOUND_EMITTER_LOCAL, "Direct (not affected by environment/location)" = SOUND_EMITTER_DIRECT) - new_mode = input(user, "Choose a new mode.", "Sound Emitter") as null|anything in mode_list - if(!new_mode) + new_mode = tgui_input_list(user, "Choose a new mode", "Sound Emitter", mode_list) + if(isnull(new_mode)) return motus_operandi = mode_list[new_mode] to_chat(user, span_notice("Mode set to [motus_operandi]."), confidential = TRUE) if(href_list["edit_range"]) var/new_range var/range_list = list("Radius (all mobs within a radius)" = SOUND_EMITTER_RADIUS, "Z-Level (all mobs on the same z)" = SOUND_EMITTER_ZLEVEL, "Global (all players)" = SOUND_EMITTER_GLOBAL) - new_range = input(user, "Choose a new range.", "Sound Emitter") as null|anything in range_list - if(!new_range) + new_range = tgui_input_list(user, "Choose a new range", "Sound Emitter", range_list) + if(isnull(new_range)) return emitter_range = range_list[new_range] to_chat(user, span_notice("Range set to [emitter_range]."), confidential = TRUE) if(href_list["edit_radius"]) - var/new_radius = input(user, "Choose a radius.", "Sound Emitter", sound_volume) as null|num + var/new_radius = tgui_input_number(user, "Choose a radius.", "Sound Emitter", sound_volume, 127) if(isnull(new_radius)) return new_radius = clamp(new_radius, 0, 127) diff --git a/code/modules/admin/verbs/secrets.dm b/code/modules/admin/verbs/secrets.dm index 34b9db1f44c..c5492689ea3 100644 --- a/code/modules/admin/verbs/secrets.dm +++ b/code/modules/admin/verbs/secrets.dm @@ -458,7 +458,7 @@ GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller) if(GLOB.everyone_a_traitor) tgui_alert(usr, "The everyone is a traitor secret has already been triggered") return - var/objective = stripped_input(holder, "Enter an objective") + var/objective = tgui_input_text(holder, "Enter an objective", "Objective") if(!objective) return GLOB.everyone_a_traitor = new /datum/everyone_is_a_traitor_controller(objective) diff --git a/code/modules/antagonists/wizard/equipment/spellbook.dm b/code/modules/antagonists/wizard/equipment/spellbook.dm index 41f73beb68c..b1728f7ad60 100644 --- a/code/modules/antagonists/wizard/equipment/spellbook.dm +++ b/code/modules/antagonists/wizard/equipment/spellbook.dm @@ -642,7 +642,7 @@ log_spellbook("[key_name(user)] cast [src] for [cost] points") SSblackbox.record_feedback("tally", "wizard_spell_learned", 1, name) times++ - var/message = stripped_input(user, "Whisper a secret truth to drive your victims to madness.", "Whispers of Madness") + var/message = tgui_input_text(user, "Whisper a secret truth to drive your victims to madness", "Whispers of Madness") if(!message) return FALSE curse_of_madness(user, message) diff --git a/code/modules/art/paintings.dm b/code/modules/art/paintings.dm index 123799afaaf..a67d77e4286 100644 --- a/code/modules/art/paintings.dm +++ b/code/modules/art/paintings.dm @@ -273,7 +273,7 @@ /obj/item/canvas/proc/try_rename(mob/user) if(painting_metadata.loaded_from_json) // No renaming old paintings return - var/new_name = stripped_input(user,"What do you want to name the painting?") + var/new_name = tgui_input_text(user, "What do you want to name the painting?", "Title Your Masterpiece") if(new_name != painting_metadata.title && new_name && user.canUseTopic(src, BE_CLOSE)) painting_metadata.title = new_name var/sign_choice = tgui_alert(user, "Do you want to sign it or remain anonymous?", "Sign painting?", list("Yes", "No")) diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index 2907b974382..c20f6900c61 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -650,7 +650,7 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister()) pressure = can_max_release_pressure . = TRUE else if(pressure == "input") - pressure = input("New release pressure ([can_min_release_pressure]-[can_max_release_pressure] kPa):", name, release_pressure) as num|null + pressure = tgui_input_number(usr, "New release pressure", "Canister Pressure", release_pressure, can_max_release_pressure, can_min_release_pressure) if(!isnull(pressure) && !..()) . = TRUE else if(text2num(pressure) != null) @@ -703,13 +703,10 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister()) if("increase") timer_set = min(maximum_timer_set, timer_set + 10) if("input") - var/user_input = input(usr, "Set time to valve toggle.", name) as null|num - if(!user_input) + var/user_input = tgui_input_number(usr, "Set time to valve toggle", "Canister Timer", timer_set, maximum_timer_set, minimum_timer_set) + if(isnull(user_input)) return - var/N = text2num(user_input) - if(!N) - return - timer_set = clamp(N,minimum_timer_set,maximum_timer_set) + timer_set = clamp(user_input, minimum_timer_set, maximum_timer_set) log_admin("[key_name(usr)] has activated a prototype valve timer") . = TRUE if("toggle_timer") diff --git a/code/modules/cargo/centcom_podlauncher.dm b/code/modules/cargo/centcom_podlauncher.dm index 145e391a50a..4f2f5f32f1f 100644 --- a/code/modules/cargo/centcom_podlauncher.dm +++ b/code/modules/cargo/centcom_podlauncher.dm @@ -332,10 +332,10 @@ temp_pod.adminNamed = FALSE temp_pod.setStyle(temp_pod.style) //This resets the name of the pod based on it's current style (see supplypod/setStyle() proc) return - var/nameInput= input("Custom name", "Enter a custom name", GLOB.podstyles[temp_pod.style][POD_NAME]) as null|text //Gather input for name and desc + var/nameInput= tgui_input_text(usr, "Enter a custom name", "Custom name", GLOB.podstyles[temp_pod.style][POD_NAME], MAX_NAME_LEN) //Gather input for name and desc if (isnull(nameInput)) return - var/descInput = input("Custom description", "Enter a custom desc", GLOB.podstyles[temp_pod.style][POD_DESC]) as null|text //The GLOB.podstyles is used to get the name, desc, or icon state based on the pod's style + var/descInput = tgui_input_text(usr, "Enter a custom desc", "Custom description", GLOB.podstyles[temp_pod.style][POD_DESC]) //The GLOB.podstyles is used to get the name, desc, or icon state based on the pod's style if (isnull(descInput)) return temp_pod.name = nameInput diff --git a/code/modules/cargo/orderconsole.dm b/code/modules/cargo/orderconsole.dm index bc98324897f..bd4ecc57935 100644 --- a/code/modules/cargo/orderconsole.dm +++ b/code/modules/cargo/orderconsole.dm @@ -238,7 +238,7 @@ var/reason = "" if(requestonly && !self_paid) - reason = stripped_input("Reason:", name, "") + reason = tgui_input_text(usr, "Reason", name) if(isnull(reason) || ..()) return diff --git a/code/modules/cargo/supplypod_beacon.dm b/code/modules/cargo/supplypod_beacon.dm index 0462b8932d0..746cf8946f0 100644 --- a/code/modules/cargo/supplypod_beacon.dm +++ b/code/modules/cargo/supplypod_beacon.dm @@ -87,12 +87,13 @@ to_chat(user, span_alert("There is no linked console.")) /obj/item/supplypod_beacon/attackby(obj/item/W, mob/user) - if(istype(W, /obj/item/pen)) //give a tag that is visible from the linked express console - var/new_beacon_name = stripped_input(user, "What would you like the tag to be?") - if(!user.canUseTopic(src, BE_CLOSE)) - return - if(new_beacon_name) - name += " ([tag])" - return - else + if(!istype(W, /obj/item/pen)) //give a tag that is visible from the linked express console return ..() + var/new_beacon_name = tgui_input_text(user, "What would you like the tag to be?", "Beacon Tag", max_length = MAX_NAME_LEN) + if(isnull(new_beacon_name)) + return + if(!user.canUseTopic(src, BE_CLOSE)) + return + name += " ([tag])" + + diff --git a/code/modules/clothing/neck/_neck.dm b/code/modules/clothing/neck/_neck.dm index 15014751c98..634570c3a21 100644 --- a/code/modules/clothing/neck/_neck.dm +++ b/code/modules/clothing/neck/_neck.dm @@ -184,7 +184,7 @@ return ..() /obj/item/clothing/neck/petcollar/attack_self(mob/user) - tagname = sanitize_name(stripped_input(user, "Would you like to change the name on the tag?", "Name your new pet", "Spot", MAX_NAME_LEN)) + tagname = sanitize_name(tgui_input_text(user, "Would you like to change the name on the tag?", "Pet Naming", "Spot", MAX_NAME_LEN)) name = "[initial(name)] - [tagname]" ////////////// diff --git a/code/modules/clothing/under/accessories.dm b/code/modules/clothing/under/accessories.dm index 56ea7719fc7..e7f19035a9b 100755 --- a/code/modules/clothing/under/accessories.dm +++ b/code/modules/clothing/under/accessories.dm @@ -162,7 +162,7 @@ span_notice("You try to pin [src] on [M]'s chest.")) var/input if(!commended && user != M) - input = stripped_input(user,"Please input a reason for this commendation, it will be recorded by Nanotrasen.", ,"", 140) + input = tgui_input_text(user, "Reason for this commendation? It will be recorded by Nanotrasen.", "Commendation", max_length = 140) if(do_after(user, delay, target = M)) if(U.attach_accessory(src, user, 0)) //Attach it, do not notify the user of the attachment if(user == M) diff --git a/code/modules/economy/pay_stand.dm b/code/modules/economy/pay_stand.dm index 555dc4a2c30..c14431aa239 100644 --- a/code/modules/economy/pay_stand.dm +++ b/code/modules/economy/pay_stand.dm @@ -21,7 +21,7 @@ ) var/choice = show_radial_menu(user, src, items, null, require_near = TRUE, tooltips = TRUE) if(choice == "Rename") - var/rename_msg = stripped_input(user, "Rename the Paystand:", "Paystand Naming", name) + var/rename_msg = tgui_input_text(user, "Rename the Paystand", "Paystand Name", name) if(!rename_msg || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return name = rename_msg @@ -39,7 +39,7 @@ var/obj/item/card/id/new_card = W if(!new_card.registered_account) return - var/msg = stripped_input(user, "Name of pay stand:", "Paystand Naming", "Paystand (owned by [new_card.registered_account.account_holder])") + var/msg = tgui_input_text(user, "Name of pay stand", "Paystand Naming", "Paystand (owned by [new_card.registered_account.account_holder])") if(!msg) return name = msg @@ -54,7 +54,10 @@ return var/credit_amount = 0 if(!force_fee) - credit_amount = input(user, "How much would you like to deposit?", "Money Deposit") as null|num + credit_amount = tgui_input_number(user, "How much would you like to deposit?", "Money Deposit") + if(isnull(credit_amount)) + return + credit_amount = round(credit_amount) else credit_amount = force_fee if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) @@ -75,7 +78,10 @@ return if(istype(W, /obj/item/holochip)) var/obj/item/holochip/H = W - var/cashmoney = input(user, "How much would you like to deposit?", "Money Deposit") as null|num + var/cashmoney = round(tgui_input_number(user, "How much would you like to deposit?", "Money Deposit")) + if(isnull(cashmoney)) + return + cashmoney = round(cashmoney) if(H.spend(cashmoney, FALSE)) purchase(user, cashmoney) to_chat(user, "Thanks for purchasing! The vendor has been informed.") @@ -97,19 +103,18 @@ if(!my_card) to_chat(user, span_warning("ERROR: No identification card has been assigned to this paystand yet!")) return - if(!signaler) - var/cash_limit = input(user, "Enter the minimum amount of cash needed to deposit before the signaler is activated.", "Signaler Activation Threshold") as null|num - if(cash_limit < 1) - to_chat(user, span_warning("ERROR: Invalid amount designated.")) - return - if(cash_limit) - S.forceMove(src) - signaler = S - signaler_threshold = cash_limit - to_chat(user, "You attach the signaler to the paystand.") - desc += " A signaler appears to be attached to the scanner." - else + if(!isnull(signaler)) to_chat(user, span_warning("A signaler is already attached to this unit!")) + return + var/cash_limit = tgui_input_number(user, "Enter the minimum amount of cash needed to deposit before the signaler is activated.", "Signaler Activation Threshold", 1, min_value = 1) + if(isnull(cash_limit)) + return + cash_limit = round(cash_limit) + S.forceMove(src) + signaler = S + signaler_threshold = cash_limit + to_chat(user, "You attach the signaler to the paystand.") + desc += " A signaler appears to be attached to the scanner." if(default_deconstruction_screwdriver(user, "card_scanner", "card_scanner", W)) return diff --git a/code/modules/events/holiday/vday.dm b/code/modules/events/holiday/vday.dm index 57fd38bb4e0..6fac3bb71ea 100644 --- a/code/modules/events/holiday/vday.dm +++ b/code/modules/events/holiday/vday.dm @@ -70,8 +70,8 @@ if(!user.is_literate()) to_chat(user, span_notice("You scribble illegibly on [src]!")) return - var/recipient = stripped_input(user, "Who is receiving this valentine?", "To:", null , 20) - var/sender = stripped_input(user, "Who is sending this valentine?", "From:", null , 20) + var/recipient = tgui_input_text(user, "Who is receiving this valentine?", "To:", max_length = MAX_NAME_LEN) + var/sender = tgui_input_text(user, "Who is sending this valentine?", "From:", max_length = MAX_NAME_LEN) if(!user.canUseTopic(src, BE_CLOSE)) return if(recipient && sender) diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index 2638820721f..502383a0e5a 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -214,10 +214,10 @@ if (params["amount"]) desired = text2num(params["amount"]) else - desired = input("How many items?", "How many items would you like to take out?", 1) as null|num - if(!desired) + desired = tgui_input_number(usr, "How many items would you like to take out?", "Release", 1, min_value = 1) + if(isnull(desired)) return FALSE - + desired = round(desired) if(QDELETED(src) || QDELETED(usr) || !usr.Adjacent(src)) // Sanity checkin' in case stupid stuff happens while we wait for input() return FALSE diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index 099b3c53f31..2391d736300 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -224,7 +224,7 @@ to_chat(user, span_notice("You scribble illegibly on [src]!")) return var/obj/item/pizzabox/box = boxes.len ? boxes[boxes.len] : src - box.boxtag += stripped_input(user, "Write on [box]'s tag:", box, "", 30) + box.boxtag += tgui_input_text(user, "Write on [box]'s tag:", box, max_length = 30) if(!user.canUseTopic(src, BE_CLOSE)) return to_chat(user, span_notice("You write with [I] on [src].")) diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index 02cb4c9220c..46ac0c5c6ce 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -448,50 +448,35 @@ /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?", "Seed Alteration", list("Plant Name", "Seed Description", "Product Description")) + if(isnull(choice)) + return if(!user.canUseTopic(src, BE_CLOSE)) return switch(choice) if("Plant Name") - var/newplantname = reject_bad_text(stripped_input(user, "Write a new plant name:", name, plantname)) + var/newplantname = reject_bad_text(tgui_input_text(user, "Write a new plant name", "Plant Name", plantname, 20)) + if(isnull(newplantname)) + return if(!user.canUseTopic(src, BE_CLOSE)) return - if (length(newplantname) > 20) - to_chat(user, span_warning("That name is too long!")) - return - if(!newplantname) - to_chat(user, span_warning("That name is invalid.")) - return - else - name = "[lowertext(newplantname)]" - plantname = newplantname + name = "[lowertext(newplantname)]" + plantname = newplantname if("Seed Description") - var/newdesc = stripped_input(user, "Write a new description:", name, desc) + var/newdesc = tgui_input_text(user, "Write a new seed description", "Seed Description", desc, 180) + if(isnull(newdesc)) + return if(!user.canUseTopic(src, BE_CLOSE)) return - if (length(newdesc) > 180) - to_chat(user, span_warning("That description is too long!")) - return - if(!newdesc) - to_chat(user, span_warning("That description is invalid.")) - return - else - desc = newdesc + desc = newdesc if("Product Description") if(product && !productdesc) productdesc = initial(product.desc) - var/newproductdesc = stripped_input(user, "Write a new description:", name, productdesc) + var/newproductdesc = tgui_input_text(user, "Write a new product description", "Product Description", productdesc, 180) + if(isnull(newproductdesc)) + return if(!user.canUseTopic(src, BE_CLOSE)) return - if (length(newproductdesc) > 180) - to_chat(user, span_warning("That description is too long!")) - return - if(!newproductdesc) - to_chat(user, span_warning("That description is invalid.")) - return - else - productdesc = newproductdesc - else - return + productdesc = newproductdesc ..() // Fallthrough to item/attackby() so that bags can pick seeds up diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 578fee3b0f1..1da174fde37 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -284,7 +284,10 @@ if (params["sheets"]) desired = text2num(params["sheets"]) else - desired = input("How many sheets?", "How many sheets would you like to smelt?", 1) as null|num + desired = tgui_input_number(usr, "How many sheets would you like to smelt?", "Smelt") + if(isnull(desired)) + return + desired = round(desired) var/sheets_to_remove = round(min(desired,50,stored_amount)) @@ -331,7 +334,10 @@ if (params["sheets"]) desired = text2num(params["sheets"]) else - desired = input("How many sheets?", "How many sheets would you like to smelt?", 1) as null|num + desired = tgui_input_number(usr, "How many sheets would you like to smelt?", "Smelt") + if(isnull(desired)) + return + desired = round(desired) var/amount = round(min(desired,50,smelt_amount)) mat_container.use_materials(alloy.materials, amount) materials.silo_log(src, "released", -amount, "sheets", alloy.materials) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 4bc1be9d5c7..9f8d7515aab 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -102,11 +102,11 @@ var/less_input_message if(SSlag_switch.measures[DISABLE_DEAD_KEYLOOP]) less_input_message = " - Notice: Observer freelook is currently disabled." - var/this_is_like_playing_right = alert(usr, "Are you sure you wish to observe? You will not be able to play this round![less_input_message]","Player Setup", "Yes", "No") - - if(QDELETED(src) || !src.client || this_is_like_playing_right != "Yes") + var/this_is_like_playing_right = tgui_alert(usr, "Are you sure you wish to observe? You will not be able to play this round![less_input_message]", "Observe", "Yes", "No") + if(this_is_like_playing_right != "Yes") + return FALSE + if(QDELETED(src) || !src.client) ready = PLAYER_NOT_READY - src << browse(null, "window=playersetup") //closes the player setup window return FALSE var/mob/dead/observer/observer = new() diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index 722444023af..8c7e21e32f2 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -67,13 +67,14 @@ GLOBAL_VAR(posibrain_notify_cooldown) /obj/item/mmi/posibrain/AltClick(mob/living/user) if(!istype(user) || !user.canUseTopic(src, BE_CLOSE)) return - var/input_seed = stripped_input(user, "Enter a personality seed", "Enter seed", ask_role, MAX_NAME_LEN) + var/input_seed = tgui_input_text(user, "Enter a personality seed", "Enter seed", ask_role, MAX_NAME_LEN) + if(isnull(input_seed)) + return if(!istype(user) || !user.canUseTopic(src, BE_CLOSE)) return - if(input_seed) - to_chat(user, span_notice("You set the personality seed to \"[input_seed]\".")) - ask_role = input_seed - update_appearance() + to_chat(user, span_notice("You set the personality seed to \"[input_seed]\".")) + ask_role = input_seed + update_appearance() /obj/item/mmi/posibrain/proc/check_success() searching = FALSE diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 6e2806bed9a..4fecdd7f4b3 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -274,16 +274,16 @@ if(href_list["add_citation"]) var/maxFine = CONFIG_GET(number/maxfine) var/t1 = tgui_input_text(usr, "Citation crime", "Security HUD") - var/fine = FLOOR(tgui_input_number(usr, "Citation fine", "Security HUD", 50, max_value = maxFine), 1) - if(!R || !t1 || !fine || !allowed_access) + var/fine = tgui_input_number(usr, "Citation fine", "Security HUD", 50, maxFine, 5) + if(isnull(fine)) + return + if(!R || !t1 || !allowed_access) return if(!H.canUseHUD()) return if(!HAS_TRAIT(H, TRAIT_SECURITY_HUD)) return - if(fine < 0) - to_chat(usr, span_warning("You're pretty sure that's not how money works.")) - return + fine = round(fine) fine = min(fine, maxFine) var/datum/data/crime/crime = GLOB.data_core.createCrimeEntry(t1, "", allowed_access, station_time_timestamp(), fine) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index bcb644d3b89..560a1fc0565 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -307,7 +307,7 @@ to_chat(usr, span_alert("[can_evac_or_fail_reason]")) return - var/reason = input(src, "What is the nature of your emergency? ([CALL_SHUTTLE_REASON_LENGTH] characters required.)", "Confirm Shuttle Call") as null|text + var/reason = tgui_input_text(src, "What is the nature of your emergency? ([CALL_SHUTTLE_REASON_LENGTH] characters required.)", "Confirm Shuttle Call") if(incapacitated()) return diff --git a/code/modules/mob/living/silicon/ai/ai_say.dm b/code/modules/mob/living/silicon/ai/ai_say.dm index 2b47e096921..160a5c207bb 100644 --- a/code/modules/mob/living/silicon/ai/ai_say.dm +++ b/code/modules/mob/living/silicon/ai/ai_say.dm @@ -87,7 +87,7 @@ to_chat(src, span_notice("Please wait [DisplayTimeText(announcing_vox - world.time)].")) return - var/message = input(src, "WARNING: Misuse of this verb can result in you being job banned. More help is available in 'Announcement Help'", "Announcement", src.last_announcement) as text|null + var/message = tgui_input_text(src, "WARNING: Misuse of this verb can result in you being job banned. More help is available in 'Announcement Help'", "Announcement", src.last_announcement) if(!message || announcing_vox > world.time) return diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 345381bf275..8ff0e972f11 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -299,7 +299,7 @@ to_chat(src, "You are a cak! You're a harmless cat/cake hybrid that everyone loves. People can take bites out of you if they're hungry, but you regenerate health \ so quickly that it generally doesn't matter. You're remarkably resilient to any damage besides this and it's hard for you to really die at all. You should go around and bring happiness and \ free cake to the station!") - var/new_name = stripped_input(src, "Enter your name, or press \"Cancel\" to stick with Keeki.", "Name Change") + var/new_name = tgui_input_text(src, "Enter your name, or press \"Cancel\" to stick with Keeki.", "Name Change", max_length = MAX_NAME_LEN) if(new_name) to_chat(src, span_notice("Your name is now \"new_name\"!")) name = new_name diff --git a/code/modules/mob/living/simple_animal/guardian/guardian.dm b/code/modules/mob/living/simple_animal/guardian/guardian.dm index 8433dc9cc2d..e77a86cded7 100644 --- a/code/modules/mob/living/simple_animal/guardian/guardian.dm +++ b/code/modules/mob/living/simple_animal/guardian/guardian.dm @@ -163,7 +163,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians add_atom_colour(guardiancolor, FIXED_COLOUR_PRIORITY) /mob/living/simple_animal/hostile/guardian/proc/guardianrename() - var/new_name = sanitize_name(reject_bad_text(stripped_input(src, "What would you like your name to be?", "Choose Your Name", real_name, MAX_NAME_LEN))) + var/new_name = sanitize_name(reject_bad_text(tgui_input_text(src, "What would you like your name to be?", "Choose Your Name", real_name, MAX_NAME_LEN))) if(!new_name) //redo proc until we get a good name to_chat(src, span_warning("Not a valid name, please try again.")) guardianrename() @@ -393,7 +393,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians /mob/living/simple_animal/hostile/guardian/proc/Communicate() if(summoner) var/sender_key = key - var/input = stripped_input(src, "Please enter a message to tell your summoner.", "Guardian", "") + var/input = tgui_input_text(src, "Enter a message to tell your summoner", "Guardian") if(sender_key != key || !input) //guardian got reset, or did not enter anything return @@ -414,7 +414,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians set name = "Communicate" set category = "Guardian" set desc = "Communicate telepathically with your guardian." - var/input = stripped_input(src, "Please enter a message to tell your guardian.", "Message", "") + var/input = tgui_input_text(src, "Enter a message to tell your guardian", "Message") if(!input) return diff --git a/code/modules/mob/living/simple_animal/guardian/types/standard.dm b/code/modules/mob/living/simple_animal/guardian/types/standard.dm index 43b741b2fa4..99eb1282f73 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/standard.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/standard.dm @@ -16,7 +16,7 @@ set name = "Set Battlecry" set category = "Guardian" set desc = "Choose what you shout as you punch people." - var/input = stripped_input(src,"What do you want your battlecry to be? Max length of 6 characters.", ,"", 7) + var/input = tgui_input_text(src, "What do you want your battlecry to be?", "Battle Cry", max_length = 6) if(input) battlecry = input diff --git a/code/modules/mob/living/simple_animal/hostile/bear.dm b/code/modules/mob/living/simple_animal/hostile/bear.dm index 54181a92723..4c3a97cd7d5 100644 --- a/code/modules/mob/living/simple_animal/hostile/bear.dm +++ b/code/modules/mob/living/simple_animal/hostile/bear.dm @@ -172,7 +172,7 @@ to_chat(src, "You are a butter bear! You're a mostly harmless bear/butter hybrid that everyone loves. People can take bites out of you if they're hungry, but you regenerate health \ so quickly that it generally doesn't matter. You're remarkably resilient to any damage besides this and it's hard for you to really die at all. You should go around and bring happiness and \ free butter to the station!") - var/new_name = stripped_input(src, "Enter your name, or press \"Cancel\" to stick with Terrygold.", "Name Change") + var/new_name = sanitize_name(tgui_input_text(src, "Enter your name, or press \"Cancel\" to stick with Terrygold.", "Name Change")) if(new_name) to_chat(src, span_notice("Your name is now \"new_name\"!")) name = new_name diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index 642eaa5fd22..c50190ea19a 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -502,7 +502,9 @@ if(!istype(owner, /mob/living/simple_animal/hostile/giant_spider/midwife)) return var/mob/living/simple_animal/hostile/giant_spider/midwife/spider = owner - spider.directive = stripped_input(spider, "Enter the new directive", "Create directive", "[spider.directive]") + spider.directive = tgui_input_text(spider, "Enter the new directive", "Create directive", "[spider.directive]") + if(isnull(spider.directive)) + return message_admins("[ADMIN_LOOKUPFLW(owner)] set its directive to: '[spider.directive]'.") log_game("[key_name(owner)] set its directive to: '[spider.directive]'.") @@ -519,7 +521,7 @@ return TRUE /datum/action/innate/spider/comm/Trigger() - var/input = stripped_input(owner, "Input a command for your legions to follow.", "Command", "") + var/input = tgui_input_text(owner, "Input a command for your legions to follow.", "Command") if(QDELETED(src) || !input || !IsAvailable()) return FALSE spider_command(owner, input) diff --git a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm index ce98f35680f..fea54e75aa4 100644 --- a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm +++ b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm @@ -214,7 +214,7 @@ * If the name is invalid, will re-prompt the dragon until a proper name is chosen. */ /mob/living/simple_animal/hostile/space_dragon/proc/dragon_name() - var/chosen_name = sanitize_name(reject_bad_text(stripped_input(src, "What would you like your name to be?", "Choose Your Name", real_name, MAX_NAME_LEN))) + var/chosen_name = sanitize_name(reject_bad_text(tgui_input_text(src, "What would you like your name to be?", "Choose Your Name", real_name, MAX_NAME_LEN))) if(!chosen_name) to_chat(src, span_warning("Not a valid name, please try again.")) dragon_name() diff --git a/code/modules/modular_computers/file_system/programs/borg_monitor.dm b/code/modules/modular_computers/file_system/programs/borg_monitor.dm index f0511a2ca60..cebde040f02 100644 --- a/code/modules/modular_computers/file_system/programs/borg_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/borg_monitor.dm @@ -130,7 +130,7 @@ return if(R.stat == DEAD) //Dead borgs will listen to you no longer to_chat(usr, span_warning("Error -- Could not open a connection to unit:[R]")) - var/message = stripped_input(usr, message = "Enter message to be sent to remote cyborg.", title = "Send Message") + var/message = tgui_input_text(usr, "Message to be sent to remote cyborg", "Send Message") if(!message) return to_chat(R, "

[span_notice("Message from [ID] -- \"[message]\"")]
") diff --git a/code/modules/modular_computers/file_system/programs/budgetordering.dm b/code/modules/modular_computers/file_system/programs/budgetordering.dm index e47235c8289..5bfe32d006f 100644 --- a/code/modules/modular_computers/file_system/programs/budgetordering.dm +++ b/code/modules/modular_computers/file_system/programs/budgetordering.dm @@ -221,7 +221,7 @@ var/reason = "" if((requestonly && !self_paid) || !(card_slot?.GetID())) - reason = stripped_input("Reason:", name, "") + reason = tgui_input_text(usr, "Reason", name) if(isnull(reason) || ..()) return diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm index 24bd71dc91d..ef22e798c6a 100644 --- a/code/modules/paperwork/folders.dm +++ b/code/modules/paperwork/folders.dm @@ -34,7 +34,7 @@ to_chat(user, span_notice("You scribble illegibly on the cover of [src]!")) return - var/inputvalue = stripped_input(user, "What would you like to label the folder?", "Folder Labelling", "", MAX_NAME_LEN) + var/inputvalue = tgui_input_text(user, "What would you like to label the folder?", "Folder Labelling", max_length = MAX_NAME_LEN) if(!inputvalue) return diff --git a/code/modules/paperwork/handlabeler.dm b/code/modules/paperwork/handlabeler.dm index 94ff618a963..c6d492fd84f 100644 --- a/code/modules/paperwork/handlabeler.dm +++ b/code/modules/paperwork/handlabeler.dm @@ -72,7 +72,7 @@ if(mode) to_chat(user, span_notice("You turn on [src].")) //Now let them chose the text. - var/str = reject_bad_text(tgui_input_text(user, "Label text", "Set Label", max_length = 64)) + var/str = reject_bad_text(tgui_input_text(user, "Label text", "Set Label", label, MAX_NAME_LEN)) if(!str) to_chat(user, span_warning("Invalid text!")) return diff --git a/code/modules/paperwork/pen.dm b/code/modules/paperwork/pen.dm index 56529a234ec..c34efbec4f7 100644 --- a/code/modules/paperwork/pen.dm +++ b/code/modules/paperwork/pen.dm @@ -127,11 +127,12 @@ if(.) return - var/deg = input(user, "What angle would you like to rotate the pen head to? (1-360)", "Rotate Pen Head") as null|num - if(deg && (deg > 0 && deg <= 360)) - degrees = deg - to_chat(user, span_notice("You rotate the top of the pen to [degrees] degrees.")) - SEND_SIGNAL(src, COMSIG_PEN_ROTATED, deg, user) + var/deg = tgui_input_number(user, "What angle would you like to rotate the pen head to? (1-360)", "Rotate Pen Head", max_value = 360) + if(isnull(deg)) + return + degrees = round(deg) + to_chat(user, span_notice("You rotate the top of the pen to [degrees] degrees.")) + SEND_SIGNAL(src, COMSIG_PEN_ROTATED, deg, user) /obj/item/pen/attack(mob/living/M, mob/user, params) if(force) // If the pen has a force value, call the normal attack procs. Used for e-daggers and captain's pen mostly. @@ -147,11 +148,11 @@ . = ..() //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 = tgui_input_list(user, "What would you like to edit?", "Pen Setting", list("Rename","Change description","Reset")) + var/penchoice = tgui_alert(user, "What would you like to edit?", "Pen Setting", list("Rename","Description","Reset")) if(QDELETED(O) || !user.canUseTopic(O, BE_CLOSE)) return if(penchoice == "Rename") - var/input = stripped_input(user,"What do you want to name [O]?", ,"[O.name]", MAX_NAME_LEN) + var/input = tgui_input_text(user, "What do you want to name [O]?", "Object Name", "[O.name]", MAX_NAME_LEN) var/oldname = O.name if(QDELETED(O) || !user.canUseTopic(O, BE_CLOSE)) return @@ -167,7 +168,7 @@ O.renamedByPlayer = TRUE if(penchoice == "Change description") - var/input = stripped_input(user,"Describe [O] here:", ,"[O.desc]", 140) + var/input = tgui_input_text(user, "Describe [O]", "Description", "[O.desc]", 140) var/olddesc = O.desc if(QDELETED(O) || !user.canUseTopic(O, BE_CLOSE)) return diff --git a/code/modules/photography/camera/camera.dm b/code/modules/photography/camera/camera.dm index 1af782316ae..7895948dd15 100644 --- a/code/modules/photography/camera/camera.dm +++ b/code/modules/photography/camera/camera.dm @@ -234,9 +234,9 @@ if(can_customise) customise = tgui_alert(user, "Do you want to customize the photo?", "Customization", list("Yes", "No")) if(customise == "Yes") - var/name1 = stripped_input(user, "Set a name for this photo, or leave blank. 32 characters max.", "Name", max_length = 32) - var/desc1 = stripped_input(user, "Set a description to add to photo, or leave blank. 128 characters max.", "Caption", max_length = 128) - var/caption = stripped_input(user, "Set a caption for this photo, or leave blank. 256 characters max.", "Caption", max_length = 256) + var/name1 = tgui_input_text(user, "Set a name for this photo, or leave blank.", "Name", max_length = 32) + var/desc1 = tgui_input_text(user, "Set a description to add to photo, or leave blank.", "Description", max_length = 128) + var/caption = tgui_input_text(user, "Set a caption for this photo, or leave blank.", "Caption", max_length = 256) if(name1) picture.picture_name = name1 if(desc1) diff --git a/code/modules/photography/photos/photo.dm b/code/modules/photography/photos/photo.dm index a1716fb46a4..277d380a63f 100644 --- a/code/modules/photography/photos/photo.dm +++ b/code/modules/photography/photos/photo.dm @@ -66,7 +66,7 @@ if(!user.is_literate()) to_chat(user, span_notice("You scribble illegibly on [src]!")) return - var/txt = stripped_input(user, "What would you like to write on the back?", "Photo Writing", "", 128) + var/txt = tgui_input_text(user, "What would you like to write on the back?", "Photo Writing", max_length = 128) if(txt && user.canUseTopic(src, BE_CLOSE)) scribble = txt else @@ -97,7 +97,7 @@ set category = "Object" set src in usr - var/n_name = stripped_input(usr, "What would you like to label the photo?", "Photo Labelling", "", MAX_NAME_LEN) + var/n_name = tgui_input_text(usr, "What would you like to label the photo?", "Photo Labelling", max_length = MAX_NAME_LEN) //loc.loc check is for making possible renaming photos in clipboards if(n_name && (loc == usr || loc.loc && loc.loc == usr) && usr.stat == CONSCIOUS && !usr.incapacitated()) name = "photo[(n_name ? text("- '[n_name]'") : null)]" diff --git a/code/modules/reagents/chemistry/chem_wiki_render.dm b/code/modules/reagents/chemistry/chem_wiki_render.dm index fb62a332f6c..c56aa592eb8 100644 --- a/code/modules/reagents/chemistry/chem_wiki_render.dm +++ b/code/modules/reagents/chemistry/chem_wiki_render.dm @@ -13,7 +13,7 @@ |- "} - var/input_text = stripped_input(usr, "Input a name of a reagent, or a series of reagents split with a comma (no spaces) to get it's wiki table entry", "Recipe") //95% of the time, the reagent type is a lowercase, no spaces / underscored version of the name + var/input_text = tgui_input_text(usr, "Input a name of a reagent, or a series of reagents split with a comma (no spaces) to get it's wiki table entry", "Recipe") //95% of the time, the reagent type is a lowercase, no spaces / underscored version of the name if(!input_text) to_chat(usr, "Input was blank!") return diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index 0f96f89b080..8486c263b0c 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -329,7 +329,7 @@ if("save_recording") if(!is_operational) return - var/name = stripped_input(usr,"Name","What do you want to name this recipe?", "Recipe", MAX_NAME_LEN) + var/name = tgui_input_text(usr, "What do you want to name this recipe?", "Recipe Name", MAX_NAME_LEN) if(!usr.canUseTopic(src, !issilicon(usr))) return if(saved_recipes[name] && tgui_alert(usr, "\"[name]\" already exists, do you want to overwrite it?",, list("Yes", "No")) == "No") diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index de25ebdbeab..1305bdfba10 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -344,9 +344,9 @@ name_default = reagents.get_master_reagent_name() if (name_has_units) name_default += " ([vol_each]u)" - name = stripped_input(usr, - "Name:", + name = tgui_input_text(usr, "Give it a name!", + "Name", name_default, MAX_NAME_LEN) if(!name || !reagents.total_volume || !src || QDELETED(src) || !usr.canUseTopic(src, !issilicon(usr))) diff --git a/code/modules/reagents/chemistry/machinery/chem_recipe_debug.dm b/code/modules/reagents/chemistry/machinery/chem_recipe_debug.dm index d93a11fc904..476cf054ffc 100644 --- a/code/modules/reagents/chemistry/machinery/chem_recipe_debug.dm +++ b/code/modules/reagents/chemistry/machinery/chem_recipe_debug.dm @@ -321,7 +321,7 @@ beaker_spawn = !beaker_spawn return TRUE if("setTargetList") - var/text = stripped_input(usr,"List","Enter a list of Recipe product names separated by commas", "Recipe", MAX_MESSAGE_LEN) + var/text = tgui_input_text(usr, "Enter a list of Recipe product names separated by commas", "Recipe List", multiline = TRUE) reaction_names = list() if(!text) say("Could not find reaction") diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index 1bcf6244ce0..d74bf0054d5 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -73,7 +73,7 @@ if(!user.is_literate()) to_chat(user, span_notice("You scribble illegibly on the label of [src]!")) return - var/custom_label = stripped_input(user, "What would you like to label the blood pack?", name, null, 53) + var/custom_label = tgui_input_text(user, "What would you like to label the blood pack?", "Blood Pack", name, MAX_NAME_LEN) if(!user.canUseTopic(src, BE_CLOSE)) return if(user.get_active_held_item() != tool) diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index ba6e5f36031..be68673e532 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -63,7 +63,7 @@ if(!user.is_literate()) to_chat(user, span_notice("You scribble illegibly on the side of [src]!")) return - var/str = stripped_input(user, "Label text?", "Set label", "", MAX_NAME_LEN) + var/str = tgui_input_text(user, "Label text?", "Set label", max_length = MAX_NAME_LEN) if(!user.canUseTopic(src, BE_CLOSE)) return if(!str || !length(str)) @@ -256,7 +256,7 @@ if(!user.is_literate()) to_chat(user, span_notice("You scribble illegibly on the side of [src]!")) return - var/str = stripped_input(user, "Label text?", "Set label", "", MAX_NAME_LEN) + var/str = tgui_input_text(user, "Label text?", "Set label", max_length = MAX_NAME_LEN) if(!user.canUseTopic(src, BE_CLOSE)) return if(!str || !length(str)) diff --git a/code/modules/research/xenobiology/crossbreeding/stabilized.dm b/code/modules/research/xenobiology/crossbreeding/stabilized.dm index 3d298e320d4..84be0a5486e 100644 --- a/code/modules/research/xenobiology/crossbreeding/stabilized.dm +++ b/code/modules/research/xenobiology/crossbreeding/stabilized.dm @@ -153,7 +153,7 @@ Stabilized extracts: saved_mind = null START_PROCESSING(SSobj, src) if(choice == "Familiar Name") - var/newname = sanitize_name(stripped_input(user, "Would you like to change the name of [mob_name]", "Name change", mob_name, MAX_NAME_LEN)) + var/newname = sanitize_name(tgui_input_text(user, "Would you like to change the name of [mob_name]", "Name change", mob_name, MAX_NAME_LEN)) if(newname) mob_name = newname to_chat(user, span_notice("You speak softly into [src], and it shakes slightly in response.")) diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm index fe43c08692f..65926816ef7 100644 --- a/code/modules/research/xenobiology/xenobiology.dm +++ b/code/modules/research/xenobiology/xenobiology.dm @@ -669,10 +669,10 @@ M.set_nutrition(700) to_chat(M, span_warning("You absorb the potion and feel your intense desire to feed melt away.")) to_chat(user, span_notice("You feed the slime the potion, removing its hunger and calming it.")) - var/newname = sanitize_name(stripped_input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime", MAX_NAME_LEN)) + var/newname = sanitize_name(tgui_input_text(user, "Would you like to give the slime a name?", "Name your new pet", "Pet Slime", MAX_NAME_LEN)) if (!newname) - newname = "pet slime" + newname = "Pet Slime" M.name = newname M.real_name = newname qdel(src) @@ -976,7 +976,7 @@ to_chat(user, span_notice("You offer [src] to [user]...")) - var/new_name = sanitize_name(stripped_input(M, "What would you like your name to be?", "Input a name", M.real_name, MAX_NAME_LEN)) + var/new_name = sanitize_name(tgui_input_text(M, "What would you like your name to be?", "Input a name", M.real_name, MAX_NAME_LEN)) if(!new_name || QDELETED(src) || QDELETED(M) || new_name == M.real_name || !M.Adjacent(user)) being_used = FALSE diff --git a/code/modules/spells/spell_types/personality_commune.dm b/code/modules/spells/spell_types/personality_commune.dm index bd5655f1159..f063dc8f641 100644 --- a/code/modules/spells/spell_types/personality_commune.dm +++ b/code/modules/spells/spell_types/personality_commune.dm @@ -23,7 +23,7 @@ if(!istype(trauma)) to_chat(user, span_warning("Something is wrong; Either due a bug or admemes, you are trying to cast this spell without a split personality!")) return - var/msg = stripped_input(usr, "What would you like to tell your other self?", null , "") + var/msg = tgui_input_text(usr, "What would you like to tell your other self?", "Commune") if(!msg) charge_counter = charge_max return diff --git a/code/modules/swarmers/swarmer.dm b/code/modules/swarmers/swarmer.dm index b807f3f2a57..b7c187ad9cc 100644 --- a/code/modules/swarmers/swarmer.dm +++ b/code/modules/swarmers/swarmer.dm @@ -418,7 +418,7 @@ * Proc which is used for a swarmer to input a message on a pop-up box, then attempt to send that message to the other swarmers */ /mob/living/simple_animal/hostile/swarmer/proc/contact_swarmers() - var/message = stripped_input(src, "Announce to other swarmers", "Swarmer contact") + var/message = tgui_input_text(src, "Announce to other swarmers", "Swarmer contact") // TODO get swarmers their own colour rather than just boldtext if(message) swarmer_chat(message) diff --git a/code/modules/tgui/tgui_input_text.dm b/code/modules/tgui/tgui_input_text.dm index b855064f14f..9b9e0ddd4ed 100644 --- a/code/modules/tgui/tgui_input_text.dm +++ b/code/modules/tgui/tgui_input_text.dm @@ -15,7 +15,7 @@ * * encode - Toggling this determines if input is filtered via html_encode. Setting this to FALSE gives raw input. * * timeout - The timeout of the textbox, after which the modal will close and qdel itself. Set to zero for no timeout. */ -/proc/tgui_input_text(mob/user, message = null, title = "Text Input", default = null, max_length = MAX_MESSAGE_LEN, multiline = FALSE, encode = TRUE, timeout = 0) +/proc/tgui_input_text(mob/user, message = "", title = "Text Input", default, max_length = MAX_MESSAGE_LEN, multiline = FALSE, encode = TRUE, timeout = 0) if (!user) user = usr if (!istype(user)) @@ -24,7 +24,7 @@ user = client.mob else return - /// Client does NOT have tgui_input on: Returns regular input + // Client does NOT have tgui_input on: Returns regular input if(!user.client.prefs.read_preference(/datum/preference/toggle/tgui_input)) if(max_length) if(multiline) @@ -54,7 +54,7 @@ * * encode - If toggled, input is filtered via html_encode. Setting this to FALSE gives raw input. * * callback - The callback to be invoked when a choice is made. */ -/proc/tgui_input_text_async(mob/user, message = null, title = "Text Input", default = null, max_length = null, multiline = FALSE, encode = TRUE, datum/callback/callback, timeout = 60 SECONDS) +/proc/tgui_input_text_async(mob/user, message = "", title = "Text Input", default, max_length = MAX_MESSAGE_LEN, multiline = FALSE, encode = TRUE, datum/callback/callback, timeout = 60 SECONDS) if (!user) user = usr if (!istype(user)) @@ -63,6 +63,15 @@ 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)) + if(max_length) + if(multiline) + return stripped_multiline_input(user, message, title, default, max_length) + else + return stripped_input(user, message, title, default, max_length) + else + return input(user, message, title, default) var/datum/tgui_input_text/async/text_input = new(user, message, title, default, max_length, multiline, encode, callback, timeout) text_input.ui_interact(user) @@ -138,7 +147,7 @@ "max_length" = max_length, "message" = message, "multiline" = multiline, - "placeholder" = default, /// You cannot use default as a const + "placeholder" = default, // You cannot use default as a const "preferences" = list(), "title" = title ) @@ -179,7 +188,7 @@ * An asynchronous version of tgui_input_text to be used with callbacks instead of waiting on user responses. */ /datum/tgui_input_text/async - /// The callback to be invoked by the tgui_input_text upon having a choice made. + // The callback to be invoked by the tgui_input_text upon having a choice made. var/datum/callback/callback /datum/tgui_input_text/async/New(mob/user, message, title, default, max_length, multiline, encode, callback, timeout) diff --git a/code/modules/vehicles/mecha/mecha_control_console.dm b/code/modules/vehicles/mecha/mecha_control_console.dm index 75d7dd93e76..e5e70fb47e8 100644 --- a/code/modules/vehicles/mecha/mecha_control_console.dm +++ b/code/modules/vehicles/mecha/mecha_control_console.dm @@ -55,7 +55,7 @@ var/obj/item/mecha_parts/mecha_tracking/MT = locate(params["tracker_ref"]) if(!istype(MT)) return - var/message = stripped_input(usr, "Input message", "Transmit message") + var/message = tgui_input_text(usr, "Input message", "Transmit message") var/obj/vehicle/sealed/mecha/M = MT.chassis if(trim(message) && M) to_chat(M.occupants, message) diff --git a/tgui/packages/tgui/interfaces/NumberInputModal.tsx b/tgui/packages/tgui/interfaces/NumberInputModal.tsx index ca065e4c37c..a4431dc74a1 100644 --- a/tgui/packages/tgui/interfaces/NumberInputModal.tsx +++ b/tgui/packages/tgui/interfaces/NumberInputModal.tsx @@ -1,6 +1,6 @@ import { Loader } from './common/Loader'; import { InputButtons, Preferences } from './common/InputButtons'; -import { KEY_ENTER } from 'common/keycodes'; +import { KEY_ENTER, KEY_ESCAPE } from '../../common/keycodes'; import { useBackend, useLocalState } from '../backend'; import { Box, Button, NumberInput, Section, Stack } from '../components'; import { Window } from '../layouts'; @@ -41,6 +41,9 @@ export const NumberInputModal = (_, context) => { if (keyCode === KEY_ENTER) { act('submit', { entry: input }); } + if (keyCode === KEY_ESCAPE) { + act('cancel'); + } }}>
@@ -78,6 +81,7 @@ const InputArea = (props, context) => { { // Dynamically changes the window height based on the message. const windowHeight = 125 - + Math.ceil(message?.length / 3) + + Math.ceil(message.length / 3) + (multiline ? 75 : 0) - + (large_buttons ? 5 : 0); + + (message.length && large_buttons ? 5 : 0); return ( @@ -57,6 +57,9 @@ export const TextInputModal = (_, context) => { if (keyCode === KEY_ENTER && inputIsValid.isValid) { act('submit', { entry: input }); } + if (keyCode === KEY_ESCAPE) { + act('cancel'); + } }}>
@@ -89,6 +92,7 @@ const InputArea = (props, context) => { onType(value)} placeholder="Type something..." @@ -101,6 +105,7 @@ const InputArea = (props, context) => {