From c3d57650b98a9561eaa51b236cd32980989656f9 Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Sat, 13 Jun 2020 11:44:21 -0700
Subject: [PATCH] CLAMP
---
code/__DEFINES/__513_compatibility.dm | 50 -------------------
code/__DEFINES/math.dm | 11 ++--
code/__HELPERS/icons.dm | 8 +--
code/__HELPERS/matrices.dm | 10 ++--
.../controllers/configuration/config_entry.dm | 2 +-
code/datums/components/fantasy/prefixes.dm | 4 +-
code/datums/components/mirage_border.dm | 4 +-
code/datums/components/mood.dm | 2 +-
code/datums/components/nanites.dm | 10 ++--
code/datums/components/storage/storage.dm | 4 +-
code/datums/components/wet_floor.dm | 2 +-
code/datums/progressbar.dm | 2 +-
code/game/machinery/atmoalter/scrubber.dm | 2 +-
code/game/machinery/bomb_tester_vr.dm | 4 +-
code/game/objects/explosion.dm | 2 +-
code/game/objects/items/devices/defib.dm | 2 +-
code/game/objects/items/weapons/explosives.dm | 4 +-
.../items/weapons/implants/implant_vr.dm | 4 +-
.../game/objects/items/weapons/tanks/tanks.dm | 2 +-
code/game/sound.dm | 2 +-
.../preference_setup/general/03_body.dm | 2 +-
.../preference_setup/global/05_media.dm | 4 +-
code/modules/economy/Accounts_DB.dm | 2 +-
code/modules/economy/cash.dm | 2 +-
code/modules/economy/cash_register.dm | 2 +-
code/modules/economy/retail_scanner.dm | 2 +-
code/modules/food/food/sandwich.dm | 2 +-
code/modules/food/food/snacks.dm | 6 +--
.../cooking_machines/_cooker_output.dm | 2 +-
code/modules/gamemaster/helpers.dm | 4 +-
code/modules/instruments/songs/_song.dm | 12 ++---
code/modules/instruments/songs/editor.dm | 2 +-
.../instruments/songs/play_synthesized.dm | 6 +--
.../subtypes/data_transfer.dm | 4 +-
.../integrated_electronics/subtypes/input.dm | 2 +-
.../integrated_electronics/subtypes/output.dm | 2 +-
.../subtypes/reagents.dm | 8 +--
.../integrated_electronics/subtypes/time.dm | 4 +-
code/modules/media/mediamanager.dm | 2 +-
code/modules/mining/machine_processing.dm | 6 +--
.../carbon/human/descriptors/_descriptors.dm | 4 +-
.../mob/living/carbon/human/human_movement.dm | 8 +--
code/modules/mob/living/carbon/human/life.dm | 4 +-
.../carbon/human/species/shadekin/shadekin.dm | 2 +-
.../carbon/human/species/species_attack.dm | 4 +-
.../carbon/human/species/species_attack_vr.dm | 4 +-
.../carbon/human/species/station/alraune.dm | 4 +-
.../mob/living/carbon/human/unarmed_attack.dm | 8 +--
.../mob/living/carbon/metroid/items.dm | 2 +-
code/modules/mob/living/living_defense.dm | 4 +-
code/modules/mob/mob.dm | 4 +-
code/modules/mob/mob_grab.dm | 2 +-
code/modules/mob/mob_grab_specials.dm | 4 +-
code/modules/nano/modules/law_manager.dm | 2 +-
code/modules/organs/organ.dm | 2 +-
code/modules/organs/subtypes/slime.dm | 2 +-
code/modules/organs/subtypes/xenos.dm | 2 +-
.../overmap/ships/computers/engine_control.dm | 4 +-
code/modules/overmap/ships/computers/helm.dm | 8 +--
code/modules/overmap/ships/ship.dm | 4 +-
code/modules/power/fusion/core/_core.dm | 4 +-
.../modules/power/fusion/core/core_control.dm | 2 +-
.../power/fusion/gyrotron/gyrotron_control.dm | 4 +-
.../particle_accelerator/particle_smasher.dm | 4 +-
code/modules/power/tesla/energy_ball.dm | 4 +-
code/modules/projectiles/projectile.dm | 12 ++---
code/modules/reagents/Chemistry-Machinery.dm | 12 ++---
.../Chemistry-Reagents-Food-Drinks.dm | 4 +-
.../Chemistry-Reagents-Medicine.dm | 4 +-
.../modules/reagents/distilling/distilling.dm | 4 +-
code/modules/tables/interactions.dm | 8 +--
code/modules/telesci/telesci_computer.dm | 8 +--
code/modules/vore/eating/vorepanel_vr.dm | 4 +-
73 files changed, 152 insertions(+), 207 deletions(-)
diff --git a/code/__DEFINES/__513_compatibility.dm b/code/__DEFINES/__513_compatibility.dm
index 0ae14961cfc..5ffe1b0e7df 100644
--- a/code/__DEFINES/__513_compatibility.dm
+++ b/code/__DEFINES/__513_compatibility.dm
@@ -1,54 +1,4 @@
-#if DM_VERSION < 513
-
-#define ismovable(A) (istype(A, /atom/movable))
-
-#define ismovable(A) ismovable(A)
-
-#define islist(L) (istype(L, /list))
-
-#define CLAMP01(x) (CLAMP(x, 0, 1))
-
-#define CLAMP(CLVALUE,CLMIN,CLMAX) ( max( (CLMIN), min((CLVALUE), (CLMAX)) ) )
-
-#define ATAN2(x, y) ( !(x) && !(y) ? 0 : (y) >= 0 ? arccos((x) / sqrt((x)*(x) + (y)*(y))) : -arccos((x) / sqrt((x)*(x) + (y)*(y))) )
-
-#define TAN(x) (sin(x) / cos(x))
-
-#define arctan(x) (arcsin(x/sqrt(1+x*x)))
-
-//////////////////////////////////////////////////
-
#else
-#define ismovable(A) ismovable(A)
-
#define CLAMP01(x) clamp(x, 0, 1)
-
-#define CLAMP(CLVALUE, CLMIN, CLMAX) clamp(CLVALUE, CLMIN, CLMAX)
-
-#define TAN(x) tan(x)
-
-#define ATAN2(x, y) arctan(x, y)
-
-#endif
-
-//Compatability -- These procs were added in 513.1493, not 513.1490
-//Which really shoulda bumped us up to 514 right then and there but instead Lummox is a dumb dumb
-#if DM_BUILD < 1493
-#define length_char(args...) length(args)
-#define text2ascii_char(args...) text2ascii(args)
-#define copytext_char(args...) copytext(args)
-#define splittext_char(args...) splittext(args)
-#define spantext_char(args...) spantext(args)
-#define nonspantext_char(args...) nonspantext(args)
-#define findtext_char(args...) findtext(args)
-#define findtextEx_char(args...) findtextEx(args)
-#define findlasttext_char(args...) findlasttext(args)
-#define findlasttextEx_char(args...) findlasttextEx(args)
-#define replacetext_char(args...) replacetext(args)
-#define replacetextEx_char(args...) replacetextEx(args)
-// /regex procs
-#define Find_char(args...) Find(args)
-#define Replace_char(args...) Replace(args)
-#endif
diff --git a/code/__DEFINES/math.dm b/code/__DEFINES/math.dm
index 8c983d1390d..dd9fef2adcc 100644
--- a/code/__DEFINES/math.dm
+++ b/code/__DEFINES/math.dm
@@ -16,7 +16,7 @@
#define TICK_USAGE_TO_MS(starting_tickusage) (TICK_DELTA_TO_MS(world.tick_usage - starting_tickusage))
#define PERCENT(val) (round((val)*100, 0.1))
-#define CLAMP01(x) (CLAMP(x, 0, 1))
+#define CLAMP01(x) (clamp(x, 0, 1))
//time of day but automatically adjusts to the server going into the next day within the same round.
//for when you need a reliable time number that doesn't depend on byond time.
@@ -30,17 +30,12 @@
// round() acts like floor(x, 1) by default but can't handle other values
#define FLOOR(x, y) ( round((x) / (y)) * (y) )
-#define CLAMP(CLVALUE,CLMIN,CLMAX) ( max( (CLMIN), min((CLVALUE), (CLMAX)) ) )
-
// Similar to clamp but the bottom rolls around to the top and vice versa. min is inclusive, max is exclusive
#define WRAP(val, min, max) ( min == max ? min : (val) - (round(((val) - (min))/((max) - (min))) * ((max) - (min))) )
// Real modulus that handles decimals
#define MODULUS(x, y) ( (x) - (y) * round((x) / (y)) )
-// Tangent
-#define TAN(x) (sin(x) / cos(x))
-
// Cotangent
#define COT(x) (1 / TAN(x))
@@ -187,8 +182,8 @@
while(pixel_y < -16)
pixel_y += 32
new_y--
- new_x = CLAMP(new_x, 0, world.maxx)
- new_y = CLAMP(new_y, 0, world.maxy)
+ new_x = clamp(new_x, 0, world.maxx)
+ new_y = clamp(new_y, 0, world.maxy)
return locate(new_x, new_y, starting.z)
// Returns a list where [1] is all x values and [2] is all y values that overlap between the given pair of rectangles
diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm
index f885a35f0d8..aa69e38ccc3 100644
--- a/code/__HELPERS/icons.dm
+++ b/code/__HELPERS/icons.dm
@@ -107,7 +107,7 @@ AngleToHue(hue)
Converts an angle to a hue in the valid range.
RotateHue(hsv, angle)
Takes an HSV or HSVA value and rotates the hue forward through red, green, and blue by an angle from 0 to 360.
- (Rotating red by 60° produces yellow.) The result is another HSV or HSVA color with the same saturation and value
+ (Rotating red by 60� produces yellow.) The result is another HSV or HSVA color with the same saturation and value
as the original, but a different hue.
GrayScale(rgb)
Takes an RGB or RGBA color and converts it to grayscale. Returns an RGB or RGBA string.
@@ -904,9 +904,9 @@ proc/adjust_brightness(var/color, var/value)
if (!value) return color
var/list/RGB = ReadRGB(color)
- RGB[1] = CLAMP(RGB[1]+value,0,255)
- RGB[2] = CLAMP(RGB[2]+value,0,255)
- RGB[3] = CLAMP(RGB[3]+value,0,255)
+ RGB[1] = clamp(RGB[1]+value,0,255)
+ RGB[2] = clamp(RGB[2]+value,0,255)
+ RGB[3] = clamp(RGB[3]+value,0,255)
return rgb(RGB[1],RGB[2],RGB[3])
proc/sort_atoms_by_layer(var/list/atoms)
diff --git a/code/__HELPERS/matrices.dm b/code/__HELPERS/matrices.dm
index d048e739345..a6390808ecb 100644
--- a/code/__HELPERS/matrices.dm
+++ b/code/__HELPERS/matrices.dm
@@ -52,7 +52,7 @@
/proc/color_rotation(angle)
if(angle == 0)
return color_identity()
- angle = CLAMP(angle, -180, 180)
+ angle = clamp(angle, -180, 180)
var/cos = cos(angle)
var/sin = sin(angle)
@@ -67,7 +67,7 @@
//Makes everything brighter or darker without regard to existing color or brightness
/proc/color_brightness(power)
- power = CLAMP(power, -255, 255)
+ power = clamp(power, -255, 255)
power = power/255
return list(1,0,0, 0,1,0, 0,0,1, power,power,power)
@@ -87,7 +87,7 @@
//Exxagerates or removes brightness
/proc/color_contrast(value)
- value = CLAMP(value, -100, 100)
+ value = clamp(value, -100, 100)
if(value == 0)
return color_identity()
@@ -110,7 +110,7 @@
/proc/color_saturation(value as num)
if(value == 0)
return color_identity()
- value = CLAMP(value, -100, 100)
+ value = clamp(value, -100, 100)
if(value > 0)
value *= 3
var/x = 1 + value / 100
@@ -123,4 +123,4 @@
#undef LUMR
#undef LUMG
-#undef LUMB
\ No newline at end of file
+#undef LUMB
diff --git a/code/controllers/configuration/config_entry.dm b/code/controllers/configuration/config_entry.dm
index d7323700e4c..4647b83cd71 100644
--- a/code/controllers/configuration/config_entry.dm
+++ b/code/controllers/configuration/config_entry.dm
@@ -103,7 +103,7 @@
return FALSE
var/temp = text2num(trim(str_val))
if(!isnull(temp))
- config_entry_value = CLAMP(integer ? round(temp) : temp, min_val, max_val)
+ config_entry_value = clamp(integer ? round(temp) : temp, min_val, max_val)
if(config_entry_value != temp && !(datum_flags & DF_VAR_EDITED))
log_config("Changing [name] from [temp] to [config_entry_value]!")
return TRUE
diff --git a/code/datums/components/fantasy/prefixes.dm b/code/datums/components/fantasy/prefixes.dm
index 702ec9329af..7445ab582bf 100644
--- a/code/datums/components/fantasy/prefixes.dm
+++ b/code/datums/components/fantasy/prefixes.dm
@@ -54,7 +54,7 @@
/datum/fantasy_affix/pyromantic/apply(datum/component/fantasy/comp, newName)
var/obj/item/master = comp.parent
- comp.appliedComponents += master.AddComponent(/datum/component/igniter, CLAMP(comp.quality, 1, 10))
+ comp.appliedComponents += master.AddComponent(/datum/component/igniter, clamp(comp.quality, 1, 10))
return "pyromantic [newName]"
/datum/fantasy_affix/vampiric
@@ -65,4 +65,4 @@
/datum/fantasy_affix/vampiric/apply(datum/component/fantasy/comp, newName)
var/obj/item/master = comp.parent
comp.appliedComponents += master.AddComponent(/datum/component/lifesteal, comp.quality)
- return "vampiric [newName]"
\ No newline at end of file
+ return "vampiric [newName]"
diff --git a/code/datums/components/mirage_border.dm b/code/datums/components/mirage_border.dm
index d5d32010cd1..a366f4b822f 100644
--- a/code/datums/components/mirage_border.dm
+++ b/code/datums/components/mirage_border.dm
@@ -14,8 +14,8 @@
var/x = target.x
var/y = target.y
var/z = target.z
- var/turf/southwest = locate(CLAMP(x - (direction & WEST ? range : 0), 1, world.maxx), CLAMP(y - (direction & SOUTH ? range : 0), 1, world.maxy), CLAMP(z, 1, world.maxz))
- var/turf/northeast = locate(CLAMP(x + (direction & EAST ? range : 0), 1, world.maxx), CLAMP(y + (direction & NORTH ? range : 0), 1, world.maxy), CLAMP(z, 1, world.maxz))
+ var/turf/southwest = locate(clamp(x - (direction & WEST ? range : 0), 1, world.maxx), clamp(y - (direction & SOUTH ? range : 0), 1, world.maxy), clamp(z, 1, world.maxz))
+ var/turf/northeast = locate(clamp(x + (direction & EAST ? range : 0), 1, world.maxx), clamp(y + (direction & NORTH ? range : 0), 1, world.maxy), clamp(z, 1, world.maxz))
//holder.vis_contents += block(southwest, northeast) // This doesnt work because of beta bug memes
for(var/i in block(southwest, northeast))
holder.vis_contents += i
diff --git a/code/datums/components/mood.dm b/code/datums/components/mood.dm
index 3bcbf983f1d..de2e523d88d 100644
--- a/code/datums/components/mood.dm
+++ b/code/datums/components/mood.dm
@@ -199,7 +199,7 @@
// If we're out of the acceptable minimum-maximum range move back towards it in steps of 0.5
// If the new amount would move towards the acceptable range faster then use it instead
if(amount < minimum)
- amount += CLAMP(minimum - sanity, 0, 0.7)
+ amount += clamp(minimum - sanity, 0, 0.7)
else
if(!override && HAS_TRAIT(parent, TRAIT_UNSTABLE))
maximum = sanity
diff --git a/code/datums/components/nanites.dm b/code/datums/components/nanites.dm
index 761d3e47585..2c1a48af0b8 100644
--- a/code/datums/components/nanites.dm
+++ b/code/datums/components/nanites.dm
@@ -154,7 +154,7 @@
return (nanite_volume > 0)
/datum/component/nanites/proc/adjust_nanites(datum/source, amount)
- nanite_volume = CLAMP(nanite_volume + amount, 0, max_nanites)
+ nanite_volume = clamp(nanite_volume + amount, 0, max_nanites)
if(nanite_volume <= 0) //oops we ran out
qdel(src)
@@ -166,7 +166,7 @@
if(remove || stealth)
return //bye icon
var/nanite_percent = (nanite_volume / max_nanites) * 100
- nanite_percent = CLAMP(CEILING(nanite_percent, 10), 10, 100)
+ nanite_percent = clamp(CEILING(nanite_percent, 10), 10, 100)
holder.icon_state = "nanites[nanite_percent]"
/datum/component/nanites/proc/on_emp(datum/source, severity)
@@ -220,16 +220,16 @@
return FALSE
/datum/component/nanites/proc/set_volume(datum/source, amount)
- nanite_volume = CLAMP(amount, 0, max_nanites)
+ nanite_volume = clamp(amount, 0, max_nanites)
/datum/component/nanites/proc/set_max_volume(datum/source, amount)
max_nanites = max(1, max_nanites)
/datum/component/nanites/proc/set_cloud(datum/source, amount)
- cloud_id = CLAMP(amount, 0, 100)
+ cloud_id = clamp(amount, 0, 100)
/datum/component/nanites/proc/set_safety(datum/source, amount)
- safety_threshold = CLAMP(amount, 0, max_nanites)
+ safety_threshold = clamp(amount, 0, max_nanites)
/datum/component/nanites/proc/set_regen(datum/source, amount)
regen_rate = amount
diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm
index 57fac5f9b1b..e0e882b4b61 100644
--- a/code/datums/components/storage/storage.dm
+++ b/code/datums/components/storage/storage.dm
@@ -335,8 +335,8 @@
numbered_contents = _process_numerical_display()
adjusted_contents = numbered_contents.len
- var/columns = CLAMP(max_items, 1, screen_max_columns)
- var/rows = CLAMP(CEILING(adjusted_contents / columns, 1), 1, screen_max_rows)
+ var/columns = clamp(max_items, 1, screen_max_columns)
+ var/rows = clamp(CEILING(adjusted_contents / columns, 1), 1, screen_max_rows)
standard_orient_objs(rows, columns, numbered_contents)
//This proc draws out the inventory and places the items on it. It uses the standard position.
diff --git a/code/datums/components/wet_floor.dm b/code/datums/components/wet_floor.dm
index 4eab08fa1a2..3aa3bfdb6b9 100644
--- a/code/datums/components/wet_floor.dm
+++ b/code/datums/components/wet_floor.dm
@@ -178,7 +178,7 @@
/datum/component/wet_floor/proc/_do_add_wet(type, duration_minimum, duration_add, duration_maximum)
var/time = 0
if(LAZYACCESS(time_left_list, "[type]"))
- time = CLAMP(LAZYACCESS(time_left_list, "[type]") + duration_add, duration_minimum, duration_maximum)
+ time = clamp(LAZYACCESS(time_left_list, "[type]") + duration_add, duration_minimum, duration_maximum)
else
time = min(duration_minimum, duration_maximum)
LAZYSET(time_left_list, "[type]", time)
diff --git a/code/datums/progressbar.dm b/code/datums/progressbar.dm
index 581dc012f8b..763aedb9c8b 100644
--- a/code/datums/progressbar.dm
+++ b/code/datums/progressbar.dm
@@ -39,7 +39,7 @@
shown = 0
client = user.client
- progress = CLAMP(progress, 0, goal)
+ progress = clamp(progress, 0, goal)
bar.icon_state = "prog_bar_[round(((progress / goal) * 100), 5)]"
if (!shown && user.is_preference_enabled(/datum/client_preference/show_progress_bar))
user.client.images += bar
diff --git a/code/game/machinery/atmoalter/scrubber.dm b/code/game/machinery/atmoalter/scrubber.dm
index edd458107e7..30ce79eee44 100644
--- a/code/game/machinery/atmoalter/scrubber.dm
+++ b/code/game/machinery/atmoalter/scrubber.dm
@@ -136,7 +136,7 @@
. = 1
if (href_list["volume_adj"])
var/diff = text2num(href_list["volume_adj"])
- volume_rate = CLAMP(volume_rate+diff, minrate, maxrate)
+ volume_rate = clamp(volume_rate+diff, minrate, maxrate)
. = 1
update_icon()
diff --git a/code/game/machinery/bomb_tester_vr.dm b/code/game/machinery/bomb_tester_vr.dm
index 04b2ea9f72a..739f07b28e2 100644
--- a/code/game/machinery/bomb_tester_vr.dm
+++ b/code/game/machinery/bomb_tester_vr.dm
@@ -201,7 +201,7 @@
if(href_list["set_can_pressure"])
var/change = text2num(href_list["set_can_pressure"])
- sim_canister_output = CLAMP(sim_canister_output+change, ONE_ATMOSPHERE/10, ONE_ATMOSPHERE*10)
+ sim_canister_output = clamp(sim_canister_output+change, ONE_ATMOSPHERE/10, ONE_ATMOSPHERE*10)
if(href_list["start_sim"])
start_simulating()
@@ -381,4 +381,4 @@
#undef MODE_SINGLE
#undef MODE_DOUBLE
-#undef MODE_CANISTER
\ No newline at end of file
+#undef MODE_CANISTER
diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm
index 5e1fbe42483..72e081a4986 100644
--- a/code/game/objects/explosion.dm
+++ b/code/game/objects/explosion.dm
@@ -40,7 +40,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
if(dist <= round(max_range + world.view - 2, 1))
M.playsound_local(epicenter, get_sfx("explosion"), 100, 1, frequency, falloff = 5) // get_sfx() is so that everyone gets the same sound
else if(dist <= far_dist)
- var/far_volume = CLAMP(far_dist, 30, 50) // Volume is based on explosion size and dist
+ var/far_volume = clamp(far_dist, 30, 50) // Volume is based on explosion size and dist
far_volume += (dist <= far_dist * 0.5 ? 50 : 0) // add 50 volume if the mob is pretty close to the explosion
M.playsound_local(epicenter, 'sound/effects/explosionfar.ogg', far_volume, 1, frequency, falloff = 5)
diff --git a/code/game/objects/items/devices/defib.dm b/code/game/objects/items/devices/defib.dm
index 4a92735ff76..341b196fb67 100644
--- a/code/game/objects/items/devices/defib.dm
+++ b/code/game/objects/items/devices/defib.dm
@@ -503,7 +503,7 @@
var/obj/item/organ/internal/brain/brain = H.internal_organs_by_name[O_BRAIN]
if(!brain) return //no brain
- var/brain_damage = CLAMP((deadtime - DEFIB_TIME_LOSS)/(DEFIB_TIME_LIMIT - DEFIB_TIME_LOSS)*brain.max_damage, H.getBrainLoss(), brain.max_damage)
+ var/brain_damage = clamp((deadtime - DEFIB_TIME_LOSS)/(DEFIB_TIME_LIMIT - DEFIB_TIME_LOSS)*brain.max_damage, H.getBrainLoss(), brain.max_damage)
H.setBrainLoss(brain_damage)
/obj/item/shockpaddles/proc/make_announcement(var/message, var/msg_class)
diff --git a/code/game/objects/items/weapons/explosives.dm b/code/game/objects/items/weapons/explosives.dm
index 8d9ba476e7b..972e3e9e301 100644
--- a/code/game/objects/items/weapons/explosives.dm
+++ b/code/game/objects/items/weapons/explosives.dm
@@ -41,7 +41,7 @@
/obj/item/plastique/attack_self(mob/user as mob)
var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num
if(user.get_active_hand() == src)
- newtime = CLAMP(newtime, 10, 60000)
+ newtime = clamp(newtime, 10, 60000)
timer = newtime
to_chat(user, "Timer set for [timer] seconds.")
@@ -116,4 +116,4 @@
blast_flash = blast_light + round(new_blast_power * 0.75)
else
to_chat(user, "The [I] is not any better than the component already installed into this charge!")
- return .
\ No newline at end of file
+ return .
diff --git a/code/game/objects/items/weapons/implants/implant_vr.dm b/code/game/objects/items/weapons/implants/implant_vr.dm
index 0a7f664bccc..d99126edab7 100644
--- a/code/game/objects/items/weapons/implants/implant_vr.dm
+++ b/code/game/objects/items/weapons/implants/implant_vr.dm
@@ -105,7 +105,7 @@
var/static/regex/size_mult = new/regex("\\d+")
if(size_mult.Find(msg))
var/resizing_value = text2num(size_mult.match)
- H.resize(CLAMP(resizing_value/100 , 0.25, 2))
+ H.resize(clamp(resizing_value/100 , 0.25, 2))
@@ -134,4 +134,4 @@
src.imp = new /obj/item/implant/sizecontrol( src )
..()
update()
- return
\ No newline at end of file
+ return
diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm
index 0057e64ad07..ae2ca17f868 100644
--- a/code/game/objects/items/weapons/tanks/tanks.dm
+++ b/code/game/objects/items/weapons/tanks/tanks.dm
@@ -501,7 +501,7 @@ var/list/global/tank_gauge_cache = list()
var/release_ratio = 0.002
if(tank_pressure)
- release_ratio = CLAMP(0.002, sqrt(max(tank_pressure-env_pressure,0)/tank_pressure),1)
+ release_ratio = clamp(0.002, sqrt(max(tank_pressure-env_pressure,0)/tank_pressure),1)
var/datum/gas_mixture/leaked_gas = air_contents.remove_ratio(release_ratio)
//dynamic air release based on ambient pressure
diff --git a/code/game/sound.dm b/code/game/sound.dm
index a1ab7ff13d7..f4b8f071139 100644
--- a/code/game/sound.dm
+++ b/code/game/sound.dm
@@ -94,7 +94,7 @@ GLOBAL_VAR_INIT(sound_distance_offscreen, 7)
distance *= distance_multiplier
// Extra falloff if sound is offscreen from world's default view.
- S.volume *= (1 - CLAMP(((max(distance - GLOB.sound_distance_offscreen, 0) * GLOB.sound_offscreen_falloff_factor)/100), 0, 1))
+ S.volume *= (1 - clamp(((max(distance - GLOB.sound_distance_offscreen, 0) * GLOB.sound_offscreen_falloff_factor)/100), 0, 1))
var/pressure_factor = 1
if(pressure_affected)
diff --git a/code/modules/client/preference_setup/general/03_body.dm b/code/modules/client/preference_setup/general/03_body.dm
index 8b9fc8677ba..bc750075268 100644
--- a/code/modules/client/preference_setup/general/03_body.dm
+++ b/code/modules/client/preference_setup/general/03_body.dm
@@ -182,7 +182,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
if(isnull(last_descriptors[entry]))
pref.body_descriptors[entry] = descriptor.default_value // Species datums have initial default value.
else
- pref.body_descriptors[entry] = CLAMP(last_descriptors[entry], 1, LAZYLEN(descriptor.standalone_value_descriptors))
+ pref.body_descriptors[entry] = clamp(last_descriptors[entry], 1, LAZYLEN(descriptor.standalone_value_descriptors))
return
diff --git a/code/modules/client/preference_setup/global/05_media.dm b/code/modules/client/preference_setup/global/05_media.dm
index 7ae263d9ea1..1478fd25d82 100644
--- a/code/modules/client/preference_setup/global/05_media.dm
+++ b/code/modules/client/preference_setup/global/05_media.dm
@@ -15,7 +15,7 @@
S["media_player"] << pref.media_player
/datum/category_item/player_setup_item/player_global/media/sanitize_preferences()
- pref.media_volume = isnum(pref.media_volume) ? CLAMP(pref.media_volume, 0, 1) : initial(pref.media_volume)
+ pref.media_volume = isnum(pref.media_volume) ? clamp(pref.media_volume, 0, 1) : initial(pref.media_volume)
pref.media_player = sanitize_inlist(pref.media_player, list(0, 1, 2), initial(pref.media_player))
/datum/category_item/player_setup_item/player_global/media/content(var/mob/user)
@@ -35,7 +35,7 @@
if(CanUseTopic(user))
var/value = input("Choose your Jukebox volume (0-100%)", "Jukebox volume", round(pref.media_volume * 100))
if(isnum(value))
- value = CLAMP(value, 0, 100)
+ value = clamp(value, 0, 100)
pref.media_volume = value/100.0
if(user.client && user.client.media)
user.client.media.update_volume(pref.media_volume)
diff --git a/code/modules/economy/Accounts_DB.dm b/code/modules/economy/Accounts_DB.dm
index 331c87839c3..a0aebe8f125 100644
--- a/code/modules/economy/Accounts_DB.dm
+++ b/code/modules/economy/Accounts_DB.dm
@@ -143,7 +143,7 @@
var/account_name = href_list["holder_name"]
var/starting_funds = max(text2num(href_list["starting_funds"]), 0)
- starting_funds = CLAMP(starting_funds, 0, station_account.money) // Not authorized to put the station in debt.
+ starting_funds = clamp(starting_funds, 0, station_account.money) // Not authorized to put the station in debt.
starting_funds = min(starting_funds, fund_cap) // Not authorized to give more than the fund cap.
create_account(account_name, starting_funds, src)
diff --git a/code/modules/economy/cash.dm b/code/modules/economy/cash.dm
index e2970c1dcd1..956bbb69d31 100644
--- a/code/modules/economy/cash.dm
+++ b/code/modules/economy/cash.dm
@@ -80,7 +80,7 @@
var/amount = input(usr, "How many Thalers do you want to take? (0 to [src.worth])", "Take Money", 20) as num
if(!src || QDELETED(src))
return
- amount = round(CLAMP(amount, 0, src.worth))
+ amount = round(clamp(amount, 0, src.worth))
if(!amount)
return
diff --git a/code/modules/economy/cash_register.dm b/code/modules/economy/cash_register.dm
index 0d3450dca32..7463c676903 100644
--- a/code/modules/economy/cash_register.dm
+++ b/code/modules/economy/cash_register.dm
@@ -128,7 +128,7 @@
if("set_amount")
var/item_name = locate(href_list["item"])
var/n_amount = round(input("Enter amount", "New amount") as num)
- n_amount = CLAMP(n_amount, 0, 20)
+ 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]
if(!n_amount)
diff --git a/code/modules/economy/retail_scanner.dm b/code/modules/economy/retail_scanner.dm
index 195b0b46510..ddb68587de7 100644
--- a/code/modules/economy/retail_scanner.dm
+++ b/code/modules/economy/retail_scanner.dm
@@ -120,7 +120,7 @@
if("set_amount")
var/item_name = locate(href_list["item"])
var/n_amount = round(input("Enter amount", "New amount") as num)
- n_amount = CLAMP(n_amount, 0, 20)
+ 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]
if(!n_amount)
diff --git a/code/modules/food/food/sandwich.dm b/code/modules/food/food/sandwich.dm
index 9d4325e9b45..94ce3bc7ec9 100644
--- a/code/modules/food/food/sandwich.dm
+++ b/code/modules/food/food/sandwich.dm
@@ -71,7 +71,7 @@
name = lowertext("[fullname] sandwich")
if(length(name) > 80) name = "[pick(list("absurd","colossal","enormous","ridiculous"))] sandwich"
- w_class = n_ceil(CLAMP((ingredients.len/2),2,4))
+ w_class = n_ceil(clamp((ingredients.len/2),2,4))
/obj/item/reagent_containers/food/snacks/csandwich/Destroy()
for(var/obj/item/O in ingredients)
diff --git a/code/modules/food/food/snacks.dm b/code/modules/food/food/snacks.dm
index a15fe3ea57d..4ab3e69ebde 100644
--- a/code/modules/food/food/snacks.dm
+++ b/code/modules/food/food/snacks.dm
@@ -4684,14 +4684,14 @@ END CITADEL CHANGE */
item.reagents.trans_to_holder(returningitem.reagents, item.reagents.total_volume) //Old chip to new chip
if(item.icon_state == "chip_half")
returningitem.icon_state = "[returningitem.icon_state]_half"
- returningitem.bitesize = CLAMP(returningitem.reagents.total_volume,1,10)
+ returningitem.bitesize = clamp(returningitem.reagents.total_volume,1,10)
else if(prob(1))
memed = 1
to_chat(user, "You scoop up some dip with the chip, but mid-scoop, the chip breaks off into the dreadful abyss of dip, never to be seen again...")
returningitem.icon_state = "[returningitem.icon_state]_half"
- returningitem.bitesize = CLAMP(returningitem.reagents.total_volume,1,10)
+ returningitem.bitesize = clamp(returningitem.reagents.total_volume,1,10)
else
- returningitem.bitesize = CLAMP(returningitem.reagents.total_volume*0.5,1,10)
+ returningitem.bitesize = clamp(returningitem.reagents.total_volume*0.5,1,10)
qdel(item)
reagents.trans_to_holder(returningitem.reagents, bitesize) //Dip to new chip
user.put_in_hands(returningitem)
diff --git a/code/modules/food/kitchen/cooking_machines/_cooker_output.dm b/code/modules/food/kitchen/cooking_machines/_cooker_output.dm
index 59260a9923b..5fe5670e82f 100644
--- a/code/modules/food/kitchen/cooking_machines/_cooker_output.dm
+++ b/code/modules/food/kitchen/cooking_machines/_cooker_output.dm
@@ -26,7 +26,7 @@
var/ratio = reagents.total_volume / size
scale = ratio**(1/3) //Scaling factor is square root of desired area
- scale = CLAMP(scale, min_scale, max_scale)
+ scale = clamp(scale, min_scale, max_scale)
else
scale = min_scale
diff --git a/code/modules/gamemaster/helpers.dm b/code/modules/gamemaster/helpers.dm
index 7b5c04aade1..d11dd43f6d2 100644
--- a/code/modules/gamemaster/helpers.dm
+++ b/code/modules/gamemaster/helpers.dm
@@ -1,9 +1,9 @@
// Tell the game master that something dangerous happened, e.g. someone dying.
/datum/controller/subsystem/gamemaster/proc/adjust_danger(var/amt)
amt = amt * danger_modifier
- danger = round( CLAMP(danger + amt, 0, 1000), 0.1)
+ danger = round( clamp(danger + amt, 0, 1000), 0.1)
// Tell the game master that something interesting happened.
/datum/controller/subsystem/gamemaster/proc/adjust_staleness(var/amt)
amt = amt * staleness_modifier
- staleness = round( CLAMP(staleness + amt, -50, 200), 0.1)
\ No newline at end of file
+ staleness = round( clamp(staleness + amt, -50, 200), 0.1)
diff --git a/code/modules/instruments/songs/_song.dm b/code/modules/instruments/songs/_song.dm
index c297396bbf3..3916a06ecf8 100644
--- a/code/modules/instruments/songs/_song.dm
+++ b/code/modules/instruments/songs/_song.dm
@@ -123,7 +123,7 @@
if(length(allowed_instrument_ids))
set_instrument(allowed_instrument_ids[1])
hearing_mobs = list()
- volume = CLAMP(volume, min_volume, max_volume)
+ volume = clamp(volume, min_volume, max_volume)
update_sustain()
/datum/song/Destroy()
@@ -211,7 +211,7 @@
/datum/song/proc/sanitize_tempo(new_tempo)
new_tempo = abs(new_tempo)
- return CLAMP(round(new_tempo, world.tick_lag), world.tick_lag, 5 SECONDS)
+ return clamp(round(new_tempo, world.tick_lag), world.tick_lag, 5 SECONDS)
/datum/song/proc/get_bpm()
return 600 / tempo
@@ -240,22 +240,22 @@
cached_linear_dropoff = volume_decrease_per_decisecond
/datum/song/proc/set_volume(volume)
- src.volume = CLAMP(volume, max(0, min_volume), min(100, max_volume))
+ src.volume = clamp(volume, max(0, min_volume), min(100, max_volume))
update_sustain()
updateDialog()
/datum/song/proc/set_dropoff_volume(volume)
- sustain_dropoff_volume = CLAMP(volume, INSTRUMENT_MIN_SUSTAIN_DROPOFF, 100)
+ sustain_dropoff_volume = clamp(volume, INSTRUMENT_MIN_SUSTAIN_DROPOFF, 100)
update_sustain()
updateDialog()
/datum/song/proc/set_exponential_drop_rate(drop)
- sustain_exponential_dropoff = CLAMP(drop, INSTRUMENT_EXP_FALLOFF_MIN, INSTRUMENT_EXP_FALLOFF_MAX)
+ sustain_exponential_dropoff = clamp(drop, INSTRUMENT_EXP_FALLOFF_MIN, INSTRUMENT_EXP_FALLOFF_MAX)
update_sustain()
updateDialog()
/datum/song/proc/set_linear_falloff_duration(duration)
- sustain_linear_duration = CLAMP(duration, 0.1, INSTRUMENT_MAX_TOTAL_SUSTAIN)
+ sustain_linear_duration = clamp(duration, 0.1, INSTRUMENT_MAX_TOTAL_SUSTAIN)
update_sustain()
updateDialog()
diff --git a/code/modules/instruments/songs/editor.dm b/code/modules/instruments/songs/editor.dm
index 2cb181c1dd9..92345c029ed 100644
--- a/code/modules/instruments/songs/editor.dm
+++ b/code/modules/instruments/songs/editor.dm
@@ -230,7 +230,7 @@
else if(href_list["setnoteshift"])
var/amount = input(usr, "Set note shift", "Note Shift") as null|num
if(!isnull(amount))
- note_shift = CLAMP(amount, note_shift_min, note_shift_max)
+ 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 list("Linear", "Exponential")
diff --git a/code/modules/instruments/songs/play_synthesized.dm b/code/modules/instruments/songs/play_synthesized.dm
index 628f87ed1ce..b51b0b7d01d 100644
--- a/code/modules/instruments/songs/play_synthesized.dm
+++ b/code/modules/instruments/songs/play_synthesized.dm
@@ -52,8 +52,8 @@
if(!num) //it's an accidental
accents[key] = oct_acc //if they misspelled it/fucked up that's on them lmao, no safety checks.
else //octave
- octaves[key] = CLAMP(num, octave_min, octave_max)
- compiled_chord += CLAMP((note_offset_lookup[key] + octaves[key] * 12 + accent_lookup[accents[key]]), key_min, key_max)
+ octaves[key] = clamp(num, octave_min, octave_max)
+ compiled_chord += clamp((note_offset_lookup[key] + octaves[key] * 12 + accent_lookup[accents[key]]), key_min, key_max)
compiled_chord += tempodiv //this goes last
if(length(compiled_chord))
compiled_chords[++compiled_chords.len] = compiled_chord
@@ -62,7 +62,7 @@
/datum/song/proc/playkey_synth(key)
if(can_noteshift)
- key = CLAMP(key + note_shift, key_min, key_max)
+ key = clamp(key + note_shift, key_min, key_max)
if((world.time - MUSICIAN_HEARCHECK_MINDELAY) > last_hearcheck)
do_hearcheck()
var/datum/instrument_key/K = using_instrument.samples[num2text(key)] //See how fucking easy it is to make a number text? You don't need a complicated 9 line proc!
diff --git a/code/modules/integrated_electronics/subtypes/data_transfer.dm b/code/modules/integrated_electronics/subtypes/data_transfer.dm
index 052d3acb769..ce2d06dd888 100644
--- a/code/modules/integrated_electronics/subtypes/data_transfer.dm
+++ b/code/modules/integrated_electronics/subtypes/data_transfer.dm
@@ -125,7 +125,7 @@
/obj/item/integrated_circuit/transfer/pulsedemultiplexer/do_work()
var/output_index = get_pin_data(IC_INPUT, 1)
- if(output_index == CLAMP(output_index, 1, number_of_outputs))
+ if(output_index == clamp(output_index, 1, number_of_outputs))
activate_pin(round(output_index + 1 ,1))
/obj/item/integrated_circuit/transfer/pulsedemultiplexer/medium
@@ -143,4 +143,4 @@
name = "sixteen pulse demultiplexer"
icon_state = "dmux16"
w_class = ITEMSIZE_SMALL
- number_of_outputs = 16
\ No newline at end of file
+ number_of_outputs = 16
diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm
index e1d92896846..ffbd19ca50d 100644
--- a/code/modules/integrated_electronics/subtypes/input.dm
+++ b/code/modules/integrated_electronics/subtypes/input.dm
@@ -296,7 +296,7 @@
/obj/item/integrated_circuit/input/advanced_locator/on_data_written()
var/rad = get_pin_data(IC_INPUT, 2)
if(isnum(rad))
- rad = CLAMP(rad, 0, 7)
+ rad = clamp(rad, 0, 7)
radius = rad
/obj/item/integrated_circuit/input/advanced_locator/do_work()
diff --git a/code/modules/integrated_electronics/subtypes/output.dm b/code/modules/integrated_electronics/subtypes/output.dm
index 3ddc3458d7c..e73fe35956d 100644
--- a/code/modules/integrated_electronics/subtypes/output.dm
+++ b/code/modules/integrated_electronics/subtypes/output.dm
@@ -108,7 +108,7 @@
var/brightness = get_pin_data(IC_INPUT, 2)
if(new_color && isnum(brightness))
- brightness = CLAMP(brightness, 0, 6)
+ brightness = clamp(brightness, 0, 6)
light_rgb = new_color
light_brightness = brightness
diff --git a/code/modules/integrated_electronics/subtypes/reagents.dm b/code/modules/integrated_electronics/subtypes/reagents.dm
index 41cb67b967c..2cf7d2beb4c 100644
--- a/code/modules/integrated_electronics/subtypes/reagents.dm
+++ b/code/modules/integrated_electronics/subtypes/reagents.dm
@@ -83,7 +83,7 @@
else
direc = 1
if(isnum(new_amount))
- new_amount = CLAMP(new_amount, 0, volume)
+ new_amount = clamp(new_amount, 0, volume)
transfer_amount = new_amount
@@ -132,7 +132,7 @@
if(!TS.Adjacent(TT))
activate_pin(3)
return
- var/tramount = CLAMP(min(transfer_amount, reagents.maximum_volume - reagents.total_volume), 0, reagents.maximum_volume)
+ var/tramount = clamp(min(transfer_amount, reagents.maximum_volume - reagents.total_volume), 0, reagents.maximum_volume)
if(ismob(target))//Blood!
if(istype(target, /mob/living/carbon))
var/mob/living/carbon/T = target
@@ -207,7 +207,7 @@
else
direc = 1
if(isnum(new_amount))
- new_amount = CLAMP(new_amount, 0, 50)
+ new_amount = clamp(new_amount, 0, 50)
transfer_amount = new_amount
/obj/item/integrated_circuit/reagent/pump/do_work()
@@ -329,7 +329,7 @@
else
direc = 1
if(isnum(new_amount))
- new_amount = CLAMP(new_amount, 0, 50)
+ new_amount = clamp(new_amount, 0, 50)
transfer_amount = new_amount
/obj/item/integrated_circuit/reagent/filter/do_work()
diff --git a/code/modules/integrated_electronics/subtypes/time.dm b/code/modules/integrated_electronics/subtypes/time.dm
index 1061904607d..aa1a34860b0 100644
--- a/code/modules/integrated_electronics/subtypes/time.dm
+++ b/code/modules/integrated_electronics/subtypes/time.dm
@@ -22,7 +22,7 @@
/obj/item/integrated_circuit/time/delay/do_work()
var/delay_input = get_pin_data(IC_INPUT, 1)
if(delay_input && isnum(delay_input) )
- var/new_delay = CLAMP(delay_input, 1, 1 HOUR)
+ var/new_delay = clamp(delay_input, 1, 1 HOUR)
delay = new_delay
addtimer(CALLBACK(src, .proc/activate_pin, 2), delay)
@@ -51,7 +51,7 @@
/obj/item/integrated_circuit/time/SSticker/on_data_written()
var/delay_input = get_pin_data(IC_INPUT, 2)
if(delay_input && isnum(delay_input) )
- var/new_delay = CLAMP(delay_input, 1, 1 HOUR)
+ var/new_delay = clamp(delay_input, 1, 1 HOUR)
delay = new_delay
power_draw_per_use = CEILING((max_power_draw / delay) / delay, 1)
diff --git a/code/modules/media/mediamanager.dm b/code/modules/media/mediamanager.dm
index 06775486086..3d24b0b6604 100644
--- a/code/modules/media/mediamanager.dm
+++ b/code/modules/media/mediamanager.dm
@@ -149,7 +149,7 @@
if (url != targetURL || abs(targetStartTime - start_time) > 1 || abs(targetVolume - source_volume) > 0.1 /* 10% */)
url = targetURL
start_time = targetStartTime
- source_volume = CLAMP(targetVolume, 0, 1)
+ source_volume = clamp(targetVolume, 0, 1)
send_update()
/datum/media_manager/proc/stop_music()
diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm
index cd09a46a8e6..73de3301b44 100644
--- a/code/modules/mining/machine_processing.dm
+++ b/code/modules/mining/machine_processing.dm
@@ -281,7 +281,7 @@
else if(ores_processing[metal] == PROCESS_COMPRESS && O.compresses_to) //Compressing.
- var/can_make = CLAMP(ores_stored[metal],0,sheets_per_tick-sheets)
+ var/can_make = clamp(ores_stored[metal],0,sheets_per_tick-sheets)
if(can_make%2>0) can_make--
var/datum/material/M = get_material_by_name(O.compresses_to)
@@ -296,7 +296,7 @@
else if(ores_processing[metal] == PROCESS_SMELT && O.smelts_to) //Smelting.
- var/can_make = CLAMP(ores_stored[metal],0,sheets_per_tick-sheets)
+ var/can_make = clamp(ores_stored[metal],0,sheets_per_tick-sheets)
var/datum/material/M = get_material_by_name(O.smelts_to)
if(!istype(M) || !can_make || ores_stored[metal] < 1)
@@ -312,7 +312,7 @@
new /obj/item/ore/slag(output.loc)
else
continue
-
+
if(!(tick % 10))
console.updateUsrDialog()
tick = 0
diff --git a/code/modules/mob/living/carbon/human/descriptors/_descriptors.dm b/code/modules/mob/living/carbon/human/descriptors/_descriptors.dm
index 7416968b6e5..17d8ba7f6c6 100644
--- a/code/modules/mob/living/carbon/human/descriptors/_descriptors.dm
+++ b/code/modules/mob/living/carbon/human/descriptors/_descriptors.dm
@@ -101,10 +101,10 @@
/datum/mob_descriptor/proc/get_comparative_value_string_smaller(var/value, var/datum/gender/my_gender, var/datum/gender/other_gender)
var/maxval = LAZYLEN(comparative_value_descriptors_smaller)
- value = CLAMP(CEILING(value * maxval, 1), 1, maxval)
+ value = clamp(CEILING(value * maxval, 1), 1, maxval)
return comparative_value_descriptors_smaller[value]
/datum/mob_descriptor/proc/get_comparative_value_string_larger(var/value, var/datum/gender/my_gender, var/datum/gender/other_gender)
var/maxval = LAZYLEN(comparative_value_descriptors_larger)
- value = CLAMP(CEILING(value * maxval, 1), 1, maxval)
+ value = clamp(CEILING(value * maxval, 1), 1, maxval)
return comparative_value_descriptors_larger[value]
diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm
index 19a94f0cd8d..63019b540cd 100644
--- a/code/modules/mob/living/carbon/human/human_movement.dm
+++ b/code/modules/mob/living/carbon/human/human_movement.dm
@@ -148,20 +148,20 @@
var/turf_move_cost = T.movement_cost
if(istype(T, /turf/simulated/floor/water))
if(species.water_movement)
- turf_move_cost = CLAMP(HUMAN_LOWEST_SLOWDOWN, turf_move_cost + species.water_movement, 15)
+ turf_move_cost = clamp(HUMAN_LOWEST_SLOWDOWN, turf_move_cost + species.water_movement, 15)
if(shoes)
var/obj/item/clothing/shoes/feet = shoes
if(feet.water_speed)
- turf_move_cost = CLAMP(HUMAN_LOWEST_SLOWDOWN, turf_move_cost + feet.water_speed, 15)
+ turf_move_cost = clamp(HUMAN_LOWEST_SLOWDOWN, turf_move_cost + feet.water_speed, 15)
. += turf_move_cost
if(istype(T, /turf/simulated/floor/outdoors/snow))
if(species.snow_movement)
- turf_move_cost = CLAMP(HUMAN_LOWEST_SLOWDOWN, turf_move_cost + species.snow_movement, 15)
+ turf_move_cost = clamp(HUMAN_LOWEST_SLOWDOWN, turf_move_cost + species.snow_movement, 15)
if(shoes)
var/obj/item/clothing/shoes/feet = shoes
if(feet.water_speed)
- turf_move_cost = CLAMP(HUMAN_LOWEST_SLOWDOWN, turf_move_cost + feet.snow_speed, 15)
+ turf_move_cost = clamp(HUMAN_LOWEST_SLOWDOWN, turf_move_cost + feet.snow_speed, 15)
. += turf_move_cost
// Wind makes it easier or harder to move, depending on if you're with or against the wind.
diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm
index decd88e6c80..2b515bd38ae 100644
--- a/code/modules/mob/living/carbon/human/life.dm
+++ b/code/modules/mob/living/carbon/human/life.dm
@@ -255,7 +255,7 @@
if(gene.is_active(src))
gene.OnMobLife(src)
- radiation = CLAMP(radiation,0,250)
+ radiation = clamp(radiation,0,250)
if(!radiation)
if(species.appearance_flags & RADIATION_GLOWS)
@@ -514,7 +514,7 @@
if(toxins_pp > safe_toxins_max)
var/ratio = (poison/safe_toxins_max) * 10
if(reagents)
- reagents.add_reagent("toxin", CLAMP(ratio, MIN_TOXIN_DAMAGE, MAX_TOXIN_DAMAGE))
+ reagents.add_reagent("toxin", clamp(ratio, MIN_TOXIN_DAMAGE, MAX_TOXIN_DAMAGE))
breath.adjust_gas(poison_type, -poison/6, update = 0) //update after
phoron_alert = max(phoron_alert, 1)
else
diff --git a/code/modules/mob/living/carbon/human/species/shadekin/shadekin.dm b/code/modules/mob/living/carbon/human/species/shadekin/shadekin.dm
index 821fd0cc37d..d285bb3463f 100644
--- a/code/modules/mob/living/carbon/human/species/shadekin/shadekin.dm
+++ b/code/modules/mob/living/carbon/human/species/shadekin/shadekin.dm
@@ -191,7 +191,7 @@
if(!istype(shade_organ))
return
- shade_organ.dark_energy = CLAMP(new_energy, 0, get_max_energy(H))
+ shade_organ.dark_energy = clamp(new_energy, 0, get_max_energy(H))
/datum/species/shadekin/proc/set_max_energy(var/mob/living/carbon/human/H, var/new_max_energy)
var/obj/item/organ/internal/brain/shadekin/shade_organ = H.internal_organs_by_name[O_BRAIN]
diff --git a/code/modules/mob/living/carbon/human/species/species_attack.dm b/code/modules/mob/living/carbon/human/species/species_attack.dm
index 9e6a07d1685..b1b28b8f26c 100644
--- a/code/modules/mob/living/carbon/human/species/species_attack.dm
+++ b/code/modules/mob/living/carbon/human/species/species_attack.dm
@@ -27,7 +27,7 @@
var/datum/gender/T = gender_datums[user.get_visible_gender()]
var/datum/gender/TT = gender_datums[target.get_visible_gender()]
if(!skill) skill = 1
- attack_damage = CLAMP(attack_damage, 1, 5)
+ attack_damage = clamp(attack_damage, 1, 5)
if(target == user)
user.visible_message("[user] [pick(attack_verb)] [T.himself] in the [affecting.name]!")
@@ -92,4 +92,4 @@
/datum/unarmed_attack/stomp/weak/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage)
var/obj/item/organ/external/affecting = target.get_organ(zone)
user.visible_message("[user] jumped up and down on \the [target]'s [affecting.name]!")
- playsound(user.loc, attack_sound, 25, 1, -1)
\ No newline at end of file
+ playsound(user.loc, attack_sound, 25, 1, -1)
diff --git a/code/modules/mob/living/carbon/human/species/species_attack_vr.dm b/code/modules/mob/living/carbon/human/species/species_attack_vr.dm
index 58257ae3242..82d4410384c 100644
--- a/code/modules/mob/living/carbon/human/species/species_attack_vr.dm
+++ b/code/modules/mob/living/carbon/human/species/species_attack_vr.dm
@@ -9,7 +9,7 @@
/datum/unarmed_attack/bite/sharp/numbing/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage)
var/obj/item/organ/external/affecting = target.get_organ(zone)
- attack_damage = CLAMP(attack_damage, 1, 5)
+ attack_damage = clamp(attack_damage, 1, 5)
if(target == user)
user.visible_message("[user] [pick(attack_verb)] \himself in the [affecting.name]!")
return 0 //No venom for you.
@@ -57,4 +57,4 @@
/datum/unarmed_attack/bite/sharp/shadekin/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage)
..()
- user.shadekin_adjust_energy(energy_gain)
\ No newline at end of file
+ user.shadekin_adjust_energy(energy_gain)
diff --git a/code/modules/mob/living/carbon/human/species/station/alraune.dm b/code/modules/mob/living/carbon/human/species/station/alraune.dm
index e3ca192c215..d5099c38f1b 100644
--- a/code/modules/mob/living/carbon/human/species/station/alraune.dm
+++ b/code/modules/mob/living/carbon/human/species/station/alraune.dm
@@ -211,7 +211,7 @@
var/co2buff = 0
if(inhaling)
- co2buff = (CLAMP(inhale_pp, 0, minimum_breath_pressure))/minimum_breath_pressure //returns a value between 0 and 1.
+ co2buff = (clamp(inhale_pp, 0, minimum_breath_pressure))/minimum_breath_pressure //returns a value between 0 and 1.
var/light_amount = fullysealed ? H.getlightlevel() : H.getlightlevel()/5 // if they're covered, they're not going to get much light on them.
@@ -226,7 +226,7 @@
if(toxins_pp > safe_toxins_max)
var/ratio = (poison/safe_toxins_max) * 10
if(H.reagents)
- H.reagents.add_reagent("toxin", CLAMP(ratio, MIN_TOXIN_DAMAGE, MAX_TOXIN_DAMAGE))
+ H.reagents.add_reagent("toxin", clamp(ratio, MIN_TOXIN_DAMAGE, MAX_TOXIN_DAMAGE))
breath.adjust_gas(poison_type, -poison/6, update = 0) //update after
H.phoron_alert = max(H.phoron_alert, 1)
else
diff --git a/code/modules/mob/living/carbon/human/unarmed_attack.dm b/code/modules/mob/living/carbon/human/unarmed_attack.dm
index c970cd67f40..e841a48907a 100644
--- a/code/modules/mob/living/carbon/human/unarmed_attack.dm
+++ b/code/modules/mob/living/carbon/human/unarmed_attack.dm
@@ -142,7 +142,7 @@ var/global/list/sparring_attack_cache = list()
var/datum/gender/TU = gender_datums[user.get_visible_gender()]
var/datum/gender/TT = gender_datums[target.get_visible_gender()]
- attack_damage = CLAMP(attack_damage, 1, 5) // We expect damage input of 1 to 5 for this proc. But we leave this check juuust in case.
+ attack_damage = clamp(attack_damage, 1, 5) // We expect damage input of 1 to 5 for this proc. But we leave this check juuust in case.
if(target == user)
user.visible_message("[user] [pick(attack_verb)] [TU.himself] in the [organ]!")
@@ -216,7 +216,7 @@ var/global/list/sparring_attack_cache = list()
var/datum/gender/TT = gender_datums[target.get_visible_gender()]
var/organ = affecting.name
- attack_damage = CLAMP(attack_damage, 1, 5)
+ attack_damage = clamp(attack_damage, 1, 5)
switch(attack_damage)
if(1 to 2) user.visible_message("[user] threw [target] a glancing [pick(attack_noun)] to the [organ]!") //it's not that they're kicking lightly, it's that the kick didn't quite connect
@@ -262,7 +262,7 @@ var/global/list/sparring_attack_cache = list()
var/obj/item/clothing/shoes = user.shoes
var/datum/gender/TU = gender_datums[user.get_visible_gender()]
- attack_damage = CLAMP(attack_damage, 1, 5)
+ attack_damage = clamp(attack_damage, 1, 5)
switch(attack_damage)
if(1 to 4) user.visible_message("[pick("[user] stomped on", "[user] slammed [TU.his] [shoes ? copytext(shoes.name, 1, -1) : "foot"] down onto")] [target]'s [organ]!")
@@ -276,4 +276,4 @@ var/global/list/sparring_attack_cache = list()
shredding = 0
damage = 0
sharp = 0
- edge = 0
\ No newline at end of file
+ edge = 0
diff --git a/code/modules/mob/living/carbon/metroid/items.dm b/code/modules/mob/living/carbon/metroid/items.dm
index b4621ecd7eb..25181944789 100644
--- a/code/modules/mob/living/carbon/metroid/items.dm
+++ b/code/modules/mob/living/carbon/metroid/items.dm
@@ -176,7 +176,7 @@
return ..()
to_chat(user, "You feed the slime the stabilizer. It is now less likely to mutate.")
- M.mutation_chance = CLAMP(M.mutation_chance-15,0,100)
+ M.mutation_chance = clamp(M.mutation_chance-15,0,100)
qdel(src)
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index 0296c68eadc..536e0220b6f 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -368,7 +368,7 @@
return
/mob/living/proc/adjust_fire_stacks(add_fire_stacks) //Adjusting the amount of fire_stacks we have on person
- fire_stacks = CLAMP(fire_stacks + add_fire_stacks, FIRE_MIN_STACKS, FIRE_MAX_STACKS)
+ fire_stacks = clamp(fire_stacks + add_fire_stacks, FIRE_MIN_STACKS, FIRE_MAX_STACKS)
/mob/living/proc/handle_fire()
if(fire_stacks < 0)
@@ -554,4 +554,4 @@
if(confused)
accuracy_penalty += 45
- return accuracy_penalty
\ No newline at end of file
+ return accuracy_penalty
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 044b9cfbe68..ce439d8e97f 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -841,10 +841,10 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
return
/mob/proc/AdjustLosebreath(amount)
- losebreath = CLAMP(0, losebreath + amount, 25)
+ losebreath = clamp(0, losebreath + amount, 25)
/mob/proc/SetLosebreath(amount)
- losebreath = CLAMP(0, amount, 25)
+ losebreath = clamp(0, amount, 25)
/mob/proc/get_species()
return ""
diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm
index 5c29a1f6c70..19a824a0a82 100644
--- a/code/modules/mob/mob_grab.dm
+++ b/code/modules/mob/mob_grab.dm
@@ -382,7 +382,7 @@
//It's easier to break out of a grab by a smaller mob
break_strength += max(size_difference(affecting, assailant), 0)
- var/break_chance = break_chance_table[CLAMP(break_strength, 1, break_chance_table.len)]
+ var/break_chance = break_chance_table[clamp(break_strength, 1, break_chance_table.len)]
if(prob(break_chance))
if(state == GRAB_KILL)
reset_kill_state()
diff --git a/code/modules/mob/mob_grab_specials.dm b/code/modules/mob/mob_grab_specials.dm
index 5f2655dab82..65a8f39e213 100644
--- a/code/modules/mob/mob_grab_specials.dm
+++ b/code/modules/mob/mob_grab_specials.dm
@@ -61,7 +61,7 @@
to_chat(target, "You feel extreme pain!")
var/max_halloss = round(target.species.total_health * 0.8) //up to 80% of passing out
- affecting.adjustHalLoss(CLAMP(0, max_halloss - affecting.halloss, 30))
+ affecting.adjustHalLoss(clamp(0, max_halloss - affecting.halloss, 30))
/obj/item/grab/proc/attack_eye(mob/living/carbon/human/target, mob/living/carbon/human/attacker)
if(!istype(attacker))
@@ -171,4 +171,4 @@
user.visible_message("[user] devours [target]!")
target.loc = user
attacker.stomach_contents.Add(target)
- qdel(src)
\ No newline at end of file
+ qdel(src)
diff --git a/code/modules/nano/modules/law_manager.dm b/code/modules/nano/modules/law_manager.dm
index 5bb40d06201..b8af650b7ef 100644
--- a/code/modules/nano/modules/law_manager.dm
+++ b/code/modules/nano/modules/law_manager.dm
@@ -94,7 +94,7 @@
if(href_list["change_supplied_law_position"])
var/new_position = input(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) as num|null
if(isnum(new_position) && can_still_topic())
- supplied_law_position = CLAMP(new_position, 1, MAX_SUPPLIED_LAW_NUMBER)
+ supplied_law_position = clamp(new_position, 1, MAX_SUPPLIED_LAW_NUMBER)
return 1
if(href_list["edit_law"])
diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm
index 90384956721..63b0c96d399 100644
--- a/code/modules/organs/organ.dm
+++ b/code/modules/organs/organ.dm
@@ -109,7 +109,7 @@ var/list/organ_cache = list()
owner.can_defib = 0
/obj/item/organ/proc/adjust_germ_level(var/amount) // Unless you're setting germ level directly to 0, use this proc instead
- germ_level = CLAMP(germ_level + amount, 0, INFECTION_LEVEL_MAX)
+ germ_level = clamp(germ_level + amount, 0, INFECTION_LEVEL_MAX)
/obj/item/organ/process()
diff --git a/code/modules/organs/subtypes/slime.dm b/code/modules/organs/subtypes/slime.dm
index 5fb54a21b45..df80692296e 100644
--- a/code/modules/organs/subtypes/slime.dm
+++ b/code/modules/organs/subtypes/slime.dm
@@ -114,7 +114,7 @@
else if(amount > 0)
last_strain_increase = world.time
- strain = CLAMP(strain + amount, 0, min_broken_damage)
+ strain = clamp(strain + amount, 0, min_broken_damage)
/obj/item/organ/internal/regennetwork/process()
..()
diff --git a/code/modules/organs/subtypes/xenos.dm b/code/modules/organs/subtypes/xenos.dm
index 1c4cfa69078..844b647730e 100644
--- a/code/modules/organs/subtypes/xenos.dm
+++ b/code/modules/organs/subtypes/xenos.dm
@@ -48,7 +48,7 @@
adjust_plasma(1)
/obj/item/organ/internal/xenos/plasmavessel/proc/adjust_plasma(var/amount = 0)
- stored_plasma = CLAMP(stored_plasma + amount, 0, max_plasma)
+ stored_plasma = clamp(stored_plasma + amount, 0, max_plasma)
/obj/item/organ/internal/xenos/plasmavessel/grey
icon_state = "plasma_grey"
diff --git a/code/modules/overmap/ships/computers/engine_control.dm b/code/modules/overmap/ships/computers/engine_control.dm
index 01920ee2e01..7a04e5b9600 100644
--- a/code/modules/overmap/ships/computers/engine_control.dm
+++ b/code/modules/overmap/ships/computers/engine_control.dm
@@ -70,13 +70,13 @@
if(href_list["set_limit"])
var/datum/ship_engine/E = locate(href_list["engine"])
var/newlim = input("Input new thrust limit (0..100)", "Thrust limit", E.get_thrust_limit()) as num
- var/limit = CLAMP(newlim/100, 0, 1)
+ var/limit = clamp(newlim/100, 0, 1)
if(E)
E.set_thrust_limit(limit)
if(href_list["limit"])
var/datum/ship_engine/E = locate(href_list["engine"])
- var/limit = CLAMP(E.get_thrust_limit() + text2num(href_list["limit"]), 0, 1)
+ var/limit = clamp(E.get_thrust_limit() + text2num(href_list["limit"]), 0, 1)
if(E)
E.set_thrust_limit(limit)
diff --git a/code/modules/overmap/ships/computers/helm.dm b/code/modules/overmap/ships/computers/helm.dm
index 0249fae4829..feec55a0c1d 100644
--- a/code/modules/overmap/ships/computers/helm.dm
+++ b/code/modules/overmap/ships/computers/helm.dm
@@ -130,9 +130,9 @@
R.fields["y"] = linked.y
if("new")
var/newx = input("Input new entry x coordinate", "Coordinate input", linked.x) as num
- R.fields["x"] = CLAMP(newx, 1, world.maxx)
+ R.fields["x"] = clamp(newx, 1, world.maxx)
var/newy = input("Input new entry y coordinate", "Coordinate input", linked.y) as num
- R.fields["y"] = CLAMP(newy, 1, world.maxy)
+ R.fields["y"] = clamp(newy, 1, world.maxy)
known_sectors += R
if (href_list["remove"])
@@ -142,12 +142,12 @@
if (href_list["setx"])
var/newx = input("Input new destiniation x coordinate", "Coordinate input", dx) as num|null
if (newx)
- dx = CLAMP(newx, 1, world.maxx)
+ dx = clamp(newx, 1, world.maxx)
if (href_list["sety"])
var/newy = input("Input new destiniation y coordinate", "Coordinate input", dy) as num|null
if (newy)
- dy = CLAMP(newy, 1, world.maxy)
+ dy = clamp(newy, 1, world.maxy)
if (href_list["x"] && href_list["y"])
dx = text2num(href_list["x"])
diff --git a/code/modules/overmap/ships/ship.dm b/code/modules/overmap/ships/ship.dm
index 0abd450a692..2a0d503db0a 100644
--- a/code/modules/overmap/ships/ship.dm
+++ b/code/modules/overmap/ships/ship.dm
@@ -53,8 +53,8 @@
return res
/obj/effect/map/ship/proc/adjust_speed(n_x, n_y)
- speed[1] = CLAMP(speed[1] + n_x, -default_delay, default_delay)
- speed[2] = CLAMP(speed[2] + n_y, -default_delay, default_delay)
+ speed[1] = clamp(speed[1] + n_x, -default_delay, default_delay)
+ speed[2] = clamp(speed[2] + n_y, -default_delay, default_delay)
if(is_still())
toggle_move_stars(map_z)
else
diff --git a/code/modules/power/fusion/core/_core.dm b/code/modules/power/fusion/core/_core.dm
index 9ac3738b1ba..a81e6c439fe 100644
--- a/code/modules/power/fusion/core/_core.dm
+++ b/code/modules/power/fusion/core/_core.dm
@@ -94,7 +94,7 @@ var/list/fusion_cores = list()
. = owned_field.bullet_act(Proj)
/obj/machinery/power/fusion_core/proc/set_strength(var/value)
- value = CLAMP(value, MIN_FIELD_STR, MAX_FIELD_STR)
+ value = clamp(value, MIN_FIELD_STR, MAX_FIELD_STR)
field_strength = value
active_power_usage = 5 * value
if(owned_field)
@@ -137,4 +137,4 @@ var/list/fusion_cores = list()
if(!owned_field)
return FALSE
owned_field.plasma_temperature = field_temperature
- return TRUE
\ No newline at end of file
+ return TRUE
diff --git a/code/modules/power/fusion/core/core_control.dm b/code/modules/power/fusion/core/core_control.dm
index c8929915ea3..1928cdf665b 100644
--- a/code/modules/power/fusion/core/core_control.dm
+++ b/code/modules/power/fusion/core/core_control.dm
@@ -140,7 +140,7 @@
return
if(href_list["access_device"])
- var/idx = CLAMP(text2num(href_list["toggle_active"]), 1, connected_devices.len)
+ var/idx = clamp(text2num(href_list["toggle_active"]), 1, connected_devices.len)
cur_viewed_device = connected_devices[idx]
updateUsrDialog()
return 1
diff --git a/code/modules/power/fusion/gyrotron/gyrotron_control.dm b/code/modules/power/fusion/gyrotron/gyrotron_control.dm
index d2f4d5d0287..5a808cad301 100644
--- a/code/modules/power/fusion/gyrotron/gyrotron_control.dm
+++ b/code/modules/power/fusion/gyrotron/gyrotron_control.dm
@@ -73,7 +73,7 @@
if(!new_val)
to_chat(usr, "That's not a valid number.")
return 1
- G.mega_energy = CLAMP(new_val, 1, 50)
+ G.mega_energy = clamp(new_val, 1, 50)
G.active_power_usage = G.mega_energy * 1500
updateUsrDialog()
return 1
@@ -83,7 +83,7 @@
if(!new_val)
to_chat(usr, "That's not a valid number.")
return 1
- G.rate = CLAMP(new_val, 1, 10)
+ G.rate = clamp(new_val, 1, 10)
updateUsrDialog()
return 1
diff --git a/code/modules/power/singularity/particle_accelerator/particle_smasher.dm b/code/modules/power/singularity/particle_accelerator/particle_smasher.dm
index 4065369f9f5..45ab95bc0d9 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_smasher.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_smasher.dm
@@ -149,7 +149,7 @@
if(energy)
SSradiation.radiate(src, round(((src.energy-150)/50)*5,1))
- energy = CLAMP(energy - 5, 0, max_energy)
+ energy = clamp(energy - 5, 0, max_energy)
return
@@ -375,4 +375,4 @@
required_atmos_temp_min = 3000
required_atmos_temp_max = 10000
- probability = 1
\ No newline at end of file
+ probability = 1
diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm
index 054cbeb006d..cbff8505184 100644
--- a/code/modules/power/tesla/energy_ball.dm
+++ b/code/modules/power/tesla/energy_ball.dm
@@ -66,7 +66,7 @@
pixel_x = -32
pixel_y = -32
for (var/ball in orbiting_balls)
- var/range = rand(1, CLAMP(orbiting_balls.len, 3, 7))
+ var/range = rand(1, clamp(orbiting_balls.len, 3, 7))
tesla_zap(ball, range, TESLA_MINI_POWER/7*range, TRUE)
else
energy = 0 // ensure we dont have miniballs of miniballs
@@ -284,7 +284,7 @@
closest_grounding_rod.tesla_act(power, explosive, stun_mobs)
else if(closest_mob)
- var/shock_damage = CLAMP(round(power/400), 10, 90) + rand(-5, 5)
+ var/shock_damage = clamp(round(power/400), 10, 90) + rand(-5, 5)
closest_mob.electrocute_act(shock_damage, source, 1 - closest_mob.get_shock_protection(), ran_zone())
log_game("TESLA([source.x],[source.y],[source.z]) Shocked [key_name(closest_mob)] for [shock_damage]dmg.")
message_admins("Tesla zapped [key_name_admin(closest_mob)]!")
diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm
index f07c8495ab4..08a19393eef 100644
--- a/code/modules/projectiles/projectile.dm
+++ b/code/modules/projectiles/projectile.dm
@@ -235,10 +235,10 @@
if(!homing_target)
return FALSE
var/datum/point/PT = RETURN_PRECISE_POINT(homing_target)
- PT.x += CLAMP(homing_offset_x, 1, world.maxx)
- PT.y += CLAMP(homing_offset_y, 1, world.maxy)
+ PT.x += clamp(homing_offset_x, 1, world.maxx)
+ PT.y += clamp(homing_offset_y, 1, world.maxy)
var/angle = closer_angle_difference(Angle, angle_between_points(RETURN_PRECISE_POINT(src), PT))
- setAngle(Angle + CLAMP(angle, -homing_turn_speed, homing_turn_speed))
+ setAngle(Angle + clamp(angle, -homing_turn_speed, homing_turn_speed))
/obj/item/projectile/proc/set_homing_target(atom/A)
if(!A || (!isturf(A) && !isturf(A.loc)))
@@ -316,7 +316,7 @@
stack_trace("WARNING: Projectile [type] deleted due to being unable to resolve a target after angle was null!")
qdel(src)
return
- var/turf/target = locate(CLAMP(starting + xo, 1, world.maxx), CLAMP(starting + yo, 1, world.maxy), starting.z)
+ var/turf/target = locate(clamp(starting + xo, 1, world.maxx), clamp(starting + yo, 1, world.maxy), starting.z)
setAngle(Get_Angle(src, target))
if(dispersion)
setAngle(Angle + rand(-dispersion, dispersion))
@@ -422,7 +422,7 @@
var/ox = round(screenviewX/2) - user.client.pixel_x //"origin" x
var/oy = round(screenviewY/2) - user.client.pixel_y //"origin" y
- angle = ATAN2(y - oy, x - ox)
+ angle = arctan(y - oy, x - ox)
return list(angle, p_x, p_y)
/obj/item/projectile/proc/redirect(x, y, starting, source)
@@ -449,7 +449,7 @@
/obj/item/projectile/proc/vol_by_damage()
if(damage)
- return CLAMP((damage) * 0.67, 30, 100)// Multiply projectile damage by 0.67, then CLAMP the value between 30 and 100
+ return clamp((damage) * 0.67, 30, 100)// Multiply projectile damage by 0.67, then CLAMP the value between 30 and 100
else
return 50 //if the projectile doesn't do damage, play its hitsound at 50% volume.
diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm
index 8c3026b9794..573497fe7c7 100644
--- a/code/modules/reagents/Chemistry-Machinery.dm
+++ b/code/modules/reagents/Chemistry-Machinery.dm
@@ -177,21 +177,21 @@
if(href_list["amount"])
var/id = href_list["add"]
- var/amount = CLAMP((text2num(href_list["amount"])), 0, 200)
+ var/amount = clamp((text2num(href_list["amount"])), 0, 200)
R.trans_id_to(src, id, amount)
else if (href_list["addcustom"])
var/id = href_list["addcustom"]
useramount = input("Select the amount to transfer.", 30, useramount) as num
- useramount = CLAMP(useramount, 0, 200)
+ useramount = clamp(useramount, 0, 200)
src.Topic(null, list("amount" = "[useramount]", "add" = "[id]"))
else if (href_list["remove"])
if(href_list["amount"])
var/id = href_list["remove"]
- var/amount = CLAMP((text2num(href_list["amount"])), 0, 200)
+ var/amount = clamp((text2num(href_list["amount"])), 0, 200)
if(mode)
reagents.trans_id_to(beaker, id, amount)
else
@@ -202,7 +202,7 @@
var/id = href_list["removecustom"]
useramount = input("Select the amount to transfer.", 30, useramount) as num
- useramount = CLAMP(useramount, 0, 200)
+ useramount = clamp(useramount, 0, 200)
src.Topic(null, list("amount" = "[useramount]", "remove" = "[id]"))
else if (href_list["toggle"])
@@ -224,7 +224,7 @@
count = input("Select the number of pills to make.", "Max [max_pill_count]", pillamount) as null|num
if(!count) //Covers 0 and cancel
return
- count = CLAMP(round(count), 1, max_pill_count) // Fix decimals input and clamp to reasonable amounts
+ count = clamp(round(count), 1, max_pill_count) // Fix decimals input and clamp to reasonable amounts
if(reagents.total_volume/count < 1) //Sanity checking.
return
@@ -642,4 +642,4 @@
to_chat(user, span("notice", "Scanning of \the [I] complete."))
analyzing = FALSE
update_icon()
- return
\ No newline at end of file
+ return
diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm
index 5498dec1f21..35dbf73a281 100644
--- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm
+++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm
@@ -347,7 +347,7 @@ End Citadel Change */
if(iscarbon(M) && !M.isSynthetic())
var/message = pick("Oh god, it smells disgusting here.", "What is that stench?", "That's an awful odor.")
to_chat(M,"[message]")
- if(prob(CLAMP(amount, 5, 90)))
+ if(prob(clamp(amount, 5, 90)))
var/mob/living/L = M
L.vomit()
return ..()
@@ -3921,4 +3921,4 @@ End Citadel Change */
color = "#D1B166"
glass_name = "the bubbly"
- glass_desc = "An even classier looking drink, with floating bubbles."
\ No newline at end of file
+ glass_desc = "An even classier looking drink, with floating bubbles."
diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm
index cd8e4b3d2f4..9def84a05ca 100644
--- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm
+++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm
@@ -711,7 +711,7 @@
if(H.losebreath >= 15 && prob(H.losebreath))
H.Stun(2)
else
- H.losebreath = CLAMP(H.losebreath + 3, 0, 20)
+ H.losebreath = clamp(H.losebreath + 3, 0, 20)
else
H.losebreath = max(H.losebreath - 4, 0)
@@ -803,7 +803,7 @@
I.damage = max(I.damage - 4 * removed * repair_strength, 0)
H.Confuse(2)
if(M.reagents.has_reagent("respirodaxon") || M.reagents.has_reagent("peridaxon"))
- H.losebreath = CLAMP(H.losebreath + 1, 0, 10)
+ H.losebreath = clamp(H.losebreath + 1, 0, 10)
else
H.adjustOxyLoss(-30 * removed) // Deals with blood oxygenation.
diff --git a/code/modules/reagents/distilling/distilling.dm b/code/modules/reagents/distilling/distilling.dm
index 95bf9fd7b2a..0a737c053a5 100644
--- a/code/modules/reagents/distilling/distilling.dm
+++ b/code/modules/reagents/distilling/distilling.dm
@@ -169,7 +169,7 @@
if("adjust temp")
target_temp = input("Choose a target temperature.", "Temperature.", T20C) as num
- target_temp = CLAMP(target_temp, min_temp, max_temp)
+ target_temp = clamp(target_temp, min_temp, max_temp)
update_icon()
@@ -263,7 +263,7 @@
shift_mod = 1
else if(current_temp > target_temp)
shift_mod = -1
- current_temp = CLAMP(round((current_temp + 1 * shift_mod) + (rand(-5, 5) / 10)), min_temp, max_temp)
+ current_temp = clamp(round((current_temp + 1 * shift_mod) + (rand(-5, 5) / 10)), min_temp, max_temp)
use_power(power_rating * CELLRATE)
else if(connected_port && avg_pressure > 1000)
current_temp = round((current_temp + avg_temp) / 2)
diff --git a/code/modules/tables/interactions.dm b/code/modules/tables/interactions.dm
index d9ff4b5ceb8..cdb9b6ccfa0 100644
--- a/code/modules/tables/interactions.dm
+++ b/code/modules/tables/interactions.dm
@@ -148,8 +148,8 @@
if(!click_params || !click_params["icon-x"] || !click_params["icon-y"])
return
//Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf)
- I.pixel_x = CLAMP(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
- I.pixel_y = CLAMP(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
+ I.pixel_x = clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
+ I.pixel_y = clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
AfterPutItemOnTable(I, user)
return TRUE
else
@@ -164,8 +164,8 @@
if(!click_params || !click_params["icon-x"] || !click_params["icon-y"])
return
//Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf)
- W.pixel_x = CLAMP(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
- W.pixel_y = CLAMP(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
+ W.pixel_x = clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
+ W.pixel_y = clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
return TRUE
return ..()
diff --git a/code/modules/telesci/telesci_computer.dm b/code/modules/telesci/telesci_computer.dm
index 7badf3fdbc8..06d44a71243 100644
--- a/code/modules/telesci/telesci_computer.dm
+++ b/code/modules/telesci/telesci_computer.dm
@@ -172,7 +172,7 @@
return
if(telepad)
- var/trueDistance = CLAMP(distance + distance_off, 1, get_max_allowed_distance())
+ var/trueDistance = clamp(distance + distance_off, 1, get_max_allowed_distance())
var/trueRotation = rotation + rotation_off
var/datum/projectile_data/proj_data = simple_projectile_trajectory(telepad.x, telepad.y, trueRotation, trueDistance)
@@ -282,7 +282,7 @@
updateDialog()
/obj/machinery/computer/telescience/proc/teleport(mob/user)
- distance = CLAMP(distance, 0, get_max_allowed_distance())
+ distance = clamp(distance, 0, get_max_allowed_distance())
if(rotation == null || distance == null || z_co == null)
temp_msg = "ERROR!
Set a distance, rotation and sector."
return
@@ -319,14 +319,14 @@
var/new_rot = input("Please input desired bearing in degrees.", name, rotation) as num
if(..()) // Check after we input a value, as they could've moved after they entered something
return
- rotation = CLAMP(new_rot, -900, 900)
+ rotation = clamp(new_rot, -900, 900)
rotation = round(rotation, 0.01)
if(href_list["setdistance"])
var/new_pow = input("Please input desired distance in meters.", name, rotation) as num
if(..()) // Check after we input a value, as they could've moved after they entered something
return
- distance = CLAMP(new_pow, 1, get_max_allowed_distance())
+ distance = clamp(new_pow, 1, get_max_allowed_distance())
distance = FLOOR(distance, 1)
if(href_list["setz"])
diff --git a/code/modules/vore/eating/vorepanel_vr.dm b/code/modules/vore/eating/vorepanel_vr.dm
index 0a967bb02bc..ae9ce068213 100644
--- a/code/modules/vore/eating/vorepanel_vr.dm
+++ b/code/modules/vore/eating/vorepanel_vr.dm
@@ -775,14 +775,14 @@
var/new_damage = input(user, "Choose the amount of burn damage prey will take per tick. Ranges from 0 to 6.", "Set Belly Burn Damage.", selected.digest_burn) as num|null
if(new_damage == null)
return
- var/new_new_damage = CLAMP(new_damage, 0, 6)
+ var/new_new_damage = clamp(new_damage, 0, 6)
selected.digest_burn = new_new_damage
if(href_list["b_brute_dmg"])
var/new_damage = input(user, "Choose the amount of brute damage prey will take per tick. Ranges from 0 to 6", "Set Belly Brute Damage.", selected.digest_brute) as num|null
if(new_damage == null)
return
- var/new_new_damage = CLAMP(new_damage, 0, 6)
+ var/new_new_damage = clamp(new_damage, 0, 6)
selected.digest_brute = new_new_damage
if(href_list["b_escapable"])