[MIRROR] Round value adjustments for react (#7767)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
Co-authored-by: Kashargul <KashL@t-online.de>
This commit is contained in:
CHOMPStation2
2024-02-16 11:27:03 -07:00
committed by GitHub
parent ee060aa676
commit 937090b0ec
33 changed files with 295 additions and 90 deletions

View File

@@ -2584,7 +2584,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.")

View File

@@ -155,5 +155,4 @@
return result
/obj/effect/decal/mecha_wreckage/micro
<<<<<<< HEAD
icon = 'icons/mecha/micro.dmi' */

View File

@@ -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

View File

@@ -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 ..()

View File

@@ -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, "<span class='warning'>Rotating \the [src] [new_bearing] degrees would be a waste of time.</span>")
@@ -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, "<span class='warning'>Rotating \the [src] [new_bearing] degrees would be a waste of time.</span>")

View File

@@ -299,7 +299,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

View File

@@ -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()

View File

@@ -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, "<span class='danger'>Error: set_server_fps(): Invalid world.fps value. No changes made.</span>")
return

View File

@@ -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))

View File

@@ -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

View File

@@ -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")

View File

@@ -168,7 +168,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")
@@ -182,7 +182,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
@@ -191,7 +191,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
@@ -206,7 +206,7 @@
pref.voice_freq = 42500 //CHOMPEdit
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)

View File

@@ -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))

View File

@@ -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]

View File

