mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
Replaces all occurrences of the between() proc with the native clamp() proc
This commit is contained in:
@@ -549,7 +549,7 @@
|
||||
if(href_list["out_set_pressure"])
|
||||
var/response=input(usr,"Set new pressure, in kPa. \[0-[50*ONE_ATMOSPHERE]\]") as num
|
||||
pressure_setting = text2num(response)
|
||||
pressure_setting = between(0, pressure_setting, 50*ONE_ATMOSPHERE)
|
||||
pressure_setting = clamp(pressure_setting, 0, 50*ONE_ATMOSPHERE)
|
||||
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
@@ -34,7 +34,7 @@ GLOBAL_VAR_INIT(sent_syndicate_infiltration_team, 0)
|
||||
return
|
||||
var/tctext = input(src, "How much TC do you want to give each team member? Suggested: 20-30. They cannot trade TC.") as num
|
||||
var/tcamount = text2num(tctext)
|
||||
tcamount = between(0, tcamount, 1000)
|
||||
tcamount = clamp(tcamount, 0, 1000)
|
||||
if(GLOB.sent_syndicate_infiltration_team == 1)
|
||||
if(alert("A Syndicate Infiltration Team has already been sent. Sure you want to send another?",,"Yes","No")=="No")
|
||||
return
|
||||
|
||||
@@ -206,23 +206,23 @@
|
||||
pump_direction = 1
|
||||
|
||||
if(signal.data["set_input_pressure"] != null)
|
||||
input_pressure_min = between(
|
||||
0,
|
||||
input_pressure_min = clamp(
|
||||
text2num(signal.data["set_input_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if(signal.data["set_output_pressure"] != null)
|
||||
output_pressure_max = between(
|
||||
0,
|
||||
output_pressure_max = clamp(
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
if(signal.data["set_external_pressure"] != null)
|
||||
external_pressure_bound = between(
|
||||
0,
|
||||
external_pressure_bound = clamp(
|
||||
text2num(signal.data["set_external_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
|
||||
@@ -100,9 +100,9 @@
|
||||
on = !on
|
||||
|
||||
if("set_output_pressure" in signal.data)
|
||||
target_pressure = between(
|
||||
0,
|
||||
target_pressure = clamp(
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
|
||||
@@ -155,9 +155,9 @@ Thus, the two variables affect pump operation are set in New():
|
||||
on = !on
|
||||
|
||||
if(signal.data["set_output_pressure"])
|
||||
target_pressure = between(
|
||||
0,
|
||||
target_pressure = clamp(
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
|
||||
@@ -153,9 +153,9 @@ Thus, the two variables affect pump operation are set in New():
|
||||
on = !on
|
||||
|
||||
if(signal.data["set_transfer_rate"])
|
||||
transfer_rate = between(
|
||||
0,
|
||||
transfer_rate = clamp(
|
||||
text2num(signal.data["set_transfer_rate"]),
|
||||
0,
|
||||
air1.volume
|
||||
)
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
|
||||
if(signal.data["set_volume_rate"] != null)
|
||||
var/number = text2num(signal.data["set_volume_rate"])
|
||||
volume_rate = between(0, number, air_contents.volume)
|
||||
volume_rate = clamp(number, 0, air_contents.volume)
|
||||
|
||||
if(signal.data["status"])
|
||||
broadcast_status()
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
//or if it is already above upper_limit, limit the increase to 0.
|
||||
var/inc_limit = max(upper_limit - temperature, 0)
|
||||
var/dec_limit = min(temperature - lower_limit, 0)
|
||||
temperature += between(dec_limit, rand(-7 + bias, 7 + bias), inc_limit)
|
||||
temperature += clamp(rand(-7 + bias, 7 + bias), dec_limit, inc_limit)
|
||||
|
||||
if(temperature > max_temperature)
|
||||
overheat()
|
||||
@@ -239,7 +239,7 @@
|
||||
|
||||
if(temperature > cooling_temperature)
|
||||
var/temp_loss = (temperature - cooling_temperature)/TEMPERATURE_DIVISOR
|
||||
temp_loss = between(2, round(temp_loss, 1), TEMPERATURE_CHANGE_MAX)
|
||||
temp_loss = clamp(round(temp_loss, 1), 2, TEMPERATURE_CHANGE_MAX)
|
||||
temperature = max(temperature - temp_loss, cooling_temperature)
|
||||
SStgui.update_uis(src)
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
|
||||
if(germ_level >= INFECTION_LEVEL_ONE)
|
||||
var/fever_temperature = (owner.dna.species.heat_level_1 - owner.dna.species.body_temperature - 5) * min(germ_level / INFECTION_LEVEL_TWO, 1) + owner.dna.species.body_temperature
|
||||
owner.bodytemperature += between(0, (fever_temperature - T20C) / BODYTEMP_COLD_DIVISOR + 1, fever_temperature - owner.bodytemperature)
|
||||
owner.bodytemperature += clamp((fever_temperature - T20C) / BODYTEMP_COLD_DIVISOR + 1, 0, fever_temperature - owner.bodytemperature)
|
||||
|
||||
if(germ_level >= INFECTION_LEVEL_TWO)
|
||||
var/obj/item/organ/external/parent = owner.get_organ(parent_organ)
|
||||
@@ -208,7 +208,7 @@
|
||||
/obj/item/organ/proc/receive_damage(amount, silent = 0)
|
||||
if(tough)
|
||||
return
|
||||
damage = between(0, damage + amount, max_damage)
|
||||
damage = clamp(damage + amount, 0, max_damage)
|
||||
|
||||
//only show this if the organ is not robotic
|
||||
if(owner && parent_organ && amount > 0)
|
||||
|
||||
Reference in New Issue
Block a user