From 9c6fdb567da4bdd41349e2dc58a72eab7faa9222 Mon Sep 17 00:00:00 2001 From: Jeremiah <42397676+jlsnow301@users.noreply.github.com> Date: Thu, 30 Dec 2021 14:07:28 -0800 Subject: [PATCH] TGUI list conversions + bug fixes (#63354) About The Pull Request Converts more inputs to TGUI. Possibly all user-facing input lists in the game. Did any surrounding text/number inputs as well Added null choice support so users can press cancel. Added some misc TGUI input fixes Fixed custom vendors while I was there I refactored a lot of code while just poking around. Primarily, usage of .len in files where I was already working on lists. Some code was just awful - look at guardian.dm and its non use of early returns If there are any disputes, I can revert it just fine, those changes are not integral to the PR. Why It's Good For The Game Fixes #63629 Fixes #63307 Fixes custom vendors /again/ Text input is more performant. Part of a long series of TGUI conversion to make the game more visually appealing Changelog cl refactor: The majority of user facing input lists have been converted to TGUI. refactor: Tgui text inputs now scale with entered input. fix: Many inputs now properly accept cancelling out of the menu. fix: Fixes an edge case where users could not press enter on number inputs. fix: Custom vendor bluescreen. fix: You can now press ENTER on text inputs without an entry to cancel. /cl --- code/__HELPERS/areas.dm | 18 +-- code/__HELPERS/hearted.dm | 6 +- code/__HELPERS/memory_helpers.dm | 4 + code/_onclick/hud/ai.dm | 2 + code/datums/components/cult_ritual_item.dm | 6 +- code/datums/components/material_container.dm | 2 +- code/datums/diseases/advance/advance.dm | 11 +- code/datums/elements/surgery_initiator.dm | 6 +- code/datums/mutations/actions.dm | 8 +- code/datums/station_alert.dm | 2 +- code/game/machinery/_machinery.dm | 10 +- code/game/machinery/autolathe.dm | 6 +- code/game/machinery/camera/camera.dm | 8 +- code/game/machinery/camera/camera_assembly.dm | 8 +- code/game/machinery/camera/tracking.dm | 8 +- code/game/machinery/computer/arena.dm | 4 +- code/game/machinery/computer/atmos_control.dm | 4 +- .../machinery/computer/camera_advanced.dm | 16 ++- .../game/machinery/computer/communications.dm | 4 +- .../machinery/computer/prisoner/management.dm | 8 +- code/game/machinery/computer/security.dm | 44 +++--- code/game/machinery/computer/teleporter.dm | 10 +- code/game/machinery/doors/airlock.dm | 4 +- code/game/machinery/doors/poddoor.dm | 11 +- code/game/machinery/hologram.dm | 10 +- code/game/machinery/newscaster.dm | 5 +- .../porta_turret/portable_turret_construct.dm | 8 +- code/game/machinery/syndicatebomb.dm | 12 +- .../machinery/telecomms/computers/message.dm | 9 +- code/game/objects/buckling.dm | 14 +- code/game/objects/items.dm | 4 +- code/game/objects/items/AI_modules.dm | 19 +-- code/game/objects/items/cards_ids.dm | 86 ++++++------ code/game/objects/items/choice_beacon.dm | 8 +- .../circuitboards/machine_circuitboards.dm | 16 ++- code/game/objects/items/cosmetics.dm | 8 +- code/game/objects/items/crayons.dm | 2 +- code/game/objects/items/credit_holochip.dm | 2 +- code/game/objects/items/devices/PDA/PDA.dm | 7 +- .../objects/items/devices/desynchronizer.dm | 12 +- .../objects/items/devices/pipe_painter.dm | 2 +- .../game/objects/items/devices/polycircuit.dm | 8 +- code/game/objects/items/devices/scanners.dm | 28 ++-- code/game/objects/items/dyekit.dm | 8 +- code/game/objects/items/grenades/plastic.dm | 7 +- code/game/objects/items/pinpointer.dm | 14 +- code/game/objects/items/scrolls.dm | 27 ++-- code/game/objects/items/teleportation.dm | 8 +- code/game/objects/items/wayfinding.dm | 16 ++- code/game/objects/structures/barsigns.dm | 2 +- code/game/objects/structures/bonfire.dm | 4 +- .../construction_actions.dm | 6 +- code/game/objects/structures/displaycase.dm | 4 +- code/game/objects/structures/door_assembly.dm | 2 +- code/game/objects/structures/dresser.dm | 57 ++++---- .../objects/structures/lavaland/geyser.dm | 7 +- code/game/objects/structures/mirror.dm | 33 +++-- .../objects/structures/plaques/_plaques.dm | 8 +- code/game/objects/structures/signs/_signs.dm | 10 +- code/game/objects/structures/spirit_board.dm | 6 +- .../objects/structures/windoor_assembly.dm | 2 +- code/modules/admin/admin_investigate.dm | 5 +- code/modules/admin/admin_verbs.dm | 8 +- code/modules/admin/outfit_editor.dm | 10 +- code/modules/admin/outfit_manager.dm | 7 +- .../admin/smites/imaginary_friend_special.dm | 4 +- code/modules/admin/topic.dm | 2 +- .../SDQL2/SDQL_spells/spell_edit_menu.dm | 15 +- code/modules/admin/verbs/adminjump.dm | 31 +++-- code/modules/admin/verbs/borgpanel.dm | 11 +- code/modules/admin/verbs/debug.dm | 8 +- code/modules/admin/verbs/manipulate_organs.dm | 24 ++-- code/modules/admin/verbs/maprotation.dm | 2 +- code/modules/admin/verbs/shuttlepanel.dm | 8 +- .../admin/view_variables/topic_basic.dm | 8 +- code/modules/antagonists/blob/powers.dm | 6 +- .../changeling/powers/humanform.dm | 2 +- code/modules/antagonists/cult/blood_magic.dm | 25 ++-- code/modules/antagonists/cult/cult_items.dm | 68 +++++---- code/modules/antagonists/cult/runes.dm | 35 +++-- .../eldritch_cult/eldritch_items.dm | 4 +- .../eldritch_cult/eldritch_knowledge.dm | 15 +- .../eldritch_cult/eldritch_magic.dm | 18 +-- .../eldritch_cult/eldritch_structures.dm | 7 +- code/modules/art/paintings.dm | 7 +- code/modules/assembly/doorcontrol.dm | 9 +- .../machinery/portable/canister.dm | 8 +- .../awaymissions/bluespaceartillery.dm | 19 +-- .../cargo/blackmarket/blackmarket_uplink.dm | 10 +- code/modules/cargo/centcom_podlauncher.dm | 10 +- code/modules/client/verbs/ooc.dm | 12 +- code/modules/clothing/chameleon.dm | 17 +-- code/modules/clothing/head/wig.dm | 2 +- code/modules/clothing/under/_under.dm | 4 +- code/modules/economy/pay_stand.dm | 4 +- code/modules/food_and_drinks/pizzabox.dm | 4 +- code/modules/hydroponics/hydroponics.dm | 12 +- code/modules/instruments/songs/editor.dm | 28 ++-- code/modules/language/language_menu.dm | 8 +- code/modules/library/lib_items.dm | 40 +++--- code/modules/library/lib_machines.dm | 8 +- .../mining/equipment/marker_beacons.dm | 18 +-- code/modules/mining/fulton.dm | 20 +-- code/modules/mining/machine_redemption.dm | 4 +- code/modules/mining/machine_vending.dm | 6 +- code/modules/mob/dead/dead.dm | 6 +- code/modules/mob/dead/observer/observer.dm | 21 +-- .../carbon/alien/humanoid/alien_powers.dm | 129 ++++++++++-------- .../carbon/human/species_types/jellypeople.dm | 66 ++++----- code/modules/mob/living/silicon/ai/ai.dm | 71 ++++++---- .../mob/living/silicon/pai/software.dm | 6 +- code/modules/mob/living/silicon/silicon.dm | 37 +++-- .../mob/living/simple_animal/bot/floorbot.dm | 6 +- .../mob/living/simple_animal/bot/mulebot.dm | 12 +- .../living/simple_animal/guardian/guardian.dm | 77 ++++++----- .../simple_animal/guardian/types/ranged.dm | 13 +- .../mob/living/simple_animal/slime/powers.dm | 15 +- code/modules/mob/transform_procs.dm | 10 +- .../computers/item/computer.dm | 10 +- .../suit/ninja_equipment_actions/ninja_net.dm | 14 +- code/modules/photography/camera/camera.dm | 8 +- .../photography/camera/silicon_camera.dm | 7 +- code/modules/plumbing/plumbers/bottler.dm | 5 +- .../plumbing/plumbers/plumbing_buffer.dm | 6 +- code/modules/projectiles/gun.dm | 6 +- code/modules/projectiles/pins.dm | 9 +- .../reagents/cat2_medicine_reagents.dm | 2 +- .../reagents/reagent_containers/borghydro.dm | 17 ++- code/modules/religion/rites.dm | 14 +- code/modules/research/destructive_analyzer.dm | 4 +- .../xenobiology/crossbreeding/charged.dm | 4 +- .../crossbreeding/selfsustaining.dm | 4 +- .../xenobiology/crossbreeding/stabilized.dm | 6 +- code/modules/shuttle/assault_pod.dm | 7 +- code/modules/shuttle/navigation_computer.dm | 25 ++-- .../shuttle/spaceship_navigation_beacon.dm | 5 +- code/modules/spells/spell.dm | 36 ++--- .../spells/spell_types/area_teleport.dm | 16 ++- .../spells/spell_types/voice_of_god.dm | 2 +- code/modules/station_goals/bsa.dm | 8 +- code/modules/surgery/organ_manipulation.dm | 11 +- code/modules/surgery/organs/vocal_cords.dm | 12 +- code/modules/surgery/plastic_surgery.dm | 4 +- code/modules/tgui/tgui_input_number.dm | 16 ++- code/modules/tgui/tgui_input_text.dm | 10 +- code/modules/vehicles/mecha/_mecha.dm | 12 +- code/modules/vehicles/mecha/mecha_topic.dm | 2 +- code/modules/vending/_vending.dm | 5 +- .../wiremod/components/admin/input_request.dm | 12 +- .../tgui/interfaces/NumberInputModal.tsx | 27 ++-- .../tgui/interfaces/TextInputModal.tsx | 82 ++++------- tgui/packages/tgui/interfaces/Vending.tsx | 19 +-- .../tgui/interfaces/common/InputButtons.tsx | 22 +-- 153 files changed, 1196 insertions(+), 986 deletions(-) diff --git a/code/__HELPERS/areas.dm b/code/__HELPERS/areas.dm index 822c47e1d05..887509cd9cf 100644 --- a/code/__HELPERS/areas.dm +++ b/code/__HELPERS/areas.dm @@ -17,7 +17,7 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engineerin . = list() var/list/checked_turfs = list() var/list/found_turfs = list(origin) - while(found_turfs.len) + while(length(found_turfs)) var/turf/sourceT = found_turfs[1] found_turfs.Cut(1, 2) var/dir_flags = checked_turfs[sourceT] @@ -54,23 +54,23 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engineerin if(!turfs) to_chat(creator, span_warning("The new area must be completely airtight and not a part of a shuttle.")) return - if(turfs.len > BP_MAX_ROOM_SIZE) - to_chat(creator, span_warning("The room you're in is too big. It is [turfs.len >= BP_MAX_ROOM_SIZE *2 ? "more than 100" : ((turfs.len / BP_MAX_ROOM_SIZE)-1)*100]% larger than allowed.")) + if(length(turfs) > BP_MAX_ROOM_SIZE) + to_chat(creator, span_warning("The room you're in is too big. It is [length(turfs) >= BP_MAX_ROOM_SIZE *2 ? "more than 100" : ((length(turfs) / BP_MAX_ROOM_SIZE)-1)*100]% larger than allowed.")) return var/list/areas = list("New Area" = /area) - for(var/i in 1 to turfs.len) + for(var/i in 1 to length(turfs)) var/area/place = get_area(turfs[i]) if(blacklisted_areas[place.type]) continue if(!place.requires_power || (place.area_flags & NOTELEPORT) || (place.area_flags & HIDDEN_AREA)) continue // No expanding powerless rooms etc areas[place.name] = place - var/area_choice = input(creator, "Choose an area to expand or make a new area.", "Area Expansion") as null|anything in areas - area_choice = areas[area_choice] - - if(!area_choice) + var/area_choice = tgui_input_list(creator, "Choose an area to expand or make a new area", "Area Expansion", areas) + if(isnull(area_choice)) to_chat(creator, span_warning("No choice selected. The area remains undefined.")) return + area_choice = areas[area_choice] + var/area/newA var/area/oldA = get_area(get_turf(creator)) if(!isarea(area_choice)) @@ -83,7 +83,7 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engineerin else newA = area_choice - for(var/i in 1 to turfs.len) + for(var/i in 1 to length(turfs)) var/turf/thing = turfs[i] var/area/old_area = thing.loc newA.contents += thing diff --git a/code/__HELPERS/hearted.dm b/code/__HELPERS/hearted.dm index 75957b1a93a..06e8b222916 100644 --- a/code/__HELPERS/hearted.dm +++ b/code/__HELPERS/hearted.dm @@ -42,11 +42,11 @@ var/heart_nominee switch(attempt) if(1) - heart_nominee = input(src, "What was their name? Just a first or last name may be enough. (Leave blank to cancel)", "<3?") + heart_nominee = tgui_input_text(src, "What was their name? Just a first or last name may be enough.", "<3?") if(2) - heart_nominee = input(src, "Try again, what was their name? Just a first or last name may be enough. (Leave blank to cancel)", "<3?") + heart_nominee = tgui_input_text(src, "Try again, what was their name? Just a first or last name may be enough.", "<3?") if(3) - heart_nominee = input(src, "One more try, what was their name? Just a first or last name may be enough. (Leave blank to cancel)", "<3?") + heart_nominee = tgui_input_text(src, "One more try, what was their name? Just a first or last name may be enough.", "<3?") if(isnull(heart_nominee) || heart_nominee == "") return diff --git a/code/__HELPERS/memory_helpers.dm b/code/__HELPERS/memory_helpers.dm index f65c275a7e6..1d1d94609be 100644 --- a/code/__HELPERS/memory_helpers.dm +++ b/code/__HELPERS/memory_helpers.dm @@ -97,6 +97,10 @@ choice_list[memory_iter.name] = memory_iter var/choice = tgui_input_list(usr, "Select a memory to [verbage]", "Memory Selection?", choice_list) + if(isnull(choice)) + return FALSE + if(isnull(choice_list[choice])) + return FALSE var/datum/memory/memory_choice = choice_list[choice] return memory_choice diff --git a/code/_onclick/hud/ai.dm b/code/_onclick/hud/ai.dm index 9671691a7ce..1713a857058 100644 --- a/code/_onclick/hud/ai.dm +++ b/code/_onclick/hud/ai.dm @@ -34,6 +34,8 @@ return var/mob/living/silicon/ai/AI = usr var/target_name = tgui_input_list(AI, "Select a target", "Tracking", AI.trackable_mobs()) + if(isnull(target_name)) + return AI.ai_camera_track(target_name) /atom/movable/screen/ai/camera_light diff --git a/code/datums/components/cult_ritual_item.dm b/code/datums/components/cult_ritual_item.dm index e4956e40deb..b364d25a3a3 100644 --- a/code/datums/components/cult_ritual_item.dm +++ b/code/datums/components/cult_ritual_item.dm @@ -259,7 +259,9 @@ return FALSE entered_rune_name = tgui_input_list(cultist, "Choose a rite to scribe", "Sigils of Power", GLOB.rune_types) - if(!entered_rune_name || !can_scribe_rune(tool, cultist)) + if(isnull(entered_rune_name)) + return FALSE + if(!can_scribe_rune(tool, cultist)) return FALSE rune_to_scribe = GLOB.rune_types[entered_rune_name] @@ -447,7 +449,7 @@ to_chat(cultist, span_warning("This veil is not weak enough here - it can only be scribed in [english_list(summon_objective.summon_spots)]!")) return FALSE - if(fail_if_last_site && summon_objective.summon_spots.len <= 1) + if(fail_if_last_site && length(summon_objective.summon_spots) <= 1) to_chat(cultist, span_warning("This rune cannot be scribed here - the ritual site must be reserved for the final summoning!")) return FALSE diff --git a/code/datums/components/material_container.dm b/code/datums/components/material_container.dm index 16bd6af8d86..a7c903c2c82 100644 --- a/code/datums/components/material_container.dm +++ b/code/datums/components/material_container.dm @@ -141,7 +141,7 @@ if(istype(I, /obj/item/stack) && precise_insertion) var/atom/current_parent = parent var/obj/item/stack/S = I - requested_amount = input(user, "How much do you want to insert?", "Inserting [S.singular_name]s") as num|null + requested_amount = round(tgui_input_number(user, "How much do you want to insert?", "Inserting [S.singular_name]s")) if(isnull(requested_amount) || (requested_amount <= 0)) return if(QDELETED(I) || QDELETED(user) || QDELETED(src) || parent != current_parent || user.physical_can_use_topic(current_parent) < UI_INTERACTIVE || user.get_active_held_item() != active_held) diff --git a/code/datums/diseases/advance/advance.dm b/code/datums/diseases/advance/advance.dm index a62917f82eb..cf9b40693af 100644 --- a/code/datums/diseases/advance/advance.dm +++ b/code/datums/diseases/advance/advance.dm @@ -451,7 +451,7 @@ symptoms += SSdisease.list_symptoms.Copy() do if(user) - var/symptom = input(user, "Choose a symptom to add ([i] remaining)", "Choose a Symptom") in sort_list(symptoms, /proc/cmp_typepaths_asc) + var/symptom = tgui_input_list(user, "Choose a symptom to add ([i] remaining)", "Choose a Symptom", sort_list(symptoms, /proc/cmp_typepaths_asc)) if(isnull(symptom)) return else if(istext(symptom)) @@ -465,7 +465,7 @@ if(D.symptoms.len > 0) - var/new_name = stripped_input(user, "Name your new disease.", "New Name") + var/new_name = tgui_input_text(user, "Name your new disease", "New Name", max_length = MAX_NAME_LEN) if(!new_name) return D.Refresh() @@ -474,11 +474,10 @@ var/list/targets = list("Random") targets += sort_names(GLOB.human_list) - var/target = input(user, "Pick a viable human target for the disease.", "Disease Target") as null|anything in targets - - var/mob/living/carbon/human/H - if(!target) + var/target = tgui_input_list(user, "Viable human target", "Disease Target", targets) + if(isnull(target)) return + var/mob/living/carbon/human/H if(target == "Random") for(var/human in shuffle(GLOB.human_list)) H = human diff --git a/code/datums/elements/surgery_initiator.dm b/code/datums/elements/surgery_initiator.dm index 0f1d07d5129..9748adaaaaf 100644 --- a/code/datums/elements/surgery_initiator.dm +++ b/code/datums/elements/surgery_initiator.dm @@ -62,11 +62,13 @@ available_surgeries[surgeryloop_two.name] = surgeryloop_two break - if(!available_surgeries.len) + if(!length(available_surgeries)) return var/pick_your_surgery = tgui_input_list(user, "Which procedure?", "Surgery", sort_list(available_surgeries)) - if(pick_your_surgery && user?.Adjacent(livingtarget) && (source in user)) + if(isnull(pick_your_surgery)) + return + if(user?.Adjacent(livingtarget) && (source in user)) var/datum/surgery/surgeryinstance_notonmob = available_surgeries[pick_your_surgery] for(var/i_three in livingtarget.surgeries) diff --git a/code/datums/mutations/actions.dm b/code/datums/mutations/actions.dm index 25ed84fe440..b1a7003bd07 100644 --- a/code/datums/mutations/actions.dm +++ b/code/datums/mutations/actions.dm @@ -61,9 +61,9 @@ if(!length(possible)) to_chat(user,span_warning("Despite your best efforts, there are no scents to be found on [sniffed]...")) return - tracking_target = input(user, "Choose a scent to remember.", "Scent Tracking") as null|anything in sort_names(possible) - if(!tracking_target) - if(!old_target) + tracking_target = tgui_input_list(user, "Scent to remember", "Scent Tracking", sort_names(possible)) + if(isnull(tracking_target)) + if(isnull(old_target)) to_chat(user,span_warning("You decide against remembering any scents. Instead, you notice your own nose in your peripheral vision. This goes on to remind you of that one time you started breathing manually and couldn't stop. What an awful day that was.")) return tracking_target = old_target @@ -242,7 +242,7 @@ if(BP.body_part != HEAD && BP.body_part != CHEST) if(BP.dismemberable) parts += BP - if(!parts.len) + if(!length(parts)) to_chat(usr, span_notice("You can't shed any more limbs!")) return diff --git a/code/datums/station_alert.dm b/code/datums/station_alert.dm index edec9f5cb50..5b969afb005 100644 --- a/code/datums/station_alert.dm +++ b/code/datums/station_alert.dm @@ -93,7 +93,7 @@ chosen_camera = named_cameras[1] else chosen_camera = tgui_input_list(ai, "Choose a camera to jump to", "Camera Selection", named_cameras) - if(!chosen_camera) + if(isnull(chosen_camera)) return var/obj/machinery/camera/selected_camera = named_cameras[chosen_camera] if(!selected_camera.can_use()) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index a08d90e2b91..7a4ca3e0c1f 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -159,11 +159,11 @@ if(occupant_typecache) occupant_typecache = typecacheof(occupant_typecache) - + if((resistance_flags & INDESTRUCTIBLE) && component_parts){ // This is needed to prevent indestructible machinery still blowing up. If an explosion occurs on the same tile as the indestructible machinery without the PREVENT_CONTENTS_EXPLOSION_1 flag, /datum/controller/subsystem/explosions/proc/propagate_blastwave will call ex_act on all movable atoms inside the machine, including the circuit board and component parts. However, if those parts get deleted, the entire machine gets deleted, allowing for INDESTRUCTIBLE machines to be destroyed. (See #62164 for more info) flags_1 |= PREVENT_CONTENTS_EXPLOSION_1 } - + return INITIALIZE_HINT_LATELOAD /obj/machinery/LateInitialize() @@ -627,11 +627,13 @@ if(!Adjacent(user) || !can_buckle || !has_buckled_mobs()) //so that borgs (but not AIs, sadly (perhaps in a future PR?)) can unbuckle people from machines return _try_interact(user) - if(buckled_mobs.len <= 1) + if(length(buckled_mobs) <= 1) if(user_unbuckle_mob(buckled_mobs[1],user)) return TRUE - var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sort_names(buckled_mobs) + var/unbuckled = tgui_input_list(user, "Who do you wish to unbuckle?", "Unbuckle", sort_names(buckled_mobs)) + if(isnull(unbuckled)) + return FALSE if(user_unbuckle_mob(unbuckled,user)) return TRUE diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 5458ca95ec3..629262551a4 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -207,7 +207,7 @@ list_to_show += i used_material = tgui_input_list(usr, "Choose [used_material]", "Custom Material", sort_list(list_to_show, /proc/cmp_typepaths_asc)) - if(!used_material) + if(isnull(used_material)) return //Didn't pick any material, so you can't build shit either. custom_materials[used_material] += amount_needed @@ -264,7 +264,7 @@ else LAZYADD(not_imported, blueprint.name) if(not_imported) - to_chat(user, span_warning("The following design[not_imported.len > 1 ? "s" : ""] couldn't be imported: [english_list(not_imported)]")) + to_chat(user, span_warning("The following design[length(not_imported) > 1 ? "s" : ""] couldn't be imported: [english_list(not_imported)]")) busy = FALSE return TRUE @@ -348,7 +348,7 @@ . += span_notice("The status display reads: Storing up to [materials.max_amount] material units.
Material consumption at [creation_efficiency*100]%.") /obj/machinery/autolathe/proc/can_build(datum/design/D, amount = 1) - if(D.make_reagents.len) + if(length(D.make_reagents)) return FALSE var/coeff = (ispath(D.build_path, /obj/item/stack) ? 1 : creation_efficiency) diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 0c2cd199971..e0977e31d5f 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -231,10 +231,12 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/camera/xray, 0) droppable_parts += assembly.emp_module if(assembly.proxy_module) droppable_parts += assembly.proxy_module - if(!droppable_parts.len) + if(!length(droppable_parts)) return - var/obj/item/choice = input(user, "Select a part to remove:", src) as null|obj in sort_names(droppable_parts) - if(!choice || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) + var/obj/item/choice = tgui_input_list(user, "Select a part to remove", "Part Removal", sort_names(droppable_parts)) + if(isnull(choice)) + return + if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return to_chat(user, span_notice("You remove [choice] from [src].")) if(choice == assembly.xray_module) diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm index e506bca3ddf..4714647f93f 100644 --- a/code/game/machinery/camera/camera_assembly.dm +++ b/code/game/machinery/camera/camera_assembly.dm @@ -201,10 +201,12 @@ droppable_parts += emp_module if(proxy_module) droppable_parts += proxy_module - if(!droppable_parts.len) + if(!length(droppable_parts)) return - var/obj/item/choice = input(user, "Select a part to remove:", src) as null|obj in sort_names(droppable_parts) - if(!choice || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) + var/obj/item/choice = tgui_input_list(user, "Select a part to remove", "Part Removal", sort_names(droppable_parts)) + if(isnull(choice)) + return + if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return to_chat(user, span_notice("You remove [choice] from [src].")) drop_upgrade(choice) diff --git a/code/game/machinery/camera/tracking.dm b/code/game/machinery/camera/tracking.dm index 4eb93a21449..163489cebb0 100644 --- a/code/game/machinery/camera/tracking.dm +++ b/code/game/machinery/camera/tracking.dm @@ -9,7 +9,7 @@ for (var/obj/machinery/camera/C in L) var/list/tempnetwork = C.network&src.network - if (tempnetwork.len) + if (length(tempnetwork)) T[text("[][]", C.c_tag, (C.can_use() ? null : " (Deactivated)"))] = C return T @@ -17,6 +17,10 @@ /mob/living/silicon/ai/proc/show_camera_list() var/list/cameras = get_camera_list() var/camera = tgui_input_list(src, "Choose which camera you want to view", "Cameras", cameras) + if(isnull(camera)) + return + if(isnull(cameras[camera])) + return switchCamera(cameras[camera]) /datum/trackable @@ -145,7 +149,7 @@ var/obj/machinery/camera/a var/obj/machinery/camera/b - for (var/i = L.len, i > 0, i--) + for (var/i = length(L), i > 0, i--) for (var/j = 1 to i - 1) a = L[j] b = L[j + 1] diff --git a/code/game/machinery/computer/arena.dm b/code/game/machinery/computer/arena.dm index b4c0cef5371..a3743627755 100644 --- a/code/game/machinery/computer/arena.dm +++ b/code/game/machinery/computer/arena.dm @@ -159,9 +159,9 @@ var/list/keys = list() for(var/mob/M in GLOB.player_list) keys += M.client - var/client/selection = input("Please, select a player!", "Team member", null, null) as null|anything in sort_key(keys) + var/client/selection = tgui_input_list(user, "Select a player", "Team member", sort_key(keys)) //Could be freeform if you want to add disconnected i guess - if(!selection) + if(isnull(selection)) return key = selection.ckey if(!team_keys[team]) diff --git a/code/game/machinery/computer/atmos_control.dm b/code/game/machinery/computer/atmos_control.dm index 7ab28b03a50..8d522d6602d 100644 --- a/code/game/machinery/computer/atmos_control.dm +++ b/code/game/machinery/computer/atmos_control.dm @@ -419,7 +419,9 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) IO |= text[1] if(!IO.len) to_chat(user, span_alert("No machinery detected.")) - var/S = input("Select the device set: ", "Selection", IO[1]) as anything in sort_list(IO) + var/S = tgui_input_list(user, "Select the device set", "Reconnect", sort_list(IO)) + if(isnull(S)) + return if(src) src.input_tag = "[S]_in" src.output_tag = "[S]_out" diff --git a/code/game/machinery/computer/camera_advanced.dm b/code/game/machinery/computer/camera_advanced.dm index ea4cd14d9a9..4b0f51193de 100644 --- a/code/game/machinery/computer/camera_advanced.dm +++ b/code/game/machinery/computer/camera_advanced.dm @@ -137,19 +137,19 @@ var/camera_location var/turf/myturf = get_turf(src) if(eyeobj.use_static != FALSE) - if((!z_lock.len || (myturf.z in z_lock)) && GLOB.cameranet.checkTurfVis(myturf)) + if((!length(z_lock) || (myturf.z in z_lock)) && GLOB.cameranet.checkTurfVis(myturf)) camera_location = myturf else for(var/obj/machinery/camera/C in GLOB.cameranet.cameras) - if(!C.can_use() || z_lock.len && !(C.z in z_lock)) + if(!C.can_use() || length(z_lock) && !(C.z in z_lock)) continue var/list/network_overlap = networks & C.network - if(network_overlap.len) + if(length(network_overlap)) camera_location = get_turf(C) break else camera_location = myturf - if(z_lock.len && !(myturf.z in z_lock)) + if(length(z_lock) && !(myturf.z in z_lock)) camera_location = locate(round(world.maxx/2), round(world.maxy/2), z_lock[1]) if(camera_location) @@ -274,7 +274,7 @@ var/list/L = list() for (var/obj/machinery/camera/cam in GLOB.cameranet.cameras) - if(origin.z_lock.len && !(cam.z in origin.z_lock)) + if(length(origin.z_lock) && !(cam.z in origin.z_lock)) continue L.Add(cam) @@ -284,13 +284,17 @@ for (var/obj/machinery/camera/netcam in L) var/list/tempnetwork = netcam.network & origin.networks - if (tempnetwork.len) + if (length(tempnetwork)) if(!netcam.c_tag) continue T["[netcam.c_tag][netcam.can_use() ? null : " (Deactivated)"]"] = netcam playsound(origin, 'sound/machines/terminal_prompt.ogg', 25, FALSE) var/camera = tgui_input_list(usr, "Camera to view", "Cameras", T) + if(isnull(camera)) + return + if(isnull(T[camera])) + return var/obj/machinery/camera/final = T[camera] playsound(src, "terminal_type", 25, FALSE) if(final) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 8ca8dfa1736..da69dd4c94f 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -573,7 +573,7 @@ message_admins("[key_name(usr)] has cancelled the outgoing cross-comms message.") return TRUE - + return ..() /// Returns whether or not the communications console can communicate with the station @@ -657,7 +657,7 @@ if(!SScommunications.can_announce(user, is_ai)) to_chat(user, span_alert("Intercomms recharging. Please stand by.")) return - var/input = stripped_input(user, "Please choose a message to announce to the station crew.", "What?") + var/input = tgui_input_text(user, "Message to announce to the station crew", "Announcement") if(!input || !user.canUseTopic(src, !issilicon(usr))) return if(!(user.can_speak())) //No more cheating, mime/random mute guy! diff --git a/code/game/machinery/computer/prisoner/management.dm b/code/game/machinery/computer/prisoner/management.dm index f69d7b9e6f2..9b1c0e27a57 100644 --- a/code/game/machinery/computer/prisoner/management.dm +++ b/code/game/machinery/computer/prisoner/management.dm @@ -98,10 +98,10 @@ if("reset") contained_id.points = 0 if("setgoal") - var/num = round(input(usr, "Choose prisoner's goal:", "Input an Integer", null) as num|null) - if(num >= 0) - num = min(num,1000) //Cap the quota to the equivilent of 10 minutes. - contained_id.goal = num + var/num = tgui_input_text(usr, "Enter the prisoner's goal", "Prisoner Management", 1, 1000, 1) + if(isnull(num)) + return + contained_id.goal = round(num) else if(href_list["inject1"]) var/obj/item/implant/I = locate(href_list["inject1"]) in GLOB.tracked_chem_implants if(I && istype(I)) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 89e829e713f..bf3b0bff237 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -584,19 +584,19 @@ What a mess.*/ printing = null if("Print Poster") if(!( printing )) - var/wanted_name = stripped_input(usr, "Please enter an alias for the criminal:", "Print Wanted Poster", active1.fields["name"]) + var/wanted_name = tgui_input_text(usr, "Enter an alias for the criminal", "Print Wanted Poster", active1.fields["name"]) if(wanted_name) var/default_description = "A poster declaring [wanted_name] to be a dangerous individual, wanted by Nanotrasen. Report any sightings to security immediately." var/list/crimes = active2.fields["crim"] - if(crimes.len) + if(length(crimes)) default_description += "\n[wanted_name] is wanted for the following crimes:\n" for(var/datum/data/crime/c in active2.fields["crim"]) default_description += "\n[c.crimeName]\n" default_description += "[c.crimeDetails]\n" - var/headerText = stripped_input(usr, "Please enter Poster Heading (Max 7 Chars):", "Print Wanted Poster", "WANTED", 8) + var/headerText = tgui_input_text(usr, "Enter a poster heading", "Print Wanted Poster", "WANTED", 7) - var/info = stripped_multiline_input(usr, "Please input a description for the poster:", "Print Wanted Poster", default_description, null) + var/info = tgui_input_text(usr, "Input a description for the poster", "Print Wanted Poster", default_description) if(info) playsound(loc, 'sound/items/poster_being_created.ogg', 100, TRUE) printing = 1 @@ -607,13 +607,13 @@ What a mess.*/ printing = 0 if("Print Missing") if(!( printing )) - var/missing_name = stripped_input(usr, "Please enter an alias for the missing person:", "Print Missing Persons Poster", active1.fields["name"]) + var/missing_name = tgui_input_text(usr, "Enter an alias for the missing person", "Print Missing Persons Poster", active1.fields["name"]) if(missing_name) var/default_description = "A poster declaring [missing_name] to be a missing individual, missed by Nanotrasen. Report any sightings to security immediately." - var/headerText = stripped_input(usr, "Please enter Poster Heading (Max 7 Chars):", "Print Missing Persons Poster", "MISSING", 8) + var/headerText = tgui_input_text(usr, "Enter a poster heading", "Print Missing Persons Poster", "MISSING", 7) - var/info = stripped_multiline_input(usr, "Please input a description for the poster:", "Print Missing Persons Poster", default_description, null) + var/info = tgui_input_text(usr, "Input a description for the poster", "Print Missing Persons Poster", default_description) if(info) playsound(loc, 'sound/items/poster_being_created.ogg', 100, TRUE) printing = 1 @@ -641,7 +641,7 @@ What a mess.*/ if(!( istype(active2, /datum/data/record) )) return var/a2 = active2 - var/t1 = stripped_multiline_input("Add Comment:", "Secure. records", null, null) + var/t1 = tgui_input_text(usr, "Add a comment", "Security Records") if(!canUseSecurityRecordsConsole(usr, t1, null, a2)) return var/counter = 1 @@ -735,7 +735,7 @@ What a mess.*/ switch(href_list["field"]) if("name") if(istype(active1, /datum/data/record) || istype(active2, /datum/data/record)) - var/t1 = stripped_input(usr, "Please input name:", "Secure. records", active1.fields["name"], MAX_MESSAGE_LEN) + var/t1 = tgui_input_text(usr, "Input a name", "Security Records", active1.fields["name"]) if(!canUseSecurityRecordsConsole(usr, t1, a1)) return if(istype(active1, /datum/data/record)) @@ -744,7 +744,7 @@ What a mess.*/ active2.fields["name"] = t1 if("id") if(istype(active2, /datum/data/record) || istype(active1, /datum/data/record)) - var/t1 = stripped_input(usr, "Please input id:", "Secure. records", active1.fields["id"], null) + var/t1 = tgui_input_text(usr, "Input an id", "Security Records", active1.fields["id"]) if(!canUseSecurityRecordsConsole(usr, t1, a1)) return if(istype(active1, /datum/data/record)) @@ -753,7 +753,7 @@ What a mess.*/ active2.fields["id"] = t1 if("fingerprint") if(istype(active1, /datum/data/record)) - var/t1 = stripped_input(usr, "Please input fingerprint hash:", "Secure. records", active1.fields["fingerprint"], null) + var/t1 = tgui_input_text(usr, "Input a fingerprint hash", "Security Records", active1.fields["fingerprint"]) if(!canUseSecurityRecordsConsole(usr, t1, a1)) return active1.fields["fingerprint"] = t1 @@ -767,7 +767,7 @@ What a mess.*/ active1.fields["gender"] = "Male" if("age") if(istype(active1, /datum/data/record)) - var/t1 = input("Please input age:", "Secure. records", active1.fields["age"], null) as num|null + var/t1 = tgui_input_number(usr, "Input age", "Security records", active1.fields["age"], AGE_MAX, AGE_MIN) if (!t1) return @@ -777,7 +777,9 @@ What a mess.*/ active1.fields["age"] = t1 if("species") if(istype(active1, /datum/data/record)) - var/t1 = input("Select a species", "Species Selection") as null|anything in get_selectable_species() + var/t1 = tgui_input_list(usr, "Select a species", "Species Selection", get_selectable_species()) + if(isnull(t1)) + return if(!canUseSecurityRecordsConsole(usr, t1, a1)) return active1.fields["species"] = t1 @@ -827,8 +829,8 @@ What a mess.*/ print_photo(P.picture.picture_image, active1.fields["name"]) if("crim_add") if(istype(active1, /datum/data/record)) - var/t1 = stripped_input(usr, "Please input crime names:", "Secure. records", "", null) - var/t2 = stripped_input(usr, "Please input crime details:", "Secure. records", "", null) + var/t1 = tgui_input_text(usr, "Input crime names", "Security Records") + var/t2 = tgui_input_text(usr, "Input crime details", "Security Records") if(!canUseSecurityRecordsConsole(usr, t1, null, a2)) return var/crime = GLOB.data_core.createCrimeEntry(t1, t2, authenticated, station_time_timestamp()) @@ -843,7 +845,7 @@ What a mess.*/ if("add_details") if(istype(active1, /datum/data/record)) if(href_list["cdataid"]) - var/t1 = stripped_input(usr, "Please input crime details:", "Secure. records", "", null) + var/t1 = tgui_input_text(usr, "Input crime details", "Security Records") if(!canUseSecurityRecordsConsole(usr, t1, null, a2)) return GLOB.data_core.addCrimeDetails(active1.fields["id"], href_list["cdataid"], t1) @@ -852,17 +854,13 @@ What a mess.*/ if(istype(active1, /datum/data/record)) var/maxFine = CONFIG_GET(number/maxfine) - var/t1 = stripped_input(usr, "Please input citation crime:", "Secure. records", "", null) - var/fine = FLOOR(input(usr, "Please input citation fine, up to [maxFine]:", "Secure. records", 50) as num|null, 1) + var/t1 = tgui_input_text(usr, "Input citation crime", "Security Records") + var/fine = round(tgui_input_number(usr, "Input citation fine", "Security Records", 50, maxFine, 1)) if (isnull(fine)) return fine = min(fine, maxFine) - if(fine < 0) - to_chat(usr, span_warning("You're pretty sure that's not how money works.")) - return - if(!canUseSecurityRecordsConsole(usr, t1, null, a2)) return @@ -890,7 +888,7 @@ What a mess.*/ GLOB.data_core.removeCitation(active1.fields["id"], href_list["cdataid"]) if("notes") if(istype(active2, /datum/data/record)) - var/t1 = stripped_input(usr, "Please summarize notes:", "Secure. records", active2.fields["notes"], null) + var/t1 = tgui_input_text(usr, "Please summarize notes", "Security Records", active2.fields["notes"]) if(!canUseSecurityRecordsConsole(usr, t1, null, a2)) return active2.fields["notes"] = t1 diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm index 2821874cc3a..2473bcdbfe6 100644 --- a/code/game/machinery/computer/teleporter.dm +++ b/code/game/machinery/computer/teleporter.dm @@ -183,16 +183,20 @@ var/list/targets = get_targets() if (regime_set == "Teleporter") - var/desc = input("Please select a location to lock in.", "Locking Computer") as null|anything in sort_list(targets) + var/desc = tgui_input_list(usr, "Select a location to lock in", "Locking Computer", sort_list(targets)) + if(isnull(desc)) + return set_teleport_target(targets[desc]) var/turf/target_turf = get_turf(targets[desc]) log_game("[key_name(user)] has set the teleporter target to [targets[desc]] at [AREACOORD(target_turf)]") else - if (targets.len == 0) + if (!length(targets)) to_chat(user, span_alert("No active connected stations located.")) return - var/desc = input("Please select a station to lock in.", "Locking Computer") as null|anything in sort_list(targets) + var/desc = tgui_input_list(usr, "Select a station to lock in", "Locking Computer", sort_list(targets)) + if(isnull(desc)) + return var/obj/machinery/teleport/station/target_station = targets[desc] if(!target_station || !target_station.teleporter_hub) return diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index e079a2f63f1..517517fbda1 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1199,7 +1199,7 @@ // reads from the airlock painter's `available paintjob` list. lets the player choose a paint option, or cancel painting var/current_paintjob = tgui_input_list(user, "Paintjob for this airlock", "Customize", sort_list(painter.available_paint_jobs)) - if(!current_paintjob) // if the user clicked cancel on the popup, return + if(isnull(current_paintjob)) // if the user clicked cancel on the popup, return return var/airlock_type = painter.available_paint_jobs["[current_paintjob]"] // get the airlock type path associated with the airlock name the user just chose @@ -1349,7 +1349,7 @@ if(!electronics) ae = new/obj/item/electronics/airlock(loc) gen_access() - if(req_one_access.len) + if(length(req_one_access)) ae.one_access = 1 ae.accesses = req_one_access else diff --git a/code/game/machinery/doors/poddoor.dm b/code/game/machinery/doors/poddoor.dm index cebbc5c6699..f2129b03329 100644 --- a/code/game/machinery/doors/poddoor.dm +++ b/code/game/machinery/doors/poddoor.dm @@ -31,11 +31,12 @@ return if (deconstruction != BLASTDOOR_FINISHED) return - var/change_id = input("Set the shutters/blast door/blast door controllers ID. It must be a number between 1 and 100.", "ID", id) as num|null - if(change_id) - id = clamp(round(change_id, 1), 1, 100) - to_chat(user, span_notice("You change the ID to [id].")) - balloon_alert(user, "ID changed") + var/change_id = tgui_input_number(user, "Set the door controllers ID", "Door Controller ID", id, 100, 1) + if(isnull(change_id)) + return + id = round(change_id) + to_chat(user, span_notice("You change the ID to [id].")) + balloon_alert(user, "ID changed") /obj/machinery/door/poddoor/crowbar_act(mob/living/user, obj/item/tool) . = ..() diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 2d488535b48..a041f1a2c2f 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -302,7 +302,9 @@ Possible to do for anyone motivated enough: LAZYADD(callnames[A], I) callnames -= get_area(src) var/result = tgui_input_list(usr, "Choose an area to call", "Holocall", sort_names(callnames)) - if(QDELETED(usr) || !result || outgoing_call) + if(isnull(result)) + return + if(QDELETED(usr) || outgoing_call) return if(usr.loc == loc) var/input = text2num(params["headcall"]) @@ -721,15 +723,15 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ if(time_delta >= 1) disk.record.entries += list(list(HOLORECORD_DELAY,time_delta)) disk.record.entries += list(list(HOLORECORD_SAY,message)) - if(disk.record.entries.len >= HOLORECORD_MAX_LENGTH) + if(length(disk.record.entries) >= HOLORECORD_MAX_LENGTH) record_stop() /obj/machinery/holopad/proc/replay_entry(entry_number) if(!replay_mode) return - if (!disk.record.entries.len) // check for zero entries such as photographs and no text recordings + if (!length(disk.record.entries)) // check for zero entries such as photographs and no text recordings return // and pretty much just display them statically untill manually stopped - if(disk.record.entries.len < entry_number) + if(length(disk.record.entries) < entry_number) if(loop_mode) entry_number = 1 else diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index 6f511a66b52..035ccf038f1 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -553,7 +553,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster/security_unit, 30) for(var/datum/newscaster/feed_channel/F in GLOB.news_network.network_channels) if( (!F.locked || F.author == scanned_user) && !F.censored) available_channels += F.channel_name - channel_name = input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in sort_list(available_channels) + var/channel_choice = tgui_input_list(usr, "Choose receiving Feed Channel", "Network Channel Handler", sort_list(available_channels)) + if(isnull(channel_choice)) + return + channel_name = channel_choice updateUsrDialog() else if(href_list["set_new_message"]) var/temp_message = tgui_input_text(usr, "Write your Feed story", "Network Channel Handler", msg, multiline = TRUE) diff --git a/code/game/machinery/porta_turret/portable_turret_construct.dm b/code/game/machinery/porta_turret/portable_turret_construct.dm index 38d23926841..3716832b55b 100644 --- a/code/game/machinery/porta_turret/portable_turret_construct.dm +++ b/code/game/machinery/porta_turret/portable_turret_construct.dm @@ -178,13 +178,13 @@ return if(istype(I, /obj/item/pen)) //you can rename turrets like bots! - var/t = stripped_input(user, "Enter new turret name", name, finish_name) - if(!t) + var/choice = tgui_input_text(user, "Enter a new turret name", "Turret Classification", finish_name, MAX_NAME_LEN) + if(!choice) return - if(!Adjacent(user)) + if(!user.canUseTopic(src, BE_CLOSE)) return - finish_name = t + finish_name = choice return return ..() diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index 655236cf875..6182fe29eca 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -193,17 +193,19 @@ notify_ghosts("\A [src] has been activated at [get_area(src)]!", source = src, action = NOTIFY_ORBIT, flashwindow = FALSE, header = "Bomb Planted") /obj/machinery/syndicatebomb/proc/settings(mob/user) + if(!user.canUseTopic(src, !issilicon(user))) + return 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(!user.canUseTopic(src, !issilicon(user))) + return + timer_set = round(new_timer) + loc.visible_message(span_notice("[icon2html(src, viewers(src))] timer set for [timer_set] seconds.")) 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)) + if(!user.canUseTopic(src, !issilicon(user))) return if(active) to_chat(user, span_warning("The bomb is already active!")) diff --git a/code/game/machinery/telecomms/computers/message.dm b/code/game/machinery/telecomms/computers/message.dm index c3e1b8cc2a3..c73b3bbeb29 100644 --- a/code/game/machinery/telecomms/computers/message.dm +++ b/code/game/machinery/telecomms/computers/message.dm @@ -288,10 +288,11 @@ for (var/obj/machinery/telecomms/message_server/M in GLOB.telecomms_list) message_servers += M - if(message_servers.len > 1) + if(length(message_servers) > 1) linkedServer = tgui_input_list(usr, "Please select a server", "Server Selection", message_servers) - message = span_alert("NOTICE: Server selected.") - else if(message_servers.len > 0) + if(linkedServer) + message = span_alert("NOTICE: Server selected.") + else if(length(message_servers) > 0) linkedServer = message_servers[1] message = span_notice("NOTICE: Only Single Server Detected - Server selected.") else @@ -388,7 +389,7 @@ if("Recepient") //Get out list of viable PDAs var/list/obj/item/pda/sendPDAs = get_viewable_pdas() - if(GLOB.PDAs && GLOB.PDAs.len > 0) + if(GLOB.PDAs && length(GLOB.PDAs) > 0) customrecepient = tgui_input_list(usr, "Select a PDA from the list", "PDA Selection", sendPDAs) else customrecepient = null diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 0c438dccf2b..9b8844b9545 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -18,8 +18,10 @@ if(.) return if(can_buckle && has_buckled_mobs()) - if(buckled_mobs.len > 1) - var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sort_names(buckled_mobs) + if(length(buckled_mobs) > 1) + var/mob/living/unbuckled = tgui_input_list(user, "Who do you wish to unbuckle?", "Unbuckle", sort_names(buckled_mobs)) + if(isnull(unbuckled)) + return if(user_unbuckle_mob(unbuckled,user)) return TRUE else @@ -44,8 +46,10 @@ if(.) return if(Adjacent(user) && can_buckle && has_buckled_mobs()) - if(buckled_mobs.len > 1) - var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sort_names(buckled_mobs) + if(length(buckled_mobs) > 1) + var/mob/living/unbuckled = tgui_input_list(user, "Who do you wish to unbuckle?", "Unbuckle", sort_names(buckled_mobs)) + if(isnull(unbuckled)) + return return user_unbuckle_mob(unbuckled,user) else return user_unbuckle_mob(buckled_mobs[1], user) @@ -71,7 +75,7 @@ /atom/movable/proc/has_buckled_mobs() if(!buckled_mobs) return FALSE - if(buckled_mobs.len) + if(length(buckled_mobs)) return TRUE /** diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 75ac3bef8bd..5717d0d8284 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -408,7 +408,9 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e affixes.Add(suffixes) //admin picks, cleanup the ones we didn't do and handle chosen - var/picked_affix_name = input(usr, "Choose an affix to add to [src]...", "Enchant [src]") as null|anything in affixes + var/picked_affix_name = tgui_input_list(usr, "Affix to add to [src]", "Enchant [src]", affixes) + if(isnull(picked_affix_name)) + return if(!affixes[picked_affix_name] || QDELETED(src)) return var/datum/fantasy_affix/affix = affixes[picked_affix_name] diff --git a/code/game/objects/items/AI_modules.dm b/code/game/objects/items/AI_modules.dm index 2a65725dd1b..f8c4de5fbfb 100644 --- a/code/game/objects/items/AI_modules.dm +++ b/code/game/objects/items/AI_modules.dm @@ -246,15 +246,10 @@ AI MODULES laws = list("") /obj/item/ai_module/supplied/freeform/attack_self(mob/user) - var/newpos = input("Please enter the priority for your new law. Can only write to law sectors 15 and above.", "Law Priority (15+)", lawpos) as num|null - if(newpos == null) + var/newpos = tgui_input_number(user, "Please enter the priority for your new law. Can only write to law sectors 15 and above.", "Law Priority ", lawpos, 50, 15) + if(isnull(newpos)) return - if(newpos < 15) - var/response = tgui_alert(usr, "Error: The law priority of [newpos] is invalid, Law priorities below 14 are reserved for core laws, Would you like to change that that to 15?", "Invalid law priority", list("Change to 15", "Cancel")) - if (!response || response == "Cancel") - return - newpos = 15 - lawpos = min(newpos, 50) + lawpos = round(newpos) var/targName = tgui_input_text(user, "Enter a new law for the AI.", "Freeform Law Entry", laws[1], CONFIG_GET(number/max_law_len), TRUE) if(!targName) return @@ -290,12 +285,8 @@ AI MODULES var/lawpos = 1 /obj/item/ai_module/remove/attack_self(mob/user) - lawpos = input("Please enter the law you want to delete.", "Law Number", lawpos) as num|null - if(lawpos == null) - return - if(lawpos <= 0) - to_chat(user, span_warning("Error: The law number of [lawpos] is invalid.")) - lawpos = 1 + lawpos = tgui_input_number(user, "Law to delete", "Law Removal", lawpos, 50, 1) + if(isnull(lawpos)) return to_chat(user, span_notice("Law [lawpos] selected.")) ..() diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index b730a6fbf5f..6c94e1daab7 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -454,7 +454,7 @@ to_chat(user, span_warning("[src] doesn't have a linked account to deposit into!")) return FALSE - if (!money || !money.len) + if (!money || !length(money)) return FALSE var/total = 0 @@ -484,49 +484,38 @@ . = FALSE var/datum/bank_account/old_account = registered_account - var/new_bank_id = input(user, "Enter your account ID number.", "Account Reclamation", 111111) as num | null - - if (isnull(new_bank_id)) + var/new_bank_id = tgui_input_number(user, "Enter your account ID number", "Account Reclamation", 111111, 999999, 111111) + if(isnull(new_bank_id)) return - if(!alt_click_can_use_id(user)) return - if(!new_bank_id || new_bank_id < 111111 || new_bank_id > 999999) - to_chat(user, span_warning("The account ID number needs to be between 111111 and 999999.")) - return - if (registered_account && registered_account.account_id == new_bank_id) + if(registered_account && registered_account.account_id == new_bank_id) to_chat(user, span_warning("The account ID was already assigned to this card.")) return - - var/datum/bank_account/B = SSeconomy.bank_accounts_by_id["[new_bank_id]"] - if(B) - if (old_account) - old_account.bank_cards -= src - - B.bank_cards += src - registered_account = B - to_chat(user, span_notice("The provided account has been linked to this ID card.")) - - return TRUE - - to_chat(user, span_warning("The account ID number provided is invalid.")) - return + var/datum/bank_account/account = SSeconomy.bank_accounts_by_id["[new_bank_id]"] + if(isnull(account)) + to_chat(user, span_warning("The account ID number provided is invalid.")) + return + if(old_account) + old_account.bank_cards -= src + account.bank_cards += src + registered_account = account + to_chat(user, span_notice("The provided account has been linked to this ID card.")) + return TRUE /obj/item/card/id/AltClick(mob/living/user) if(!alt_click_can_use_id(user)) return - if(!registered_account) set_new_account(user) return - if (registered_account.being_dumped) registered_account.bank_card_talk(span_warning("内部服务器错误"), TRUE) return - - var/amount_to_remove = FLOOR(input(user, "How much do you want to withdraw? Current Balance: [registered_account.account_balance]", "Withdraw Funds", 5) as num|null, 1) - - if(!amount_to_remove || amount_to_remove < 0) + var/amount_to_remove = round(tgui_input_number(user, "How much do you want to withdraw?", "Withdraw Funds", 1, registered_account.account_balance, 1)) + if(isnull(amount_to_remove)) + return + if(amount_to_remove < 1 || amount_to_remove > registered_account.account_balance) return if(!alt_click_can_use_id(user)) return @@ -975,19 +964,21 @@ /obj/item/card/id/advanced/prisoner/attackby(obj/item/card/id/C, mob/user) ..() var/list/id_access = C.GetAccess() - if(ACCESS_BRIG in id_access) - if(timed) - timed = FALSE - time_to_assign = initial(time_to_assign) - registered_name = initial(registered_name) - STOP_PROCESSING(SSobj, src) - to_chat(user, "Restating prisoner ID to default parameters.") - return - time_to_assign = input(user,"Set sentence time in seconds.","Set sentence time in seconds.",0) as num|null - if(isnull(time_to_assign) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) - return - to_chat(user, "You set the sentence time to [time_to_assign] seconds.") - timed = TRUE + if(!(ACCESS_BRIG in id_access)) + return + if(timed) + timed = FALSE + time_to_assign = initial(time_to_assign) + registered_name = initial(registered_name) + STOP_PROCESSING(SSobj, src) + to_chat(user, "Restating prisoner ID to default parameters.") + return + var/choice = tgui_input_number(user, "Sentence time in seconds", "Sentencing") + if(isnull(time_to_assign) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) + return + time_to_assign = round(choice) + to_chat(user, "You set the sentence time to [time_to_assign] seconds.") + timed = TRUE /obj/item/card/id/advanced/prisoner/proc/start_timer() say("Sentence started, welcome to the corporate rehabilitation center!") @@ -1266,7 +1257,7 @@ return if(popup_input == "Forge/Reset") if(!forged) - var/input_name = stripped_input(user, "What name would you like to put on this card? Leave blank to randomise.", "Agent card name", registered_name ? registered_name : (ishuman(user) ? user.real_name : user.name), MAX_NAME_LEN) + var/input_name = tgui_input_text(user, "What name would you like to put on this card? Leave blank to randomise.", "Agent card name", registered_name ? registered_name : (ishuman(user) ? user.real_name : user.name), MAX_NAME_LEN) input_name = sanitize_name(input_name) if(!input_name) // Invalid/blank names give a randomly generated one. @@ -1293,18 +1284,17 @@ var/fake_trim_name = "[trim.assignment] ([trim.trim_state])" trim_list[fake_trim_name] = trim_path - var/selected_trim_path - selected_trim_path = input("Select trim to apply to your card.\nNote: This will not grant any trim accesses.", "Forge Trim", selected_trim_path) as null|anything in sort_list(trim_list, /proc/cmp_typepaths_asc) + var/selected_trim_path = tgui_input_list(user, "Select trim to apply to your card.\nNote: This will not grant any trim accesses.", "Forge Trim", sort_list(trim_list, /proc/cmp_typepaths_asc)) if(selected_trim_path) SSid_access.apply_trim_to_chameleon_card(src, trim_list[selected_trim_path]) - var/target_occupation = stripped_input(user, "What occupation would you like to put on this card?\nNote: This will not grant any access levels.", "Agent card job assignment", assignment ? assignment : "Assistant", MAX_MESSAGE_LEN) + var/target_occupation = tgui_input_text(user, "What occupation would you like to put on this card?\nNote: This will not grant any access levels.", "Agent card job assignment", assignment ? assignment : "Assistant") if(target_occupation) assignment = target_occupation - var/new_age = input(user, "Choose the ID's age:\n([AGE_MIN]-[AGE_MAX])", "Agent card age") as num|null + var/new_age = tgui_input_number(user, "Choose the ID's age", "Agent card age", AGE_MIN, AGE_MAX, AGE_MIN) if(new_age) - registered_age = max(round(text2num(new_age)), 0) + registered_age = round(new_age) if(tgui_alert(user, "Activate wallet ID spoofing, allowing this card to force itself to occupy the visible ID slot in wallets?", "Wallet ID Spoofing", list("Yes", "No")) == "Yes") ADD_TRAIT(src, TRAIT_MAGNETIC_ID_CARD, CHAMELEON_ITEM_TRAIT) diff --git a/code/game/objects/items/choice_beacon.dm b/code/game/objects/items/choice_beacon.dm index bb0a927a3c1..e0e08943bd6 100644 --- a/code/game/objects/items/choice_beacon.dm +++ b/code/game/objects/items/choice_beacon.dm @@ -22,10 +22,14 @@ /obj/item/choice_beacon/proc/generate_options(mob/living/M) var/list/display_names = generate_display_names() - if(!display_names.len) + if(!length(display_names)) return var/choice = tgui_input_list(M, "Which item would you like to order?", "Select an Item", display_names) - if(!choice || !M.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) + if(isnull(choice)) + return + if(isnull(display_names[choice])) + return + if(!M.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return spawn_option(display_names[choice],M) diff --git a/code/game/objects/items/circuitboards/machine_circuitboards.dm b/code/game/objects/items/circuitboards/machine_circuitboards.dm index 32824f84062..a9e777793f1 100644 --- a/code/game/objects/items/circuitboards/machine_circuitboards.dm +++ b/code/game/objects/items/circuitboards/machine_circuitboards.dm @@ -455,7 +455,7 @@ if (is_special_type) return FALSE var/position = fridges_name_paths.Find(build_path, fridges_name_paths) - position = (position == fridges_name_paths.len) ? 1 : (position + 1) + position = (position == length(fridges_name_paths)) ? 1 : (position + 1) build_path = fridges_name_paths[position] to_chat(user, span_notice("You set the board to [fridges_name_paths[build_path]].")) return TRUE @@ -561,7 +561,11 @@ display_vending_names_paths = list() for(var/path in vending_names_paths) display_vending_names_paths[vending_names_paths[path]] = path - var/choice = input(user, "Choose a new brand", "Select an Item") as null|anything in sort_list(display_vending_names_paths) + var/choice = tgui_input_list(user, "Choose a new brand", "Select an Item", sort_list(display_vending_names_paths)) + if(isnull(choice)) + return + if(isnull(display_vending_names_paths[choice])) + return set_type(display_vending_names_paths[choice]) return TRUE @@ -731,11 +735,13 @@ /obj/item/circuitboard/machine/medical_kiosk/multitool_act(mob/living/user) . = ..() - var/new_cost = input("Set a new cost for using this medical kiosk.", "New cost", custom_cost) as num|null - if(!new_cost || (loc != user)) + var/new_cost = tgui_input_number(user, "New cost for using this medical kiosk", "Pricing", custom_cost, 1000, 10) + if(isnull(new_cost)) + return + if(loc != user) to_chat(user, span_warning("You must hold the circuitboard to change its cost!")) return - custom_cost = clamp(round(new_cost, 1), 10, 1000) + custom_cost = round(new_cost) to_chat(user, span_notice("The cost is now set to [custom_cost].")) /obj/item/circuitboard/machine/medical_kiosk/examine(mob/user) diff --git a/code/game/objects/items/cosmetics.dm b/code/game/objects/items/cosmetics.dm index 619a13790e1..e3a0fc131c5 100644 --- a/code/game/objects/items/cosmetics.dm +++ b/code/game/objects/items/cosmetics.dm @@ -140,7 +140,9 @@ return if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return - var/new_style = input(user, "Select a facial hairstyle", "Grooming") as null|anything in GLOB.facial_hairstyles_list + var/new_style = tgui_input_list(user, "Select a facial hairstyle", "Grooming", GLOB.facial_hairstyles_list) + if(isnull(new_style)) + return if(!get_location_accessible(H, location)) to_chat(user, span_warning("The mask is in the way!")) return @@ -186,7 +188,9 @@ return if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return - var/new_style = input(user, "Select a hairstyle", "Grooming") as null|anything in GLOB.hairstyles_list + var/new_style = tgui_input_list(user, "Select a hairstyle", "Grooming", GLOB.hairstyles_list) + if(isnull(new_style)) + return if(!get_location_accessible(H, location)) to_chat(user, span_warning("The headgear is in the way!")) return diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index 64a756386b4..09793630d96 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -248,7 +248,7 @@ if("select_colour") . = can_change_colour && select_colour(usr) if("enter_text") - var/txt = input(usr, "Choose what to write.", "Scribbles", text_buffer) as text|null + var/txt = tgui_input_text(usr, "Choose what to write", "Scribbles", text_buffer) if(isnull(txt)) return txt = crayon_text_strip(txt) diff --git a/code/game/objects/items/credit_holochip.dm b/code/game/objects/items/credit_holochip.dm index 34f99fb92a5..ff7272badf5 100644 --- a/code/game/objects/items/credit_holochip.dm +++ b/code/game/objects/items/credit_holochip.dm @@ -101,7 +101,7 @@ /obj/item/holochip/AltClick(mob/user) if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) return - var/split_amount = tgui_input_number(user, "How many credits do you want to extract from the holochip?", "Holochip") + var/split_amount = tgui_input_number(user, "How many credits do you want to extract from the holochip?", "Holochip", 1, credits, 1) if(isnull(split_amount)) return if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index bbbcb7cd5c0..192ddfe3573 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -609,8 +609,10 @@ GLOBAL_LIST_EMPTY(PDAs) playsound(src, 'sound/machines/terminal_select.ogg', 15, TRUE) if("Drone Phone") var/alert_s = tgui_input_list(U, "Alert severity level", "Ping Drones", list("Low","Medium","High","Critical")) + if(isnull(alert_s)) + return var/area/A = get_area(U) - if(A && alert_s && !QDELETED(U)) + if(A && !QDELETED(U)) var/msg = span_boldnotice("NON-DRONE PING: [U.name]: [alert_s] priority alert in [A.name]!") _alert_drones(msg, TRUE, U) to_chat(U, msg) @@ -1251,8 +1253,7 @@ GLOBAL_LIST_EMPTY(PDAs) plist[avoid_assoc_duplicate_keys(pda.owner, namecounts)] = pda var/choice = tgui_input_list(user, "Please select a PDA", "PDA Messenger", sort_list(plist)) - - if (!choice) + if (isnull(choice)) return var/selected = plist[choice] diff --git a/code/game/objects/items/devices/desynchronizer.dm b/code/game/objects/items/devices/desynchronizer.dm index 85433b6d88f..c987909ae0d 100644 --- a/code/game/objects/items/devices/desynchronizer.dm +++ b/code/game/objects/items/devices/desynchronizer.dm @@ -35,12 +35,12 @@ /obj/item/desynchronizer/AltClick(mob/living/user) if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))) return - var/new_duration = input(user, "Set the duration (5-300):", "Desynchronizer", duration / 10) as null|num - if(new_duration) - new_duration = new_duration SECONDS - new_duration = clamp(new_duration, 50, max_duration) - duration = new_duration - to_chat(user, span_notice("You set the duration to [DisplayTimeText(duration)].")) + var/new_duration = tgui_input_number(user, "Set the duration", "Desynchronizer", duration / 10, max_duration, 5 SECONDS) + if(isnull(new_duration)) + return + new_duration = new_duration SECONDS + duration = round(new_duration) + to_chat(user, span_notice("You set the duration to [DisplayTimeText(duration)].")) /obj/item/desynchronizer/proc/desync(mob/living/user) if(sync_holder) diff --git a/code/game/objects/items/devices/pipe_painter.dm b/code/game/objects/items/devices/pipe_painter.dm index ba1cbe4bfb5..ddae7360feb 100644 --- a/code/game/objects/items/devices/pipe_painter.dm +++ b/code/game/objects/items/devices/pipe_painter.dm @@ -24,7 +24,7 @@ user.visible_message(span_notice("[user] paints \the [P] [paint_color]."),span_notice("You paint \the [P] [paint_color].")) /obj/item/pipe_painter/attack_self(mob/user) - paint_color = tgui_input_list(usr, "Which colour do you want to use?","Pipe painter",GLOB.pipe_paint_colors) + paint_color = tgui_input_list(user, "Which colour do you want to use?", "Pipe painter", GLOB.pipe_paint_colors) /obj/item/pipe_painter/examine(mob/user) . = ..() diff --git a/code/game/objects/items/devices/polycircuit.dm b/code/game/objects/items/devices/polycircuit.dm index 5bf9b017724..2cc170c6060 100644 --- a/code/game/objects/items/devices/polycircuit.dm +++ b/code/game/objects/items/devices/polycircuit.dm @@ -19,15 +19,15 @@ else if(is_zero_amount(delete_if_zero = TRUE)) return - chosen_circuit = input("What type of circuit would you like to remove?", "Choose a Circuit Type", chosen_circuit) in list("airlock","firelock","fire alarm","air alarm","APC","cancel") + chosen_circuit = tgui_input_list(user, "Circuit to remove", "Circuit Removal", list("airlock","firelock","fire alarm","air alarm","APC"), chosen_circuit) + if(isnull(chosen_circuit)) + to_chat(user, span_notice("You wisely avoid putting your hands anywhere near [src].")) + return if(is_zero_amount(delete_if_zero = TRUE)) return if(loc != user) return switch(chosen_circuit) - if("cancel") - to_chat(user, span_notice("You wisely avoid putting your hands anywhere near [src].")) - return if("airlock") circuit_type = /obj/item/electronics/airlock if("firelock") diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 2e5bb93bc10..a99a6dd523d 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -97,7 +97,7 @@ GENE SCANNER var/scanmode = SCANMODE_HEALTH var/advanced = FALSE custom_price = PAYCHECK_HARD - + /obj/item/healthanalyzer/examine(mob/user) . = ..() . += span_notice("Alt-click [src] to toggle the limb damage readout.") @@ -170,9 +170,9 @@ GENE SCANNER oxy_loss = max(rand(1, 40), oxy_loss, (300 - (tox_loss + fire_loss + brute_loss))) // Random oxygen loss render_list += "[span_info("Analyzing results for [target]:")]\nOverall status: [mob_status]\n" - + SEND_SIGNAL(target, COMSIG_LIVING_HEALTHSCAN, render_list, advanced, user, mode) - + if(ishuman(target)) var/mob/living/carbon/human/humantarget = target if(humantarget.undergoing_cardiac_arrest() && humantarget.stat != DEAD) @@ -229,7 +229,7 @@ GENE SCANNER if(advanced && target.hallucinating()) render_list += "Subject is hallucinating.\n" - + //Eyes and ears if(advanced && iscarbon(target)) var/mob/living/carbon/carbontarget = target @@ -319,14 +319,14 @@ GENE SCANNER missing_organs += "ears" if(!humantarget.getorganslot(ORGAN_SLOT_EYES)) missing_organs += "eyes" - + if(length(missing_organs)) render = TRUE for(var/organ in missing_organs) toReport += "[organ]:\ [advanced ? "["-"]" : ""]\ ["Missing"]" - + if(render) render_list += toReport + "" // tables do not need extra linebreak @@ -423,7 +423,7 @@ GENE SCANNER if(istype(target) && target.reagents) var/render_list = list() - + // Blood reagents if(target.reagents.reagent_list.len) render_list += "Subject contains the following reagents in their blood:\n" @@ -434,7 +434,7 @@ GENE SCANNER render_list += "[round(reagent.volume, 0.001)] units of [reagent.name][reagent.overdosed ? " - [span_boldannounce("OVERDOSING")]" : "."]\n" else render_list += "Subject contains no reagents in their blood.\n" - + // Stomach reagents var/obj/item/organ/stomach/belly = target.getorganslot(ORGAN_SLOT_STOMACH) if(belly) @@ -452,7 +452,7 @@ GENE SCANNER render_list += "[round(bit_vol, 0.001)] units of [bit.name][bit.overdosed ? " - [span_boldannounce("OVERDOSING")]" : "."]\n" else render_list += "Subject contains no reagents in their stomach.\n" - + // Addictions if(LAZYLEN(target.mind?.active_addictions)) render_list += "Subject is addicted to the following types of drug:\n" @@ -462,7 +462,7 @@ GENE SCANNER // Special eigenstasium addiction if(target.has_status_effect(/datum/status_effect/eigenstasium)) render_list += "Subject is temporally unstable. Stabilising agent is recommended to reduce disturbances.\n" - + // Allergies for(var/datum/quirk/quirky as anything in target.quirks) if(istype(quirky, /datum/quirk/item_quirk/allergic)) @@ -470,13 +470,13 @@ GENE SCANNER var/allergies = allergies_quirk.allergy_string render_list += "Subject is extremely allergic to the following chemicals:\n" render_list += "[allergies]\n" - + // we handled the last
so we don't need handholding to_chat(user, jointext(render_list, ""), trailing_newline = FALSE, type = MESSAGE_TYPE_INFO) /obj/item/healthanalyzer/AltClick(mob/user) ..() - + if(!user.canUseTopic(src, BE_CLOSE)) return @@ -858,7 +858,9 @@ GENE SCANNER options += get_display_name(A) var/answer = tgui_input_list(user, "Analyze Potential", "Sequence Analyzer", sort_list(options)) - if(answer && ready && user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) + if(isnull(answer)) + return + if(ready && user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) var/sequence for(var/A in buffer) //this physically hurts but i dont know what anything else short of an assoc list if(get_display_name(A) == answer) diff --git a/code/game/objects/items/dyekit.dm b/code/game/objects/items/dyekit.dm index 25e2a7aa74a..e289e35d2fb 100644 --- a/code/game/objects/items/dyekit.dm +++ b/code/game/objects/items/dyekit.dm @@ -23,13 +23,15 @@ if(!ishuman(target)) return var/mob/living/carbon/human/human_target = target - var/beard_or_hair = input(user, "What do you want to dye?", "Character Preference") as null|anything in list("Hair", "Facial Hair") + var/beard_or_hair = tgui_alert(user, "What do you want to dye?", "Character Preference", list("Hair", "Facial Hair")) if(!beard_or_hair || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE)) return var/list/choices = beard_or_hair == "Hair" ? GLOB.hair_gradients_list : GLOB.facial_hair_gradients_list - var/new_grad_style = input(user, "Choose a color pattern:", "Character Preference") as null|anything in choices - if(!new_grad_style || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE)) + var/new_grad_style = tgui_input_list(user, "Choose a color pattern", "Character Preference", choices) + if(isnull(new_grad_style)) + return + if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE)) return var/new_grad_color = input(user, "Choose a secondary hair color:", "Character Preference",human_target.grad_color) as color|null diff --git a/code/game/objects/items/grenades/plastic.dm b/code/game/objects/items/grenades/plastic.dm index c860ee5b274..3e964a44ecc 100644 --- a/code/game/objects/items/grenades/plastic.dm +++ b/code/game/objects/items/grenades/plastic.dm @@ -69,14 +69,11 @@ detonate() /obj/item/grenade/c4/attack_self(mob/user) - var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num|null - + var/newtime = tgui_input_number(usr, "Please set the timer", "C4 Timer", 10, 60000, 10) if (isnull(newtime)) return - if(user.get_active_held_item() == src) - newtime = clamp(newtime, 10, 60000) - det_time = newtime + det_time = round(newtime) to_chat(user, "Timer set for [det_time] seconds.") /obj/item/grenade/c4/afterattack(atom/movable/bomb_target, mob/user, flag) diff --git a/code/game/objects/items/pinpointer.dm b/code/game/objects/items/pinpointer.dm index fdce5aa358b..ee838463df5 100644 --- a/code/game/objects/items/pinpointer.dm +++ b/code/game/objects/items/pinpointer.dm @@ -139,15 +139,17 @@ names[crewmember_name] = H name_counts[crewmember_name] = 1 - if(!names.len) + if(!length(names)) user.visible_message(span_notice("[user]'s pinpointer fails to detect a signal."), span_notice("Your pinpointer fails to detect a signal.")) return - - var/A = input(user, "Person to track", "Pinpoint") in sort_list(names) - if(!A || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated()) + var/pinpoint_target = tgui_input_list(user, "Person to track", "Pinpoint", sort_list(names)) + if(isnull(pinpoint_target)) return - - target = names[A] + if(isnull(names[pinpoint_target])) + return + if(QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated()) + return + target = names[pinpoint_target] toggle_on() user.visible_message(span_notice("[user] activates [user.p_their()] pinpointer."), span_notice("You activate your pinpointer.")) diff --git a/code/game/objects/items/scrolls.dm b/code/game/objects/items/scrolls.dm index 29914fc0463..c55f4def71c 100644 --- a/code/game/objects/items/scrolls.dm +++ b/code/game/objects/items/scrolls.dm @@ -40,27 +40,30 @@ * * user The mob that is being teleported */ /obj/item/teleportation_scroll/proc/teleportscroll(mob/user) - var/A - - A = input(user, "Area to jump to", "BOOYEA", A) as null|anything in GLOB.teleportlocs - if(!src || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated() || !A || !uses) + if(!length(GLOB.teleportlocs)) + to_chat(user, span_warning("There are no locations available")) return - var/area/thearea = GLOB.teleportlocs[A] + var/jump_target = tgui_input_list(user, "Area to jump to", "BOOYEA", GLOB.teleportlocs) + if(isnull(jump_target)) + return + if(!src || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated() || !uses) + return + var/area/thearea = GLOB.teleportlocs[jump_target] var/datum/effect_system/smoke_spread/smoke = new smoke.set_up(2, user.loc) smoke.attach(user) smoke.start() - var/list/L = list() - for(var/turf/T in get_area_turfs(thearea.type)) - if(!T.is_blocked_turf()) - L += T + var/list/possible_locations = list() + for(var/turf/target_turf in get_area_turfs(thearea.type)) + if(!target_turf.is_blocked_turf()) + possible_locations += target_turf - if(!L.len) - to_chat(user, span_warning("The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry.")) + if(!length(possible_locations)) + to_chat(user, span_warning("The spell matrix was unable to locate a suitable teleport destination for an unknown reason.")) return - if(do_teleport(user, pick(L), channel = TELEPORT_CHANNEL_MAGIC, forced = TRUE)) + if(do_teleport(user, pick(possible_locations), channel = TELEPORT_CHANNEL_MAGIC, forced = TRUE)) smoke.start() uses-- if(!uses) diff --git a/code/game/objects/items/teleportation.dm b/code/game/objects/items/teleportation.dm index 266300e65ab..1152bc2c6dd 100644 --- a/code/game/objects/items/teleportation.dm +++ b/code/game/objects/items/teleportation.dm @@ -181,8 +181,10 @@ locations["None (Dangerous)"] = PORTAL_LOCATION_DANGEROUS - var/teleport_location_key = input(user, "Please select a teleporter to lock in on.", "Hand Teleporter") as null|anything in locations - if (!teleport_location_key || user.get_active_held_item() != src || user.incapacitated()) + var/teleport_location_key = tgui_input_list(user, "Teleporter to lock on", "Hand Teleporter", sort_list(locations)) + if (isnull(teleport_location_key)) + return + if(user.get_active_held_item() != src || user.incapacitated()) return // Not always a datum, but needed for IS_WEAKREF_OF to cast properly. @@ -205,7 +207,7 @@ /// Takes either PORTAL_LOCATION_DANGEROUS or an /obj/machinery/computer/teleport/computer. /obj/item/hand_tele/proc/try_create_portal_to(mob/user, teleport_location) - if (active_portal_pairs.len >= max_portal_pairs) + if (length(active_portal_pairs) >= max_portal_pairs) user.show_message(span_notice("[src] is recharging!")) return diff --git a/code/game/objects/items/wayfinding.dm b/code/game/objects/items/wayfinding.dm index d35dac22a90..5e7e4e51133 100644 --- a/code/game/objects/items/wayfinding.dm +++ b/code/game/objects/items/wayfinding.dm @@ -253,20 +253,24 @@ if (!owner) owner = user.real_name - if(beacons.len) + if(length(beacons)) beacons.Cut() for(var/obj/machinery/navbeacon/B in GLOB.wayfindingbeacons) beacons[B.codes["wayfinding"]] = B - if(!beacons.len) + if(!length(beacons)) to_chat(user, span_notice("Your pinpointer fails to detect a signal.")) return - var/A = tgui_input_list(user, "Select a location", "Pinpoint", sort_list(beacons)) - if(!A || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated()) + var/wayfind_target = tgui_input_list(user, "Select a location", "Pinpoint", sort_list(beacons)) + if(isnull(wayfind_target)) return - - target = beacons[A] + if(isnull(beacons[wayfind_target])) + to_chat(user, span_warning("Your pinpointer fails to detect a signal.")) + return + if(QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated()) + return + target = beacons[wayfind_target] toggle_on() to_chat(user, span_notice("You activate your pinpointer.")) diff --git a/code/game/objects/structures/barsigns.dm b/code/game/objects/structures/barsigns.dm index 0ad2a35a664..1bb6f570483 100644 --- a/code/game/objects/structures/barsigns.dm +++ b/code/game/objects/structures/barsigns.dm @@ -124,7 +124,7 @@ /obj/structure/sign/barsign/proc/pick_sign(mob/user) var/picked_name = tgui_input_list(user, "Available Signage", "Bar Sign", sort_list(get_bar_names())) - if(!picked_name) + if(isnull(picked_name)) return chosen_sign = set_sign_by_name(picked_name) SSblackbox.record_feedback("tally", "barsign_picked", 1, chosen_sign.type) diff --git a/code/game/objects/structures/bonfire.dm b/code/game/objects/structures/bonfire.dm index f0c6507bea8..28bbc7aaa08 100644 --- a/code/game/objects/structures/bonfire.dm +++ b/code/game/objects/structures/bonfire.dm @@ -41,8 +41,8 @@ /obj/structure/bonfire/attackby(obj/item/used_item, mob/living/user, params) if(istype(used_item, /obj/item/stack/rods) && !can_buckle && !grill) var/obj/item/stack/rods/rods = used_item - var/choice = input(user, "What would you like to construct?", "Bonfire") as null|anything in list("Stake","Grill") - if(!choice) + var/choice = tgui_alert(user, "What would you like to construct?", "Bonfire", list("Stake","Grill")) + if(isnull(choice)) return rods.use(1) switch(choice) diff --git a/code/game/objects/structures/construction_console/construction_actions.dm b/code/game/objects/structures/construction_console/construction_actions.dm index c35e49dd907..71f4b1019a3 100644 --- a/code/game/objects/structures/construction_console/construction_actions.dm +++ b/code/game/objects/structures/construction_console/construction_actions.dm @@ -67,7 +67,11 @@ if(..()) return var/list/buildlist = list("Walls and Floors" = RCD_FLOORWALL, "Airlocks" = RCD_AIRLOCK, "Deconstruction" = RCD_DECONSTRUCT, "Windows and Grilles" = RCD_WINDOWGRILLE) - var/buildmode = input(owner, "Set construction mode.", "Base Console", null) in buildlist + var/buildmode = tgui_input_list(owner, "Set construction mode", "Base Console", buildlist) + if(isnull(buildmode)) + return + if(isnull(buildlist[buildmode])) + return check_rcd() base_console.internal_rcd.construction_mode = buildlist[buildmode] to_chat(owner, "Build mode is now [buildmode].") diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index 58ff631bf7b..67b5b9a8fa8 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -508,14 +508,14 @@ playsound(src, 'sound/machines/buzz-sigh.ogg', 50, TRUE) return - var/new_price_input = input(usr,"Set the sale price for this vend-a-tray.","new price",0) as num|null + var/new_price_input = tgui_input_number(usr, "Sale price for this vend-a-tray", "New Price", 10, 1000, 1) if(isnull(new_price_input) || (payments_acc != potential_acc.registered_account)) to_chat(usr, span_warning("[src] rejects your new price.")) return if(!usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK) ) to_chat(usr, span_warning("You need to get closer!")) return - new_price_input = clamp(round(new_price_input, 1), 10, 1000) + new_price_input = round(new_price_input) sale_price = new_price_input to_chat(usr, span_notice("The cost is now set to [sale_price].")) SStgui.update_uis(src) diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm index 29b991f7a19..c77bc7dcc3c 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -51,7 +51,7 @@ /obj/structure/door_assembly/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen)) - var/t = tgui_input_text(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", "Airlock Renaming", created_name, MAX_NAME_LEN) if(!t) return if(!in_range(src, usr) && loc != usr) diff --git a/code/game/objects/structures/dresser.dm b/code/game/objects/structures/dresser.dm index cc0f3a55d10..fd6bbababff 100644 --- a/code/game/objects/structures/dresser.dm +++ b/code/game/objects/structures/dresser.dm @@ -26,34 +26,37 @@ return if(!Adjacent(user))//no tele-grooming return - if(ishuman(user)) - var/mob/living/carbon/human/H = user + if(!ishuman(user)) + return + var/mob/living/carbon/human/dressing_human = user - if(H.dna && H.dna.species && (NO_UNDERWEAR in H.dna.species.species_traits)) - to_chat(user, span_warning("You are not capable of wearing underwear.")) - return + if(dressing_human.dna && dressing_human.dna.species && (NO_UNDERWEAR in dressing_human.dna.species.species_traits)) + to_chat(user, span_warning("You are not capable of wearing underwear.")) + return - var/choice = input(user, "Underwear, Undershirt, or Socks?", "Changing") as null|anything in list("Underwear","Underwear Color","Undershirt","Socks") + var/choice = tgui_input_list(user, "Underwear, Undershirt, or Socks?", "Changing", list("Underwear","Underwear Color","Undershirt","Socks")) + if(isnull(choice)) + return - if(!Adjacent(user)) - return - switch(choice) - if("Underwear") - var/new_undies = input(user, "Select your underwear", "Changing") as null|anything in GLOB.underwear_list - if(new_undies) - H.underwear = new_undies - if("Underwear Color") - var/new_underwear_color = input(H, "Choose your underwear color", "Underwear Color",H.underwear_color) as color|null - if(new_underwear_color) - H.underwear_color = sanitize_hexcolor(new_underwear_color) - if("Undershirt") - var/new_undershirt = input(user, "Select your undershirt", "Changing") as null|anything in GLOB.undershirt_list - if(new_undershirt) - H.undershirt = new_undershirt - if("Socks") - var/new_socks = input(user, "Select your socks", "Changing") as null|anything in GLOB.socks_list - if(new_socks) - H.socks= new_socks + if(!Adjacent(user)) + return + switch(choice) + if("Underwear") + var/new_undies = tgui_input_list(user, "Select your underwear", "Changing", GLOB.underwear_list) + if(new_undies) + dressing_human.underwear = new_undies + if("Underwear Color") + var/new_underwear_color = input(dressing_human, "Choose your underwear color", "Underwear Color", dressing_human.underwear_color) as color|null + if(new_underwear_color) + dressing_human.underwear_color = sanitize_hexcolor(new_underwear_color) + if("Undershirt") + var/new_undershirt = tgui_input_list(user, "Select your undershirt", "Changing", GLOB.undershirt_list) + if(new_undershirt) + dressing_human.undershirt = new_undershirt + if("Socks") + var/new_socks = tgui_input_list(user, "Select your socks", "Changing", GLOB.socks_list) + if(new_socks) + dressing_human.socks= new_socks - add_fingerprint(H) - H.update_body() + add_fingerprint(dressing_human) + dressing_human.update_body() diff --git a/code/game/objects/structures/lavaland/geyser.dm b/code/game/objects/structures/lavaland/geyser.dm index bd38012dc98..5e4f02ad91f 100644 --- a/code/game/objects/structures/lavaland/geyser.dm +++ b/code/game/objects/structures/lavaland/geyser.dm @@ -178,9 +178,10 @@ if(!istype(user) || !user.canUseTopic(src, BE_CLOSE)) return - var/new_layer = input("Select a layer", "Layer") as null|anything in layers - if(new_layer) - target_layer = layers[new_layer] + var/new_layer = tgui_input_list(user, "Select a layer", "Layer", layers) + if(isnull(new_layer)) + return + target_layer = layers[new_layer] ///A faster reinforced plunger /obj/item/plunger/reinforced diff --git a/code/game/objects/structures/mirror.dm b/code/game/objects/structures/mirror.dm index 22a1ca6eea6..67cbc6fc680 100644 --- a/code/game/objects/structures/mirror.dm +++ b/code/game/objects/structures/mirror.dm @@ -29,22 +29,25 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) //handle facial hair (if necessary) if(hairdresser.gender != FEMALE) - var/new_style = input(user, "Select a facial hairstyle", "Grooming") as null|anything in GLOB.facial_hairstyles_list + var/new_style = tgui_input_list(user, "Select a facial hairstyle", "Grooming", GLOB.facial_hairstyles_list) + if(isnull(new_style)) + return TRUE if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return TRUE //no tele-grooming - if(new_style) - hairdresser.facial_hairstyle = new_style + hairdresser.facial_hairstyle = new_style else hairdresser.facial_hairstyle = "Shaved" //handle normal hair - var/new_style = input(user, "Select a hairstyle", "Grooming") as null|anything in GLOB.hairstyles_list + var/new_style = tgui_input_list(user, "Select a hairstyle", "Grooming", GLOB.hairstyles_list) + if(isnull(new_style)) + return TRUE if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return TRUE //no tele-grooming if(HAS_TRAIT(hairdresser, TRAIT_BALD)) to_chat(hairdresser, span_notice("If only growing back hair were that easy for you...")) - if(new_style) - hairdresser.hairstyle = new_style + + hairdresser.hairstyle = new_style hairdresser.update_hair() @@ -130,7 +133,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) /obj/structure/mirror/magic/Initialize(mapload) . = ..() - if(selectable_races.len) + if(length(selectable_races)) return for(var/datum/species/species_type as anything in subtypesof(/datum/species)) if(initial(species_type.changesource_flags) & race_flags) @@ -146,14 +149,16 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) var/mob/living/carbon/human/amazed_human = user - var/choice = input(user, "Something to change?", "Magical Grooming") as null|anything in list("name", "race", "gender", "hair", "eyes") + var/choice = tgui_input_list(user, "Something to change?", "Magical Grooming", list("name", "race", "gender", "hair", "eyes")) + if(isnull(choice)) + return TRUE if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return TRUE switch(choice) if("name") - var/newname = sanitize_name(stripped_input(amazed_human, "Who are we again?", "Name change", amazed_human.name, MAX_NAME_LEN), allow_numbers = TRUE) //It's magic so whatever. + var/newname = sanitize_name(tgui_input_text(amazed_human, "Who are we again?", "Name change", amazed_human.name, MAX_NAME_LEN), allow_numbers = TRUE) //It's magic so whatever. if(!newname) return TRUE if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) @@ -166,8 +171,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) amazed_human.mind.name = newname if("race") - var/racechoice = input(amazed_human, "What are we again?", "Race change") as null|anything in selectable_races - if(!racechoice || !selectable_races[racechoice]) + var/racechoice = tgui_input_list(amazed_human, "What are we again?", "Race change", selectable_races) + if(isnull(racechoice)) + return TRUE + if(selectable_races[racechoice]) return TRUE if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return TRUE @@ -176,7 +183,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) amazed_human.set_species(newrace, icon_update = FALSE) if(amazed_human.dna.species.use_skintones) - var/new_s_tone = input(user, "Choose your skin tone:", "Race change") as null|anything in GLOB.skin_tones + var/new_s_tone = tgui_input_list(user, "Choose your skin tone", "Race change", GLOB.skin_tones) if(new_s_tone) amazed_human.skin_tone = new_s_tone amazed_human.dna.update_ui_block(DNA_SKIN_TONE_BLOCK) @@ -280,7 +287,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) var/turf/user_turf = get_turf(user) var/list/levels = SSmapping.levels_by_trait(ZTRAIT_SPACE_RUINS) var/turf/dest - if(levels.len) + if(length(levels)) dest = locate(user_turf.x, user_turf.y, pick(levels)) user_turf.ChangeTurf(/turf/open/chasm, flags = CHANGETURF_INHERIT_AIR) diff --git a/code/game/objects/structures/plaques/_plaques.dm b/code/game/objects/structures/plaques/_plaques.dm index e7ba3382927..dab3f27e75c 100644 --- a/code/game/objects/structures/plaques/_plaques.dm +++ b/code/game/objects/structures/plaques/_plaques.dm @@ -98,10 +98,10 @@ if(engraved) to_chat(user, span_warning("This plaque has already been engraved.")) return - var/namechoice = input(user, "Title this plaque. (e.g. 'Best HoP Award', 'Great Ashwalker War Memorial')", "Plaque Customization") + var/namechoice = tgui_input_text(user, "Title this plaque. (e.g. 'Best HoP Award', 'Great Ashwalker War Memorial')", "Plaque Customization", max_length = MAX_NAME_LEN) if(!namechoice) return - var/descriptionchoice = input(user, "Engrave this plaque's text.", "Plaque Customization") + var/descriptionchoice = tgui_input_text(user, "Engrave this plaque's text", "Plaque Customization") if(!descriptionchoice) return if(!Adjacent(user)) //Make sure user is adjacent still @@ -130,10 +130,10 @@ if(engraved) to_chat(user, span_warning("This plaque has already been engraved.")) return - var/namechoice = input(user, "Title this plaque. (e.g. 'Best HoP Award', 'Great Ashwalker War Memorial')", "Plaque Customization") + var/namechoice = tgui_input_text(user, "Title this plaque. (e.g. 'Best HoP Award', 'Great Ashwalker War Memorial')", "Plaque Customization", max_length = MAX_NAME_LEN) if(!namechoice) return - var/descriptionchoice = input(user, "Engrave this plaque's text.", "Plaque Customization") + var/descriptionchoice = tgui_input_text(user, "Engrave this plaque's text", "Plaque Customization") if(!descriptionchoice) return if(!Adjacent(user)) //Make sure user is adjacent still diff --git a/code/game/objects/structures/signs/_signs.dm b/code/game/objects/structures/signs/_signs.dm index aa8db6f0340..4fdbc7f38ac 100644 --- a/code/game/objects/structures/signs/_signs.dm +++ b/code/game/objects/structures/signs/_signs.dm @@ -132,8 +132,8 @@ if(is_editable && istype(I, /obj/item/pen)) if(!length(GLOB.editable_sign_types)) CRASH("GLOB.editable_sign_types failed to populate") - var/choice = input(user, "Select a sign type.", "Sign Customization") as null|anything in GLOB.editable_sign_types - if(!choice) + var/choice = tgui_input_list(user, "Select a sign type", "Sign Customization", GLOB.editable_sign_types) + if(isnull(choice)) return if(!Adjacent(user)) //Make sure user is adjacent still. to_chat(user, span_warning("You need to stand next to the sign to change it!")) @@ -160,14 +160,12 @@ if(is_editable && istype(I, /obj/item/pen)) if(!length(GLOB.editable_sign_types)) CRASH("GLOB.editable_sign_types failed to populate") - var/choice = input(user, "Select a sign type.", "Sign Customization") as null|anything in GLOB.editable_sign_types - if(!choice) + var/choice = tgui_input_list(user, "Select a sign type", "Sign Customization", GLOB.editable_sign_types) + if(isnull(choice)) return if(!Adjacent(user)) //Make sure user is adjacent still. to_chat(user, span_warning("You need to stand next to the sign to change it!")) return - if(!choice) - return user.visible_message(span_notice("You begin changing [src].")) if(!do_after(user, 4 SECONDS, target = src)) return diff --git a/code/game/objects/structures/spirit_board.dm b/code/game/objects/structures/spirit_board.dm index 42306f48193..77961648018 100644 --- a/code/game/objects/structures/spirit_board.dm +++ b/code/game/objects/structures/spirit_board.dm @@ -34,8 +34,10 @@ virgin = FALSE notify_ghosts("Someone has begun playing with a [src.name] in [get_area(src)]!", source = src, header = "Spirit board") - planchette = input("Choose the letter.", "Seance!") as null|anything in list("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z") - if(!planchette || !Adjacent(M) || next_use > world.time) + planchette = tgui_input_list(M, "Choose the letter.", "Seance!", list("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")) + if(isnull(planchette)) + return + if(!Adjacent(M) || next_use > world.time) return M.log_message("picked a letter on [src], which was \"[planchette]\".", LOG_GAME) next_use = world.time + rand(30,50) diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index dde1f340b7f..e85101982e9 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 = tgui_input_text(user, "Enter the name for the door.", "Windoor", created_name, MAX_NAME_LEN) + var/t = tgui_input_text(user, "Enter the name for the door", "Windoor Renaming", created_name, MAX_NAME_LEN) if(!t) return if(!in_range(src, usr) && loc != usr) diff --git a/code/modules/admin/admin_investigate.dm b/code/modules/admin/admin_investigate.dm index 03fbf449159..e983dfea9c6 100644 --- a/code/modules/admin/admin_investigate.dm +++ b/code/modules/admin/admin_investigate.dm @@ -44,8 +44,9 @@ var/list/combined = sort_list(logs_present) + sort_list(logs_missing) - var/selected = input("Investigate what?", "Investigate") as null|anything in combined - + var/selected = tgui_input_list(src, "Investigate what?", "Investigation", combined) + if(isnull(selected)) + return if(!(selected in combined) || selected == "---") return diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index cb5c3fdc475..06032ce7bd0 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -490,12 +490,12 @@ GLOBAL_PROTECT(admin_verbs_hideable) set desc = "Cause an explosion of varying strength at your location." var/list/choices = list("Small Bomb (1, 2, 3, 3)", "Medium Bomb (2, 3, 4, 4)", "Big Bomb (3, 5, 7, 5)", "Maxcap", "Custom Bomb") - var/choice = tgui_input_list(usr, "What size explosion would you like to produce? NOTE: You can do all this rapidly and in an IC manner (using cruise missiles!) with the Config/Launch Supplypod verb. WARNING: These ignore the maxcap", "Drop Bomb", choices) + var/choice = tgui_input_list(src, "What size explosion would you like to produce? NOTE: You can do all this rapidly and in an IC manner (using cruise missiles!) with the Config/Launch Supplypod verb. WARNING: These ignore the maxcap", "Drop Bomb", choices) + if(isnull(choice)) + return var/turf/epicenter = mob.loc switch(choice) - if(null) - return if("Small Bomb (1, 2, 3, 3)") explosion(epicenter, devastation_range = 1, heavy_impact_range = 2, light_impact_range = 3, flash_range = 3, adminlog = TRUE, ignorecap = TRUE, explosion_cause = mob) if("Medium Bomb (2, 3, 4, 4)") @@ -779,7 +779,7 @@ GLOBAL_PROTECT(admin_verbs_hideable) candidates = get_area_turfs(area) - if (candidates.len) + if (length(candidates)) k = 100 do diff --git a/code/modules/admin/outfit_editor.dm b/code/modules/admin/outfit_editor.dm index afa547a96de..e57d0a9e79a 100644 --- a/code/modules/admin/outfit_editor.dm +++ b/code/modules/admin/outfit_editor.dm @@ -167,7 +167,7 @@ if(suit) suit = new suit //initial() doesn't like lists options = suit.allowed - if(!options.len) //nothing will happen, but don't let the user think it's broken + if(!length(options)) //nothing will happen, but don't let the user think it's broken to_chat(owner, span_warning("No options available for the current suit.")) if("belt") @@ -189,8 +189,12 @@ if("r_pocket") choose_any_item(slot) - if(length(options)) - set_item(slot, tgui_input_list(owner, "Choose an item", OUTFIT_EDITOR_NAME, options)) + if(!length(options)) + return + var/option = tgui_input_list(owner, "Choose an item", OUTFIT_EDITOR_NAME, options) + if(isnull(option)) + return + set_item(slot, option) #undef OUTFIT_EDITOR_NAME diff --git a/code/modules/admin/outfit_manager.dm b/code/modules/admin/outfit_manager.dm index 9d20b645472..fcb41b3f2f1 100644 --- a/code/modules/admin/outfit_manager.dm +++ b/code/modules/admin/outfit_manager.dm @@ -58,8 +58,11 @@ owner.holder.load_outfit(owner.mob) if("copy") var/datum/outfit/outfit = tgui_input_list(owner, "Pick an outfit to copy from", "Outfit Manager", subtypesof(/datum/outfit)) - if(ispath(outfit)) - owner.open_outfit_editor(new outfit) + if(isnull(outfit)) + return + if(!ispath(outfit)) + return + owner.open_outfit_editor(new outfit) var/datum/outfit/target_outfit = locate(params["outfit"]) if(!istype(target_outfit)) diff --git a/code/modules/admin/smites/imaginary_friend_special.dm b/code/modules/admin/smites/imaginary_friend_special.dm index 6090dcab09d..0c54bc077af 100644 --- a/code/modules/admin/smites/imaginary_friend_special.dm +++ b/code/modules/admin/smites/imaginary_friend_special.dm @@ -14,7 +14,9 @@ var/random_appearance /datum/smite/custom_imaginary_friend/configure(client/user) - friend_candidate_client = tgui_input_list(user, "Pick the player to put in control.", "New Imaginary Friend", sort_list(GLOB.clients)) + friend_candidate_client = tgui_input_list(user, "Pick the player to put in control", "New Imaginary Friend", sort_list(GLOB.clients)) + if(isnull(friend_candidate_client)) + return if(QDELETED(friend_candidate_client)) to_chat(user, span_notice("Selected player no longer has a client, aborting.")) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 9be48936be5..ad1e6550651 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1542,7 +1542,7 @@ if(!check_rights(R_ADMIN)) return var/list/type_choices = typesof(/datum/station_goal) - var/picked = tgui_input_list(usr, "Choose goal type",, type_choices) + var/picked = tgui_input_list(usr, "Choose goal type", "Station Goal", type_choices) if(!picked) return var/datum/station_goal/G = new picked() diff --git a/code/modules/admin/verbs/SDQL2/SDQL_spells/spell_edit_menu.dm b/code/modules/admin/verbs/SDQL2/SDQL_spells/spell_edit_menu.dm index 33973d44a74..2873d8d6c7c 100644 --- a/code/modules/admin/verbs/SDQL2/SDQL_spells/spell_edit_menu.dm +++ b/code/modules/admin/verbs/SDQL2/SDQL_spells/spell_edit_menu.dm @@ -322,13 +322,14 @@ GLOBAL_LIST_INIT_TYPED(sdql_spells, /obj/effect/proc_holder/spell, list()) saved_vars[params["name"]] = !saved_vars[params["name"]] if("path_variable") var/new_path = tgui_input_list(user, "Select type.", "Add SDQL Spell", typesof(text2path(params["root_path"]))) - if(new_path) - saved_vars[params["name"]] = new_path - var/datum/sample = new new_path - var/list/overrides = list_vars[special_var_lists[params["name"]]] - overrides = overrides&sample.vars - qdel(sample) - icon_needs_updating(params["name"]) + if(isnull(new_path)) + return + saved_vars[params["name"]] = new_path + var/datum/sample = new new_path + var/list/overrides = list_vars[special_var_lists[params["name"]]] + overrides = overrides&sample.vars + qdel(sample) + icon_needs_updating(params["name"]) if("list_variable_add") if(!list_vars[params["list"]]) list_vars[params["list"]] = list() diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index 3624e1baf78..c3f9817cc96 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -153,21 +153,26 @@ usr.forceMove(M.loc) SSblackbox.record_feedback("tally", "admin_verb", 1, "Get Key") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! -/client/proc/sendmob(mob/M in sort_mobs()) +/client/proc/sendmob(mob/jumper in sort_mobs()) set category = "Admin.Game" set name = "Send Mob" if(!src.holder) to_chat(src, "Only administrators may use this command.", confidential = TRUE) return - var/area/A = input(usr, "Pick an area.", "Pick an area") in GLOB.sortedAreas|null - if(A && istype(A)) - var/list/turfs = get_area_turfs(A) - if(length(turfs) && M.forceMove(pick(turfs))) - - log_admin("[key_name(usr)] teleported [key_name(M)] to [AREACOORD(M)]") - var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(M)] to [AREACOORD(M)]" - message_admins(msg) - admin_ticket_log(M, msg) - else - to_chat(src, "Failed to move mob to a valid location.", confidential = TRUE) - SSblackbox.record_feedback("tally", "admin_verb", 1, "Send Mob") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + if(!length(GLOB.sortedAreas)) + to_chat(src, "No areas found.", confidential = TRUE) + return + var/area/target_area = tgui_input_list(src, "Pick an area", "Send Mob", GLOB.sortedAreas) + if(isnull(target_area)) + return + if(!istype(target_area)) + return + var/list/turfs = get_area_turfs(target_area) + if(length(turfs) && jumper.forceMove(pick(turfs))) + log_admin("[key_name(usr)] teleported [key_name(jumper)] to [AREACOORD(jumper)]") + var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(jumper)] to [AREACOORD(jumper)]" + message_admins(msg) + admin_ticket_log(jumper, msg) + else + to_chat(src, "Failed to move mob to a valid location.", confidential = TRUE) + SSblackbox.record_feedback("tally", "admin_verb", 1, "Send Mob") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/admin/verbs/borgpanel.dm b/code/modules/admin/verbs/borgpanel.dm index 3f6a1ff8aa3..c5ee63c199d 100644 --- a/code/modules/admin/verbs/borgpanel.dm +++ b/code/modules/admin/verbs/borgpanel.dm @@ -84,11 +84,12 @@ return switch (action) if ("set_charge") - var/newcharge = input("New charge (0-[borg.cell.maxcharge]):", borg.name, borg.cell.charge) as num|null - if (newcharge) - borg.cell.charge = clamp(newcharge, 0, borg.cell.maxcharge) - message_admins("[key_name_admin(user)] set the charge of [ADMIN_LOOKUPFLW(borg)] to [borg.cell.charge].") - log_silicon("[key_name(user)] set the charge of [key_name(borg)] to [borg.cell.charge].") + var/newcharge = tgui_input_number(usr, "Set new charge", borg.name, borg.cell.charge, borg.cell.maxcharge) + if (isnull(newcharge)) + return + borg.cell.charge = clamp(newcharge, 0, borg.cell.maxcharge) + message_admins("[key_name_admin(user)] set the charge of [ADMIN_LOOKUPFLW(borg)] to [borg.cell.charge].") + log_silicon("[key_name(user)] set the charge of [key_name(borg)] to [borg.cell.charge].") if ("remove_cell") QDEL_NULL(borg.cell) message_admins("[key_name_admin(user)] deleted the cell of [ADMIN_LOOKUPFLW(borg)].") diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 76703c9eb21..df3c825dab9 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -57,7 +57,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that if(C.key) available.Add(C) var/mob/choice = tgui_input_list(usr, "Choose a player to play the pAI", "Spawn pAI", sort_names(available)) - if(!choice) + if(isnull(choice)) return if(!isobserver(choice)) var/confirm = tgui_alert(usr, "[choice.key] isn't ghosting right now. Are you sure you want to yank them out of their body and place them in this pAI?", "Spawn pAI Confirmation", list("Yes", "No")) @@ -534,8 +534,10 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that set category = "Debug" set name = "Debug Mob Lists" set desc = "For when you just gotta know" - - switch(tgui_input_list(usr, "Which list?",, list("Players","Admins","Mobs","Living Mobs","Dead Mobs","Clients","Joined Clients"))) + var/chosen_list = tgui_input_list(usr, "Which list?", "Select List", list("Players","Admins","Mobs","Living Mobs","Dead Mobs","Clients","Joined Clients")) + if(isnull(chosen_list)) + return + switch(chosen_list) if("Players") to_chat(usr, jointext(GLOB.player_list,","), confidential = TRUE) if("Admins") diff --git a/code/modules/admin/verbs/manipulate_organs.dm b/code/modules/admin/verbs/manipulate_organs.dm index 0695777a689..f126c03f839 100644 --- a/code/modules/admin/verbs/manipulate_organs.dm +++ b/code/modules/admin/verbs/manipulate_organs.dm @@ -1,8 +1,8 @@ /client/proc/manipulate_organs(mob/living/carbon/C in world) set name = "Manipulate Organs" set category = "Debug" - var/operation = input("Select organ operation.", "Organ Manipulation", "cancel") as null|anything in list("add organ", "add implant", "drop organ/implant", "remove organ/implant", "cancel") - if (!operation) + var/operation = tgui_input_list(usr, "Select organ operation", "Organ Manipulation", list("add organ", "add implant", "drop organ/implant", "remove organ/implant")) + if (isnull(operation)) return var/list/organs = list() @@ -12,8 +12,10 @@ var/dat = replacetext("[path]", "/obj/item/organ/", ":") organs[dat] = path - var/obj/item/organ/organ = input("Select organ type:", "Organ Manipulation", null) as null|anything in organs - if(!organ) + var/obj/item/organ/organ = tgui_input_list(usr, "Select organ type", "Organ Manipulation", organs) + if(isnull(organ)) + return + if(isnull(organs[organ])) return organ = organs[organ] organ = new organ @@ -26,8 +28,10 @@ var/dat = replacetext("[path]", "/obj/item/implant/", ":") organs[dat] = path - var/obj/item/implant/organ = input("Select implant type:", "Organ Manipulation", null) as null|anything in organs - if(!organ) + var/obj/item/implant/organ = tgui_input_list(usr, "Select implant type", "Organ Manipulation", organs) + if(isnull(organ)) + return + if(isnull(organs[organ])) return organ = organs[organ] organ = new organ @@ -44,12 +48,12 @@ var/obj/item/implant/I = X organs["[I.name] ([I.type])"] = I - var/obj/item/organ = input("Select organ/implant:", "Organ Manipulation", null) as null|anything in organs - if(!organ) + var/obj/item/organ = tgui_input_list(usr, "Select organ/implant", "Organ Manipulation", organs) + if(isnull(organ)) + return + if(isnull(organs[organ])) return organ = organs[organ] - if(!organ) - return var/obj/item/organ/O var/obj/item/implant/I diff --git a/code/modules/admin/verbs/maprotation.dm b/code/modules/admin/verbs/maprotation.dm index 1b5352a9d1a..cc7e72f1ea5 100644 --- a/code/modules/admin/verbs/maprotation.dm +++ b/code/modules/admin/verbs/maprotation.dm @@ -33,7 +33,7 @@ maprotatechoices[mapname] = VM var/chosenmap = tgui_input_list(usr, "Choose a map to change to", "Change Map", sort_list(maprotatechoices)|"Custom") - if (!chosenmap) + if (isnull(chosenmap)) return if(chosenmap == "Custom") diff --git a/code/modules/admin/verbs/shuttlepanel.dm b/code/modules/admin/verbs/shuttlepanel.dm index ef584272b73..7b171019885 100644 --- a/code/modules/admin/verbs/shuttlepanel.dm +++ b/code/modules/admin/verbs/shuttlepanel.dm @@ -24,8 +24,8 @@ options += "Delete Shuttle" options += "Into The Sunset (delete & greentext 'escape')" - var/selection = input(user, "Select where to fly [name || id]:", "Fly Shuttle") as null|anything in options - if(!selection) + var/selection = tgui_input_list(user, "Select where to fly [name || id]:", "Fly Shuttle", options) + if(isnull(selection)) return switch(selection) @@ -67,8 +67,8 @@ if (canDock(S) == SHUTTLE_CAN_DOCK) options[S.name || S.id] = S - var/selection = input(user, "Select the new arrivals destination:", "Fly Shuttle") as null|anything in options - if(!selection) + var/selection = tgui_input_list(user, "New arrivals destination", "Fly Shuttle", options) + if(isnull(selection)) return target_dock = options[selection] if(!QDELETED(target_dock)) diff --git a/code/modules/admin/view_variables/topic_basic.dm b/code/modules/admin/view_variables/topic_basic.dm index c5a68dc0eeb..d483c69aade 100644 --- a/code/modules/admin/view_variables/topic_basic.dm +++ b/code/modules/admin/view_variables/topic_basic.dm @@ -62,7 +62,9 @@ names += "---Elements---" names += sort_list(subtypesof(/datum/element), /proc/cmp_typepaths_asc) var/result = tgui_input_list(usr, "Choose a component/element to add", "Add Component", names) - if(!usr || !result || result == "---Components---" || result == "---Elements---") + if(isnull(result)) + return + if(!usr || result == "---Components---" || result == "---Elements---") return if(QDELETED(src)) to_chat(usr, "That thing doesn't exist anymore!", confidential = TRUE) @@ -100,7 +102,9 @@ // We have to list every element here because there is no way to know what element is on this object without doing some sort of hack. names += sort_list(subtypesof(/datum/element), /proc/cmp_typepaths_asc) var/path = tgui_input_list(usr, "Choose a component/element to remove. All elements listed here may not be on the datum.", "Remove element", names) - if(!usr || !path || path == "---Components---" || path == "---Elements---") + if(isnull(path)) + return + if(!usr || path == "---Components---" || path == "---Elements---") return if(QDELETED(src)) to_chat(usr, "That thing doesn't exist anymore!") diff --git a/code/modules/antagonists/blob/powers.dm b/code/modules/antagonists/blob/powers.dm index ff885d26af1..75a4ad31473 100644 --- a/code/modules/antagonists/blob/powers.dm +++ b/code/modules/antagonists/blob/powers.dm @@ -71,7 +71,11 @@ for(var/i in 1 to GLOB.blob_nodes.len) var/obj/structure/blob/special/node/B = GLOB.blob_nodes[i] nodes["Blob Node #[i] ([get_area_name(B)])"] = B - var/node_name = input(src, "Choose a node to jump to.", "Node Jump") in nodes + var/node_name = tgui_input_list(src, "Choose a node to jump to", "Node Jump", nodes) + if(isnull(node_name)) + return FALSE + if(isnull(nodes[node_name])) + return FALSE var/obj/structure/blob/special/node/chosen_node = nodes[node_name] if(chosen_node) forceMove(chosen_node.loc) diff --git a/code/modules/antagonists/changeling/powers/humanform.dm b/code/modules/antagonists/changeling/powers/humanform.dm index 6e82cc195d8..d72238b8cf1 100644 --- a/code/modules/antagonists/changeling/powers/humanform.dm +++ b/code/modules/antagonists/changeling/powers/humanform.dm @@ -16,7 +16,7 @@ names += "[prof.name]" var/chosen_name = tgui_input_list(user, "Target DNA", "Transformation", sort_list(names)) - if(!chosen_name) + if(isnull(chosen_name)) return var/datum/changelingprofile/chosen_prof = changeling.get_dna(chosen_name) diff --git a/code/modules/antagonists/cult/blood_magic.dm b/code/modules/antagonists/cult/blood_magic.dm index b327cab822f..493095a8a25 100644 --- a/code/modules/antagonists/cult/blood_magic.dm +++ b/code/modules/antagonists/cult/blood_magic.dm @@ -40,15 +40,15 @@ break if(rune) limit = MAX_BLOODCHARGE - if(spells.len >= limit) + if(length(spells) >= limit) if(rune) to_chat(owner, span_cultitalic("You cannot store more than [MAX_BLOODCHARGE] spells. Pick a spell to remove.")) else to_chat(owner, span_cultitalic("You cannot store more than [RUNELESS_MAX_BLOODCHARGE] spells without an empowering rune! Pick a spell to remove.")) var/nullify_spell = tgui_input_list(owner, "Spell to remove", "Current Spells", spells) - if(nullify_spell) - qdel(nullify_spell) - return + if(isnull(nullify_spell)) + return + qdel(nullify_spell) var/entered_spell_name var/datum/action/innate/cult/blood_spell/BS var/list/possible_spells = list() @@ -58,13 +58,15 @@ possible_spells[cult_name] = J possible_spells += "(REMOVE SPELL)" entered_spell_name = tgui_input_list(owner, "Blood spell to prepare", "Spell Choices", possible_spells) + if(isnull(entered_spell_name)) + return if(entered_spell_name == "(REMOVE SPELL)") var/nullify_spell = tgui_input_list(owner, "Spell to remove", "Current Spells", spells) - if(nullify_spell) - qdel(nullify_spell) - return + if(isnull(nullify_spell)) + return + qdel(nullify_spell) BS = possible_spells[entered_spell_name] - if(QDELETED(src) || owner.incapacitated() || !BS || (rune && !(locate(/obj/effect/rune/empower) in range(1, owner))) || (spells.len >= limit)) + if(QDELETED(src) || owner.incapacitated() || !BS || (rune && !(locate(/obj/effect/rune/empower) in range(1, owner))) || (length(spells) >= limit)) return to_chat(owner,span_warning("You begin to carve unnatural symbols into your flesh!")) SEND_SOUND(owner, sound('sound/weapons/slice.ogg',0,1,10)) @@ -478,7 +480,7 @@ for(var/obj/effect/rune/teleport/teleport_rune as anything in GLOB.teleport_runes) potential_runes[avoid_assoc_duplicate_keys(teleport_rune.listkey, teleportnames)] = teleport_rune - if(!potential_runes.len) + if(!length(potential_runes)) to_chat(user, span_warning("There are no valid runes to teleport to!")) return @@ -488,6 +490,11 @@ return var/input_rune_key = tgui_input_list(user, "Rune to teleport to", "Teleportation Target", potential_runes) //we know what key they picked + if(isnull(input_rune_key)) + return + if(isnull(potential_runes[input_rune_key])) + to_chat(user, span_warning("You must pick a valid rune!")) + return var/obj/effect/rune/teleport/actual_selected_rune = potential_runes[input_rune_key] //what rune does that key correspond to? if(QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated() || !actual_selected_rune || !proximity) return diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index 1e6f88dda75..9dd1880be8a 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -162,8 +162,8 @@ Striking a noncultist, however, will tear their flesh."} /obj/item/cult_bastard/examine(mob/user) . = ..() - if(contents.len) - . += "There are [contents.len] souls trapped within the sword's core." + if(length(contents)) + . += "There are [length(contents)] souls trapped within the sword's core." else . += "The sword appears to be quite lifeless." @@ -227,7 +227,7 @@ Striking a noncultist, however, will tear their flesh."} stone.attack(human_target, user) if(!LAZYLEN(stone.contents)) qdel(stone) - if(istype(target, /obj/structure/constructshell) && contents.len) + if(istype(target, /obj/structure/constructshell) && length(contents)) var/obj/item/soulstone/stone = contents[1] if(!istype(stone)) stone.forceMove(drop_location()) @@ -665,41 +665,39 @@ Striking a noncultist, however, will tear their flesh."} to_chat(user, "That doesn't seem to do anything useful.") return - if(istype(A, /obj/item)) - - var/list/cultists = list() - for(var/datum/mind/M as anything in get_antag_minds(/datum/antagonist/cult)) - if(M.current && M.current.stat != DEAD) - cultists |= M.current - var/mob/living/cultist_to_receive = tgui_input_list(user, "Who do you wish to call to [src]?", "Followers of the Geometer", (cultists - user)) - if(!Adjacent(user) || !src || QDELETED(src) || user.incapacitated()) - return - if(!cultist_to_receive) - to_chat(user, "You require a destination!") - log_game("Void torch failed - no target") - return - if(cultist_to_receive.stat == DEAD) - to_chat(user, "[cultist_to_receive] has died!") - log_game("Void torch failed - target died") - return - if(!IS_CULTIST(cultist_to_receive)) - to_chat(user, "[cultist_to_receive] is not a follower of the Geometer!") - log_game("Void torch failed - target was deconverted") - return - if(A in user.get_all_contents()) - to_chat(user, "[A] must be on a surface in order to teleport it!") - return - to_chat(user, "You ignite [A] with \the [src], turning it to ash, but through the torch's flames you see that [A] has reached [cultist_to_receive]!") - cultist_to_receive.put_in_hands(A) - charges-- - to_chat(user, "\The [src] now has [charges] charge\s.") - if(charges == 0) - qdel(src) - - else + if(!istype(A, /obj/item)) ..() to_chat(user, span_warning("\The [src] can only transport items!")) + return + var/list/cultists = list() + for(var/datum/mind/M as anything in get_antag_minds(/datum/antagonist/cult)) + if(M.current && M.current.stat != DEAD) + cultists |= M.current + var/mob/living/cultist_to_receive = tgui_input_list(user, "Who do you wish to call to [src]?", "Followers of the Geometer", (cultists - user)) + if(!Adjacent(user) || !src || QDELETED(src) || user.incapacitated()) + return + if(isnull(cultist_to_receive)) + to_chat(user, "You require a destination!") + log_game("Void torch failed - no target") + return + if(cultist_to_receive.stat == DEAD) + to_chat(user, "[cultist_to_receive] has died!") + log_game("Void torch failed - target died") + return + if(!IS_CULTIST(cultist_to_receive)) + to_chat(user, "[cultist_to_receive] is not a follower of the Geometer!") + log_game("Void torch failed - target was deconverted") + return + if(A in user.get_all_contents()) + to_chat(user, "[A] must be on a surface in order to teleport it!") + return + to_chat(user, "You ignite [A] with \the [src], turning it to ash, but through the torch's flames you see that [A] has reached [cultist_to_receive]!") + cultist_to_receive.put_in_hands(A) + charges-- + to_chat(user, "\The [src] now has [charges] charge\s.") + if(charges == 0) + qdel(src) /obj/item/melee/cultblade/halberd name = "bloody halberd" diff --git a/code/modules/antagonists/cult/runes.dm b/code/modules/antagonists/cult/runes.dm index 63d74fb6b1a..c1a4854da63 100644 --- a/code/modules/antagonists/cult/runes.dm +++ b/code/modules/antagonists/cult/runes.dm @@ -97,10 +97,10 @@ Runes can either be invoked by one's self or with many different cultists. Each to_chat(user, span_warning("You aren't able to understand the words of [src].")) return var/list/invokers = can_invoke(user) - if(invokers.len >= req_cultists) + if(length(invokers) >= req_cultists) invoke(invokers) else - to_chat(user, span_danger("You need [req_cultists - invokers.len] more adjacent cultists to use this rune in such a manner.")) + to_chat(user, span_danger("You need [req_cultists - length(invokers)] more adjacent cultists to use this rune in such a manner.")) fail_invoke() /obj/effect/rune/attack_animal(mob/living/simple_animal/user, list/modifiers) @@ -221,7 +221,7 @@ structure_check() searches for nearby cultist structures required for the invoca for(var/mob/living/M in T) if(!IS_CULTIST(M)) myriad_targets |= M - if(!myriad_targets.len) + if(!length(myriad_targets)) fail_invoke() log_game("Offer rune failed - no eligible targets") return @@ -250,7 +250,7 @@ structure_check() searches for nearby cultist structures required for the invoca rune_in_use = FALSE /obj/effect/rune/convert/proc/do_convert(mob/living/convertee, list/invokers) - if(invokers.len < 2) + if(length(invokers) < 2) for(var/M in invokers) to_chat(M, span_warning("You need at least two invokers to convert [convertee]!")) log_game("Offer rune failed - tried conversion with one invoker") @@ -300,7 +300,7 @@ structure_check() searches for nearby cultist structures required for the invoca return FALSE var/big_sac = FALSE - if((((ishuman(sacrificial) || iscyborg(sacrificial)) && sacrificial.stat != DEAD) || C.cult_team.is_sacrifice_target(sacrificial.mind)) && invokers.len < 3) + if((((ishuman(sacrificial) || iscyborg(sacrificial)) && sacrificial.stat != DEAD) || C.cult_team.is_sacrifice_target(sacrificial.mind)) && length(invokers) < 3) for(var/M in invokers) to_chat(M, span_cultitalic("[sacrificial] is too greatly linked to the world! You need three acolytes!")) log_game("Offer rune failed - not enough acolytes and target is living or sac target") @@ -395,7 +395,7 @@ structure_check() searches for nearby cultist structures required for the invoca if(teleport_rune != src && !is_away_level(teleport_rune.z)) potential_runes[avoid_assoc_duplicate_keys(teleport_rune.listkey, teleportnames)] = teleport_rune - if(!potential_runes.len) + if(!length(potential_runes)) to_chat(user, span_warning("There are no valid runes to teleport to!")) log_game("Teleport rune failed - no other teleport runes") fail_invoke() @@ -409,6 +409,11 @@ structure_check() searches for nearby cultist structures required for the invoca return var/input_rune_key = tgui_input_list(user, "Rune to teleport to", "Teleportation Target", potential_runes) //we know what key they picked + if(isnull(input_rune_key)) + return + if(isnull(potential_runes[input_rune_key])) + fail_invoke() + return var/obj/effect/rune/teleport/actual_selected_rune = potential_runes[input_rune_key] //what rune does that key correspond to? if(!Adjacent(user) || !src || QDELETED(src) || user.incapacitated() || !actual_selected_rune) fail_invoke() @@ -561,13 +566,15 @@ structure_check() searches for nearby cultist structures required for the invoca for(var/mob/living/M in T.contents) if(IS_CULTIST(M) && (M.stat == DEAD || !M.client || M.client.is_afk())) potential_revive_mobs |= M - if(!potential_revive_mobs.len) + if(!length(potential_revive_mobs)) to_chat(user, "There are no dead cultists on the rune!") log_game("Raise Dead rune failed - no cultists to revive") fail_invoke() return - if(potential_revive_mobs.len > 1) + if(length(potential_revive_mobs) > 1) mob_to_revive = tgui_input_list(user, "Cultist to revive", "Revive Cultist", potential_revive_mobs) + if(isnull(mob_to_revive)) + return else mob_to_revive = potential_revive_mobs[1] if(QDELETED(src) || !validness_checks(mob_to_revive, user)) @@ -668,10 +675,14 @@ structure_check() searches for nearby cultist structures required for the invoca for(var/datum/mind/M as anything in get_antag_minds(/datum/antagonist/cult)) if(!(M.current in invokers) && M.current && M.current.stat != DEAD) cultists |= M.current + if(length(cultists) <= 1) + to_chat(user, span_warning("There are no cultists to summon!")) + fail_invoke() + return var/mob/living/cultist_to_summon = tgui_input_list(user, "Who do you wish to call to [src]?", "Followers of the Geometer", cultists) if(!Adjacent(user) || !src || QDELETED(src) || user.incapacitated()) return - if(!cultist_to_summon) + if(isnull(cultist_to_summon)) to_chat(user, "You require a summoning target!") fail_invoke() log_game("Summon Cultist rune failed - no target") @@ -812,7 +823,7 @@ structure_check() searches for nearby cultist structures required for the invoca for(var/mob/dead/observer/O in T) if(O.client && !is_banned_from(O.ckey, ROLE_CULTIST) && !QDELETED(src) && !(isAdminObserver(O) && (O.client.prefs.toggles & ADMIN_IGNORE_CULT_GHOST)) && !QDELETED(O)) ghosts_on_rune += O - if(!ghosts_on_rune.len) + if(!length(ghosts_on_rune)) to_chat(user, span_cultitalic("There are no spirits near [src]!")) fail_invoke() log_game("Manifest rune failed - no nearby ghosts") @@ -910,7 +921,7 @@ structure_check() searches for nearby cultist structures required for the invoca var/mob/living/user = invokers[1] var/datum/antagonist/cult/user_antag = user.mind.has_antag_datum(/datum/antagonist/cult,TRUE) var/datum/objective/eldergod/summon_objective = locate() in user_antag.cult_team.objectives - if(summon_objective.summon_spots.len <= 1) + if(length(summon_objective.summon_spots) <= 1) to_chat(user, span_cultlarge("Only one ritual site remains - it must be reserved for the final summoning!")) return if(!(place in summon_objective.summon_spots)) @@ -924,7 +935,7 @@ structure_check() searches for nearby cultist structures required for the invoca for(var/mob/living/M in GLOB.player_list) if(IS_CULTIST(M)) intensity++ - intensity = max(60, 360 - (360*(intensity/GLOB.player_list.len + 0.3)**2)) //significantly lower intensity for "winning" cults + intensity = max(60, 360 - (360*(intensity/length(GLOB.player_list) + 0.3)**2)) //significantly lower intensity for "winning" cults var/duration = intensity*10 playsound(T, 'sound/magic/enter_blood.ogg', 100, TRUE) visible_message(span_warning("A colossal shockwave of energy bursts from the rune, disintegrating it in the process!")) diff --git a/code/modules/antagonists/eldritch_cult/eldritch_items.dm b/code/modules/antagonists/eldritch_cult/eldritch_items.dm index e0328adb991..1e7c4f88b46 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_items.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_items.dm @@ -337,7 +337,7 @@ if(!rune_ref.resolve()) current_runes -= rune_ref - if(current_runes.len >= max_rune_amt) + if(length(current_runes) >= max_rune_amt) to_chat(user,span_notice("The blade cannot support more runes!")) return @@ -349,7 +349,7 @@ drawing = TRUE var/type = pick_list[tgui_input_list(user, "Choose the rune", "Rune", pick_list) ] - if(!type) + if(isnull(type)) drawing = FALSE return diff --git a/code/modules/antagonists/eldritch_cult/eldritch_knowledge.dm b/code/modules/antagonists/eldritch_cult/eldritch_knowledge.dm index fe431738a70..8c01193cf7e 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_knowledge.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_knowledge.dm @@ -147,7 +147,7 @@ for(var/atom/requirements as anything in atoms) fingerprints |= requirements.return_fingerprints() list_clear_nulls(fingerprints) - if(fingerprints.len == 0) + if(!length(fingerprints)) return FALSE return TRUE @@ -160,12 +160,12 @@ compiled_list |= human_to_check.real_name compiled_list[human_to_check.real_name] = human_to_check - if(compiled_list.len == 0) + if(!length(compiled_list)) to_chat(user, span_warning("These items don't possess the required fingerprints or DNA.")) return FALSE - var/chosen_mob = tgui_input_list(user, "Select the person you wish to curse","Your target", sort_list(compiled_list, /proc/cmp_mob_realname_dsc)) - if(!chosen_mob) + var/chosen_mob = tgui_input_list(user, "Select the person you wish to curse", "Eldritch Curse", sort_list(compiled_list, /proc/cmp_mob_realname_dsc)) + if(isnull(chosen_mob)) return FALSE curse(compiled_list[chosen_mob]) addtimer(CALLBACK(src, .proc/uncurse, compiled_list[chosen_mob]),timer) @@ -292,7 +292,12 @@ if(!targeted) break targets["[targeted.current.real_name] the [targeted.assigned_role.title][is_teammate ? " (ally)" : ""]"] = targeted.current - heart.target = targets[input(user,"Choose your next target","Target") in targets] + var/chosen_target = tgui_input_list(user, "Choose a target", "Eldritch Targeting", targets) + if(isnull(chosen_target)) + return FALSE + if(isnull(targets[chosen_target])) + return FALSE + heart.target = targets[chosen_target] qdel(temp_objective) if(heart.target) to_chat(user,span_warning("Your new target has been selected, go and sacrifice [heart.target.real_name]!")) diff --git a/code/modules/antagonists/eldritch_cult/eldritch_magic.dm b/code/modules/antagonists/eldritch_cult/eldritch_magic.dm index e5af32783b6..6895ec949ca 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_magic.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_magic.dm @@ -586,7 +586,9 @@ if(!originator?.linked_mobs[living_owner]) CRASH("Uh oh the mansus link got somehow activated without it being linked to a raw prophet or the mob not being in a list of mobs that should be able to do it.") - var/message = sanitize(input("Message:", "Telepathy from the Manse") as text|null) + var/message = sanitize(tgui_input_text(living_owner, "Enter your message", "Telepathy from the Manse")) + if(!message) + return if(QDELETED(living_owner)) return @@ -595,14 +597,14 @@ to_chat(living_owner, span_warning("The link seems to have been severed...")) Remove(living_owner) return - if(message) - var/msg = "\[Mansus Link\] [living_owner]: [message]" - log_directed_talk(living_owner, originator, msg, LOG_SAY, "Mansus Link") - to_chat(originator.linked_mobs, msg) - for(var/dead_mob in GLOB.dead_mob_list) - var/link = FOLLOW_LINK(dead_mob, living_owner) - to_chat(dead_mob, "[link] [msg]") + var/msg = "\[Mansus Link\] [living_owner]: [message]" + log_directed_talk(living_owner, originator, msg, LOG_SAY, "Mansus Link") + to_chat(originator.linked_mobs, msg) + + for(var/dead_mob in GLOB.dead_mob_list) + var/link = FOLLOW_LINK(dead_mob, living_owner) + to_chat(dead_mob, "[link] [msg]") /obj/effect/proc_holder/spell/pointed/trigger/blind/eldritch range = 10 diff --git a/code/modules/antagonists/eldritch_cult/eldritch_structures.dm b/code/modules/antagonists/eldritch_cult/eldritch_structures.dm index e0f9c24afde..b82bb65616a 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_structures.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_structures.dm @@ -81,7 +81,12 @@ for(var/X in subtypesof(/obj/item/eldritch_potion)) var/obj/item/eldritch_potion/potion = X lst[initial(potion.name)] = potion - var/type = lst[input(user,"Choose your brew","Brew") in lst] + var/chosen_type = tgui_input_list(user, "Choose a brew", "Brewing", lst) + if(isnull(chosen_type)) + return + if(isnull(lst[chosen_type])) + return + var/type = lst[chosen_type] playsound(src, 'sound/misc/desecration-02.ogg', 75, TRUE) new type(drop_location()) current_mass = 0 diff --git a/code/modules/art/paintings.dm b/code/modules/art/paintings.dm index a67d77e4286..b536ece86ef 100644 --- a/code/modules/art/paintings.dm +++ b/code/modules/art/paintings.dm @@ -180,11 +180,10 @@ to_chat(user,span_notice("You can't afford this.")) return var/sniped_amount = painting_metadata.credit_value - var/offer_amount = input(user,"How much do you want to offer ? Minimum : [painting_metadata.credit_value]","Patronage Amount", painting_metadata.credit_value + 1) as num|null - if(account.account_balance < offer_amount) - to_chat(user,span_notice("You can't afford this.")) + var/offer_amount = tgui_input_number(user, "How much do you want to offer?", "Patronage Amount", (painting_metadata.credit_value + 1), account.account_balance, painting_metadata.credit_value) + if(isnull(offer_amount)) return - if(!offer_amount || sniped_amount != painting_metadata.credit_value || offer_amount < painting_metadata.credit_value+1 || !user.canUseTopic(src)) + if(offer_amount <= 0 || sniped_amount != painting_metadata.credit_value || offer_amount < painting_metadata.credit_value+1 || !user.canUseTopic(src)) return if(!account.adjust_money(-offer_amount)) to_chat(user,span_warning("Transaction failure. Please try again.")) diff --git a/code/modules/assembly/doorcontrol.dm b/code/modules/assembly/doorcontrol.dm index 36e1bfce801..07c0d699883 100644 --- a/code/modules/assembly/doorcontrol.dm +++ b/code/modules/assembly/doorcontrol.dm @@ -14,10 +14,11 @@ . += span_notice("Its channel ID is '[id]'.") /obj/item/assembly/control/multitool_act(mob/living/user) - var/change_id = input("Set the shutters/blast door/blast door controllers ID. It must be a number between 1 and 100.", "ID", id) as num|null - if(change_id) - id = clamp(round(change_id, 1), 1, 100) - to_chat(user, span_notice("You change the ID to [id].")) + var/change_id = tgui_input_number(user, "Set the door controllers ID", "ID", id, 100, 1) + if(isnull(change_id)) + return + id = round(change_id) + to_chat(user, span_notice("You change the ID to [id].")) /obj/item/assembly/control/activate() var/openclose diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index c20f6900c61..dde97728eae 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -620,8 +620,10 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister()) return switch(action) if("relabel") - var/label = tgui_input_list(usr, "New canister label", name, GLOB.gas_id_to_canister) - if(label && !..()) + var/label = tgui_input_list(usr, "New canister label", "Canister", GLOB.gas_id_to_canister) + if(isnull(label)) + return + if(!..()) var/newtype = GLOB.gas_id_to_canister[label] if(newtype) var/obj/machinery/portable_atmospherics/canister/replacement = newtype @@ -684,7 +686,7 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister()) logmsg += "\n[name]: [gaseslog[name]] moles." if(n <= 5) //the first five gases added admin_msg += "\n[name]: [gaseslog[name]] moles." - if(n == 5 && gaseslog.len > 5) //message added if more than 5 gases + if(n == 5 && length(gaseslog) > 5) //message added if more than 5 gases admin_msg += "\nToo many gases to log. Check investigate log." if(danger) //sent to admin's chat if contains dangerous gases message_admins(admin_msg) diff --git a/code/modules/awaymissions/bluespaceartillery.dm b/code/modules/awaymissions/bluespaceartillery.dm index a080e2f287e..60ccaaac647 100644 --- a/code/modules/awaymissions/bluespaceartillery.dm +++ b/code/modules/awaymissions/bluespaceartillery.dm @@ -37,9 +37,12 @@ /obj/machinery/artillerycontrol/Topic(href, href_list) if(..()) return - var/A - A = input("Area to bombard", "Open Fire", A) in GLOB.teleportlocs - var/area/thearea = GLOB.teleportlocs[A] + var/target_area = tgui_input_list(usr, "Area to bombard", "Open Fire", GLOB.teleportlocs) + if(isnull(target_area)) + return + if(isnull(GLOB.teleportlocs[target_area])) + return + var/area/thearea = GLOB.teleportlocs[target_area] if(usr.stat != CONSCIOUS || HAS_TRAIT(usr, TRAIT_HANDS_BLOCKED)) return if(reload < reload_cooldown) @@ -47,9 +50,9 @@ if(usr.contents.Find(src) || (in_range(src, usr) && isturf(loc)) || issilicon(usr)) priority_announce("Bluespace artillery fire detected. Brace for impact.") message_admins("[ADMIN_LOOKUPFLW(usr)] has launched an artillery strike.") - var/list/L = list() - for(var/turf/T in get_area_turfs(thearea.type)) - L+=T - var/loc = pick(L) - explosion(loc, explosiondev, explosionmed, explosionlight, explosion_cause = src) + var/list/possible_turfs = list() + for(var/turf/available_turf in get_area_turfs(thearea.type)) + possible_turfs += available_turf + var/random_turf = pick(possible_turfs) + explosion(random_turf, explosiondev, explosionmed, explosionlight, explosion_cause = src) reload = 0 diff --git a/code/modules/cargo/blackmarket/blackmarket_uplink.dm b/code/modules/cargo/blackmarket/blackmarket_uplink.dm index 1adac3ac8d3..fd49538d73b 100644 --- a/code/modules/cargo/blackmarket/blackmarket_uplink.dm +++ b/code/modules/cargo/blackmarket/blackmarket_uplink.dm @@ -37,14 +37,12 @@ if(!isliving(user) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return - var/amount_to_remove = FLOOR(input(user, "How much do you want to withdraw? Current Amount: [money]", "Withdraw Funds", 5) as num|null, 1) + var/amount_to_remove = tgui_input_number(user, "How much do you want to withdraw? Current Amount: [money]", "Withdraw Funds", 5, money, 1) + if(isnull(amount_to_remove)) + return if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return - - if(!amount_to_remove || amount_to_remove < 0) - return - if(amount_to_remove > money) - to_chat(user, span_warning("There is only [money] credits in [src]")) + if(amount_to_remove <= 0) return var/obj/item/holochip/holochip = new (user.drop_location(), amount_to_remove) diff --git a/code/modules/cargo/centcom_podlauncher.dm b/code/modules/cargo/centcom_podlauncher.dm index 4f2f5f32f1f..700a1134023 100644 --- a/code/modules/cargo/centcom_podlauncher.dm +++ b/code/modules/cargo/centcom_podlauncher.dm @@ -285,7 +285,7 @@ return var/list/expNames = list("Devastation", "Heavy Damage", "Light Damage", "Flame") //Explosions have a range of different types of damage var/list/boomInput = list() - for (var/i=1 to expNames.len) //Gather input from the user for the value of each type of damage + for (var/i=1 to length(expNames)) //Gather input from the user for the value of each type of damage boomInput.Add(input("Enter the [expNames[i]] range of the explosion. WARNING: This ignores the bomb cap!", "[expNames[i]] Range", 0) as null|num) if (isnull(boomInput[i])) return @@ -456,7 +456,7 @@ continue var/sound/found = playing_sound if (found.file == tempSound.file) - soundLen = found.len + soundLen = length(found) if (!soundLen) soundLen = input(holder, "Couldn't auto-determine sound file length. What is the exact length of the sound file, in seconds. This number will be used to line the sound up so that it finishes right as the pod lands!", "Pick a Sound File", 0.3) as null|num if (isnull(soundLen)) @@ -689,7 +689,7 @@ acceptableTurfs = list() for (var/t in orderedArea) //Go through the orderedArea list var/turf/unchecked_turf = t - if (iswallturf(unchecked_turf) || typecache_filter_list_reverse(unchecked_turf.contents, ignored_atoms).len != 0) //if there is something in this turf that isn't in the blacklist, we consider this turf "acceptable" and add it to the acceptableTurfs list + if (iswallturf(unchecked_turf) || length(typecache_filter_list_reverse(unchecked_turf.contents, ignored_atoms))) //if there is something in this turf that isn't in the blacklist, we consider this turf "acceptable" and add it to the acceptableTurfs list acceptableTurfs.Add(unchecked_turf) //Because orderedArea was an ordered linear list, acceptableTurfs will be as well. numTurfs ++ @@ -703,7 +703,7 @@ if (iswallturf(accepted_turf)) launchList += accepted_turf if(LAUNCH_ORDERED) //If we are launching one at a time - if (launchCounter > acceptableTurfs.len) //Check if the launchCounter, which acts as an index, is too high. If it is, reset it to 1 + if (launchCounter > length(acceptableTurfs)) //Check if the launchCounter, which acts as an index, is too high. If it is, reset it to 1 launchCounter = 1 //Note that the launchCounter index is incremented in the launch() proc var/turf/next_turf_in_line = acceptableTurfs[launchCounter] launchList |= typecache_filter_list_reverse(next_turf_in_line.contents, ignored_atoms) //Filter the specicic turf chosen from acceptableTurfs, and add it to the launchList @@ -774,7 +774,7 @@ /datum/centcom_podlauncher/proc/updateSelector() //Ensures that the selector effect will showcase the next item if needed if (launchChoice == LAUNCH_ORDERED && length(acceptableTurfs) > 1 && !temp_pod.reversing && !temp_pod.effectMissile) //We only show the selector if we are taking items from the bay var/index = (launchCounter == 1 ? launchCounter : launchCounter + 1) //launchCounter acts as an index to the ordered acceptableTurfs list, so adding one will show the next item in the list. We don't want to do this for the very first item tho - if (index > acceptableTurfs.len) //out of bounds check + if (index > length(acceptableTurfs)) //out of bounds check index = 1 selector.forceMove(acceptableTurfs[index]) //forceMove the selector to the next turf in the ordered acceptableTurfs list else diff --git a/code/modules/client/verbs/ooc.dm b/code/modules/client/verbs/ooc.dm index 4837dc037cd..5763aadbaab 100644 --- a/code/modules/client/verbs/ooc.dm +++ b/code/modules/client/verbs/ooc.dm @@ -251,7 +251,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8") players[displayed_key] = displayed_key // Check if the list is empty - if(!players.len) + if(!length(players)) // Express that there are no players we can ignore in chat to_chat(src, "There are no other players you can ignore!") @@ -262,10 +262,10 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8") players = sort_list(players) // Request the player to ignore - var/selection = input("Please, select a player!", "Ignore", null, null) as null|anything in players + var/selection = tgui_input_list(src, "Select a player", "Ignore", players) // Stop running if we didn't receieve a valid selection - if(!selection || !(selection in players)) + if(isnull(selection) || !(selection in players)) return // Store the selected player @@ -295,7 +295,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8") set desc = "Stop ignoring a player's messages on the OOC channel" // Check if we've ignored any players - if(!prefs.ignoring.len) + if(!length(prefs.ignoring)) // Express that we haven't ignored any players in chat to_chat(src, "You haven't ignored any players!") @@ -303,10 +303,10 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8") return // Request the player to unignore - var/selection = input("Please, select a player!", "Unignore", null, null) as null|anything in prefs.ignoring + var/selection = tgui_input_list(src, "Select a player", "Unignore", prefs.ignoring) // Stop running if we didn't receive a selection - if(!selection) + if(isnull(selection)) return // Check if the selected player is not on our ignore list diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm index 0fce9fff197..3c5f7c6b62e 100644 --- a/code/modules/clothing/chameleon.dm +++ b/code/modules/clothing/chameleon.dm @@ -93,12 +93,14 @@ /datum/action/chameleon_outfit/proc/select_outfit(mob/user) if(!user || !IsAvailable()) return FALSE - var/selected = input("Select outfit to change into", "Chameleon Outfit") as null|anything in outfit_options + var/selected = tgui_input_list(user, "Select outfit to change into", "Chameleon Outfit", outfit_options) + if(isnull(selected)) + return FALSE if(!IsAvailable() || QDELETED(src) || QDELETED(user)) return FALSE - var/outfit_type = outfit_options[selected] - if(!outfit_type) + if(isnull(outfit_options[selected])) return FALSE + var/outfit_type = outfit_options[selected] var/datum/outfit/job/O = new outfit_type() var/list/outfit_types = O.get_chameleon_disguise_info() var/datum/job/job_datum = SSjob.GetJobType(O.jobtype) @@ -177,13 +179,12 @@ /datum/action/item_action/chameleon/change/proc/select_look(mob/user) var/obj/item/picked_item - var/picked_name - picked_name = input("Select [chameleon_name] to change into", "Chameleon [chameleon_name]", picked_name) as null|anything in sort_list(chameleon_list, /proc/cmp_typepaths_asc) - if(!picked_name) + var/picked_name = tgui_input_list(user, "Select [chameleon_name] to change into", "Chameleon Settings", sort_list(chameleon_list, /proc/cmp_typepaths_asc)) + if(isnull(picked_name)) + return + if(isnull(chameleon_list[picked_name])) return picked_item = chameleon_list[picked_name] - if(!picked_item) - return update_look(user, picked_item) /datum/action/item_action/chameleon/change/proc/random_look(mob/user) diff --git a/code/modules/clothing/head/wig.dm b/code/modules/clothing/head/wig.dm index 67a9ff2f68a..02cba05db56 100644 --- a/code/modules/clothing/head/wig.dm +++ b/code/modules/clothing/head/wig.dm @@ -47,7 +47,7 @@ hair_overlay.overlays += emissive_blocker(hair_overlay.icon, hair_overlay.icon_state, alpha = hair_overlay.alpha) /obj/item/clothing/head/wig/attack_self(mob/user) - var/new_style = input(user, "Select a hairstyle", "Wig Styling") as null|anything in (GLOB.hairstyles_list - "Bald") + var/new_style = tgui_input_list(user, "Select a hairstyle", "Wig Styling", GLOB.hairstyles_list - "Bald") var/newcolor = adjustablecolor ? input(usr,"","Choose Color",color) as color|null : null if(!user.canUseTopic(src, BE_CLOSE)) return diff --git a/code/modules/clothing/under/_under.dm b/code/modules/clothing/under/_under.dm index deeb081df71..00cec80bd09 100644 --- a/code/modules/clothing/under/_under.dm +++ b/code/modules/clothing/under/_under.dm @@ -247,7 +247,9 @@ return var/list/modes = list("Off", "Binary vitals", "Exact vitals", "Tracking beacon") - var/switchMode = input("Select a sensor mode:", "Suit Sensor Mode", modes[sensor_mode + 1]) in modes + var/switchMode = tgui_input_list(M, "Select a sensor mode", "Suit Sensors", modes, modes[sensor_mode + 1]) + if(isnull(switchMode)) + return if(get_dist(usr, src) > 1) to_chat(usr, span_warning("You have moved too far away!")) return diff --git a/code/modules/economy/pay_stand.dm b/code/modules/economy/pay_stand.dm index c14431aa239..fc84bab90dc 100644 --- a/code/modules/economy/pay_stand.dm +++ b/code/modules/economy/pay_stand.dm @@ -27,10 +27,10 @@ name = rename_msg return else if(choice == "Set the fee") - var/force_fee_input = input(user,"Set the fee!","Set a fee!",0) as num|null + var/force_fee_input = tgui_input_number(user, "Set the fee", "Fee", max_value = 10000) if(isnull(force_fee_input) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return - force_fee = force_fee_input + force_fee = round(force_fee_input) return locked = !locked to_chat(user, span_notice("You [src.locked ? "lock" : "unlock"] the paystand, protecting the bolts from [anchored ? "loosening" : "tightening"].")) diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index 2391d736300..6fd380f0fc2 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -150,12 +150,12 @@ update_appearance() return else - bomb_timer = input(user, "Set the [bomb] timer from [bomb_timer_min] to [bomb_timer_max].", bomb, bomb_timer) as num|null + bomb_timer = tgui_input_number(user, "Set the timer for [bomb].", "Pizza Bomb", bomb_timer, bomb_timer_max, bomb_timer_min) if (isnull(bomb_timer)) return - bomb_timer = clamp(CEILING(bomb_timer, 1), bomb_timer_min, bomb_timer_max) + bomb_timer = round(bomb_timer) bomb_defused = FALSE log_bomber(user, "has trapped a", src, "with [bomb] set to [bomb_timer] seconds") diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index f945279421c..164b733e384 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -737,8 +737,8 @@ if(!(gene.mutability_flags & PLANT_GENE_REMOVABLE)) continue // Don't show genes that can't be removed. current_traits[gene.name] = gene - var/removed_trait = (input(user, "Select a trait to remove from the [myseed.plantname].", "Plant Trait Removal") as null|anything in sort_list(current_traits)) - if(removed_trait == null) + var/removed_trait = tgui_input_list(user, "Trait to remove from the [myseed.plantname]", "Plant Trait Removal", sort_list(current_traits)) + if(isnull(removed_trait)) return if(!user.canUseTopic(src, BE_CLOSE)) return @@ -818,8 +818,12 @@ for(var/muties in myseed.mutatelist) var/obj/item/seeds/another_mut = new muties fresh_mut_list[another_mut.plantname] = muties - var/locked_mutation = (input(user, "Select a mutation to lock.", "Plant Mutation Locks") as null|anything in sort_list(fresh_mut_list)) - if(!user.canUseTopic(src, BE_CLOSE) || !locked_mutation) + var/locked_mutation = tgui_input_list(user, "Mutation to lock", "Plant Mutation Locks", sort_list(fresh_mut_list)) + if(isnull(locked_mutation)) + return + if(isnull(fresh_mut_list[locked_mutation])) + return + if(!user.canUseTopic(src, BE_CLOSE)) return myseed.mutatelist = list(fresh_mut_list[locked_mutation]) myseed.set_endurance(myseed.endurance/2) diff --git a/code/modules/instruments/songs/editor.dm b/code/modules/instruments/songs/editor.dm index 78c8ab5df00..812f2f0cef7 100644 --- a/code/modules/instruments/songs/editor.dm +++ b/code/modules/instruments/songs/editor.dm @@ -135,8 +135,8 @@ return if(length_char(t) >= MUSIC_MAXLINES * MUSIC_MAXLINECHARS) - var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no") - if(cont == "no") + var/cont = tgui_alert(usr, "Your message is too long! Would you like to continue editing it?", "Warning", list("Yes", "No")) + if(cont != "Yes") break while(length_char(t) > MUSIC_MAXLINES * MUSIC_MAXLINECHARS) ParseSong(t) @@ -157,7 +157,7 @@ INVOKE_ASYNC(src, .proc/start_playing, usr) else if(href_list["newline"]) - var/newline = html_encode(input("Enter your line: ", parent.name) as text|null) + var/newline = tgui_input_text(usr, "Enter your line ", parent.name) if(!newline || !in_range(parent, usr)) return if(lines.len > MUSIC_MAXLINES) @@ -174,7 +174,7 @@ else if(href_list["modifyline"]) var/num = round(text2num(href_list["modifyline"]),1) - var/content = stripped_input(usr, "Enter your line: ", parent.name, lines[num], MUSIC_MAXLINECHARS) + var/content = tgui_input_text(usr, "Enter your line ", parent.name, lines[num], MUSIC_MAXLINECHARS) if(!content || !in_range(parent, usr)) return if(num > lines.len || num < 1) @@ -185,22 +185,22 @@ stop_playing() else if(href_list["setlinearfalloff"]) - var/amount = input(usr, "Set linear sustain duration in seconds", "Linear Sustain Duration") as null|num + var/amount = tgui_input_number(usr, "Set linear sustain duration in seconds", "Linear Sustain Duration") if(!isnull(amount)) set_linear_falloff_duration(amount) else if(href_list["setexpfalloff"]) - var/amount = input(usr, "Set exponential sustain factor", "Exponential sustain factor") as null|num + var/amount = tgui_input_number(usr, "Set exponential sustain factor", "Exponential sustain factor") if(!isnull(amount)) set_exponential_drop_rate(amount) else if(href_list["setvolume"]) - var/amount = input(usr, "Set volume", "Volume") as null|num + var/amount = tgui_input_number(usr, "Set volume", "Volume") if(!isnull(amount)) set_volume(amount) else if(href_list["setdropoffvolume"]) - var/amount = input(usr, "Set dropoff threshold", "Dropoff Threshold Volume") as null|num + var/amount = tgui_input_number(usr, "Set dropoff threshold", "Dropoff Threshold Volume") if(!isnull(amount)) set_dropoff_volume(amount) @@ -215,12 +215,14 @@ var/datum/instrument/I = SSinstruments.get_instrument(i) if(I) LAZYSET(categories[I.category || "ERROR CATEGORY"], I.name, I.id) - var/cat = input(usr, "Select Category", "Instrument Category") as null|anything in categories - if(!cat) + var/cat = tgui_input_list(usr, "Select Category", "Instrument Category", categories) + if(isnull(cat)) return var/list/instruments = categories[cat] - var/choice = input(usr, "Select Instrument", "Instrument Selection") as null|anything in instruments - if(!choice) + var/choice = tgui_input_list(usr, "Select Instrument", "Instrument Selection", instruments) + if(isnull(choice)) + return + if(isnull(instruments[choice])) return choice = instruments[choice] //get id if(choice) @@ -232,7 +234,7 @@ note_shift = clamp(amount, note_shift_min, note_shift_max) else if(href_list["setsustainmode"]) - var/choice = input(usr, "Choose a sustain mode", "Sustain Mode") as null|anything in SSinstruments.note_sustain_modes + var/choice = tgui_input_list(usr, "Choose a sustain mode", "Sustain Mode", SSinstruments.note_sustain_modes) if(choice) sustain_mode = SSinstruments.note_sustain_modes[choice] diff --git a/code/modules/language/language_menu.dm b/code/modules/language/language_menu.dm index cb8b4d49146..f2cebf052d0 100644 --- a/code/modules/language/language_menu.dm +++ b/code/modules/language/language_menu.dm @@ -85,7 +85,9 @@ if("grant_language") if((is_admin || isobserver(AM)) && language_datum) var/list/choices = list("Only Spoken", "Only Understood", "Both") - var/choice = input(user,"How do you want to add this language?","[language_datum]",null) as null|anything in choices + var/choice = tgui_input_list(user, "How do you want to add this language?", "[language_datum]", choices) + if(isnull(choice)) + return var/spoken = FALSE var/understood = FALSE switch(choice) @@ -108,7 +110,9 @@ if("remove_language") if((is_admin || isobserver(AM)) && language_datum) var/list/choices = list("Only Spoken", "Only Understood", "Both") - var/choice = input(user,"Which part do you wish to remove?","[language_datum]",null) as null|anything in choices + var/choice = tgui_input_list(user, "Which part do you wish to remove?", "[language_datum]", choices) + if(isnull(choice)) + return var/spoken = FALSE var/understood = FALSE switch(choice) diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index 81f11d9514a..d0a60f56fd9 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -113,7 +113,7 @@ if(!user.is_literate()) to_chat(user, span_notice("You scribble illegibly on the side of [src]!")) return - var/newname = stripped_input(user, "What would you like to title this bookshelf?") + var/newname = tgui_input_text(user, "What would you like to title this bookshelf?", "Bookshelf Renaming", max_length = MAX_NAME_LEN) if(!user.canUseTopic(src, BE_CLOSE)) return if(!newname) @@ -121,7 +121,7 @@ else name = "bookcase ([sanitize(newname)])" else if(I.tool_behaviour == TOOL_CROWBAR) - if(contents.len) + if(length(contents)) to_chat(user, span_warning("You need to remove the books first!")) else I.play_tool_sound(src, 100) @@ -142,17 +142,19 @@ if(load_random_books) create_random_books(books_to_load, src, FALSE, random_category) load_random_books = FALSE - if(contents.len) - var/obj/item/book/choice = input(user, "Which book would you like to remove from the shelf?") as null|obj in sort_names(contents.Copy()) - if(choice) - if(!(user.mobility_flags & MOBILITY_USE) || user.stat != CONSCIOUS || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !in_range(loc, user)) - return - if(ishuman(user)) - if(!user.get_active_held_item()) - user.put_in_hands(choice) - else - choice.forceMove(drop_location()) - update_appearance() + if(!length(contents)) + return + var/obj/item/book/choice = tgui_input_list(user, "Book to remove from the shelf", "Remove Book", sort_names(contents.Copy())) + if(isnull(choice)) + return + if(!(user.mobility_flags & MOBILITY_USE) || user.stat != CONSCIOUS || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !in_range(loc, user)) + return + if(ishuman(user)) + if(!user.get_active_held_item()) + user.put_in_hands(choice) + else + choice.forceMove(drop_location()) + update_appearance() /obj/structure/bookcase/deconstruct(disassembled = TRUE) @@ -169,7 +171,7 @@ if(state == BOOKCASE_UNANCHORED || state == BOOKCASE_ANCHORED) icon_state = "bookempty" return ..() - var/amount = contents.len + var/amount = length(contents) if(load_random_books) amount += books_to_load icon_state = "book-[clamp(amount, 0, 5)]" @@ -249,12 +251,14 @@ if(!literate) to_chat(user, span_notice("You scribble illegibly on the cover of [src]!")) return - var/choice = tgui_input_list(usr, "What would you like to change?",,list("Title", "Contents", "Author", "Cancel")) + var/choice = tgui_input_list(usr, "What would you like to change?", "Book Alteration", list("Title", "Contents", "Author", "Cancel")) + if(isnull(choice)) + return if(!user.canUseTopic(src, BE_CLOSE, literate)) return switch(choice) if("Title") - var/newtitle = reject_bad_text(stripped_input(user, "Write a new title:")) + var/newtitle = reject_bad_text(tgui_input_text(user, "Write a new title", "Book Title", max_length = 30)) if(!user.canUseTopic(src, BE_CLOSE, literate)) return if (length_char(newtitle) > 30) @@ -267,7 +271,7 @@ name = newtitle title = newtitle if("Contents") - var/content = stripped_input(user, "Write your book's contents (HTML NOT allowed):","","",8192) + var/content = tgui_input_text(user, "Write your book's contents (HTML NOT allowed)", "Book Contents", max_length = 8192, multiline = TRUE) if(!user.canUseTopic(src, BE_CLOSE, literate)) return if(!content) @@ -276,7 +280,7 @@ else dat += content if("Author") - var/newauthor = stripped_input(user, "Write the author's name:") + var/newauthor = tgui_input_text(user, "Write the author's name", "Author Name", max_length = MAX_NAME_LEN) if(!user.canUseTopic(src, BE_CLOSE, literate)) return if(!newauthor) diff --git a/code/modules/library/lib_machines.dm b/code/modules/library/lib_machines.dm index 1eb2739e8be..848d2e0cc36 100644 --- a/code/modules/library/lib_machines.dm +++ b/code/modules/library/lib_machines.dm @@ -120,7 +120,7 @@ else title = null if(href_list["setcategory"]) - var/newcategory = tgui_input_list(usr, "Choose a category to search for:",, list("Any", "Fiction", "Non-Fiction", "Adult", "Reference", "Religion")) + var/newcategory = tgui_input_list(usr, "Choose a category to search for", "Category Search", list("Any", "Fiction", "Non-Fiction", "Adult", "Reference", "Religion")) if(newcategory) category = sanitize(newcategory) else @@ -409,17 +409,17 @@ if(b && istype(b)) inventory.Remove(b) if(href_list["setauthor"]) - var/newauthor = stripped_input(usr, "Enter the author's name: ", max_length = 45) + var/newauthor = stripped_input(usr, "Enter the author's name", "Set Author", max_length = MAX_NAME_LEN) if(newauthor) scanner.cache.author = newauthor if(href_list["setcategory"]) - var/newcategory = tgui_input_list(usr, "Choose a category: ",, list("Fiction", "Non-Fiction", "Adult", "Reference", "Religion","Technical")) + var/newcategory = tgui_input_list(usr, "Choose a category", "Set Category", list("Fiction", "Non-Fiction", "Adult", "Reference", "Religion","Technical")) if(newcategory) upload_category = newcategory if(href_list["upload"]) if(scanner) if(scanner.cache) - var/choice = tgui_alert(usr, "Are you certain you wish to upload this title to the Archive?",, list("Confirm", "Abort")) + var/choice = tgui_alert(usr, "Are you certain you wish to upload this title to the Archive?", "Confirm Upload", list("Confirm", "Abort")) if(choice == "Confirm") if (!SSdbcore.Connect()) tgui_alert(usr,"Connection to Archive has been severed. Aborting.") diff --git a/code/modules/mining/equipment/marker_beacons.dm b/code/modules/mining/equipment/marker_beacons.dm index 336e6d1a0f4..fb867287aa3 100644 --- a/code/modules/mining/equipment/marker_beacons.dm +++ b/code/modules/mining/equipment/marker_beacons.dm @@ -62,12 +62,13 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sort_list(list( /obj/item/stack/marker_beacon/AltClick(mob/living/user) if(!istype(user) || !user.canUseTopic(src, BE_CLOSE)) return - var/input_color = input(user, "Choose a color.", "Beacon Color") as null|anything in GLOB.marker_beacon_colors + var/input_color = tgui_input_list(user, "Choose a color", "Beacon Color", GLOB.marker_beacon_colors) + if(isnull(input_color)) + return if(!istype(user) || !user.canUseTopic(src, BE_CLOSE)) return - if(input_color) - picked_color = input_color - update_appearance() + picked_color = input_color + update_appearance() /obj/structure/marker_beacon name = "marker beacon" @@ -148,12 +149,13 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sort_list(list( ..() if(!istype(user) || !user.canUseTopic(src, BE_CLOSE)) return - var/input_color = input(user, "Choose a color.", "Beacon Color") as null|anything in GLOB.marker_beacon_colors + var/input_color = tgui_input_list(user, "Choose a color", "Beacon Color", GLOB.marker_beacon_colors) + if(isnull(input_color)) + return if(!istype(user) || !user.canUseTopic(src, BE_CLOSE)) return - if(input_color) - picked_color = input_color - update_appearance() + picked_color = input_color + update_appearance() /* Preset marker beacon types, for mapping */ diff --git a/code/modules/mining/fulton.dm b/code/modules/mining/fulton.dm index 8e0afab7eee..b0179345d36 100644 --- a/code/modules/mining/fulton.dm +++ b/code/modules/mining/fulton.dm @@ -19,23 +19,17 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons) /obj/item/extraction_pack/attack_self(mob/user) var/list/possible_beacons = list() - for(var/B in GLOB.total_extraction_beacons) - var/obj/structure/extraction_point/EP = B - if(EP.beacon_network in beacon_networks) - possible_beacons += EP - - if(!possible_beacons.len) + for(var/obj/structure/extraction_point/extraction_point as anything in GLOB.total_extraction_beacons) + if(extraction_point.beacon_network in beacon_networks) + possible_beacons += extraction_point + if(!length(possible_beacons)) to_chat(user, span_warning("There are no extraction beacons in existence!")) return - else - var/A - - A = input("Select a beacon to connect to", "Balloon Extraction Pack", A) as null|anything in sort_names(possible_beacons) - - if(!A) + var/chosen_beacon = tgui_input_list(user, "Beacon to connect to", "Balloon Extraction Pack", sort_names(possible_beacons)) + if(isnull(chosen_beacon)) return - beacon = A + beacon = chosen_beacon to_chat(user, span_notice("You link the extraction pack to the beacon system.")) /obj/item/extraction_pack/afterattack(atom/movable/A, mob/living/carbon/human/user, flag, params) diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 1da174fde37..5360ec8a910 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -284,7 +284,7 @@ if (params["sheets"]) desired = text2num(params["sheets"]) else - desired = tgui_input_number(usr, "How many sheets would you like to smelt?", "Smelt") + desired = tgui_input_number(usr, "How many sheets would you like to smelt?", "Smelt", 1, stored_amount, 1) if(isnull(desired)) return desired = round(desired) @@ -334,7 +334,7 @@ if (params["sheets"]) desired = text2num(params["sheets"]) else - desired = tgui_input_number(usr, "How many sheets would you like to smelt?", "Smelt") + desired = tgui_input_number(usr, "How many sheets would you like to smelt?", "Smelt", 1, smelt_amount, 1) if(isnull(desired)) return desired = round(desired) diff --git a/code/modules/mining/machine_vending.dm b/code/modules/mining/machine_vending.dm index 183a743fb28..0380ef2ffaf 100644 --- a/code/modules/mining/machine_vending.dm +++ b/code/modules/mining/machine_vending.dm @@ -169,8 +169,10 @@ /obj/machinery/mineral/equipment_vendor/proc/RedeemVoucher(obj/item/mining_voucher/voucher, mob/redeemer) var/items = list("Survival Capsule and Explorer's Webbing", "Resonator Kit", "Minebot Kit", "Extraction and Rescue Kit", "Crusher Kit", "Mining Conscription Kit") - var/selection = input(redeemer, "Pick your equipment", "Mining Voucher Redemption") as null|anything in sort_list(items) - if(!selection || !Adjacent(redeemer) || QDELETED(voucher) || voucher.loc != redeemer) + var/selection = tgui_input_list(redeemer, "Pick your equipment", "Mining Voucher Redemption", sort_list(items)) + if(isnull(selection)) + return + if(!Adjacent(redeemer) || QDELETED(voucher) || voucher.loc != redeemer) return var/drop_location = drop_location() switch(selection) diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm index f5457aba128..706733868a9 100644 --- a/code/modules/mob/dead/dead.dm +++ b/code/modules/mob/dead/dead.dm @@ -51,7 +51,7 @@ INITIALIZE_IMMEDIATE(/mob/dead) . += "Players: [SSticker.totalPlayers]" if(client.holder) . += "Players Ready: [SSticker.totalPlayersReady]" - . += "Admins Ready: [SSticker.total_admins_ready] / [GLOB.admins.len]" + . += "Admins Ready: [SSticker.total_admins_ready] / [length(GLOB.admins)]" /mob/dead/proc/server_hop() set category = "OOC" @@ -62,7 +62,7 @@ INITIALIZE_IMMEDIATE(/mob/dead) var/list/our_id = CONFIG_GET(string/cross_comms_name) var/list/csa = CONFIG_GET(keyed_list/cross_server) - our_id var/pick - switch(csa.len) + switch(length(csa)) if(0) remove_verb(src, /mob/dead/proc/server_hop) to_chat(src, span_notice("Server Hop has been disabled.")) @@ -71,7 +71,7 @@ INITIALIZE_IMMEDIATE(/mob/dead) else pick = tgui_input_list(src, "Server to jump to", "Server Hop", csa) - if(!pick) + if(isnull(pick)) return var/addr = csa[pick] diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 4279b270dab..6b0514463c9 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -118,7 +118,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) if(!T || is_secret_level(T.z)) var/list/turfs = get_area_turfs(/area/shuttle/arrival) - if(turfs.len) + if(length(turfs)) T = pick(turfs) else T = SSmapping.get_station_center() @@ -441,14 +441,17 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp filtered += A var/area/thearea = tgui_input_list(usr, "Area to jump to", "BOOYEA", filtered) - if(!thearea) + if(isnull(thearea)) + return + if(!isobserver(usr)) + to_chat(usr, span_warning("Not when you're not dead!")) return var/list/L = list() for(var/turf/T in get_area_turfs(thearea.type)) L+=T - if(!L || !L.len) + if(!L || !length(L)) to_chat(usr, span_warning("No area available.")) return @@ -510,8 +513,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/target = null target = tgui_input_list(usr, "Please, select a player!", "Jump to Mob", possible_destinations) - - if (!target || !isobserver(usr)) + if(isnull(target)) + return + if (!isobserver(usr)) return var/mob/destination_mob = possible_destinations[target] //Destination mob @@ -879,8 +883,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/target = null target = tgui_input_list(usr, "Please, select a player!", "Jump to Mob", possible_destinations) - - if (!target || !isobserver(usr)) + if(isnull(target)) + return + if (!isobserver(usr)) return var/mob/chosen_target = possible_destinations[target] @@ -1032,7 +1037,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp I.appearance = MA t_ray_images += I stored_t_ray_images += t_ray_images - if(t_ray_images.len) + if(length(t_ray_images)) if(t_ray_view) client.images += t_ray_images else diff --git a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm index f76ac02444f..23749a0d9bf 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm @@ -85,31 +85,33 @@ Doesn't work on other aliens/AI.*/ action_icon_state = "alien_whisper" /obj/effect/proc_holder/alien/whisper/fire(mob/living/carbon/user) - var/list/options = list() - for(var/mob/living/Ms in oview(user)) - options += Ms - var/mob/living/M = input("Select who to whisper to:","Whisper to?",null) as null|mob in sort_names(options) - if(!M) + var/list/possible_recipients = list() + for(var/mob/living/recipient in oview(user)) + possible_recipients.Add(recipient) + if(!length(possible_recipients)) + to_chat(user, span_noticealien("There's no one around to whisper to.")) return FALSE - if(M.anti_magic_check(FALSE, FALSE, TRUE, 0)) - to_chat(user, span_noticealien("As you try to communicate with [M], you're suddenly stopped by a vision of a massive tinfoil wall that streches beyond visible range. It seems you've been foiled.")) + var/mob/living/chosen_recipient = tgui_input_list(user, "Select whisper recipient", "Whisper", sort_names(possible_recipients)) + if(isnull(chosen_recipient)) return FALSE - var/msg = sanitize(input("Message:", "Alien Whisper") as text|null) - if(msg) - if(M.anti_magic_check(FALSE, FALSE, TRUE, 0)) - to_chat(user, span_notice("As you try to communicate with [M], you're suddenly stopped by a vision of a massive tinfoil wall that streches beyond visible range. It seems you've been foiled.")) - return - log_directed_talk(user, M, msg, LOG_SAY, tag="alien whisper") - to_chat(M, "[span_noticealien("You hear a strange, alien voice in your head...")][msg]") - to_chat(user, span_noticealien("You said: \"[msg]\" to [M]")) - for(var/ded in GLOB.dead_mob_list) - if(!isobserver(ded)) - continue - var/follow_link_user = FOLLOW_LINK(ded, user) - var/follow_link_whispee = FOLLOW_LINK(ded, M) - to_chat(ded, "[follow_link_user] [span_name("[user]")] [span_alertalien("Alien Whisper --> ")] [follow_link_whispee] [span_name("[M]")] [span_noticealien("[msg]")]") - else + if(chosen_recipient.anti_magic_check(FALSE, FALSE, TRUE, 0)) + to_chat(user, span_noticealien("As you try to communicate with [chosen_recipient], you're suddenly stopped by a vision of a massive tinfoil wall that streches beyond visible range. It seems you've been foiled.")) return FALSE + var/msg = tgui_input_text(user, title = "Alien Whisper") + if(isnull(msg)) + return FALSE + if(chosen_recipient.anti_magic_check(FALSE, FALSE, TRUE, 0)) + to_chat(user, span_notice("As you try to communicate with [chosen_recipient], you're suddenly stopped by a vision of a massive tinfoil wall that streches beyond visible range. It seems you've been foiled.")) + return + log_directed_talk(user, chosen_recipient, msg, LOG_SAY, tag="alien whisper") + to_chat(chosen_recipient, "[span_noticealien("You hear a strange, alien voice in your head...")][msg]") + to_chat(user, span_noticealien("You said: \"[msg]\" to [chosen_recipient]")) + for(var/ded in GLOB.dead_mob_list) + if(!isobserver(ded)) + continue + var/follow_link_user = FOLLOW_LINK(ded, user) + var/follow_link_whispee = FOLLOW_LINK(ded, chosen_recipient) + to_chat(ded, "[follow_link_user] [span_name("[user]")] [span_alertalien("Alien Whisper --> ")] [follow_link_whispee] [span_name("[chosen_recipient]")] [span_noticealien("[msg]")]") return TRUE /obj/effect/proc_holder/alien/transfer @@ -120,23 +122,28 @@ Doesn't work on other aliens/AI.*/ /obj/effect/proc_holder/alien/transfer/fire(mob/living/carbon/user) var/list/mob/living/carbon/aliens_around = list() - for(var/mob/living/carbon/A in oview(user)) - if(A.getorgan(/obj/item/organ/alien/plasmavessel)) - aliens_around.Add(A) - var/mob/living/carbon/M = input("Select who to transfer to:","Transfer plasma to?",null) as mob in sort_names(aliens_around) - if(!M) - return - var/amount = input("Amount:", "Transfer Plasma to [M]") as num|null - if (amount) - amount = min(abs(round(amount)), user.getPlasma()) - if (get_dist(user,M) <= 1) - M.adjustPlasma(amount) - user.adjustPlasma(-amount) - to_chat(M, span_noticealien("[user] has transferred [amount] plasma to you.")) - to_chat(user, span_noticealien("You transfer [amount] plasma to [M].")) - else - to_chat(user, span_noticealien("You need to be closer!")) - return + for(var/mob/living/carbon/alien in oview(user)) + if(isalien(alien)) + aliens_around.Add(alien) + if(!length(aliens_around)) + to_chat(user, span_noticealien("There are no other aliens around.")) + return FALSE + var/mob/living/carbon/donation_target = tgui_input_list(user, "Target to transfer to", "Plasma Donation", sort_names(aliens_around)) + if(isnull(donation_target)) + return FALSE + var/amount = tgui_input_number(user, "Amount", "Transfer Plasma to [donation_target]", max_value = user.getPlasma()) + if(isnull(amount)) + return FALSE + + amount = min(abs(round(amount)), user.getPlasma()) + if (get_dist(user, donation_target) <= 1) + donation_target.adjustPlasma(amount) + user.adjustPlasma(-amount) + to_chat(donation_target, span_noticealien("[user] has transferred [amount] plasma to you.")) + to_chat(user, span_noticealien("You transfer [amount] plasma to [donation_target].")) + else + to_chat(user, span_noticealien("You need to be closer!")) + /obj/effect/proc_holder/alien/acid name = "Corrosive Acid" @@ -150,25 +157,31 @@ Doesn't work on other aliens/AI.*/ /obj/effect/proc_holder/alien/acid/on_lose(mob/living/carbon/user) remove_verb(user, /mob/living/carbon/proc/corrosive_acid) -/obj/effect/proc_holder/alien/acid/proc/corrode(atom/target,mob/living/carbon/user = usr) - if(target in oview(1,user)) - if(target.acid_act(200, 1000)) - user.visible_message(span_alertalien("[user] vomits globs of vile stuff all over [target]. It begins to sizzle and melt under the bubbling mess of acid!")) - return TRUE - else - to_chat(user, span_noticealien("You cannot dissolve this object.")) - return FALSE - - to_chat(src, span_noticealien("[target] is too far away.")) - return FALSE - +/obj/effect/proc_holder/alien/acid/proc/corrode(atom/target, mob/living/carbon/user = usr) + if(!(target in oview(1,user))) + to_chat(src, span_noticealien("[target] is too far away.")) + return FALSE + if(target.acid_act(200, 1000)) + user.visible_message(span_alertalien("[user] vomits globs of vile stuff all over [target]. It begins to sizzle and melt under the bubbling mess of acid!")) + return TRUE + else + to_chat(user, span_noticealien("You cannot dissolve this object.")) + return FALSE /obj/effect/proc_holder/alien/acid/fire(mob/living/carbon/alien/user) - var/O = input("Select what to dissolve:","Dissolve",null) as obj|turf in oview(1,user) - if(!O || user.incapacitated()) + var/list/nearby_targets = list() + for(var/atom/target in oview(1, user)) + nearby_targets.Add(target) + if(!length(nearby_targets)) + to_chat(user, span_noticealien("There's nothing to corrode.")) return FALSE - else - return corrode(O,user) + var/atom/dissolve_target = tgui_input_list(user, "Select a target to dissolve", "Dissolve", nearby_targets) + if(isnull(dissolve_target)) + return FALSE + if(QDELETED(dissolve_target) || user.incapacitated()) + return FALSE + + return corrode(dissolve_target, user) /mob/living/carbon/proc/corrosive_acid(O as obj|turf in oview(1)) // right click menu verb ugh set name = "Corrosive Acid" @@ -271,8 +284,10 @@ Doesn't work on other aliens/AI.*/ if(!check_vent_block(user)) return FALSE - var/choice = input("Choose what you wish to shape.","Resin building") as null|anything in structures - if(!choice) + var/choice = tgui_input_list(user, "Select a shape to build", "Resin building", structures) + if(isnull(choice)) + return FALSE + if(isnull(structures[choice])) return FALSE if (!cost_check(check_turf,user)) return FALSE diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index f27bbd16653..363a0ba8041 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -64,7 +64,7 @@ /datum/species/jelly/proc/Cannibalize_Body(mob/living/carbon/human/H) var/list/limbs_to_consume = list(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG) - H.get_missing_limbs() var/obj/item/bodypart/consumed_limb - if(!limbs_to_consume.len) + if(!length(limbs_to_consume)) H.losebreath++ return if(H.num_legs) //Legs go before arms @@ -88,7 +88,7 @@ return var/mob/living/carbon/human/H = owner var/list/limbs_to_heal = H.get_missing_limbs() - if(limbs_to_heal.len < 1) + if(!length(limbs_to_heal)) return FALSE if(H.blood_volume >= BLOOD_VOLUME_OKAY+40) return TRUE @@ -96,13 +96,13 @@ /datum/action/innate/regenerate_limbs/Activate() var/mob/living/carbon/human/H = owner var/list/limbs_to_heal = H.get_missing_limbs() - if(limbs_to_heal.len < 1) + if(!length(limbs_to_heal)) to_chat(H, span_notice("You feel intact enough as it is.")) return - to_chat(H, span_notice("You focus intently on your missing [limbs_to_heal.len >= 2 ? "limbs" : "limb"]...")) - if(H.blood_volume >= 40*limbs_to_heal.len+BLOOD_VOLUME_OKAY) + to_chat(H, span_notice("You focus intently on your missing [length(limbs_to_heal) >= 2 ? "limbs" : "limb"]...")) + if(H.blood_volume >= 40*length(limbs_to_heal)+BLOOD_VOLUME_OKAY) H.regenerate_limbs() - H.blood_volume -= 40*limbs_to_heal.len + H.blood_volume -= 40*length(limbs_to_heal) to_chat(H, span_notice("...and after a moment you finish reforming!")) return else if(H.blood_volume >= 40)//We can partially heal some limbs @@ -150,7 +150,7 @@ swap_body = new swap_body.Grant(C) - if(!bodies || !bodies.len) + if(!bodies || !length(bodies)) bodies = list(C) else bodies |= C @@ -690,7 +690,7 @@ to_chat(human_user, span_warning("The link seems to have been severed...")) return - var/message = sanitize(input("Message:", "Slime Telepathy") as text|null) + var/message = sanitize(tgui_input_text(human_user, "Enter a message", "Slime Telepathy")) if(!message) return @@ -717,35 +717,35 @@ background_icon_state = "bg_alien" /datum/action/innate/project_thought/Activate() - var/mob/living/carbon/human/H = owner - if(H.stat == DEAD) + var/mob/living/carbon/human/telepath = owner + if(telepath.stat == DEAD) return - if(!is_species(H, /datum/species/jelly/stargazer)) + if(!is_species(telepath, /datum/species/jelly/stargazer)) return - - var/list/options = list() - for(var/mob/living/Ms in oview(H)) - options += Ms - var/mob/living/M = input("Select who to send your message to:","Send thought to?",null) as null|mob in sort_names(options) - if(!M) + var/list/recipient_options = list() + for(var/mob/living/recipient in oview(telepath)) + recipient_options.Add(recipient) + if(!length(recipient_options)) + to_chat(telepath, span_warning("You don't see anyone to send your thought to.")) return - if(M.anti_magic_check(FALSE, FALSE, TRUE, 0)) - to_chat(H, span_notice("As you try to communicate with [M], you're suddenly stopped by a vision of a massive tinfoil wall that streches beyond visible range. It seems you've been foiled.")) + var/mob/living/recipient = tgui_input_list(telepath, "Choose a telepathic message recipient", "Telepathy", sort_names(recipient_options)) + if(isnull(recipient)) return - var/msg = sanitize(input("Message:", "Telepathy") as text|null) - if(msg) - if(M.anti_magic_check(FALSE, FALSE, TRUE, 0)) - to_chat(H, span_notice("As you try to communicate with [M], you're suddenly stopped by a vision of a massive tinfoil wall that streches beyond visible range. It seems you've been foiled.")) - return - log_directed_talk(H, M, msg, LOG_SAY, "slime telepathy") - to_chat(M, "[span_notice("You hear an alien voice in your head... ")][msg]") - to_chat(H, span_notice("You telepathically said: \"[msg]\" to [M]")) - for(var/dead in GLOB.dead_mob_list) - if(!isobserver(dead)) - continue - var/follow_link_user = FOLLOW_LINK(dead, H) - var/follow_link_target = FOLLOW_LINK(dead, M) - to_chat(dead, "[follow_link_user] [span_name("[H]")] [span_alertalien("Slime Telepathy --> ")] [follow_link_target] [span_name("[M]")] [span_noticealien("[msg]")]") + var/msg = tgui_input_text(telepath, title = "Telepathy") + if(isnull(msg)) + return + if(recipient.anti_magic_check(FALSE, FALSE, TRUE, 0)) + to_chat(telepath, span_notice("As you try to communicate with [recipient], you're suddenly stopped by a vision of a massive tinfoil wall that streches beyond visible range. It seems you've been foiled.")) + return + log_directed_talk(telepath, recipient, msg, LOG_SAY, "slime telepathy") + to_chat(recipient, "[span_notice("You hear an alien voice in your head... ")][msg]") + to_chat(telepath, span_notice("You telepathically said: \"[msg]\" to [recipient]")) + for(var/dead in GLOB.dead_mob_list) + if(!isobserver(dead)) + continue + var/follow_link_user = FOLLOW_LINK(dead, telepath) + var/follow_link_target = FOLLOW_LINK(dead, recipient) + to_chat(dead, "[follow_link_user] [span_name("[telepath]")] [span_alertalien("Slime Telepathy --> ")] [follow_link_target] [span_name("[recipient]")] [span_noticealien("[msg]")]") /datum/action/innate/link_minds name = "Link Minds" diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 207d0ef67ac..7343569a2a9 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -432,7 +432,7 @@ target += to_track if(name == string) target += src - if(target.len) + if(length(target)) cam_prev = get_turf(eyeobj) ai_actual_track(pick(target)) else @@ -559,11 +559,11 @@ continue tempnetwork.Remove("rd", "ordnance", "prison") - if(tempnetwork.len) + if(length(tempnetwork)) for(var/i in C.network) cameralist[i] = i var/old_network = network - network = tgui_input_list(U, "Which network would you like to view?", sort_list(cameralist)) + network = tgui_input_list(U, "Which network would you like to view?", "Camera Network", sort_list(cameralist)) if(!U.eyeobj) U.view_core() @@ -599,14 +599,19 @@ for(var/datum/data/record/record_datum in GLOB.data_core.locked)//Look in data core locked. personnel_list["[record_datum.fields["name"]]: [record_datum.fields["rank"]]"] = record_datum.fields["image"]//Pull names, rank, and image. - if(personnel_list.len) - input = tgui_input_list(usr, "Select a crew member", "Station Member", sort_list(personnel_list)) - var/icon/character_icon = personnel_list[input] - if(character_icon) - qdel(holo_icon)//Clear old icon so we're not storing it in memory. - holo_icon = getHologramIcon(icon(character_icon)) - else + if(!length(personnel_list)) tgui_alert(usr,"No suitable records found. Aborting.") + return + input = tgui_input_list(usr, "Select a crew member", "Station Member", sort_list(personnel_list)) + if(isnull(input)) + return + if(isnull(personnel_list[input])) + return + var/icon/character_icon = personnel_list[input] + if(character_icon) + qdel(holo_icon)//Clear old icon so we're not storing it in memory. + holo_icon = getHologramIcon(icon(character_icon)) + if("My Character") switch(tgui_alert(usr,"WARNING: Your AI hologram will take the appearance of your currently selected character ([usr.client.prefs?.read_preference(/datum/preference/name/real_name)]). Are you sure you want to proceed?",,list("Yes","No"))) if("Yes") @@ -638,17 +643,20 @@ ) input = tgui_input_list(usr, "Select a hologram", "Hologram", sort_list(icon_list)) - if(input) - qdel(holo_icon) - switch(input) - if("poly") - holo_icon = getHologramIcon(icon(icon_list[input],"parrot_fly")) - if("chicken") - holo_icon = getHologramIcon(icon(icon_list[input],"chicken_brown")) - if("spider") - holo_icon = getHologramIcon(icon(icon_list[input],"guard")) - else - holo_icon = getHologramIcon(icon(icon_list[input], input)) + if(isnull(input)) + return + if(isnull(icon_list[input])) + return + qdel(holo_icon) + switch(input) + if("poly") + holo_icon = getHologramIcon(icon(icon_list[input],"parrot_fly")) + if("chicken") + holo_icon = getHologramIcon(icon(icon_list[input],"chicken_brown")) + if("spider") + holo_icon = getHologramIcon(icon(icon_list[input],"guard")) + else + holo_icon = getHologramIcon(icon(icon_list[input], input)) else var/list/icon_list = list( "default" = 'icons/mob/ai.dmi', @@ -659,13 +667,16 @@ ) input = tgui_input_list(usr, "Select a hologram", "Hologram", sort_list(icon_list)) - if(input) - qdel(holo_icon) - switch(input) - if("xeno queen") - holo_icon = getHologramIcon(icon(icon_list[input],"alienq")) - else - holo_icon = getHologramIcon(icon(icon_list[input], input)) + if(isnull(input)) + return + if(isnull(icon_list[input])) + return + qdel(holo_icon) + switch(input) + if("xeno queen") + holo_icon = getHologramIcon(icon(icon_list[input],"alienq")) + else + holo_icon = getHologramIcon(icon(icon_list[input], input)) return /datum/action/innate/core_return @@ -931,7 +942,9 @@ if(!target || !(target in possible)) //If the AI is looking for a new shell, or its pre-selected shell is no longer valid target = tgui_input_list(src, "Which body to control?", "Direct Control", sort_names(possible)) - if (!target || target.stat == DEAD || target.deployed || !(!target.connected_ai ||(target.connected_ai == src))) + if(isnull(target)) + return + if (target.stat == DEAD || target.deployed || !(!target.connected_ai ||(target.connected_ai == src))) return else if(mind) diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index df5576457b2..6f541bdbf99 100644 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -99,9 +99,11 @@ if("camera_zoom") aicamera.adjust_zoom(usr) if("change_image") - var/newImage = tgui_input_list(usr, "Select your new display image.", "Display Image", sort_list(list("Happy", "Cat", "Extremely Happy", "Face", "Laugh", "Off", "Sad", "Angry", "What", "Sunglasses"))) + var/newImage = tgui_input_list(usr, "Select your new display image", "Display Image", sort_list(list("Happy", "Cat", "Extremely Happy", "Face", "Laugh", "Off", "Sad", "Angry", "What", "Sunglasses", "None"))) + if(isnull(newImage)) + return FALSE switch(newImage) - if(null) + if("None") card.emotion_icon = "null" if("Extremely Happy") card.emotion_icon = "extremely-happy" diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index c0adfa49e8a..c2a5f4185b6 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -81,7 +81,7 @@ return /mob/living/silicon/proc/queueAlarm(message, type, incoming = FALSE) - var/in_cooldown = (alarms_to_show.len > 0 || alarms_to_clear.len > 0) + var/in_cooldown = (length(alarms_to_show) || length(alarms_to_clear)) if(incoming) alarms_to_show += message alarm_types_show[type] += 1 @@ -95,10 +95,10 @@ addtimer(CALLBACK(src, .proc/show_alarms), 3 SECONDS) /mob/living/silicon/proc/show_alarms() - if(alarms_to_show.len < 5) + if(length(alarms_to_show) < 5) for(var/msg in alarms_to_show) to_chat(src, msg) - else if(alarms_to_show.len) + else if(length(alarms_to_show)) var/msg = "--- " for(var/alarm_type in alarm_types_show) @@ -107,11 +107,11 @@ msg += "\[Show Alerts\]" to_chat(src, msg) - if(alarms_to_clear.len < 3) + if(length(alarms_to_clear) < 3) for(var/msg in alarms_to_clear) to_chat(src, msg) - else if(alarms_to_clear.len) + else if(length(alarms_to_clear)) var/msg = "--- " for(var/alarm_type in alarm_types_clear) @@ -237,7 +237,7 @@ var/law = lawcache_supplied[index] if (length(law) > 0) - if(lawcache_lawcheck.len >= number+1) + if(length(lawcache_lawcheck) >= number+1) if (force || lawcache_lawcheck[number+1] == "Yes") say("[radiomod] [number]. [law]", forced = forced_log_message) number++ @@ -253,7 +253,7 @@ lawcheck[1] = "No" //Given Law 0's usual nature, it defaults to NOT getting reported. --NeoFite list += {"[lawcheck[1]] 0: [laws.zeroth]
"} - for (var/index in 1 to laws.hacked.len) + for (var/index in 1 to length(laws.hacked)) var/law = laws.hacked[index] if (length(law) > 0) if (!hackedcheck[index]) @@ -261,7 +261,7 @@ list += {"[hackedcheck[index]] [ion_num()]: [law]
"} hackedcheck.len += 1 - for (var/index in 1 to laws.ion.len) + for (var/index in 1 to length(laws.ion)) var/law = laws.ion[index] if (length(law) > 0) @@ -271,7 +271,7 @@ ioncheck.len += 1 var/number = 1 - for (var/index in 1 to laws.inherent.len) + for (var/index in 1 to length(laws.inherent)) var/law = laws.inherent[index] if (length(law) > 0) @@ -282,10 +282,10 @@ list += {"[lawcheck[number+1]] [number]: [law]
"} number++ - for (var/index in 1 to laws.supplied.len) + for (var/index in 1 to length(laws.supplied)) var/law = laws.supplied[index] if (length(law) > 0) - lawcheck.len += 1 + length(lawcheck) += 1 if (!lawcheck[number+1]) lawcheck[number+1] = "Yes" list += {"[lawcheck[number+1]] [number]: [law]
"} @@ -312,22 +312,21 @@ return //Ask the user to pick a channel from what it has available. - var/Autochan = tgui_input_list(usr, "Select a channel", "Channel Selection", list("Default","None") + radio.channels) - - if(!Autochan) + var/chosen_channel = tgui_input_list(usr, "Select a channel", "Channel Selection", list("Default","None") + radio.channels) + if(isnull(chosen_channel)) return - if(Autochan == "Default") //Autospeak on whatever frequency to which the radio is set, usually Common. + if(chosen_channel == "Default") //Autospeak on whatever frequency to which the radio is set, usually Common. radiomod = ";" - Autochan += " ([radio.get_frequency()])" - else if(Autochan == "None") //Prevents use of the radio for automatic annoucements. + chosen_channel += " ([radio.get_frequency()])" + if(chosen_channel == "None") //Prevents use of the radio for automatic annoucements. radiomod = "" else //For department channels, if any, given by the internal radio. for(var/key in GLOB.department_radio_keys) - if(GLOB.department_radio_keys[key] == Autochan) + if(GLOB.department_radio_keys[key] == chosen_channel) radiomod = ":" + key break - to_chat(src, span_notice("Automatic announcements [Autochan == "None" ? "will not use the radio." : "set to [Autochan]."]")) + to_chat(src, span_notice("Automatic announcements [chosen_channel == "None" ? "will not use the radio." : "set to [chosen_channel]."]")) /mob/living/silicon/put_in_hand_check() // This check is for borgs being able to receive items, not put them in others' hands. return FALSE diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index 08f2ed34d26..c00d59fd863 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -162,7 +162,9 @@ if(tilestack) tilestack.forceMove(drop_location()) if("line_mode") - var/setdir = input("Select construction direction:") as null|anything in list("north","east","south","west","disable") + var/setdir = tgui_input_list(usr, "Select construction direction", "Direction", list("north", "east", "south", "west", "disable")) + if(isnull(setdir)) + return switch(setdir) if("north") targetdirection = 1 @@ -246,7 +248,7 @@ addtimer(CALLBACK(src, .proc/go_idle), 0.5 SECONDS) path = list() return - if(path.len == 0) + if(!length(path)) if(!isturf(target)) var/turf/TL = get_turf(target) path = get_path_to(src, TL, 30, id=access_card,simulated_only = FALSE) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index dd96ead5d84..419be84daf0 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -307,7 +307,7 @@ if("destination") var/new_dest if(pda) - new_dest = input(user, "Enter Destination:", name, destination) as null|anything in GLOB.deliverybeacontags + new_dest = tgui_input_list(user, "Enter Destination", "Mulebot Settings", GLOB.deliverybeacontags, destination) else new_dest = params["value"] if(new_dest) @@ -323,7 +323,7 @@ if("sethome") var/new_home if(pda) - new_home = input(user, "Enter Home:", name, home_destination) as null|anything in GLOB.deliverybeacontags + new_home = tgui_input_list(user, "Enter Home", "Mulebot Settings", GLOB.deliverybeacontags, home_destination) else new_home = params["value"] if(new_home) @@ -467,7 +467,7 @@ /mob/living/simple_animal/bot/mulebot/call_bot() ..() - if(path?.len) + if(path && length(path)) target = ai_waypoint //Target is the end point of the path, the waypoint set by the AI. destination = get_area_name(target, TRUE) pathset = TRUE //Indicates the AI's custom path is initialized. @@ -524,7 +524,7 @@ at_target() return - else if(path.len > 0 && target) // valid path + else if(length(path) && target) // valid path var/turf/next = path[1] reached_target = FALSE if(next == loc) @@ -573,14 +573,14 @@ /mob/living/simple_animal/bot/mulebot/proc/process_blocked(turf/next) calc_path(avoid=next) - if(path.len > 0) + if(length(path)) buzz(DELIGHT) mode = BOT_BLOCKED /mob/living/simple_animal/bot/mulebot/proc/process_nav() calc_path() - if(path.len > 0) + if(length(path)) blockcount = 0 mode = BOT_BLOCKED buzz(DELIGHT) diff --git a/code/modules/mob/living/simple_animal/guardian/guardian.dm b/code/modules/mob/living/simple_animal/guardian/guardian.dm index e77a86cded7..1befcfa7a4f 100644 --- a/code/modules/mob/living/simple_animal/guardian/guardian.dm +++ b/code/modules/mob/living/simple_animal/guardian/guardian.dm @@ -340,7 +340,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians l_hand.screen_loc = ui_hand_position(get_held_index_of_item(l_hand)) client.screen |= l_hand - if(hands_overlays.len) + if(length(hands_overlays)) guardian_overlays[GUARDIAN_HANDS_LAYER] = hands_overlays apply_overlay(GUARDIAN_HANDS_LAYER) @@ -453,38 +453,41 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians var/mob/living/simple_animal/hostile/guardian/P = para if(P.reset) guardians -= P //clear out guardians that are already reset - if(guardians.len) - var/mob/living/simple_animal/hostile/guardian/G = tgui_input_list(src, "Pick the guardian you wish to reset", "Guardian Reset", sort_names(guardians)) - if(G) - to_chat(src, span_holoparasite("You attempt to reset [G.real_name]'s personality...")) - var/list/mob/dead/observer/candidates = poll_ghost_candidates("Do you want to play as [src.real_name]'s [G.real_name]?", ROLE_PAI, FALSE, 100) - if(LAZYLEN(candidates)) - var/mob/dead/observer/C = pick(candidates) - to_chat(G, span_holoparasite("Your user reset you, and your body was taken over by a ghost. Looks like they weren't happy with your performance.")) - to_chat(src, "Your [G.real_name] has been successfully reset.") - message_admins("[key_name_admin(C)] has taken control of ([ADMIN_LOOKUPFLW(G)])") - G.ghostize(0) - G.guardianrecolor() - G.guardianrename() //give it a new color and name, to show it's a new person - G.key = C.key - G.reset = 1 - switch(G.theme) - if("tech") - to_chat(src, span_holoparasite("[G.real_name] is now online!")) - if("magic") - to_chat(src, span_holoparasite("[G.real_name] has been summoned!")) - if("carp") - to_chat(src, span_holoparasite("[G.real_name] has been caught!")) - if("miner") - to_chat(src, span_holoparasite("[G.real_name] has appeared!")) - guardians -= G - if(!guardians.len) - remove_verb(src, /mob/living/proc/guardian_reset) - else - to_chat(src, span_holoparasite("There were no ghosts willing to take control of [G.real_name]. Looks like you're stuck with it for now.")) - else - to_chat(src, span_holoparasite("You decide not to reset [guardians.len > 1 ? "any of your guardians":"your guardian"].")) - else + if(!length(guardians)) + remove_verb(src, /mob/living/proc/guardian_reset) + return + + var/mob/living/simple_animal/hostile/guardian/chosen_guardian = tgui_input_list(src, "Pick the guardian you wish to reset", "Guardian Reset", sort_names(guardians)) + if(isnull(chosen_guardian)) + to_chat(src, span_holoparasite("You decide not to reset [length(guardians) > 1 ? "any of your guardians":"your guardian"].")) + return + + to_chat(src, span_holoparasite("You attempt to reset [chosen_guardian.real_name]'s personality...")) + var/list/mob/dead/observer/ghost_candidates = poll_ghost_candidates("Do you want to play as [src.real_name]'s [chosen_guardian.real_name]?", ROLE_PAI, FALSE, 100) + if(!LAZYLEN(ghost_candidates)) + to_chat(src, span_holoparasite("There were no ghosts willing to take control of [chosen_guardian.real_name]. Looks like you're stuck with it for now.")) + return + + var/mob/dead/observer/candidate = pick(ghost_candidates) + to_chat(chosen_guardian, span_holoparasite("Your user reset you, and your body was taken over by a ghost. Looks like they weren't happy with your performance.")) + to_chat(src, "Your [chosen_guardian.real_name] has been successfully reset.") + message_admins("[key_name_admin(candidate)] has taken control of ([ADMIN_LOOKUPFLW(chosen_guardian)])") + chosen_guardian.ghostize(0) + chosen_guardian.guardianrecolor() + chosen_guardian.guardianrename() //give it a new color and name, to show it's a new person + chosen_guardian.key = candidate.key + chosen_guardian.reset = 1 + switch(chosen_guardian.theme) + if("tech") + to_chat(src, span_holoparasite("[chosen_guardian.real_name] is now online!")) + if("magic") + to_chat(src, span_holoparasite("[chosen_guardian.real_name] has been summoned!")) + if("carp") + to_chat(src, span_holoparasite("[chosen_guardian.real_name] has been caught!")) + if("miner") + to_chat(src, span_holoparasite("[chosen_guardian.real_name] has appeared!")) + guardians -= chosen_guardian + if(!length(guardians)) remove_verb(src, /mob/living/proc/guardian_reset) ////////parasite tracking/finding procs @@ -526,7 +529,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians to_chat(user, span_holoparasite("[mob_name] chains are not allowed.")) return var/list/guardians = user.hasparasites() - if(guardians.len && !allowmultiple) + if(length(guardians) && !allowmultiple) to_chat(user, span_holoparasite("You already have a [mob_name]!")) return if(user.mind && user.mind.has_antag_datum(/datum/antagonist/changeling) && !allowling) @@ -552,8 +555,8 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians if(random) guardiantype = pick(possible_guardians) else - guardiantype = tgui_input_list(user, "Pick the type of [mob_name]", "[mob_name] Creation", sort_list(possible_guardians)) - if(!guardiantype || !candidate.client) + guardiantype = tgui_input_list(user, "Pick the type of [mob_name]", "Guardian Creation", sort_list(possible_guardians)) + if(isnull(guardiantype) || !candidate.client) to_chat(user, "[failure_message]" ) used = FALSE return @@ -594,7 +597,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians pickedtype = /mob/living/simple_animal/hostile/guardian/gravitokinetic var/list/guardians = user.hasparasites() - if(guardians.len && !allowmultiple) + if(length(guardians) && !allowmultiple) to_chat(user, span_holoparasite("You already have a [mob_name]!") ) used = FALSE return diff --git a/code/modules/mob/living/simple_animal/guardian/types/ranged.dm b/code/modules/mob/living/simple_animal/guardian/types/ranged.dm index 47f7b56d934..2bc9517b8d1 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/ranged.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/ranged.dm @@ -84,7 +84,7 @@ set name = "Set Surveillance Snare" set category = "Guardian" set desc = "Set an invisible snare that will alert you when living creatures walk over it. Max of 5" - if(snares.len <6) + if(length(snares) < 6) var/turf/snare_loc = get_turf(loc) var/obj/effect/snare/S = new /obj/effect/snare(snare_loc) S.spawner = src @@ -98,11 +98,12 @@ set name = "Remove Surveillance Snare" set category = "Guardian" set desc = "Disarm unwanted surveillance snares." - var/picked_snare = input(src, "Pick which snare to remove", "Remove Snare") as null|anything in sort_names(snares) - if(picked_snare) - snares -= picked_snare - qdel(picked_snare) - to_chat(src, "[span_danger("Snare disarmed.")]") + var/picked_snare = tgui_input_list(src, "Pick which snare to remove", "Remove Snare", sort_names(snares)) + if(isnull(picked_snare)) + return + snares -= picked_snare + qdel(picked_snare) + to_chat(src, "[span_danger("Snare disarmed.")]") /obj/effect/snare name = "snare" diff --git a/code/modules/mob/living/simple_animal/slime/powers.dm b/code/modules/mob/living/simple_animal/slime/powers.dm index 737da2ba7ba..3bb0392974d 100644 --- a/code/modules/mob/living/simple_animal/slime/powers.dm +++ b/code/modules/mob/living/simple_animal/slime/powers.dm @@ -30,15 +30,16 @@ return FALSE var/list/choices = list() - for(var/mob/living/C in view(1,src)) - if(C!=src && Adjacent(C)) - choices += C + for(var/mob/living/nearby_mob in view(1,src)) + if(nearby_mob != src && Adjacent(nearby_mob)) + choices += nearby_mob - var/mob/living/M = input(src,"Who do you wish to feed on?") in null|sort_names(choices) - if(!M) + var/choice = tgui_input_list(src, "Who do you wish to feed on?", "Slime Feed", sort_names(choices)) + if(isnull(choice)) return FALSE - if(CanFeedon(M)) - Feedon(M) + var/mob/living/victim = choice + if(CanFeedon(victim)) + Feedon(victim) return TRUE return FALSE diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 41d9ca5bb5c..8ed79a0cef5 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -71,12 +71,12 @@ landmark_loc += sloc.loc break landmark_loc += sloc.loc - if(!landmark_loc.len) + if(!length(landmark_loc)) to_chat(src, "Oh god sorry we can't find an unoccupied AI spawn location, so we're spawning you on top of someone.") for(var/obj/effect/landmark/start/ai/sloc in GLOB.landmarks_list) landmark_loc += sloc.loc - if(!landmark_loc.len) + if(!length(landmark_loc)) message_admins("Could not find ai landmark for [src]. Yell at a mapper! We are spawning them at their current location.") landmark_loc += loc @@ -305,7 +305,8 @@ var/list/mobtypes = typesof(/mob/living/simple_animal) var/mobpath = tgui_input_list(usr, "Which type of mob should [src] turn into?", "Choose a type", sort_list(mobtypes, /proc/cmp_typepaths_asc)) - + if(isnull(mobpath)) + return if(!safe_animal(mobpath)) to_chat(usr, span_danger("Sorry but this mob type is currently unavailable.")) return @@ -338,7 +339,8 @@ var/list/mobtypes = typesof(/mob/living/simple_animal) var/mobpath = tgui_input_list(usr, "Which type of mob should [src] turn into?", "Choose a type", sort_list(mobtypes, /proc/cmp_typepaths_asc)) - + if(isnull(mobpath)) + return if(!safe_animal(mobpath)) to_chat(usr, span_danger("Sorry but this mob type is currently unavailable.")) return diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index 5277a8f8d1b..0722268c0c7 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -393,7 +393,7 @@ if(3) data["PC_ntneticon"] = "sig_lan.gif" - if(idle_threads.len) + if(length(idle_threads)) var/list/program_headers = list() for(var/I in idle_threads) var/datum/computer_file/program/P = I @@ -486,7 +486,7 @@ return TRUE /obj/item/modular_computer/screwdriver_act(mob/user, obj/item/tool) - if(!all_components.len) + if(!length(all_components)) to_chat(user, span_warning("This device doesn't have any components installed.")) return var/list/component_names = list() @@ -494,9 +494,9 @@ var/obj/item/computer_hardware/H = all_components[h] component_names.Add(H.name) - var/choice = input(user, "Which component do you want to uninstall?", "Computer maintenance", null) as null|anything in sort_list(component_names) + var/choice = tgui_input_list(user, "Component to uninstall", "Computer maintenance", sort_list(component_names)) - if(!choice) + if(isnull(choice)) return if(!Adjacent(user)) @@ -528,7 +528,7 @@ return if(W.tool_behaviour == TOOL_WRENCH) - if(all_components.len) + if(length(all_components)) to_chat(user, span_warning("Remove all components from \the [src] before disassembling it.")) return new /obj/item/stack/sheet/iron( get_turf(src.loc), steel_sheet_cost ) diff --git a/code/modules/ninja/suit/ninja_equipment_actions/ninja_net.dm b/code/modules/ninja/suit/ninja_equipment_actions/ninja_net.dm index b4890fbf421..29ffe4a5af0 100644 --- a/code/modules/ninja/suit/ninja_equipment_actions/ninja_net.dm +++ b/code/modules/ninja/suit/ninja_equipment_actions/ninja_net.dm @@ -12,11 +12,17 @@ */ /obj/item/clothing/suit/space/space_ninja/proc/ninjanet() var/mob/living/carbon/human/ninja = affecting - var/mob/living/net_target = input("Select who to capture:","Capture who?",null) as null|mob in sort_names(oview(ninja)) - - if(QDELETED(net_target)||!(net_target in oview(ninja))) + var/list/nearby_targets = list() + for(var/mob/living/target in oview(ninja)) + nearby_targets.Add(target) + if(!length(nearby_targets)) + to_chat(ninja, span_warning("You see no one nearby to ensnare.")) + return + var/mob/living/net_target = tgui_input_list(ninja, "Select who to capture", "Capture Target", sort_names(nearby_targets)) + if(isnull(net_target)) + return + if(QDELETED(net_target) || !(net_target in oview(ninja)) || !isliving(net_target) || ninja.incapacitated()) return - if(locate(/obj/structure/energy_net) in get_turf(net_target))//Check if they are already being affected by an energy net. to_chat(ninja, span_warning("[net_target.p_they(TRUE)] are already trapped inside an energy net!")) return diff --git a/code/modules/photography/camera/camera.dm b/code/modules/photography/camera/camera.dm index 7895948dd15..9c347477984 100644 --- a/code/modules/photography/camera/camera.dm +++ b/code/modules/photography/camera/camera.dm @@ -57,16 +57,12 @@ . += span_notice("Alt-click to change its focusing, allowing you to set how big of an area it will capture.") /obj/item/camera/proc/adjust_zoom(mob/user) - var/desired_x = input(user, "How wide do you want the camera to shoot, between [picture_size_x_min] and [picture_size_x_max]?", "Zoom", picture_size_x) as num|null - + var/desired_x = tgui_input_number(user, "How wide do you want the camera to shoot?", "Zoom", picture_size_x, picture_size_x_max, picture_size_x_min) if (isnull(desired_x)) return - - var/desired_y = input(user, "How high do you want the camera to shoot, between [picture_size_y_min] and [picture_size_y_max]?", "Zoom", picture_size_y) as num|null - + var/desired_y = tgui_input_number(user, "How high do you want the camera to shoot", "Zoom", picture_size_y, picture_size_y_max, picture_size_y_min) if (isnull(desired_y)) return - picture_size_x = min(clamp(desired_x, picture_size_x_min, picture_size_x_max), CAMERA_PICTURE_SIZE_HARD_LIMIT) picture_size_y = min(clamp(desired_y, picture_size_y_min, picture_size_y_max), CAMERA_PICTURE_SIZE_HARD_LIMIT) diff --git a/code/modules/photography/camera/silicon_camera.dm b/code/modules/photography/camera/silicon_camera.dm index aea2cb2c33f..913959f1c81 100644 --- a/code/modules/photography/camera/silicon_camera.dm +++ b/code/modules/photography/camera/silicon_camera.dm @@ -24,7 +24,6 @@ /obj/item/camera/siliconcam/proc/selectpicture(mob/user) var/list/nametemp = list() - var/find if(!stored.len) to_chat(usr, "No images saved") return @@ -33,8 +32,10 @@ var/datum/picture/p = i nametemp += p.picture_name temp[p.picture_name] = p - find = input(user, "Select image") in nametemp|null - if(!find) + var/find = tgui_input_list(user, "Select image", "Storage", nametemp) + if(isnull(find)) + return + if(isnull(temp[find])) return return temp[find] diff --git a/code/modules/plumbing/plumbers/bottler.dm b/code/modules/plumbing/plumbers/bottler.dm index 89f33b4daa7..ca560240b8b 100644 --- a/code/modules/plumbing/plumbers/bottler.dm +++ b/code/modules/plumbing/plumbers/bottler.dm @@ -67,7 +67,10 @@ if(!valid_output_configuration) to_chat(user, span_warning("A flashing notification on the screen reads: \"Output location error!\"")) return . - wanted_amount = clamp(round(input(user,"maximum is 100u","set ammount to fill with") as num|null, 1), 1, 100) + var/new_amount = tgui_input_number(user, "Set Amount to Fill", "Desired Amount", 1, 100, 1) + if(isnull(new_amount)) + return . + wanted_amount = round(new_amount) to_chat(user, span_notice(" The [src] will now fill for [wanted_amount]u.")) /obj/machinery/plumbing/bottler/process() diff --git a/code/modules/plumbing/plumbers/plumbing_buffer.dm b/code/modules/plumbing/plumbers/plumbing_buffer.dm index 47494c35dc4..45550bf1e3e 100644 --- a/code/modules/plumbing/plumbers/plumbing_buffer.dm +++ b/code/modules/plumbing/plumbers/plumbing_buffer.dm @@ -76,11 +76,11 @@ . = SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN - var/new_volume = input(user, "Enter new activation threshold", "Beepityboop", activation_volume) as num|null - if(!new_volume) + var/new_volume = tgui_input_number(user, "Enter new activation threshold", "Beepityboop", activation_volume, buffer) + if(isnull(new_volume)) return - activation_volume = round(clamp(new_volume, 0, buffer)) + activation_volume = round(new_volume) to_chat(user, span_notice("New activation threshold is now [activation_volume].")) return diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 5a80508e9de..0fd0066a794 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -452,8 +452,10 @@ return if((can_flashlight && gun_light) && (can_bayonet && bayonet)) //give them a choice instead of removing both var/list/possible_items = list(gun_light, bayonet) - var/obj/item/item_to_remove = input(user, "Select an attachment to remove", "Attachment Removal") as null|obj in sort_names(possible_items) - if(!item_to_remove || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) + var/obj/item/item_to_remove = tgui_input_list(user, "Attachment to remove", "Attachment Removal", sort_names(possible_items)) + if(isnull(item_to_remove)) + return + if(user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return return remove_gun_attachment(user, I, item_to_remove) diff --git a/code/modules/projectiles/pins.dm b/code/modules/projectiles/pins.dm index 89854f7c203..cd245580efb 100644 --- a/code/modules/projectiles/pins.dm +++ b/code/modules/projectiles/pins.dm @@ -261,15 +261,12 @@ pin_owner = null owned = FALSE return - var/transaction_amount = input(user, "Insert valid deposit amount for gun purchase", "Money Deposit") as null|num - if(transaction_amount < 1) - to_chat(user, span_warning("ERROR: Invalid amount designated.")) - return - if(!transaction_amount) + var/transaction_amount = tgui_input_number(user, "Insert valid deposit amount for gun purchase", "Money Deposit", 1, 10000, 1) + if(isnull(transaction_amount)) return pin_owner = id owned = TRUE - payment_amount = transaction_amount + payment_amount = round(transaction_amount) gun_owners += user to_chat(user, span_notice("You link the card to the firing pin.")) diff --git a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm index fe5d470540c..37f55e26574 100644 --- a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm @@ -52,7 +52,7 @@ helbent = TRUE to_chat(M, span_hierophant("Malevolent spirits appear before you, bartering your life in a 'friendly' game of rock, paper, scissors. Which do you choose?")) var/timeisticking = world.time - var/RPSchoice = input(M, "Janken Time! You have 60 Seconds to Choose!", "Rock Paper Scissors",null) as null|anything in RockPaperScissors + var/RPSchoice = tgui_alert(M, "Janken Time! You have 60 Seconds to Choose!", "Rock Paper Scissors", RockPaperScissors, 60) if(QDELETED(M) || (timeisticking+(1.1 MINUTES) < world.time)) reaping = FALSE return //good job, you ruined it diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index a17145159db..8c5def625c0 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -64,10 +64,10 @@ Borg Hypospray RG.my_atom = src reagent_list += RG - var/datum/reagents/R = reagent_list[reagent_list.len] + var/datum/reagents/R = reagent_list[length(reagent_list)] R.add_reagent(reagent, 30, reagtemp = dispensed_temperature) - modes[reagent] = modes.len + 1 + modes[reagent] = length(modes) + 1 if(initial(reagent.harmful)) reagent_names[C2NAMEREAGENT] = reagent @@ -82,7 +82,7 @@ Borg Hypospray reagent_names -= initial(reagent.name) var/datum/reagents/RG var/datum/reagents/TRG - for(var/i in 1 to reagent_ids.len) + for(var/i in 1 to length(reagent_ids)) TRG = reagent_list[i] if (TRG.has_reagent(reagent)) RG = TRG @@ -91,13 +91,13 @@ Borg Hypospray reagent_list -= RG RG.del_reagent(reagent) - modes[reagent] = modes.len - 1 + modes[reagent] = length(modes) - 1 /obj/item/reagent_containers/borghypo/proc/regenerate_reagents() if(iscyborg(src.loc)) var/mob/living/silicon/robot/R = src.loc if(R?.cell) - for(var/i in 1 to reagent_ids.len) + for(var/i in 1 to length(reagent_ids)) var/datum/reagents/RG = reagent_list[i] if(RG.total_volume < RG.maximum_volume) //Don't recharge reagents and drain power if the storage is full. R.cell.use(charge_cost) //Take power from borg... @@ -123,9 +123,12 @@ Borg Hypospray log_combat(user, M, "injected", src, "(CHEMICALS: [english_list(injected)])") /obj/item/reagent_containers/borghypo/attack_self(mob/user) - var/chosen_reagent = modes[reagent_names[input(user, "What reagent do you want to dispense?") as null|anything in sort_list(reagent_names)]] - if(!chosen_reagent) + var/choice = tgui_input_list(user, "Reagent to dispense", "Medical Hypospray", sort_list(reagent_names)) + if(isnull(choice)) return + if(isnull(reagent_names[choice])) + return + var/chosen_reagent = modes[reagent_names[choice]] mode = chosen_reagent playsound(loc, 'sound/effects/pop.ogg', 50, FALSE) var/datum/reagent/R = GLOB.chemical_reagents_list[reagent_ids[mode]] diff --git a/code/modules/religion/rites.dm b/code/modules/religion/rites.dm index f453e023342..6f6227479fc 100644 --- a/code/modules/religion/rites.dm +++ b/code/modules/religion/rites.dm @@ -44,12 +44,12 @@ user.say(i) first_invoke = FALSE continue - if(!ritual_invocations.len) //we divide so we gotta protect + if(!length(ritual_invocations)) //we divide so we gotta protect return FALSE - if(!do_after(user, target = user, delay = ritual_length/ritual_invocations.len)) + if(!do_after(user, target = user, delay = ritual_length/length(ritual_invocations))) return FALSE user.say(i) - if(!do_after(user, target = user, delay = ritual_length/ritual_invocations.len)) //because we start at 0 and not the first fraction in invocations, we still have another fraction of ritual_length to complete + if(!do_after(user, target = user, delay = ritual_length/length(ritual_invocations))) //because we start at 0 and not the first fraction in invocations, we still have another fraction of ritual_length to complete return FALSE if(invoke_msg) user.say(invoke_msg) @@ -392,11 +392,11 @@ var/datum/mutation/human/honorbound/honormut = user.dna.check_mutation(HONORBOUND) if(!honormut) return FALSE - if(!honormut.guilty.len) + if(!length(honormut.guilty)) to_chat(user, span_warning("[GLOB.deity] is holding no grudges to forgive.")) return FALSE - var/forgiven_choice = tgui_input_list(user, "Choose one of [GLOB.deity]'s guilty to forgive.", "Forgive", honormut.guilty) - if(!forgiven_choice) + var/forgiven_choice = tgui_input_list(user, "Choose one of [GLOB.deity]'s guilty to forgive", "Forgive", honormut.guilty) + if(isnull(forgiven_choice)) return FALSE who = forgiven_choice return ..() @@ -660,7 +660,7 @@ if(!(unfiltered_area.area_flags & HIDDEN_AREA)) filtered += unfiltered_area area_instance = tgui_input_list(user, "Choose an area to mark as an arena!", "Arena Declaration", filtered) - if(!area_instance) + if(isnull(area_instance)) return FALSE . = ..() diff --git a/code/modules/research/destructive_analyzer.dm b/code/modules/research/destructive_analyzer.dm index 16015c9d3bb..65af7ec4355 100644 --- a/code/modules/research/destructive_analyzer.dm +++ b/code/modules/research/destructive_analyzer.dm @@ -90,8 +90,8 @@ Note: Must be placed within 3 tiles of the R&D Console differences[i] = value if(length(worths) && !length(differences)) return FALSE - var/choice = input("Are you sure you want to destroy [loaded_item] to [!length(worths) ? "reveal [TN.display_name]" : "boost [TN.display_name] by [json_encode(differences)] point\s"]?") in list("Proceed", "Cancel") - if(choice == "Cancel") + var/choice = tgui_alert(user, "Are you sure you want to destroy [loaded_item] to [!length(worths) ? "reveal [TN.display_name]" : "boost [TN.display_name] by [json_encode(differences)] point\s"]?", "Destructive Analyzer", list("Proceed", "Cancel")) + if(choice != "Proceed") return FALSE if(QDELETED(loaded_item) || QDELETED(src)) return FALSE diff --git a/code/modules/research/xenobiology/crossbreeding/charged.dm b/code/modules/research/xenobiology/crossbreeding/charged.dm index e95ada65cac..ba108763483 100644 --- a/code/modules/research/xenobiology/crossbreeding/charged.dm +++ b/code/modules/research/xenobiology/crossbreeding/charged.dm @@ -169,8 +169,8 @@ Charged extracts: if(!istype(H)) to_chat(user, span_warning("You must be a humanoid to use this!")) return - var/racechoice = input(H, "Choose your slime subspecies.", "Slime Selection") as null|anything in sort_list(subtypesof(/datum/species/jelly), /proc/cmp_typepaths_asc) - if(!racechoice) + var/racechoice = tgui_input_list(H, "Choose your slime subspecies", "Slime Selection", sort_list(subtypesof(/datum/species/jelly), /proc/cmp_typepaths_asc)) + if(isnull(racechoice)) to_chat(user, span_notice("You decide not to become a slime for now.")) return if(!user.canUseTopic(src, BE_CLOSE)) diff --git a/code/modules/research/xenobiology/crossbreeding/selfsustaining.dm b/code/modules/research/xenobiology/crossbreeding/selfsustaining.dm index 94e1b13dc39..6bead094b35 100644 --- a/code/modules/research/xenobiology/crossbreeding/selfsustaining.dm +++ b/code/modules/research/xenobiology/crossbreeding/selfsustaining.dm @@ -32,7 +32,9 @@ Self-sustaining extracts: return ..() /obj/item/autoslime/attack_self(mob/user) - var/reagentselect = input(user, "Choose the reagent the extract will produce.", "Self-sustaining Reaction") as null|anything in sort_list(extract.activate_reagents, /proc/cmp_typepaths_asc) + var/reagentselect = tgui_input_list(user, "Reagent the extract will produce.", "Self-sustaining Reaction", sort_list(extract.activate_reagents, /proc/cmp_typepaths_asc)) + if(isnull(reagentselect)) + return var/amount = 5 var/secondary diff --git a/code/modules/research/xenobiology/crossbreeding/stabilized.dm b/code/modules/research/xenobiology/crossbreeding/stabilized.dm index 84be0a5486e..95ba185bde9 100644 --- a/code/modules/research/xenobiology/crossbreeding/stabilized.dm +++ b/code/modules/research/xenobiology/crossbreeding/stabilized.dm @@ -121,7 +121,7 @@ Stabilized extracts: /obj/item/slimecross/stabilized/gold/proc/generate_mobtype() var/static/list/mob_spawn_pets = list() - if(mob_spawn_pets.len <= 0) + if(!length(mob_spawn_pets)) for(var/T in typesof(/mob/living/simple_animal)) var/mob/living/simple_animal/SA = T switch(initial(SA.gold_core_spawnable)) @@ -134,7 +134,9 @@ Stabilized extracts: generate_mobtype() /obj/item/slimecross/stabilized/gold/attack_self(mob/user) - var/choice = input(user, "Which do you want to reset?", "Familiar Adjustment") as null|anything in sort_list(list("Familiar Location", "Familiar Species", "Familiar Sentience", "Familiar Name")) + var/choice = tgui_input_list(user, "Which do you want to reset?", "Familiar Adjustment", sort_list(list("Familiar Location", "Familiar Species", "Familiar Sentience", "Familiar Name"))) + if(isnull(choice)) + return if(!user.canUseTopic(src, BE_CLOSE)) return if(isliving(user)) diff --git a/code/modules/shuttle/assault_pod.dm b/code/modules/shuttle/assault_pod.dm index 02d17bb74fb..02a7c2ae43e 100644 --- a/code/modules/shuttle/assault_pod.dm +++ b/code/modules/shuttle/assault_pod.dm @@ -34,9 +34,10 @@ /obj/item/assault_pod/attack_self(mob/living/user) - var/target_area - target_area = tgui_input_list(user, "Area to land", "Landing Zone", GLOB.teleportlocs) - if(!target_area) + var/target_area = tgui_input_list(user, "Area to land", "Landing Zone", GLOB.teleportlocs) + if(isnull(target_area)) + return + if(isnull(GLOB.teleportlocs[target_area])) return var/area/picked_area = GLOB.teleportlocs[target_area] if(!src || QDELETED(src)) diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm index f5c46b4c9aa..8560b6761fa 100644 --- a/code/modules/shuttle/navigation_computer.dm +++ b/code/modules/shuttle/navigation_computer.dm @@ -378,17 +378,20 @@ L["([L.len]) [nav_beacon.name] locked"] = null playsound(console, 'sound/machines/terminal_prompt.ogg', 25, FALSE) - var/selected = input("Choose location to jump to", "Locations", null) as null|anything in sort_list(L) + var/selected = tgui_input_list(usr, "Choose location to jump to", "Locations", sort_list(L)) + if(isnull(selected)) + playsound(console, 'sound/machines/terminal_prompt_deny.ogg', 25, FALSE) + return if(QDELETED(src) || QDELETED(target) || !isliving(target)) return playsound(src, "terminal_type", 25, FALSE) - if(selected) - var/turf/T = get_turf(L[selected]) - if(T) - playsound(console, 'sound/machines/terminal_prompt_confirm.ogg', 25, FALSE) - remote_eye.setLoc(T) - to_chat(target, span_notice("Jumped to [selected].")) - C.overlay_fullscreen("flash", /atom/movable/screen/fullscreen/flash/static) - C.clear_fullscreen("flash", 3) - else - playsound(console, 'sound/machines/terminal_prompt_deny.ogg', 25, FALSE) + var/turf/T = get_turf(L[selected]) + if(isnull(T)) + return + playsound(console, 'sound/machines/terminal_prompt_confirm.ogg', 25, FALSE) + remote_eye.setLoc(T) + to_chat(target, span_notice("Jumped to [selected].")) + C.overlay_fullscreen("flash", /atom/movable/screen/fullscreen/flash/static) + C.clear_fullscreen("flash", 3) + + diff --git a/code/modules/shuttle/spaceship_navigation_beacon.dm b/code/modules/shuttle/spaceship_navigation_beacon.dm index 418ddf745d7..48b4644062d 100644 --- a/code/modules/shuttle/spaceship_navigation_beacon.dm +++ b/code/modules/shuttle/spaceship_navigation_beacon.dm @@ -37,7 +37,10 @@ /obj/machinery/spaceship_navigation_beacon/multitool_act(mob/living/user, obj/item/multitool/I) ..() if(panel_open) - var/new_name = "Beacon_[stripped_input("Enter the custom name for this beacon", "It be Beacon ..your input..")]" + var/chosen_tag = tgui_input_text(user, "Enter the custom name for this beacon", "Beacon Reclassification", max_length = MAX_NAME_LEN) + if(!chosen_tag) + return + var/new_name = "Beacon_[chosen_tag]" if(new_name && Adjacent(user)) name = new_name to_chat(user, span_notice("You change beacon name to [name].")) diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm index c18ce60b5b7..ed8d15ea02d 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -441,24 +441,28 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th //targets += input("Choose the target for the spell.", "Targeting") as mob in possible_targets //Adds a safety check post-input to make sure those targets are actually in range. - var/mob/M + var/mob/chosen_target if(!random_target) - M = input("Choose the target for the spell.", "Targeting") as null|mob in sort_names(possible_targets) + chosen_target = tgui_input_list(user, "Choose the target for the spell", "Targeting", sort_names(possible_targets)) + if(isnull(chosen_target)) + return + if(ismob(chosen_target) || user.incapacitated()) + return else switch(random_target_priority) if(TARGET_RANDOM) - M = pick(possible_targets) + chosen_target = pick(possible_targets) if(TARGET_CLOSEST) - for(var/mob/living/L in possible_targets) - if(M) - if(get_dist(user,L) < get_dist(user,M)) - if(los_check(user,L)) - M = L + for(var/mob/living/living_target in possible_targets) + if(chosen_target) + if(get_dist(user, living_target) < get_dist(user, chosen_target)) + if(los_check(user, living_target)) + chosen_target = living_target else - if(los_check(user,L)) - M = L - if(M in view_or_range(range, user, selection_type)) - targets += M + if(los_check(user, living_target)) + chosen_target = living_target + if(chosen_target in view_or_range(range, user, selection_type)) + targets += chosen_target else var/list/possible_targets = list() @@ -467,7 +471,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th continue possible_targets += target for(var/i in 1 to max_targets) - if(!possible_targets.len) + if(!length(possible_targets)) break if(target_ignore_prev) var/target = pick(possible_targets) @@ -479,11 +483,11 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th if(!include_user && (user in targets)) targets -= user - if(!targets.len) //doesn't waste the spell + if(!length(targets)) //doesn't waste the spell revert_cast(user) return - perform(targets,user=user) + perform(targets, user=user) /obj/effect/proc_holder/spell/aoe_turf/choose_targets(mob/user = usr) var/list/targets = list() @@ -494,7 +498,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th if(!(target in view_or_range(inner_radius,user,selection_type))) targets += target - if(!targets.len) //doesn't waste the spell + if(!length(targets)) //doesn't waste the spell revert_cast() return diff --git a/code/modules/spells/spell_types/area_teleport.dm b/code/modules/spells/spell_types/area_teleport.dm index 86871f60089..3463d9fa6ea 100644 --- a/code/modules/spells/spell_types/area_teleport.dm +++ b/code/modules/spells/spell_types/area_teleport.dm @@ -23,15 +23,17 @@ after_cast(targets) /obj/effect/proc_holder/spell/targeted/area_teleport/before_cast(list/targets) - var/A = null + var/target_area = null if(!randomise_selection) - A = input("Area to teleport to", "Teleport", A) as null|anything in GLOB.teleportlocs + target_area = tgui_input_list(usr, "Area to teleport to", "Teleport", GLOB.teleportlocs) else - A = pick(GLOB.teleportlocs) - if(!A) + target_area = pick(GLOB.teleportlocs) + if(isnull(target_area)) return - var/area/thearea = GLOB.teleportlocs[A] + if(isnull(GLOB.teleportlocs[target_area])) + return + var/area/thearea = GLOB.teleportlocs[target_area] return thearea @@ -49,7 +51,7 @@ if(clear) L+=T - if(!L.len) + if(!length(L)) to_chat(usr, span_warning("The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry.")) return @@ -59,7 +61,7 @@ var/list/tempL = L var/attempt = null var/success = FALSE - while(tempL.len) + while(length(tempL)) attempt = pick(tempL) do_teleport(target, attempt, channel = TELEPORT_CHANNEL_MAGIC) if(get_turf(target) == attempt) diff --git a/code/modules/spells/spell_types/voice_of_god.dm b/code/modules/spells/spell_types/voice_of_god.dm index 58c76b47753..f1a130ec6a7 100644 --- a/code/modules/spells/spell_types/voice_of_god.dm +++ b/code/modules/spells/spell_types/voice_of_god.dm @@ -23,7 +23,7 @@ /obj/effect/proc_holder/spell/voice_of_god/choose_targets(mob/user = usr) perform(user=user) /obj/effect/proc_holder/spell/voice_of_god/perform(list/targets, recharge = 1, mob/user = usr) - command = input(user, "Speak with the Voice of God", "Command") + command = tgui_input_text(user, "Speak with the Voice of God", "Command") if(QDELETED(src) || QDELETED(user)) return if(!command) diff --git a/code/modules/station_goals/bsa.dm b/code/modules/station_goals/bsa.dm index a51ac8d90bd..06740b3f240 100644 --- a/code/modules/station_goals/bsa.dm +++ b/code/modules/station_goals/bsa.dm @@ -300,8 +300,12 @@ GLOBAL_VAR_INIT(bsa_unlock, FALSE) var/list/options = gps_locators if(area_aim) options += GLOB.teleportlocs - var/V = input(user,"Select target", "Select target",null) in options|null - target = options[V] + var/victim = tgui_input_list(user, "Select target", "Artillery Targeting", options) + if(isnull(victim)) + return + if(isnull(options[victim])) + return + target = options[victim] /obj/machinery/computer/bsa_control/proc/get_target_name() diff --git a/code/modules/surgery/organ_manipulation.dm b/code/modules/surgery/organ_manipulation.dm index fc543fe58ee..ecf711a5aaf 100644 --- a/code/modules/surgery/organ_manipulation.dm +++ b/code/modules/surgery/organ_manipulation.dm @@ -76,7 +76,7 @@ /datum/surgery_step/manipulate_organs/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) target_organ = null if(istype(tool, /obj/item/borg/apparatus/organ_storage)) - if(!tool.contents.len) + if(!length(tool.contents)) to_chat(user, span_warning("There is nothing inside [tool]!")) return -1 target_organ = tool.contents[1] @@ -109,7 +109,7 @@ var/list/organs = target.getorganszone(target_zone) if (target_zone == BODY_ZONE_PRECISE_EYES) target_zone = check_zone(target_zone) - if(!organs.len) + if(!length(organs)) to_chat(user, span_warning("There are no removable organs in [target]'s [parse_zone(target_zone)]!")) return -1 else @@ -118,8 +118,11 @@ organs -= organ organs[organ.name] = organ - target_organ = input("Remove which organ?", "Surgery", null, null) as null|anything in sort_list(organs) - if(target_organ && user && target && user.Adjacent(target) && user.get_active_held_item() == tool) + var/chosen_organ = tgui_input_list(user, "Remove which organ?", "Surgery", sort_list(organs)) + if(isnull(chosen_organ)) + return -1 + target_organ = chosen_organ + if(user && target && user.Adjacent(target) && user.get_active_held_item() == tool) target_organ = organs[target_organ] if(!target_organ) return -1 diff --git a/code/modules/surgery/organs/vocal_cords.dm b/code/modules/surgery/organs/vocal_cords.dm index 7d7ffbb6a82..430d5467f49 100644 --- a/code/modules/surgery/organs/vocal_cords.dm +++ b/code/modules/surgery/organs/vocal_cords.dm @@ -35,8 +35,10 @@ /datum/action/item_action/organ_action/use/adamantine_vocal_cords/Trigger() if(!IsAvailable()) return - var/message = input(owner, "Resonate a message to all nearby golems.", "Resonate") - if(QDELETED(src) || QDELETED(owner) || !message) + var/message = tgui_input_text(owner, "Resonate a message to all nearby golems", "Resonate") + if(!message) + return + if(QDELETED(src) || QDELETED(owner)) return owner.say(".x[message]") @@ -90,11 +92,11 @@ if(world.time < cords.next_command) to_chat(owner, span_notice("You must wait [DisplayTimeText(cords.next_command - world.time)] before Speaking again.")) return - var/command = input(owner, "Speak with the Voice of God", "Command") - if(QDELETED(src) || QDELETED(owner)) - return + var/command = tgui_input_text(owner, "Speak with the Voice of God", "Command") if(!command) return + if(QDELETED(src) || QDELETED(owner)) + return owner.say(".x[command]") /obj/item/organ/vocal_cords/colossus/can_speak_with() diff --git a/code/modules/surgery/plastic_surgery.dm b/code/modules/surgery/plastic_surgery.dm index 91772b3c564..bfc25433aee 100644 --- a/code/modules/surgery/plastic_surgery.dm +++ b/code/modules/surgery/plastic_surgery.dm @@ -39,8 +39,8 @@ for(var/_i in 1 to 9) names += "Subject [target.gender == MALE ? "i" : "o"]-[pick("a", "b", "c", "d", "e")]-[rand(10000, 99999)]" names += target.dna.species.random_name(target.gender, TRUE) //give one normal name in case they want to do regular plastic surgery - var/chosen_name = input(user, "Choose a new name to assign.", "Plastic Surgery") as null|anything in names - if(!chosen_name) + var/chosen_name = tgui_input_list(user, "New name to assign", "Plastic Surgery", names) + if(isnull(chosen_name)) return var/oldname = target.real_name target.real_name = chosen_name diff --git a/code/modules/tgui/tgui_input_number.dm b/code/modules/tgui/tgui_input_number.dm index 1d908fd54fd..3d23a9ef0da 100644 --- a/code/modules/tgui/tgui_input_number.dm +++ b/code/modules/tgui/tgui_input_number.dm @@ -14,7 +14,7 @@ * * min_value - Specifies a minimum value. Often 0. * * timeout - The timeout of the number input, after which the modal will close and qdel itself. Set to zero for no timeout. */ -/proc/tgui_input_number(mob/user, message, title = "Number Input", default, max_value, min_value, timeout = 0) +/proc/tgui_input_number(mob/user, message, title = "Number Input", default = 0, max_value, min_value = 0, timeout = 0) if (!user) user = usr if (!istype(user)) @@ -48,7 +48,7 @@ * * callback - The callback to be invoked when a choice is made. * * timeout - The timeout of the number input, after which the modal will close and qdel itself. Set to zero for no timeout. */ -/proc/tgui_input_number_async(mob/user, message, title = "Number Input", default, max_value, min_value, datum/callback/callback, timeout = 60 SECONDS) +/proc/tgui_input_number_async(mob/user, message, title = "Number Input", default = 0, max_value, min_value = 0, datum/callback/callback, timeout = 60 SECONDS) if (!user) user = usr if (!istype(user)) @@ -100,6 +100,14 @@ src.timeout = timeout start_time = world.time QDEL_IN(src, timeout) + /// Checks for empty numbers - bank accounts, etc. + if(max_value == 0) + src.min_value = 0 + if(default) + src.default = 0 + /// Sanity check + if(default < min_value) + src.default = min_value /datum/tgui_input_number/Destroy(force, ...) SStgui.close_uis(src) @@ -129,10 +137,10 @@ /datum/tgui_input_number/ui_static_data(mob/user) . = list( - "init_value" = default || 0, // Default is a reserved keyword + "init_value" = default, // Default is a reserved keyword "max_value" = max_value, "message" = message, - "min_value" = min_value || 0, + "min_value" = min_value, "preferences" = list(), "title" = title ) diff --git a/code/modules/tgui/tgui_input_text.dm b/code/modules/tgui/tgui_input_text.dm index 9b9e0ddd4ed..dabf0e7ebf9 100644 --- a/code/modules/tgui/tgui_input_text.dm +++ b/code/modules/tgui/tgui_input_text.dm @@ -26,13 +26,13 @@ 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(encode) 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) + return input(user, message, title, default) as text|null var/datum/tgui_input_text/text_input = new(user, message, title, default, max_length, multiline, encode, timeout) text_input.ui_interact(user) text_input.wait() @@ -71,7 +71,7 @@ else return stripped_input(user, message, title, default, max_length) else - return input(user, message, title, default) + return input(user, message, title, default) as text|null var/datum/tgui_input_text/async/text_input = new(user, message, title, default, max_length, multiline, encode, callback, timeout) text_input.ui_interact(user) @@ -170,6 +170,10 @@ return FALSE if(encode && (length(html_encode(params["entry"])) > max_length)) to_chat(usr, span_notice("Input uses special characters, thus reducing the maximum length.")) + if(!length(params["entry"])) + set_entry(null) + SStgui.close_uis(src) + return TRUE set_entry(params["entry"]) SStgui.close_uis(src) return TRUE diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index 9cc47a8184a..5f619d0af1e 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -364,7 +364,7 @@ var/hide_weapon = locate(/obj/item/mecha_parts/concealed_weapon_bay) in contents var/hidden_weapon = hide_weapon ? (locate(/obj/item/mecha_parts/mecha_equipment/weapon) in equipment) : null var/list/visible_equipment = equipment - hidden_weapon - if(visible_equipment.len) + if(length(visible_equipment)) . += "It's equipped with:" for(var/obj/item/mecha_parts/mecha_equipment/ME in visible_equipment) . += "[icon2html(ME, user)] \A [ME]." @@ -826,14 +826,14 @@ var/list/ai_pilots = list() for(var/mob/living/silicon/ai/aipilot in occupants) ai_pilots += aipilot - if(!ai_pilots.len) //Mech does not have an AI for a pilot + if(!length(ai_pilots)) //Mech does not have an AI for a pilot to_chat(user, span_warning("No AI detected in the [name] onboard computer.")) return - if(ai_pilots.len > 1) //Input box for multiple AIs, but if there's only one we'll default to them. - AI = input(user,"Which AI do you wish to card?", "AI Selection") as null|anything in sort_list(ai_pilots) + if(length(ai_pilots) > 1) //Input box for multiple AIs, but if there's only one we'll default to them. + AI = tgui_input_list(user, "Which AI do you wish to card?", "AI Selection", sort_list(ai_pilots)) else AI = ai_pilots[1] - if(!AI) + if(isnull(AI)) return if(!(AI in occupants) || !user.Adjacent(src)) return //User sat on the selection window and things changed. @@ -946,7 +946,7 @@ if(atom_integrity <= 0) to_chat(M, span_warning("You cannot get in the [name], it has been destroyed!")) else if(LAZYLEN(occupants) >= max_occupants) - to_chat(M, span_danger("[occupants[occupants.len]] was faster! Try better next time, loser."))//get the last one that hopped in + to_chat(M, span_danger("[occupants[length(occupants)]] was faster! Try better next time, loser."))//get the last one that hopped in else if(M.buckled) to_chat(M, span_warning("You can't enter the exosuit while buckled.")) else if(M.has_buckled_mobs()) diff --git a/code/modules/vehicles/mecha/mecha_topic.dm b/code/modules/vehicles/mecha/mecha_topic.dm index 1038c685cf3..3039d2b8f49 100644 --- a/code/modules/vehicles/mecha/mecha_topic.dm +++ b/code/modules/vehicles/mecha/mecha_topic.dm @@ -355,7 +355,7 @@ //Changes the exosuit name. if(href_list["change_name"]) - var/userinput = stripped_input(usr, "Choose a new exosuit name.", "Rename exosuit", "", MAX_NAME_LEN) + var/userinput = tgui_input_text(usr, "Choose a new exosuit name", "Rename exosuit", max_length = MAX_NAME_LEN) if(!userinput || !locate(usr) in occupants || usr.incapacitated()) return name = userinput diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm index 4a16cb629d5..01fae201b3c 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -1253,7 +1253,10 @@ GLOBAL_LIST_EMPTY(vending_products) var/price = 1 /obj/item/price_tagger/attack_self(mob/user) - price = max(1, round(input(user,"set price","price") as num|null, 1)) + var/chosen_price = tgui_input_number(user, "Set price", "Price", price) + if(isnull(chosen_price)) + return + price = round(chosen_price) to_chat(user, span_notice(" The [src] will now give things a [price] cr tag.")) /obj/item/price_tagger/afterattack(atom/target, mob/user, proximity) diff --git a/code/modules/wiremod/components/admin/input_request.dm b/code/modules/wiremod/components/admin/input_request.dm index 0b078080550..b0efdb4ea42 100644 --- a/code/modules/wiremod/components/admin/input_request.dm +++ b/code/modules/wiremod/components/admin/input_request.dm @@ -59,21 +59,21 @@ var/new_option = input_options.value switch(new_option) if(COMP_INPUT_STRING) - var/player_input = input(player, "Input a value", "Input value") as null|text - if(!player_input) + var/player_input = tgui_input_text(player, "Input a value", "Input value") + if(isnull(player_input)) return input_response.set_output(player_input) if(COMP_INPUT_NUMBER) - var/player_input = input(player, "Input a value", "Input value") as null|num - if(!player_input) + var/player_input = tgui_input_number(player, "Input a value", "Input value") + if(isnull(player_input)) return input_response.set_output(player_input) if(COMP_INPUT_LIST) var/list/data = parameter.value if(!islist(data)) return - var/player_input = input(player, "Input a value", "Input value") as null|anything in data - if(!player_input) + var/player_input = tgui_input_list(player, "Input a value", "Input value", data) + if(isnull(player_input)) return input_response.set_output(player_input) input_triggered.set_output(COMPONENT_SIGNAL) diff --git a/tgui/packages/tgui/interfaces/NumberInputModal.tsx b/tgui/packages/tgui/interfaces/NumberInputModal.tsx index d032b0e3d4e..bad1e2df6f5 100644 --- a/tgui/packages/tgui/interfaces/NumberInputModal.tsx +++ b/tgui/packages/tgui/interfaces/NumberInputModal.tsx @@ -21,14 +21,22 @@ export const NumberInputModal = (_, context) => { const { large_buttons } = preferences; const [input, setInput] = useLocalState(context, 'input', init_value); const onChange = (value: number) => { + if (value === input) { + return; + } setInput(value); }; const onClick = (value: number) => { + if (value === input) { + return; + } setInput(value); }; // Dynamically changes the window height based on the message. const windowHeight - = 125 + Math.ceil(message?.length / 3) + (large_buttons ? 5 : 0); + = 125 + + Math.ceil(message.length / 3) + + (message.length && large_buttons ? 5 : 0); return ( @@ -71,9 +79,10 @@ const InputArea = (props, context) => {