@@ -0,0 +1,207 @@
//Original Casino Code created by Shadowfire117#1269 - Ported from CHOMPstation
//Modified by GhostActual#2055 for use with VOREstation
/obj/machinery/chipmachine
name = "Casino Chip Exchange"
desc = "Takes all your cash and gives you chips back! No change and half refund!"
icon = 'icons/obj/casino.dmi'
icon_state ="chipmachine"
anchored = 1
/obj/machinery/chipmachine/attackby(obj/item/I as obj, mob/user as mob)
if(istype(I,/obj/item/weapon/spacecash) && (I:worth >= 5))
//consume the money
if(prob(50))
playsound(loc, 'sound/items/polaroid1.ogg', 50, 1)
else
playsound(loc, 'sound/items/polaroid2.ogg', 50, 1)
user << "<span class='info'>You insert [I] into [src].</span>"
spawn_casinochips(round(I:worth/5), src.loc)
src.attack_hand(user)
qdel(I)
if(istype(I,/obj/item/weapon/spacecasinocash))
//consume the chips
if(prob(50))
playsound(loc, 'sound/items/polaroid1.ogg', 50, 1)
else
playsound(loc, 'sound/items/polaroid2.ogg', 50, 1)
user << "<span class='info'>You insert [I] into [src].</span>"
spawn_money(round(I:worth*5), src.loc)
src.attack_hand(user)
qdel(I)
/obj/item/weapon/spacecasinocash
name = "broken casino chip"
desc = "It's worth nothing in a casino."
gender = PLURAL
icon = 'icons/obj/casino.dmi'
icon_state = "spacecasinocash1"
opacity = 0
density = 0
anchored = 0.0
force = 1.0
throwforce = 1.0
throw_speed = 1
throw_range = 2
w_class = ITEMSIZE_SMALL
var/access = list()
access = access_crate_cash
var/worth = 0
/obj/item/weapon/spacecasinocash/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/spacecasinocash))
var/obj/item/weapon/spacecasinocash/SC = W
SC.adjust_worth(src.worth)
if(istype(user, /mob/living/carbon/human))
var/mob/living/carbon/human/h_user = user
h_user.drop_from_inventory(src)
h_user.drop_from_inventory(SC)
h_user.put_in_hands(SC)
user << "<span class='notice'>You combine the casino chips to a stack of [SC.worth] casino credits.</span>"
qdel(src)
/obj/item/weapon/spacecasinocash/update_icon()
overlays.Cut()
name = "[worth] casino credit\s"
if(worth in list(1000,500,200,100,50,20,10,1))
icon_state = "spacecasinocash[worth]"
desc = "It's a stack of casino chips with a combined value of [worth] casino credits."
return
var/sum = src.worth
var/num = 0
for(var/i in list(1000,500,200,100,50,20,10,1))
while(sum >= i && num < 50)
sum -= i
num++
var/image/banknote = image('icons/obj/casino.dmi', "spacecasinocash[i]")
var/matrix/M = matrix()
M.Translate(rand(-6, 6), rand(-4, 8))
M.Turn(pick(-45, -27.5, 0, 0, 0, 0, 0, 0, 0, 27.5, 45))
banknote.transform = M
src.overlays += banknote
if(num == 0) // Less than one credit, let's just make it look like 1 for ease
var/image/banknote = image('icons/obj/casino.dmi', "spacecasinocash1")
var/matrix/M = matrix()
M.Translate(rand(-6, 6), rand(-4, 8))
M.Turn(pick(-45, -27.5, 0, 0, 0, 0, 0, 0, 0, 27.5, 45))
banknote.transform = M
src.overlays += banknote
src.desc = "They are worth [worth] casino credits."
/obj/item/weapon/spacecasinocash/proc/adjust_worth(var/adjust_worth = 0, var/update = 1)
worth += adjust_worth
if(worth > 0)
if(update)
update_icon()
return worth
else
qdel(src)
return 0
/obj/item/weapon/spacecasinocash/proc/set_worth(var/new_worth = 0, var/update = 1)
worth = max(0, new_worth)
if(update)
update_icon()
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, src.worth)
if(!src || QDELETED(src))
return
amount = round(CLAMP(amount, 0, src.worth))
if(!amount)
return
adjust_worth(-amount)
var/obj/item/weapon/spacecasinocash/SC = new (usr.loc)
SC.set_worth(amount)
usr.put_in_hands(SC)
/obj/item/weapon/spacecasinocash/c1
name = "1 credit casino chip"
icon_state = "spacecasinocash1"
desc = "It's worth 1 credit."
worth = 1
/obj/item/weapon/spacecasinocash/c10
name = "10 credit casino chip"
icon_state = "spacecasinocash10"
desc = "It's worth 10 credits."
worth = 10
/obj/item/weapon/spacecasinocash/c20
name = "20 credit casino chip"
icon_state = "spacecasinocash20"
desc = "It's worth 20 credits."
worth = 20
/obj/item/weapon/spacecasinocash/c50
name = "50 credit casino chip"
icon_state = "spacecasinocash50"
desc = "It's worth 50 credits."
worth = 50
/obj/item/weapon/spacecasinocash/c100
name = "100 credit casino chip"
icon_state = "spacecasinocash100"
desc = "It's worth 100 credits."
worth = 100
/obj/item/weapon/spacecasinocash/c200
name = "200 credit casino chip"
icon_state = "spacecasinocash200"
desc = "It's worth 200 credits."
worth = 200
/obj/item/weapon/spacecasinocash/c500
name = "500 credit casino chip"
icon_state = "spacecasinocash500"
desc = "It's worth 500 credits."
worth = 500
/obj/item/weapon/spacecasinocash/c1000
name = "1000 credit casino chip"
icon_state = "spacecasinocash1000"
desc = "It's worth 1000 credits."
worth = 1000
/proc/spawn_casinochips(var/sum, spawnloc, mob/living/carbon/human/human_user as mob)
var/obj/item/weapon/spacecasinocash/SC = new (spawnloc)
SC.set_worth(sum, TRUE)
if (ishuman(human_user) && !human_user.get_active_hand())
human_user.put_in_hands(SC)
return
/obj/item/weapon/casino_platinum_chip
name = "platinum chip"
desc = "Ringa-a-Ding-Ding!"
icon = 'icons/obj/casino.dmi'
icon_state = "platinum_chip"
var/sides = 2
opacity = 0
density = 0
anchored = 0.0
force = 1.0
throwforce = 1.0
throw_speed = 1
throw_range = 2
w_class = ITEMSIZE_SMALL
/obj/item/weapon/casino_platinum_chip/attack_self(mob/user as mob)
var/result = rand(1, sides)
var/comment = ""
if(result == 1)
comment = "Ace"
else if(result == 2)
comment = "Joker"
user.visible_message("<span class='notice'>[user] has thrown \the [src]. It lands on [comment]! </span>", \
"<span class='notice'>You throw \the [src]. It lands on [comment]! </span>")

View File

@@ -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]

View File

@@ -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)

View File

@@ -168,7 +168,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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -574,7 +574,6 @@ var/global/list/light_type_cache = list()
if(cell)
. += "Its backup power charge meter reads [round((cell.charge / cell.maxcharge) * 100, 0.1)]%."
/obj/machinery/light/proc/get_fitting_name()
var/obj/item/weapon/light/L = light_type
return initial(L.name)
@@ -1126,7 +1125,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
@@ -1141,7 +1140,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

