From 59d751a9f97c4b5e1c7af5281ef9170379f7af74 Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Fri, 16 Feb 2024 14:18:54 +0100 Subject: [PATCH] Round value adjustments for react (#15764) * input adjustments * . * . --- code/game/mecha/mecha.dm | 2 +- code/game/objects/items/blueprints_vr.dm | 2 +- code/game/objects/micro_event.dm | 2 +- code/game/objects/structures/props/beam_prism.dm | 4 ++-- code/modules/admin/admin_verbs.dm | 2 +- code/modules/admin/verbs/debug.dm | 4 ++-- code/modules/admin/verbs/fps.dm | 2 +- code/modules/admin/verbs/randomverbs.dm | 8 ++++---- code/modules/admin/verbs/resize.dm | 2 +- code/modules/admin/view_variables/topic.dm | 4 ++-- code/modules/client/preference_setup/vore/02_size.dm | 8 ++++---- code/modules/economy/cash.dm | 2 +- code/modules/economy/cash_register.dm | 2 +- code/modules/economy/casinocash.dm | 4 ++-- code/modules/economy/retail_scanner.dm | 2 +- code/modules/instruments/songs/editor.dm | 6 +++--- code/modules/mob/living/living_vr.dm | 2 +- code/modules/overmap/ships/computers/helm.dm | 10 +++++----- code/modules/overmap/ships/computers/sensors.dm | 4 ++-- code/modules/power/cable.dm | 2 +- code/modules/power/lighting.dm | 4 ++-- code/modules/random_map/drop/droppod.dm | 4 ++-- code/modules/reagents/machinery/distillery.dm | 2 +- code/modules/reagents/machinery/injector_maker.dm | 6 +++--- code/modules/tgui/modules/law_manager.dm | 4 ++-- code/modules/tgui/modules/overmap.dm | 12 ++++++------ code/modules/tgui_input/number.dm | 2 +- code/modules/virus2/admin.dm | 4 ++-- code/modules/vore/eating/vorepanel_vr.dm | 12 ++++++------ 29 files changed, 62 insertions(+), 62 deletions(-) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 633757a03f9..0bc34b01d29 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -2580,7 +2580,7 @@ if(!in_range(src, usr)) return var/mob/user = top_filter.getMob("user") if(user) - var/new_pressure = tgui_input_number(user,"Input new output pressure","Pressure setting",internal_tank_valve) + var/new_pressure = tgui_input_number(user,"Input new output pressure","Pressure setting",internal_tank_valve, round_value=FALSE) if(new_pressure) internal_tank_valve = new_pressure to_chat(user, "The internal pressure valve has been set to [internal_tank_valve]kPa.") diff --git a/code/game/objects/items/blueprints_vr.dm b/code/game/objects/items/blueprints_vr.dm index 92231894d9b..93bd466de60 100644 --- a/code/game/objects/items/blueprints_vr.dm +++ b/code/game/objects/items/blueprints_vr.dm @@ -108,7 +108,7 @@ to_chat(user, span_notice("You add some more writing material to the [src] with the [blueprint]!")) return else if(blueprint.uses_charges && blueprint.charges) //Getting from another with limited charges. - var/to_add = tgui_input_number(user, "How many charges do you want to add to the [src]?", "[blueprint]", missing_charges) + var/to_add = tgui_input_number(user, "How many charges do you want to add to the [src]?", "[blueprint]", missing_charges, blueprint.charges) if(!isnull(to_add) && blueprint.charges >= to_add) to_chat(user, span_notice("You add some more writing material to the [src] with the [blueprint]!")) blueprint.charges -= to_add diff --git a/code/game/objects/micro_event.dm b/code/game/objects/micro_event.dm index f798d9b6aad..36fcb152e78 100644 --- a/code/game/objects/micro_event.dm +++ b/code/game/objects/micro_event.dm @@ -17,7 +17,7 @@ shrinking = FALSE our_message = "What should the size limit be? Anyone under this limit will be grown to this size. (1 = 100%, etc)" - size_limit = tgui_input_number(user, our_message, "Pick a Size", 1) + size_limit = tgui_input_number(user, our_message, "Pick a Size", 1, round_value=FALSE) return ..() diff --git a/code/game/objects/structures/props/beam_prism.dm b/code/game/objects/structures/props/beam_prism.dm index 96c6dc57b9e..59ab3f619a3 100644 --- a/code/game/objects/structures/props/beam_prism.dm +++ b/code/game/objects/structures/props/beam_prism.dm @@ -59,7 +59,7 @@ var/new_bearing if(free_rotate) - new_bearing = tgui_input_number(usr, "What bearing do you want to rotate \the [src] to?", "[name]") + new_bearing = tgui_input_number(usr, "What bearing do you want to rotate \the [src] to?", "[name]", 0, 360, 0) new_bearing = round(new_bearing) if(new_bearing <= -1 || new_bearing > 360) to_chat(user, "Rotating \the [src] [new_bearing] degrees would be a waste of time.") @@ -176,7 +176,7 @@ var/new_bearing if(free_rotate) - new_bearing = tgui_input_number(usr, "What bearing do you want to rotate \the [src] to?", "[name]") + new_bearing = tgui_input_number(usr, "What bearing do you want to rotate \the [src] to?", "[name]", 0, 360, 0) new_bearing = round(new_bearing) if(new_bearing <= -1 || new_bearing > 360) to_chat(user, "Rotating \the [src] [new_bearing] degrees would be a waste of time.") diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index d6502200fe3..91eaaa3e079 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -297,7 +297,7 @@ if ("Badmin") severity = 99 D.makerandom(severity) - D.infectionchance = tgui_input_number(usr, "How virulent is this disease? (1-100)", "Give Disease", D.infectionchance) + D.infectionchance = tgui_input_number(usr, "How virulent is this disease? (1-100)", "Give Disease", D.infectionchance, 100, 1) if(istype(T,/mob/living/carbon/human)) var/mob/living/carbon/human/H = T diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index d4344704f5c..12f4b117852 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -678,9 +678,9 @@ var/datum/planet/planet = tgui_input_list(usr, "Which planet do you want to modify time on?", "Change Time", SSplanets.planets) if(istype(planet)) var/datum/time/current_time_datum = planet.current_time - var/new_hour = tgui_input_number(usr, "What hour do you want to change to?", "Change Time", text2num(current_time_datum.show_time("hh"))) + var/new_hour = tgui_input_number(usr, "What hour do you want to change to?", "Change Time", text2num(current_time_datum.show_time("hh")), 23) if(!isnull(new_hour)) - var/new_minute = tgui_input_number(usr, "What minute do you want to change to?", "Change Time", text2num(current_time_datum.show_time("mm")) ) + var/new_minute = tgui_input_number(usr, "What minute do you want to change to?", "Change Time", text2num(current_time_datum.show_time("mm")), 59) if(!isnull(new_minute)) var/type_needed = current_time_datum.type var/datum/time/new_time = new type_needed() diff --git a/code/modules/admin/verbs/fps.dm b/code/modules/admin/verbs/fps.dm index c3b9999afbc..60158ec4753 100644 --- a/code/modules/admin/verbs/fps.dm +++ b/code/modules/admin/verbs/fps.dm @@ -8,7 +8,7 @@ if(!check_rights(R_DEBUG)) return - var/new_fps = round(tgui_input_number(usr, "Sets game frames-per-second. Can potentially break the game (default: [config.fps])", "FPS", world.fps)) + var/new_fps = round(tgui_input_number(usr, "Sets game frames-per-second. Can potentially break the game (default: [config.fps])", "FPS", world.fps), round(config.fps * 1.5)) if(new_fps <= 0) to_chat(src, "Error: set_server_fps(): Invalid world.fps value. No changes made.") return diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 19f75f850e5..ca291a4a3ab 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -694,13 +694,13 @@ Traitors and the like can also be revived with the previous role mostly intact. if(!check_rights(R_DEBUG|R_FUN)) return //VOREStation Edit - var/devastation = tgui_input_number(usr, "Range of total devastation. -1 to none", text("Input")) + var/devastation = tgui_input_number(usr, "Range of total devastation. -1 to none", text("Input"), min_value=-1) if(devastation == null) return - var/heavy = tgui_input_number(usr, "Range of heavy impact. -1 to none", text("Input")) + var/heavy = tgui_input_number(usr, "Range of heavy impact. -1 to none", text("Input"), min_value=-1) if(heavy == null) return - var/light = tgui_input_number(usr, "Range of light impact. -1 to none", text("Input")) + var/light = tgui_input_number(usr, "Range of light impact. -1 to none", text("Input"), min_value=-1) if(light == null) return - var/flash = tgui_input_number(usr, "Range of flash. -1 to none", text("Input")) + var/flash = tgui_input_number(usr, "Range of flash. -1 to none", text("Input"), min_value=-1) if(flash == null) return if ((devastation != -1) || (heavy != -1) || (light != -1) || (flash != -1)) diff --git a/code/modules/admin/verbs/resize.dm b/code/modules/admin/verbs/resize.dm index d8bc5be57c2..c67e2ffd8f7 100644 --- a/code/modules/admin/verbs/resize.dm +++ b/code/modules/admin/verbs/resize.dm @@ -5,7 +5,7 @@ if(!check_rights(R_ADMIN|R_FUN|R_VAREDIT)) return - var/size_multiplier = tgui_input_number(usr, "Input size multiplier.", "Resize", 1) + var/size_multiplier = tgui_input_number(usr, "Input size multiplier.", "Resize", 1, round_value=FALSE) if(!size_multiplier) return //cancelled diff --git a/code/modules/admin/view_variables/topic.dm b/code/modules/admin/view_variables/topic.dm index 09e15f7162a..c5e5cf4dedc 100644 --- a/code/modules/admin/view_variables/topic.dm +++ b/code/modules/admin/view_variables/topic.dm @@ -103,7 +103,7 @@ var/severity = tgui_input_number(usr, "How much damage should the bleeding internal wound cause? \ Bleed timer directly correlates with this. 0 cancels. Input is rounded to nearest integer.", - "Wound Severity", 0, min_value = 0, round_value = TRUE ) + "Wound Severity", 0) if(!severity) return var/obj/item/organ/external/chosen_organ = tgui_input_list(usr, "Choose an external organ to inflict IB on!", "Organ Choice", H.organs) @@ -545,7 +545,7 @@ var/Text = href_list["adjustDamage"] - var/amount = tgui_input_number(usr, "Deal how much damage to mob? (Negative values here heal)","Adjust [Text]loss",0) + var/amount = tgui_input_number(usr, "Deal how much damage to mob? (Negative values here heal)","Adjust [Text]loss",0, min_value=-INFINITY, round_value=FALSE) if(!L) to_chat(usr, "Mob doesn't exist anymore") diff --git a/code/modules/client/preference_setup/vore/02_size.dm b/code/modules/client/preference_setup/vore/02_size.dm index e1a77d2883e..530706c0e22 100644 --- a/code/modules/client/preference_setup/vore/02_size.dm +++ b/code/modules/client/preference_setup/vore/02_size.dm @@ -139,7 +139,7 @@ This measurement should be set relative to a normal 5'10'' person's body and not the actual size of your character.\n\ If you set your weight to 500 because you're a naga or have metal implants then complain that you're a blob I\n\ swear to god I will find you and I will punch you for not reading these directions!\n\ - ([WEIGHT_MIN]-[WEIGHT_MAX])", "Character Preference", null, WEIGHT_MAX, WEIGHT_MIN) + ([WEIGHT_MIN]-[WEIGHT_MAX])", "Character Preference", null, WEIGHT_MAX, WEIGHT_MIN, round_value=FALSE) if(new_weight) var/unit_of_measurement = tgui_alert(user, "Is that number in pounds (lb) or kilograms (kg)?", "Confirmation", list("Pounds", "Kilograms")) if(unit_of_measurement == "Pounds") @@ -153,7 +153,7 @@ var/weight_gain_rate = tgui_input_number(user, "Choose your character's rate of weight gain between 100% \ (full realism body fat gain) and 0% (no body fat gain).\n\ (If you want to disable weight gain, set this to 0.01 to round it to 0%.)\ - ([WEIGHT_CHANGE_MIN]-[WEIGHT_CHANGE_MAX])", "Character Preference", pref.weight_gain) + ([WEIGHT_CHANGE_MIN]-[WEIGHT_CHANGE_MAX])", "Character Preference", pref.weight_gain, WEIGHT_CHANGE_MAX, WEIGHT_CHANGE_MIN, round_value=FALSE) if(weight_gain_rate) pref.weight_gain = round(text2num(weight_gain_rate),1) return TOPIC_REFRESH @@ -162,7 +162,7 @@ var/weight_loss_rate = tgui_input_number(user, "Choose your character's rate of weight loss between 100% \ (full realism body fat loss) and 0% (no body fat loss).\n\ (If you want to disable weight loss, set this to 0.01 round it to 0%.)\ - ([WEIGHT_CHANGE_MIN]-[WEIGHT_CHANGE_MAX])", "Character Preference", pref.weight_loss) + ([WEIGHT_CHANGE_MIN]-[WEIGHT_CHANGE_MAX])", "Character Preference", pref.weight_loss, WEIGHT_CHANGE_MAX, WEIGHT_CHANGE_MIN, round_value=FALSE) if(weight_loss_rate) pref.weight_loss = round(text2num(weight_loss_rate),1) return TOPIC_REFRESH @@ -177,7 +177,7 @@ pref.voice_freq = choice return TOPIC_REFRESH else if(choice == 1) - choice = tgui_input_number(user, "Choose your character's voice frequency, ranging from [MIN_VOICE_FREQ] to [MAX_VOICE_FREQ]", "Custom Voice Frequency", null, MAX_VOICE_FREQ, MIN_VOICE_FREQ, round_value = TRUE) + choice = tgui_input_number(user, "Choose your character's voice frequency, ranging from [MIN_VOICE_FREQ] to [MAX_VOICE_FREQ]", "Custom Voice Frequency", null, MAX_VOICE_FREQ, MIN_VOICE_FREQ) if(choice > MAX_VOICE_FREQ) choice = MAX_VOICE_FREQ else if(choice < MIN_VOICE_FREQ) diff --git a/code/modules/economy/cash.dm b/code/modules/economy/cash.dm index 7b2d31a391c..7cf04f4ac5a 100644 --- a/code/modules/economy/cash.dm +++ b/code/modules/economy/cash.dm @@ -80,7 +80,7 @@ return worth /obj/item/weapon/spacecash/attack_self() - var/amount = tgui_input_number(usr, "How many [initial_name]s do you want to take? (0 to [src.worth])", "Take Money", 20) + var/amount = tgui_input_number(usr, "How many [initial_name]s do you want to take? (0 to [src.worth])", "Take Money", 20, src.worth) if(!src || QDELETED(src)) return amount = round(CLAMP(amount, 0, src.worth)) diff --git a/code/modules/economy/cash_register.dm b/code/modules/economy/cash_register.dm index 8c799597ea0..ae2479d6130 100644 --- a/code/modules/economy/cash_register.dm +++ b/code/modules/economy/cash_register.dm @@ -129,7 +129,7 @@ src.visible_message("\icon[src][bicon(src)][transaction_purpose]: [t_amount] Thaler\s.") if("set_amount") var/item_name = locate(href_list["item"]) - var/n_amount = round(tgui_input_number(usr, "Enter amount", "New amount")) + var/n_amount = round(tgui_input_number(usr, "Enter amount", "New amount", 0, 20, 0)) n_amount = CLAMP(n_amount, 0, 20) if (!item_list[item_name] || !Adjacent(usr)) return transaction_amount += (n_amount - item_list[item_name]) * price_list[item_name] diff --git a/code/modules/economy/casinocash.dm b/code/modules/economy/casinocash.dm index e74b89d42b7..79a057b6365 100644 --- a/code/modules/economy/casinocash.dm +++ b/code/modules/economy/casinocash.dm @@ -112,7 +112,7 @@ return worth /obj/item/weapon/spacecasinocash/attack_self() - var/amount = tgui_input_number(usr, "How much credits worth of chips do you want to take? (0 to [src.worth])", "Take chips", 20) + var/amount = tgui_input_number(usr, "How much credits worth of chips do you want to take? (0 to [src.worth])", "Take chips", 20, src.worth) if(!src || QDELETED(src)) return amount = round(CLAMP(amount, 0, src.worth)) @@ -204,4 +204,4 @@ else if(result == 2) comment = "Joker" user.visible_message("[user] has thrown \the [src]. It lands on [comment]! ", \ - "You throw \the [src]. It lands on [comment]! ") \ No newline at end of file + "You throw \the [src]. It lands on [comment]! ") diff --git a/code/modules/economy/retail_scanner.dm b/code/modules/economy/retail_scanner.dm index f2b4854d116..d2ab5884ae1 100644 --- a/code/modules/economy/retail_scanner.dm +++ b/code/modules/economy/retail_scanner.dm @@ -123,7 +123,7 @@ src.visible_message("\icon[src][bicon(src)][transaction_purpose]: [t_amount] Thaler\s.") if("set_amount") var/item_name = locate(href_list["item"]) - var/n_amount = round(tgui_input_number(usr, "Enter amount", "New amount")) + var/n_amount = round(tgui_input_number(usr, "Enter amount", "New amount", 0, 20, 0)) n_amount = CLAMP(n_amount, 0, 20) if (!item_list[item_name] || !Adjacent(usr)) return transaction_amount += (n_amount - item_list[item_name]) * price_list[item_name] diff --git a/code/modules/instruments/songs/editor.dm b/code/modules/instruments/songs/editor.dm index 883ecc881e4..f38420fd376 100644 --- a/code/modules/instruments/songs/editor.dm +++ b/code/modules/instruments/songs/editor.dm @@ -196,7 +196,7 @@ set_linear_falloff_duration(round(amount * 10, world.tick_lag)) else if(href_list["setexpfalloff"]) - var/amount = tgui_input_number(usr, "Set exponential sustain factor", "Exponential sustain factor") + var/amount = tgui_input_number(usr, "Set exponential sustain factor", "Exponential sustain factor", round_value=FALSE) if(!isnull(amount)) set_exponential_drop_rate(round(amount, 0.00001)) @@ -206,7 +206,7 @@ set_volume(round(amount, 1)) else if(href_list["setdropoffvolume"]) - var/amount = tgui_input_number(usr, "Set dropoff threshold", "Dropoff Threshold Volume") + var/amount = tgui_input_number(usr, "Set dropoff threshold", "Dropoff Threshold Volume", round_value=FALSE) if(!isnull(amount)) set_dropoff_volume(round(amount, 0.01)) @@ -233,7 +233,7 @@ set_instrument(choice) else if(href_list["setnoteshift"]) - var/amount = tgui_input_number(usr, "Set note shift", "Note Shift") + var/amount = tgui_input_number(usr, "Set note shift", "Note Shift", null, note_shift_max, note_shift_min) if(!isnull(amount)) note_shift = clamp(amount, note_shift_min, note_shift_max) diff --git a/code/modules/mob/living/living_vr.dm b/code/modules/mob/living/living_vr.dm index 43575d3e0c2..582ed83db6c 100644 --- a/code/modules/mob/living/living_vr.dm +++ b/code/modules/mob/living/living_vr.dm @@ -124,7 +124,7 @@ voice_freq = choice return else if(choice == 1) - choice = tgui_input_number(src, "Choose your character's voice frequency, ranging from [MIN_VOICE_FREQ] to [MAX_VOICE_FREQ]", "Custom Voice Frequency", null, MAX_VOICE_FREQ, MIN_VOICE_FREQ, round_value = TRUE) + choice = tgui_input_number(src, "Choose your character's voice frequency, ranging from [MIN_VOICE_FREQ] to [MAX_VOICE_FREQ]", "Custom Voice Frequency", null, MAX_VOICE_FREQ, MIN_VOICE_FREQ) else if(choice > MAX_VOICE_FREQ) choice = MAX_VOICE_FREQ else if(choice < MIN_VOICE_FREQ) diff --git a/code/modules/overmap/ships/computers/helm.dm b/code/modules/overmap/ships/computers/helm.dm index 37c625dc895..95657cb43c2 100644 --- a/code/modules/overmap/ships/computers/helm.dm +++ b/code/modules/overmap/ships/computers/helm.dm @@ -172,10 +172,10 @@ GLOBAL_LIST_EMPTY(all_waypoints) R.fields["x"] = linked.x R.fields["y"] = linked.y if("new") - var/newx = tgui_input_number(usr, "Input new entry x coordinate", "Coordinate input", linked.x) + var/newx = tgui_input_number(usr, "Input new entry x coordinate", "Coordinate input", linked.x, world.maxx, 1) if(tgui_status(usr, state) != STATUS_INTERACTIVE) return TRUE - var/newy = tgui_input_number(usr, "Input new entry y coordinate", "Coordinate input", linked.y) + var/newy = tgui_input_number(usr, "Input new entry y coordinate", "Coordinate input", linked.y, world.maxy, 1) if(tgui_status(usr, state) != STATUS_INTERACTIVE) return FALSE R.fields["x"] = CLAMP(newx, 1, world.maxx) @@ -192,14 +192,14 @@ GLOBAL_LIST_EMPTY(all_waypoints) if("setcoord") if(params["setx"]) - var/newx = tgui_input_number(usr, "Input new destiniation x coordinate", "Coordinate input", dx) + var/newx = tgui_input_number(usr, "Input new destiniation x coordinate", "Coordinate input", dx, world.maxx, 1) if(tgui_status(usr, state) != STATUS_INTERACTIVE) return if(newx) dx = CLAMP(newx, 1, world.maxx) if(params["sety"]) - var/newy = tgui_input_number(usr, "Input new destiniation y coordinate", "Coordinate input", dy) + var/newy = tgui_input_number(usr, "Input new destiniation y coordinate", "Coordinate input", dy, world.maxy, 1) if(tgui_status(usr, state) != STATUS_INTERACTIVE) return if(newy) @@ -217,7 +217,7 @@ GLOBAL_LIST_EMPTY(all_waypoints) . = TRUE if("speedlimit") - var/newlimit = tgui_input_number(usr, "Input new speed limit for autopilot (0 to brake)", "Autopilot speed limit", speedlimit*1000) + var/newlimit = tgui_input_number(usr, "Input new speed limit for autopilot (0 to brake)", "Autopilot speed limit", speedlimit*1000, 100000) if(newlimit) speedlimit = CLAMP(newlimit/1000, 0, 100) . = TRUE diff --git a/code/modules/overmap/ships/computers/sensors.dm b/code/modules/overmap/ships/computers/sensors.dm index 18c0e36196c..5990c6f1463 100644 --- a/code/modules/overmap/ships/computers/sensors.dm +++ b/code/modules/overmap/ships/computers/sensors.dm @@ -106,7 +106,7 @@ if(sensors) switch(action) if("range") - var/nrange = tgui_input_number(usr, "Set new sensors range", "Sensor range", sensors.range) + var/nrange = tgui_input_number(usr, "Set new sensors range", "Sensor range", sensors.range, world.view) if(tgui_status(usr, state) != STATUS_INTERACTIVE) return FALSE if(nrange) @@ -241,4 +241,4 @@ /obj/machinery/shipsensors/weak heat_reduction = 0.2 - desc = "Miniaturized gravity scanner with various other sensors, used to detect irregularities in surrounding space. Can only run in vacuum to protect delicate quantum bluespace elements." \ No newline at end of file + desc = "Miniaturized gravity scanner with various other sensors, used to detect irregularities in surrounding space. Can only run in vacuum to protect delicate quantum bluespace elements." diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 00e855e0479..f86a6c5d2ce 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -980,7 +980,7 @@ var/list/possible_cable_coil_colours = list( /obj/item/stack/cable_coil/alien/attack_hand(mob/user as mob) if (user.get_inactive_hand() == src) - var/N = tgui_input_number(usr, "How many units of wire do you want to take from [src]? You can only take up to [amount] at a time.", "Split stacks", 1) + var/N = tgui_input_number(usr, "How many units of wire do you want to take from [src]? You can only take up to [amount] at a time.", "Split stacks", 1, amount) if(N && N <= amount) var/obj/item/stack/cable_coil/CC = new/obj/item/stack/cable_coil(user.loc) CC.amount = N diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 6ee50752b1c..223b0e07fb5 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -1106,7 +1106,7 @@ var/global/list/light_type_cache = list() brightness_range = new_range if("Normal Brightness") - var/new_power = tgui_input_number(usr, "Choose the new brightness of the light! (0.01 - [init_brightness_power])", "", init_brightness_power, init_brightness_power, 0.01, 0) + var/new_power = tgui_input_number(usr, "Choose the new brightness of the light! (0.01 - [init_brightness_power])", "", init_brightness_power, init_brightness_power, 0.01, round_value=FALSE) if(new_power) brightness_power = new_power @@ -1121,7 +1121,7 @@ var/global/list/light_type_cache = list() nightshift_range = new_range if("Nightshift Brightness") - var/new_power = tgui_input_number(usr, "Choose the new brightness of the light! (0.01 - [init_nightshift_power])", "", init_nightshift_power, init_nightshift_power, 0.01) + var/new_power = tgui_input_number(usr, "Choose the new brightness of the light! (0.01 - [init_nightshift_power])", "", init_nightshift_power, init_nightshift_power, 0.01, round_value=FALSE) if(new_power) nightshift_power = new_power diff --git a/code/modules/random_map/drop/droppod.dm b/code/modules/random_map/drop/droppod.dm index e842772f4a5..dace62feee2 100644 --- a/code/modules/random_map/drop/droppod.dm +++ b/code/modules/random_map/drop/droppod.dm @@ -164,7 +164,7 @@ return if(tgui_alert(usr, "Do you wish the mob to have a player?","Assign Player?",list("No","Yes")) == "No") - var/spawn_count = tgui_input_number(usr, "How many mobs do you wish the pod to contain?", "Drop Pod Selection", null) + var/spawn_count = tgui_input_number(usr, "How many mobs do you wish the pod to contain?", "Drop Pod Selection", null, min_value=1) if(spawn_count <= 0) return for(var/i=0;i 0) switch(material) if("mold plastic") @@ -210,7 +210,7 @@ if(!beaker.reagents.total_volume) to_chat(user, SPAN_WARNING("Chemical storage is empty!")) return - var/injector_amount = tgui_input_number(user, "How many injectors would you like?", "Make large injectors", 0, 100, 0, 0, TRUE) + var/injector_amount = tgui_input_number(user, "How many injectors would you like?", "Make large injectors", 0, 100) if(injector_amount > 0) switch(material) if("mold plastic") diff --git a/code/modules/tgui/modules/law_manager.dm b/code/modules/tgui/modules/law_manager.dm index 847281a554a..77fe6db5464 100644 --- a/code/modules/tgui/modules/law_manager.dm +++ b/code/modules/tgui/modules/law_manager.dm @@ -89,7 +89,7 @@ return TRUE if("change_supplied_law_position") - var/new_position = tgui_input_number(usr, "Enter new supplied law position between 1 and [MAX_SUPPLIED_LAW_NUMBER], inclusive. Inherent laws at the same index as a supplied law will not be stated.", "Law Position", supplied_law_position) + var/new_position = tgui_input_number(usr, "Enter new supplied law position between 1 and [MAX_SUPPLIED_LAW_NUMBER], inclusive. Inherent laws at the same index as a supplied law will not be stated.", "Law Position", supplied_law_position, MAX_SUPPLIED_LAW_NUMBER, 1) if(isnum(new_position) && can_still_topic(usr, state)) supplied_law_position = CLAMP(new_position, 1, MAX_SUPPLIED_LAW_NUMBER) return TRUE @@ -221,4 +221,4 @@ /datum/tgui_module/law_manager/admin /datum/tgui_module/law_manager/admin/tgui_state(mob/user) - return GLOB.tgui_admin_state \ No newline at end of file + return GLOB.tgui_admin_state diff --git a/code/modules/tgui/modules/overmap.dm b/code/modules/tgui/modules/overmap.dm index af3f2b6c8f0..28e935e3d00 100644 --- a/code/modules/tgui/modules/overmap.dm +++ b/code/modules/tgui/modules/overmap.dm @@ -320,8 +320,8 @@ R.fields["x"] = linked.x R.fields["y"] = linked.y if("new") - var/newx = tgui_input_number(usr, "Input new entry x coordinate", "Coordinate input", linked.x) - var/newy = tgui_input_number(usr, "Input new entry y coordinate", "Coordinate input", linked.y) + var/newx = tgui_input_number(usr, "Input new entry x coordinate", "Coordinate input", linked.x, world.maxx, 1) + var/newy = tgui_input_number(usr, "Input new entry y coordinate", "Coordinate input", linked.y, world.maxy, 1) R.fields["x"] = CLAMP(newx, 1, world.maxx) R.fields["y"] = CLAMP(newy, 1, world.maxy) known_sectors[sec_name] = R @@ -336,12 +336,12 @@ if("setcoord") if(params["setx"]) - var/newx = tgui_input_number(usr, "Input new destiniation x coordinate", "Coordinate input", dx) + var/newx = tgui_input_number(usr, "Input new destiniation x coordinate", "Coordinate input", dx, world.maxx, 1) if(newx) dx = CLAMP(newx, 1, world.maxx) if(params["sety"]) - var/newy = tgui_input_number(usr, "Input new destiniation y coordinate", "Coordinate input", dy) + var/newy = tgui_input_number(usr, "Input new destiniation y coordinate", "Coordinate input", dy, world.maxy, 1) if(newy) dy = CLAMP(newy, 1, world.maxy) . = TRUE @@ -357,7 +357,7 @@ . = TRUE if("speedlimit") - var/newlimit = tgui_input_number(usr, "Input new speed limit for autopilot (0 to brake)", "Autopilot speed limit", speedlimit*1000) + var/newlimit = tgui_input_number(usr, "Input new speed limit for autopilot (0 to brake)", "Autopilot speed limit", speedlimit*1000, 100000) if(newlimit) speedlimit = CLAMP(newlimit/1000, 0, 100) . = TRUE @@ -438,7 +438,7 @@ /* END ENGINES */ /* SENSORS */ if("range") - var/nrange = tgui_input_number(usr, "Set new sensors range", "Sensor range", sensors.range, round_value = FALSE) + var/nrange = tgui_input_number(usr, "Set new sensors range", "Sensor range", sensors.range, world.view, round_value = FALSE) if(nrange) sensors.set_range(CLAMP(nrange, 1, world.view)) . = TRUE diff --git a/code/modules/tgui_input/number.dm b/code/modules/tgui_input/number.dm index f45eaad5c03..da302798411 100644 --- a/code/modules/tgui_input/number.dm +++ b/code/modules/tgui_input/number.dm @@ -15,7 +15,7 @@ * * timeout - The timeout of the number input, after which the modal will close and qdel itself. Set to zero for no timeout. * * round_value - whether the inputted number is rounded down into an integer. */ -/proc/tgui_input_number(mob/user, message, title = "Number Input", default = 0, max_value = INFINITY, min_value = -INFINITY, timeout = 0, round_value = TRUE, ui_state = GLOB.tgui_always_state) +/proc/tgui_input_number(mob/user, message, title = "Number Input", default = 0, max_value = INFINITY, min_value = 0, timeout = 0, round_value = TRUE, ui_state = GLOB.tgui_always_state) if (!user) user = usr if (!istype(user)) diff --git a/code/modules/virus2/admin.dm b/code/modules/virus2/admin.dm index 687473c1069..3712d70f064 100644 --- a/code/modules/virus2/admin.dm +++ b/code/modules/virus2/admin.dm @@ -150,7 +150,7 @@ if(!infectee.species || !(infectee.species.get_bodytype() in species)) infectee = null if("ichance") - var/I = tgui_input_number(usr, "Input infection chance", "Infection Chance", infectionchance) + var/I = tgui_input_number(usr, "Input infection chance", "Infection Chance", infectionchance, 100) if(!I) return infectionchance = I if("stype") @@ -172,7 +172,7 @@ else if(href_list["reset"]) antigens = list() if("resistance") - var/S = tgui_input_number(usr, "Input % resistance to antibiotics", "Resistance", resistance) + var/S = tgui_input_number(usr, "Input % resistance to antibiotics", "Resistance", resistance, 100) if(!S) return resistance = S if("infectee") diff --git a/code/modules/vore/eating/vorepanel_vr.dm b/code/modules/vore/eating/vorepanel_vr.dm index e16f9f773ec..a38c48cc795 100644 --- a/code/modules/vore/eating/vorepanel_vr.dm +++ b/code/modules/vore/eating/vorepanel_vr.dm @@ -1460,42 +1460,42 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono", host.vore_selected.shrink_grow_size = (new_grow*0.01) . = TRUE if("b_nutritionpercent") - var/new_nutrition = tgui_input_number(user, "Choose the nutrition gain percentage you will receive per tick from prey. Ranges from 0.01 to 100.", "Set Nutrition Gain Percentage.", host.vore_selected.nutrition_percent, 100, 0.01) + var/new_nutrition = tgui_input_number(user, "Choose the nutrition gain percentage you will receive per tick from prey. Ranges from 0.01 to 100.", "Set Nutrition Gain Percentage.", host.vore_selected.nutrition_percent, 100, 0.01, round_value=FALSE) if(new_nutrition == null) return FALSE var/new_new_nutrition = CLAMP(new_nutrition, 0.01, 100) host.vore_selected.nutrition_percent = new_new_nutrition . = TRUE if("b_burn_dmg") - var/new_damage = tgui_input_number(user, "Choose the amount of burn damage prey will take per tick. Ranges from 0 to 6.", "Set Belly Burn Damage.", host.vore_selected.digest_burn, 6, 0) + var/new_damage = tgui_input_number(user, "Choose the amount of burn damage prey will take per tick. Ranges from 0 to 6.", "Set Belly Burn Damage.", host.vore_selected.digest_burn, 6, 0, round_value=FALSE) if(new_damage == null) return FALSE var/new_new_damage = CLAMP(new_damage, 0, 6) host.vore_selected.digest_burn = new_new_damage . = TRUE if("b_brute_dmg") - var/new_damage = tgui_input_number(user, "Choose the amount of brute damage prey will take per tick. Ranges from 0 to 6", "Set Belly Brute Damage.", host.vore_selected.digest_brute, 6, 0) + var/new_damage = tgui_input_number(user, "Choose the amount of brute damage prey will take per tick. Ranges from 0 to 6", "Set Belly Brute Damage.", host.vore_selected.digest_brute, 6, 0, round_value=FALSE) if(new_damage == null) return FALSE var/new_new_damage = CLAMP(new_damage, 0, 6) host.vore_selected.digest_brute = new_new_damage . = TRUE if("b_oxy_dmg") - var/new_damage = tgui_input_number(user, "Choose the amount of suffocation damage prey will take per tick. Ranges from 0 to 12.", "Set Belly Suffocation Damage.", host.vore_selected.digest_oxy, 12, 0) + var/new_damage = tgui_input_number(user, "Choose the amount of suffocation damage prey will take per tick. Ranges from 0 to 12.", "Set Belly Suffocation Damage.", host.vore_selected.digest_oxy, 12, 0, round_value=FALSE) if(new_damage == null) return FALSE var/new_new_damage = CLAMP(new_damage, 0, 12) host.vore_selected.digest_oxy = new_new_damage . = TRUE if("b_tox_dmg") - var/new_damage = tgui_input_number(user, "Choose the amount of toxins damage prey will take per tick. Ranges from 0 to 6", "Set Belly Toxins Damage.", host.vore_selected.digest_tox, 6, 0) + var/new_damage = tgui_input_number(user, "Choose the amount of toxins damage prey will take per tick. Ranges from 0 to 6", "Set Belly Toxins Damage.", host.vore_selected.digest_tox, 6, 0, round_value=FALSE) if(new_damage == null) return FALSE var/new_new_damage = CLAMP(new_damage, 0, 6) host.vore_selected.digest_tox = new_new_damage . = TRUE if("b_clone_dmg") - var/new_damage = tgui_input_number(user, "Choose the amount of brute DNA damage (clone) prey will take per tick. Ranges from 0 to 6", "Set Belly Clone Damage.", host.vore_selected.digest_clone, 6, 0) + var/new_damage = tgui_input_number(user, "Choose the amount of brute DNA damage (clone) prey will take per tick. Ranges from 0 to 6", "Set Belly Clone Damage.", host.vore_selected.digest_clone, 6, 0, round_value=FALSE) if(new_damage == null) return FALSE var/new_new_damage = CLAMP(new_damage, 0, 6)