View File

@@ -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<spawn_count;i++)

View File

@@ -204,7 +204,7 @@
OutputBeaker = null
if("adjust temp")
target_temp = tgui_input_number(usr, "Choose a target temperature.", "Temperature.", T20C)
target_temp = tgui_input_number(usr, "Choose a target temperature.", "Temperature.", T20C, max_temp, min_temp, round_value = FALSE)
target_temp = CLAMP(target_temp, min_temp, max_temp)
update_icon()

View File

@@ -100,7 +100,7 @@
if(istype(O,/obj/item/stack/material))
if(O.get_material_name() == MAT_PLASTIC)
var/obj/item/stack/S = O
var/input_amount = tgui_input_number(user, "How many sheets would you like to add?", "Add plastic", 0, S.get_amount(), 0, 0, TRUE)
var/input_amount = tgui_input_number(user, "How many sheets would you like to add?", "Add plastic", 0, S.get_amount())
if(input_amount == 0)
return
var/plastic_input = input_amount * value_plastic
@@ -179,7 +179,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 small injectors", 0, 100, 0, 0, TRUE)
var/injector_amount = tgui_input_number(user, "How many injectors would you like?", "Make small injectors", 0, 100)
if(injector_amount > 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")

View File

@@ -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

View File

@@ -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)
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

View File

@@ -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 = FALSE)
/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))

View File

@@ -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")

View File

@@ -3138,14 +3138,14 @@ 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)
@@ -3153,7 +3153,7 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
host.vore_selected.items_preserved.Cut() //CHOMPAdd
. = 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)
@@ -3161,21 +3161,21 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
host.vore_selected.items_preserved.Cut() //CHOMPAdd
. = 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)
@@ -3725,7 +3725,7 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
host.vore_selected.update_internal_overlay()
. = TRUE
if("b_mush_alpha")
var/newalpha = tgui_input_number(usr, "Set alpha transparency between 0-255", "Mush Alpha",255,255,0,0,1)
var/newalpha = tgui_input_number(usr, "Set alpha transparency between 0-255", "Mush Alpha",255,255)
if(newalpha != null)
host.vore_selected.mush_alpha = newalpha
host.vore_selected.update_internal_overlay()
@@ -3788,7 +3788,7 @@ var/global/list/belly_colorable_only_fullscreens = list("a_synth_flesh_mono",
host.vore_selected.update_internal_overlay()
. = TRUE
if("b_custom_ingested_alpha")
var/newalpha = tgui_input_number(usr, "Set alpha transparency between 0-255 when not using mush overlay option.", "Custom Ingested Alpha",255,255,0,0,1)
var/newalpha = tgui_input_number(usr, "Set alpha transparency between 0-255 when not using mush overlay option.", "Custom Ingested Alpha",255,255)
if(newalpha != null)
host.vore_selected.custom_ingested_alpha = newalpha
host.vore_selected.update_internal_overlay()

View File

@@ -75,7 +75,7 @@ These should come standard with the Protean rigsuit, unless you want them to wor
/obj/item/rig_module/protean/armor/engage()
var/armor_chosen = input(usr, "Which armor to adjust?", "Protean Armor") as null|anything in armor_settings
if(armor_chosen)
var/armorvalue = tgui_input_number(usr, "Set armour reduction value (Max of 60%)", "Protean Armor",0,60,0,0,1)
var/armorvalue = tgui_input_number(usr, "Set armour reduction value (Max of 60%)", "Protean Armor",0,60)
if(isnum(armorvalue))
armor_settings[armor_chosen] = armorvalue
interface_desc = initial(interface_desc)

View File

@@ -241,7 +241,7 @@
to_chat(caller,"<span class='warning'>You can't process [substance]!</span>")
return
var/howmuch = tgui_input_number(caller,"How much do you want to store? (0-[matstack.get_amount()])","Select amount",null,matstack.get_amount(),0)
var/howmuch = tgui_input_number(caller,"How much do you want to store? (0-[matstack.get_amount()])","Select amount",null,matstack.get_amount())
if(!howmuch || matstack != caller.get_active_hand() || howmuch > matstack.get_amount())
return //Quietly fail