From 5a11150e954bb06946d64b6c36dd0f8c7b774b8c Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Mon, 15 Jan 2024 04:14:08 -0500 Subject: [PATCH] Defines cleanup (#5439) # About the pull request Cleans up some duplicate, unused, and/or obsolete (due to native DM implementation) defines. Each change is isolated in its own commit if any are objectionable. - `Clamp()` - functionally identical to and replaced by native `clamp()`, introduced in 513: https://www.byond.com/docs/ref/#/proc/clamp - `Tan()` - functionally identical to and replaced by native `tan()`, introduced in 513: https://www.byond.com/docs/ref/#/proc/tan - `roundNearest()` - functionally identical to and replaced by native 2-argument `round(x, 1)`: https://www.byond.com/docs/ref/#/proc/round - `IsInRange()` - never used and identical to `ISINRANGE()` define, elected to keep the latter as it is in the DEFINES folder - `CEILING(x, 1)` - when 1 is the second argument, replaced by the functionally identical and simpler `Ceiling()` define, which itself can be replaced by native `ceil()` when we move to 515: https://www.byond.com/docs/ref/#/proc/ceil - `n_ceil()` - functionally identical to and replaced by `Ceiling()` - `FLOOR(x, 1)` - when 1 is the second argument, replaced by the functionally identical and simpler `Floor()` define, which itself can be replaced by native `floor()` when we move to 515: https://www.byond.com/docs/ref/#/proc/floor - `LERP()` - a version was implemented in projectile code, moved it out to the DEFINES folder and switched to a slightly more robust version from TGMC: https://github.com/tgstation/TerraGov-Marine-Corps/blob/2da5c237640d73e3e66ad79e34861e9682f4609c/code/__DEFINES/maths.dm#L87-L90 # Explain why it's good for the game Less duplication leads to greater maintainability. # Testing Photographs and Procedure
Screenshots & Videos Put screenshots and videos here with an empty line between the screenshots and the `
` tags.
# Changelog No player-facing changes. --- code/__DEFINES/_math.dm | 3 +++ code/__HELPERS/#maths.dm | 18 +------------ code/__HELPERS/_time.dm | 8 +++--- code/__HELPERS/icons.dm | 6 ++--- code/__HELPERS/unsorted.dm | 10 +++---- code/_onclick/click.dm | 4 +-- code/controllers/subsystem/minimap.dm | 4 +-- code/controllers/subsystem/timer.dm | 2 +- code/controllers/subsystem/x_evolution.dm | 2 +- code/datums/beam.dm | 4 +-- code/datums/components/overlay_lighting.dm | 2 +- code/datums/diseases/advance/advance.dm | 6 ++--- code/datums/stamina/_stamina.dm | 2 +- .../jobs/job/civilians/other/survivors.dm | 2 +- code/game/jobs/slot_scaling.dm | 2 +- code/game/machinery/computer/research.dm | 2 +- code/game/machinery/telecomms/presets.dm | 2 +- .../objects/items/devices/motion_detector.dm | 2 +- code/game/objects/items/fulton.dm | 4 +-- .../reagent_containers/food/drinks/bottle.dm | 2 +- .../items/reagent_containers/food/sandwich.dm | 2 +- code/game/objects/items/storage/pouch.dm | 4 +-- .../objects/structures/barricade/barricade.dm | 2 +- .../objects/structures/pipes/vents/vents.dm | 2 +- code/game/objects/structures/surface.dm | 4 +-- code/game/turfs/open.dm | 4 +-- code/modules/buildmode/buildmode.dm | 2 +- code/modules/clothing/suits/marine_armor.dm | 4 +-- code/modules/cm_aliens/structures/fruit.dm | 2 +- code/modules/cm_aliens/weeds.dm | 6 ++--- .../cm_marines/altitude_control_console.dm | 2 +- code/modules/cm_marines/orbital_cannon.dm | 4 +-- code/modules/cm_marines/shuttle_backend.dm | 4 +-- code/modules/cm_tech/resources/resource.dm | 2 +- code/modules/defenses/bell_tower.dm | 2 +- code/modules/economy/cash.dm | 2 +- .../lighting_mask/shadow_calculator.dm | 2 +- .../lighting_static/static_lighting_source.dm | 4 +-- code/modules/mob/dead/observer/orbit.dm | 4 +-- .../mob/living/carbon/human/human_damage.dm | 4 +-- .../carbon/human/life/handle_environment.dm | 2 +- .../living/carbon/human/powers/issue_order.dm | 6 ++--- .../mob/living/carbon/human/species/human.dm | 4 +-- .../abilities/ravager/ravager_powers.dm | 8 +++--- .../carbon/xenomorph/abilities/xeno_action.dm | 4 +-- .../living/carbon/xenomorph/castes/Warrior.dm | 2 +- .../living/carbon/xenomorph/hive_status.dm | 2 +- .../mutators/strains/praetorian/warden.dm | 2 +- .../living/carbon/xenomorph/update_icons.dm | 2 +- code/modules/mob/living/living_defense.dm | 2 +- .../modules/mob/living/living_health_procs.dm | 2 +- .../mob/living/simple_animal/hostile/alien.dm | 2 +- .../mob/living/simple_animal/simple_animal.dm | 2 +- code/modules/mob/mob_helpers.dm | 2 +- code/modules/mob/mob_movement.dm | 2 +- code/modules/movement/launching/launching.dm | 2 +- code/modules/nightmare/nmnodes/mapload.dm | 2 +- code/modules/organs/limbs.dm | 2 +- code/modules/projectiles/ammunition.dm | 2 +- .../modules/projectiles/guns/flamer/flamer.dm | 8 +++--- code/modules/projectiles/magazines/flamer.dm | 4 +-- code/modules/projectiles/projectile.dm | 26 +++++++------------ .../chemistry_machinery/chem_master.dm | 2 +- .../chemistry_machinery/chem_simulator.dm | 2 +- .../chemistry_properties/prop_neutral.dm | 2 +- .../shuttle/computers/dropship_computer.dm | 2 +- .../vehicles/hardpoints/primary/minigun.dm | 2 +- 67 files changed, 115 insertions(+), 134 deletions(-) diff --git a/code/__DEFINES/_math.dm b/code/__DEFINES/_math.dm index 6fb634e66720..138adeeda451 100644 --- a/code/__DEFINES/_math.dm +++ b/code/__DEFINES/_math.dm @@ -32,3 +32,6 @@ /// Gets the sign of x, returns -1 if negative, 0 if 0, 1 if positive #define SIGN(x) ( ((x) > 0) - ((x) < 0) ) + +/// Performs a linear interpolation between a and b. Note that amount=0 returns a, amount=1 returns b, and amount=0.5 returns the mean of a and b. +#define LERP(a, b, amount) ( amount ? ((a) + ((b) - (a)) * (amount)) : a ) diff --git a/code/__HELPERS/#maths.dm b/code/__HELPERS/#maths.dm index 6ea534a79923..7eea79742148 100644 --- a/code/__HELPERS/#maths.dm +++ b/code/__HELPERS/#maths.dm @@ -9,11 +9,10 @@ GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, // MATH DEFINES #define Ceiling(x) (-round(-x)) -#define Clamp(val, min_val, max_val) (max(min_val, min(val, max_val))) #define CLAMP01(x) (clamp(x, 0, 1)) // cotangent -#define Cot(x) (1 / Tan(x)) +#define Cot(x) (1 / tan(x)) // cosecant #define Csc(x) (1 / sin(x)) @@ -21,19 +20,12 @@ GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, #define Default(a, b) (a ? a : b) #define Floor(x) (round(x)) -//Finds nearest integer to x, above or below -//something.5 or higher, round up, else round down -#define roundNearest(x) (((Ceiling(x) - x) <= (x - Floor(x))) ? Ceiling(x) : Floor(x)) - // Greatest Common Divisor - Euclid's algorithm #define Gcd(a, b) (b ? Gcd(b, a % b) : a) #define Inverse(x) (1 / x) #define IsEven(x) (x % 2 == 0) -// Returns true if val is from min to max, inclusive. -#define IsInRange(val, min, max) (min <= val && val <= max) - #define IsInteger(x) (Floor(x) == x) #define IsOdd(x) (!IsEven(x)) #define IsMultiple(x, y) (x % y == 0) @@ -47,9 +39,6 @@ GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, // secant #define Sec(x) (1 / cos(x)) -// tangent -#define Tan(x) (sin(x) / cos(x)) - // 57.2957795 = 180 / Pi #define ToDegrees(radians) (radians * 57.2957795) @@ -85,11 +74,6 @@ GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, return rotated_point -// Round up -/proc/n_ceil(num) - if(isnum(num)) - return round(num)+1 - ///Format a power value in W, kW, MW, or GW. /proc/display_power(powerused) if(powerused < 1000) //Less than a kW diff --git a/code/__HELPERS/_time.dm b/code/__HELPERS/_time.dm index 8386feff41c2..733ca659501b 100644 --- a/code/__HELPERS/_time.dm +++ b/code/__HELPERS/_time.dm @@ -48,7 +48,7 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0) return gameTimestamp("mm:ss", time) /proc/time_left_until(target_time, current_time, time_unit) - return CEILING(target_time - current_time, 1) / time_unit + return Ceiling(target_time - current_time) / time_unit /proc/text2duration(text = "00:00") // Attempts to convert time text back to time value var/split_text = splittext(text, ":") @@ -91,21 +91,21 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0) return "right now" if(second < 60) return "[second] second[(second != 1)? "s":""]" - var/minute = FLOOR(second / 60, 1) + var/minute = Floor(second / 60) second = FLOOR(MODULUS(second, 60), round_seconds_to) var/secondT if(second) secondT = " and [second] second[(second != 1)? "s":""]" if(minute < 60) return "[minute] minute[(minute != 1)? "s":""][secondT]" - var/hour = FLOOR(minute / 60, 1) + var/hour = Floor(minute / 60) minute = MODULUS(minute, 60) var/minuteT if(minute) minuteT = " and [minute] minute[(minute != 1)? "s":""]" if(hour < 24) return "[hour] hour[(hour != 1)? "s":""][minuteT][secondT]" - var/day = FLOOR(hour / 24, 1) + var/day = Floor(hour / 24) hour = MODULUS(hour, 24) var/hourT if(hour) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 97243002740d..29755683165c 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -548,9 +548,9 @@ world 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(list/atoms) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 05fa7c69e50f..3d8b35de6304 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -40,11 +40,11 @@ #define skillcheckexplicit(user, skill, req_level) ((!user.skills || user.skills.is_skilled(skill, req_level, TRUE))) // Ensure the frequency is within bounds of what it should be sending/receiving at -// Sets f within bounds via `Clamp(round(f), 1441, 1489)` +// Sets f within bounds via `clamp(round(f), 1441, 1489)` // If f is even, adds 1 to its value to make it odd -#define sanitize_frequency(f) ((Clamp(round(f), 1441, 1489) % 2) == 0 ? \ - Clamp(round(f), 1441, 1489) + 1 : \ - Clamp(round(f), 1441, 1489) \ +#define sanitize_frequency(f) ((clamp(round(f), 1441, 1489) % 2) == 0 ? \ + clamp(round(f), 1441, 1489) + 1 : \ + clamp(round(f), 1441, 1489) \ ) //Turns 1479 into 147.9 @@ -1633,7 +1633,7 @@ GLOBAL_LIST_INIT(WALLITEMS, list( . = 0 var/i = DS2TICKS(initial_delay) do - . += CEILING(i*DELTA_CALC, 1) + . += Ceiling(i*DELTA_CALC) sleep(i*world.tick_lag*DELTA_CALC) i *= 2 while (TICK_USAGE > min(TICK_LIMIT_TO_RUN, Master.current_ticklimit)) diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index b99d52086e36..72e298d32729 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -376,8 +376,8 @@ var/shiftX = C.pixel_x / world.icon_size var/shiftY = C.pixel_y / world.icon_size var/list/actual_view = getviewsize(C ? C.view : GLOB.world_view_size) - tX = Clamp(origin.x + text2num(tX) + shiftX - round(actual_view[1] / 2) - 1, 1, world.maxx) - tY = Clamp(origin.y + text2num(tY) + shiftY - round(actual_view[2] / 2) - 1, 1, world.maxy) + tX = clamp(origin.x + text2num(tX) + shiftX - round(actual_view[1] / 2) - 1, 1, world.maxx) + tY = clamp(origin.y + text2num(tY) + shiftY - round(actual_view[2] / 2) - 1, 1, world.maxy) return locate(tX, tY, tZ) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index f3b141c0d9f8..3255c7db2fc5 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -88,8 +88,8 @@ SUBSYSTEM_DEF(minimaps) else if(yval < smallest_y) smallest_y = yval - minimaps_by_z["[level]"].x_offset = FLOOR((SCREEN_PIXEL_SIZE-largest_x-smallest_x) / MINIMAP_SCALE, 1) - minimaps_by_z["[level]"].y_offset = FLOOR((SCREEN_PIXEL_SIZE-largest_y-smallest_y) / MINIMAP_SCALE, 1) + minimaps_by_z["[level]"].x_offset = Floor((SCREEN_PIXEL_SIZE-largest_x-smallest_x) / MINIMAP_SCALE) + minimaps_by_z["[level]"].y_offset = Floor((SCREEN_PIXEL_SIZE-largest_y-smallest_y) / MINIMAP_SCALE) icon_gen.Shift(EAST, minimaps_by_z["[level]"].x_offset) icon_gen.Shift(NORTH, minimaps_by_z["[level]"].y_offset) diff --git a/code/controllers/subsystem/timer.dm b/code/controllers/subsystem/timer.dm index e7e17876d9db..47403f3379fb 100644 --- a/code/controllers/subsystem/timer.dm +++ b/code/controllers/subsystem/timer.dm @@ -583,7 +583,7 @@ SUBSYSTEM_DEF(timer) be supported and may refuse to run or run with a 0 wait") if (flags & TIMER_CLIENT_TIME) // REALTIMEOFDAY has a resolution of 1 decisecond - wait = max(CEILING(wait, 1), 1) // so if we use tick_lag timers may be inserted in the "past" + wait = max(Ceiling(wait), 1) // so if we use tick_lag timers may be inserted in the "past" else wait = max(CEILING(wait, world.tick_lag), world.tick_lag) diff --git a/code/controllers/subsystem/x_evolution.dm b/code/controllers/subsystem/x_evolution.dm index 2232147d2eb8..857af8117df2 100644 --- a/code/controllers/subsystem/x_evolution.dm +++ b/code/controllers/subsystem/x_evolution.dm @@ -47,7 +47,7 @@ SUBSYSTEM_DEF(xevolution) //Add on any bonuses from thie hivecore after applying upgrade progress boost_power_new += (0.5 * HS.has_special_structure(XENO_STRUCTURE_CORE)) - boost_power_new = Clamp(boost_power_new, BOOST_POWER_MIN, BOOST_POWER_MAX) + boost_power_new = clamp(boost_power_new, BOOST_POWER_MIN, BOOST_POWER_MAX) boost_power_new += HS.evolution_bonus if(!force_boost_power) diff --git a/code/datums/beam.dm b/code/datums/beam.dm index e51dcafa0218..08b5ea9f9a64 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -125,11 +125,11 @@ //Position the effect so the beam is one continous line var/a if(abs(Pixel_x)>world.icon_size) - a = Pixel_x > 0 ? round(Pixel_x/32) : CEILING(Pixel_x/world.icon_size, 1) + a = Pixel_x > 0 ? round(Pixel_x/32) : Ceiling(Pixel_x/world.icon_size) X.x += a Pixel_x %= world.icon_size if(abs(Pixel_y)>world.icon_size) - a = Pixel_y > 0 ? round(Pixel_y/32) : CEILING(Pixel_y/world.icon_size, 1) + a = Pixel_y > 0 ? round(Pixel_y/32) : Ceiling(Pixel_y/world.icon_size) X.y += a Pixel_y %= world.icon_size diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index 9bc5b019b5cd..8288453f7b24 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -340,7 +340,7 @@ turn_off() range = clamp(CEILING(new_range, 0.5), 1, 7) var/pixel_bounds = ((range - 1) * 64) + 32 - lumcount_range = CEILING(range, 1) + lumcount_range = Ceiling(range) if(current_holder && overlay_lighting_flags & LIGHTING_ON) current_holder.underlays -= visible_mask visible_mask.icon = light_overlays["[pixel_bounds]"] diff --git a/code/datums/diseases/advance/advance.dm b/code/datums/diseases/advance/advance.dm index d933b81eb620..8b84513169e6 100644 --- a/code/datums/diseases/advance/advance.dm +++ b/code/datums/diseases/advance/advance.dm @@ -204,9 +204,9 @@ GLOBAL_LIST_INIT(advance_cures, list( hidden = list( (properties["stealth"] > 2), (properties["stealth"] > 3) ) // The more symptoms we have, the less transmittable it is but some symptoms can make up for it. - SetSpread(Clamp(properties["transmittable"] - symptoms.len, BLOOD, AIRBORNE)) + SetSpread(clamp(properties["transmittable"] - symptoms.len, BLOOD, AIRBORNE)) permeability_mod = max(Ceiling(0.4 * properties["transmittable"]), 1) - cure_chance = 15 - Clamp(properties["resistance"], -5, 5) // can be between 10 and 20 + cure_chance = 15 - clamp(properties["resistance"], -5, 5) // can be between 10 and 20 stage_prob = max(properties["stage_rate"], 2) SetSeverity(properties["severity"]) GenerateCure(properties) @@ -254,7 +254,7 @@ GLOBAL_LIST_INIT(advance_cures, list( // Will generate a random cure, the less resistance the symptoms have, the harder the cure. /datum/disease/advance/proc/GenerateCure(list/properties = list()) if(properties && properties.len) - var/res = Clamp(properties["resistance"] - (symptoms.len / 2), 1, GLOB.advance_cures.len) + var/res = clamp(properties["resistance"] - (symptoms.len / 2), 1, GLOB.advance_cures.len) cure_id = GLOB.advance_cures[res] // Get the cure name from the cure_id diff --git a/code/datums/stamina/_stamina.dm b/code/datums/stamina/_stamina.dm index e233aaa81676..80e7df74e86b 100644 --- a/code/datums/stamina/_stamina.dm +++ b/code/datums/stamina/_stamina.dm @@ -34,7 +34,7 @@ if(!has_stamina) return - current_stamina = Clamp(current_stamina - amount, 0, max_stamina) + current_stamina = clamp(current_stamina - amount, 0, max_stamina) if(current_stamina < max_stamina) START_PROCESSING(SSobj, src) diff --git a/code/game/jobs/job/civilians/other/survivors.dm b/code/game/jobs/job/civilians/other/survivors.dm index 23097e139eda..a85731aa781a 100644 --- a/code/game/jobs/job/civilians/other/survivors.dm +++ b/code/game/jobs/job/civilians/other/survivors.dm @@ -14,7 +14,7 @@ var/hostile = FALSE /datum/job/civilian/survivor/set_spawn_positions(count) - spawn_positions = Clamp((round(count * SURVIVOR_TO_TOTAL_SPAWN_RATIO)), 2, 8) + spawn_positions = clamp((round(count * SURVIVOR_TO_TOTAL_SPAWN_RATIO)), 2, 8) total_positions = spawn_positions /datum/job/civilian/survivor/equip_job(mob/living/survivor) diff --git a/code/game/jobs/slot_scaling.dm b/code/game/jobs/slot_scaling.dm index 2d444d06e5ab..8bd4af908c07 100644 --- a/code/game/jobs/slot_scaling.dm +++ b/code/game/jobs/slot_scaling.dm @@ -10,7 +10,7 @@ /proc/job_slot_formula(marine_count, factor, c, min, max) if(marine_count <= factor) return min - return round(Clamp((marine_count/factor)+c, min, max)) + return round(clamp((marine_count/factor)+c, min, max)) /proc/medic_slot_formula(playercount) return job_slot_formula(playercount,40,1,3,5) diff --git a/code/game/machinery/computer/research.dm b/code/game/machinery/computer/research.dm index 1ba696eeee9c..d5158cb76451 100644 --- a/code/game/machinery/computer/research.dm +++ b/code/game/machinery/computer/research.dm @@ -179,7 +179,7 @@ if("purchase_document") if(!photocopier) return - var/purchase_tier = FLOOR(text2num(params["purchase_document"]), 1) + var/purchase_tier = Floor(text2num(params["purchase_document"])) if(purchase_tier <= 0 || purchase_tier > 5) return if(purchase_tier > GLOB.chemical_data.clearance_level) diff --git a/code/game/machinery/telecomms/presets.dm b/code/game/machinery/telecomms/presets.dm index 7621d55e3645..ebf627cbf629 100644 --- a/code/game/machinery/telecomms/presets.dm +++ b/code/game/machinery/telecomms/presets.dm @@ -91,7 +91,7 @@ return // Leave the poor thing alone health -= damage - health = Clamp(health, 0, initial(health)) + health = clamp(health, 0, initial(health)) if(health <= 0) toggled = FALSE // requires flipping on again once repaired diff --git a/code/game/objects/items/devices/motion_detector.dm b/code/game/objects/items/devices/motion_detector.dm index 9776eae11c8f..f9fa0224cbd6 100644 --- a/code/game/objects/items/devices/motion_detector.dm +++ b/code/game/objects/items/devices/motion_detector.dm @@ -280,7 +280,7 @@ DB.icon_state = "[blip_icon]_blip" DB.setDir(initial(DB.dir)) - DB.screen_loc = "[Clamp(c_view + 1 - view_x_offset + (target.x - user.x), 1, 2*c_view+1)],[Clamp(c_view + 1 - view_y_offset + (target.y - user.y), 1, 2*c_view+1)]" + DB.screen_loc = "[clamp(c_view + 1 - view_x_offset + (target.x - user.x), 1, 2*c_view+1)],[clamp(c_view + 1 - view_y_offset + (target.y - user.y), 1, 2*c_view+1)]" user.client.add_to_screen(DB) addtimer(CALLBACK(src, PROC_REF(clear_pings), user, DB), 1 SECONDS) diff --git a/code/game/objects/items/fulton.dm b/code/game/objects/items/fulton.dm index 788613cf4c6e..e36d269c8b90 100644 --- a/code/game/objects/items/fulton.dm +++ b/code/game/objects/items/fulton.dm @@ -141,8 +141,8 @@ GLOBAL_LIST_EMPTY(deployed_fultons) original_location = get_turf(attached_atom) playsound(loc, 'sound/items/fulton.ogg', 50, 1) reservation = SSmapping.RequestBlockReservation(3, 3, turf_type_override = /turf/open/space) - var/middle_x = reservation.bottom_left_coords[1] + FLOOR((reservation.top_right_coords[1] - reservation.bottom_left_coords[1]) / 2, 1) - var/middle_y = reservation.bottom_left_coords[2] + FLOOR((reservation.top_right_coords[2] - reservation.bottom_left_coords[2]) / 2, 1) + var/middle_x = reservation.bottom_left_coords[1] + Floor((reservation.top_right_coords[1] - reservation.bottom_left_coords[1]) / 2) + var/middle_y = reservation.bottom_left_coords[2] + Floor((reservation.top_right_coords[2] - reservation.bottom_left_coords[2]) / 2) var/turf/space_tile = locate(middle_x, middle_y, reservation.bottom_left_coords[3]) if(!space_tile) visible_message(SPAN_WARNING("[src] begins beeping like crazy. Something is wrong!")) diff --git a/code/game/objects/items/reagent_containers/food/drinks/bottle.dm b/code/game/objects/items/reagent_containers/food/drinks/bottle.dm index 0e63a19c7ef1..b522d8d2ed81 100644 --- a/code/game/objects/items/reagent_containers/food/drinks/bottle.dm +++ b/code/game/objects/items/reagent_containers/food/drinks/bottle.dm @@ -107,7 +107,7 @@ if(alcohol_potency < BURN_LEVEL_TIER_1) to_chat(user, SPAN_NOTICE("There's not enough flammable liquid in \the [src]!")) return - alcohol_potency = Clamp(alcohol_potency, BURN_LEVEL_TIER_1, BURN_LEVEL_TIER_7) + alcohol_potency = clamp(alcohol_potency, BURN_LEVEL_TIER_1, BURN_LEVEL_TIER_7) if(!do_after(user, 20, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD)) return diff --git a/code/game/objects/items/reagent_containers/food/sandwich.dm b/code/game/objects/items/reagent_containers/food/sandwich.dm index 511c0c042be1..b3f68bd299a9 100644 --- a/code/game/objects/items/reagent_containers/food/sandwich.dm +++ b/code/game/objects/items/reagent_containers/food/sandwich.dm @@ -74,7 +74,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),1,3)) + w_class = Ceiling(clamp((ingredients.len/2),1,3)) /obj/item/reagent_container/food/snacks/csandwich/Destroy() QDEL_NULL_LIST(ingredients) diff --git a/code/game/objects/items/storage/pouch.dm b/code/game/objects/items/storage/pouch.dm index acb87e988879..7369df548045 100644 --- a/code/game/objects/items/storage/pouch.dm +++ b/code/game/objects/items/storage/pouch.dm @@ -976,7 +976,7 @@ to_chat(user, SPAN_WARNING("[O] is empty!")) return - var/amt_to_remove = Clamp(O.reagents.total_volume, 0, inner.volume) + var/amt_to_remove = clamp(O.reagents.total_volume, 0, inner.volume) if(!amt_to_remove) to_chat(user, SPAN_WARNING("[O] is empty!")) return @@ -989,7 +989,7 @@ fill_autoinjector(contents[1]) //Top up our inner reagent canister after filling up the injector - amt_to_remove = Clamp(O.reagents.total_volume, 0, inner.volume) + amt_to_remove = clamp(O.reagents.total_volume, 0, inner.volume) if(amt_to_remove) O.reagents.trans_to(inner, amt_to_remove) diff --git a/code/game/objects/structures/barricade/barricade.dm b/code/game/objects/structures/barricade/barricade.dm index b23e07f707f2..1206148b7b78 100644 --- a/code/game/objects/structures/barricade/barricade.dm +++ b/code/game/objects/structures/barricade/barricade.dm @@ -341,7 +341,7 @@ /obj/structure/barricade/update_health(damage, nomessage) health -= damage - health = Clamp(health, 0, maxhealth) + health = clamp(health, 0, maxhealth) if(!health) if(!nomessage) diff --git a/code/game/objects/structures/pipes/vents/vents.dm b/code/game/objects/structures/pipes/vents/vents.dm index 298fbc57f4ad..d7e090c581c5 100644 --- a/code/game/objects/structures/pipes/vents/vents.dm +++ b/code/game/objects/structures/pipes/vents/vents.dm @@ -176,7 +176,7 @@ addtimer(CALLBACK(src, PROC_REF(release_gas), radius), warning_time) /obj/structure/pipes/vents/proc/release_gas(radius = 4) - radius = Clamp(radius, 1, 10) + radius = clamp(radius, 1, 10) if(!gas_holder || welded) return FALSE playsound(loc, 'sound/effects/smoke.ogg', 25, 1, 4) diff --git a/code/game/objects/structures/surface.dm b/code/game/objects/structures/surface.dm index 13a81af2dc3d..ac8cf51a407e 100644 --- a/code/game/objects/structures/surface.dm +++ b/code/game/objects/structures/surface.dm @@ -27,8 +27,8 @@ var/mouse_x = text2num(click_data["icon-x"])-1 // Ranging from 0 to 31 var/mouse_y = text2num(click_data["icon-y"])-1 - var/cell_x = Clamp(round(mouse_x/CELLSIZE), 0, CELLS-1) // Ranging from 0 to CELLS-1 - var/cell_y = Clamp(round(mouse_y/CELLSIZE), 0, CELLS-1) + var/cell_x = clamp(round(mouse_x/CELLSIZE), 0, CELLS-1) // Ranging from 0 to CELLS-1 + var/cell_y = clamp(round(mouse_y/CELLSIZE), 0, CELLS-1) var/list/center = cached_key_number_decode(new_item.center_of_mass) diff --git a/code/game/turfs/open.dm b/code/game/turfs/open.dm index 7d9dd6303c64..ac1635f151dd 100644 --- a/code/game/turfs/open.dm +++ b/code/game/turfs/open.dm @@ -115,10 +115,10 @@ scorchedness = 1 if(2 to 30) - scorchedness = Clamp(scorchedness + 1, 0, 3) //increase scorch by 1 (not that hot of a fire) + scorchedness = clamp(scorchedness + 1, 0, 3) //increase scorch by 1 (not that hot of a fire) if(31 to 60) - scorchedness = Clamp(scorchedness + 2, 0, 3) //increase scorch by 2 (hotter fire) + scorchedness = clamp(scorchedness + 2, 0, 3) //increase scorch by 2 (hotter fire) if(61 to INFINITY) scorchedness = 3 //max out the scorchedness (hottest fire) diff --git a/code/modules/buildmode/buildmode.dm b/code/modules/buildmode/buildmode.dm index eeab65ec031a..bc20a714027d 100644 --- a/code/modules/buildmode/buildmode.dm +++ b/code/modules/buildmode/buildmode.dm @@ -80,7 +80,7 @@ var/pos_idx = 0 for(var/thing in elements) var/x = pos_idx % switch_width - var/y = FLOOR(pos_idx / switch_width, 1) + var/y = Floor(pos_idx / switch_width) var/atom/movable/screen/buildmode/B = new buttontype(src, thing) // extra .5 for a nice offset look B.screen_loc = "NORTH-[(1 + 0.5 + y*1.5)],WEST+[0.5 + x*1.5]" diff --git a/code/modules/clothing/suits/marine_armor.dm b/code/modules/clothing/suits/marine_armor.dm index 844655049a69..afefa2903ab4 100644 --- a/code/modules/clothing/suits/marine_armor.dm +++ b/code/modules/clothing/suits/marine_armor.dm @@ -190,7 +190,7 @@ if(. != CHECKS_PASSED) return set_light_range(initial(light_range)) - set_light_power(FLOOR(initial(light_power) * 0.5, 1)) + set_light_power(Floor(initial(light_power) * 0.5)) set_light_on(toggle_on) flags_marine_armor ^= ARMOR_LAMP_ON @@ -1011,7 +1011,7 @@ if(camo_active) if(current_camo < full_camo_alpha) current_camo = full_camo_alpha - current_camo = Clamp(current_camo + incremental_shooting_camo_penalty, full_camo_alpha, 255) + current_camo = clamp(current_camo + incremental_shooting_camo_penalty, full_camo_alpha, 255) H.alpha = current_camo addtimer(CALLBACK(src, PROC_REF(fade_out_finish), H), camouflage_break, TIMER_OVERRIDE|TIMER_UNIQUE) animate(H, alpha = full_camo_alpha + 5, time = camouflage_break, easing = LINEAR_EASING, flags = ANIMATION_END_NOW) diff --git a/code/modules/cm_aliens/structures/fruit.dm b/code/modules/cm_aliens/structures/fruit.dm index 408ed5d951cc..00272cf90341 100644 --- a/code/modules/cm_aliens/structures/fruit.dm +++ b/code/modules/cm_aliens/structures/fruit.dm @@ -239,7 +239,7 @@ /obj/effect/alien/resin/fruit/unstable/consume_effect(mob/living/carbon/xenomorph/recipient, do_consume = TRUE) if(mature && recipient && !QDELETED(recipient)) - recipient.add_xeno_shield(Clamp(overshield_amount, 0, recipient.maxHealth * 0.3), XENO_SHIELD_SOURCE_GARDENER, duration = shield_duration, decay_amount_per_second = shield_decay) + recipient.add_xeno_shield(clamp(overshield_amount, 0, recipient.maxHealth * 0.3), XENO_SHIELD_SOURCE_GARDENER, duration = shield_duration, decay_amount_per_second = shield_decay) to_chat(recipient, SPAN_XENONOTICE("We feel our defense being bolstered, and begin to regenerate rapidly.")) // Every seconds, heal him for 5. new /datum/effects/heal_over_time(recipient, regeneration_amount_total, regeneration_ticks, 1) diff --git a/code/modules/cm_aliens/weeds.dm b/code/modules/cm_aliens/weeds.dm index 45c78b979105..5298e7ab02f1 100644 --- a/code/modules/cm_aliens/weeds.dm +++ b/code/modules/cm_aliens/weeds.dm @@ -58,9 +58,9 @@ if(spread_on_semiweedable && weed_strength < WEED_LEVEL_HIVE) if(color) var/list/RGB = ReadRGB(color) - RGB[1] = Clamp(RGB[1] + 35, 0, 255) - RGB[2] = Clamp(RGB[2] + 35, 0, 255) - RGB[3] = Clamp(RGB[3] + 35, 0, 255) + RGB[1] = clamp(RGB[1] + 35, 0, 255) + RGB[2] = clamp(RGB[2] + 35, 0, 255) + RGB[3] = clamp(RGB[3] + 35, 0, 255) color = rgb(RGB[1], RGB[2], RGB[3]) else color = "#a1a1a1" diff --git a/code/modules/cm_marines/altitude_control_console.dm b/code/modules/cm_marines/altitude_control_console.dm index a8281806be10..7e0a8c395152 100644 --- a/code/modules/cm_marines/altitude_control_console.dm +++ b/code/modules/cm_marines/altitude_control_console.dm @@ -63,7 +63,7 @@ GLOBAL_VAR_INIT(ship_alt, SHIP_ALT_MED) temperature_change = COOLING if(SHIP_ALT_HIGH) temperature_change = COOLING - GLOB.ship_temp = Clamp(GLOB.ship_temp += temperature_change, 0, 120) + GLOB.ship_temp = clamp(GLOB.ship_temp += temperature_change, 0, 120) if(prob(50)) return if(GLOB.ship_alt == SHIP_ALT_LOW) diff --git a/code/modules/cm_marines/orbital_cannon.dm b/code/modules/cm_marines/orbital_cannon.dm index b003237f68ee..23bce06fdc1a 100644 --- a/code/modules/cm_marines/orbital_cannon.dm +++ b/code/modules/cm_marines/orbital_cannon.dm @@ -224,8 +224,8 @@ GLOBAL_LIST_EMPTY(orbital_cannon_cancellation) var/area/area = get_area(T) var/off_x = (inaccurate_fuel + 1) * round(rand(-3,3), 1) var/off_y = (inaccurate_fuel + 1) * round(rand(-3,3), 1) - var/target_x = Clamp(T.x + off_x, 1, world.maxx) - var/target_y = Clamp(T.y + off_y, 1, world.maxy) + var/target_x = clamp(T.x + off_x, 1, world.maxx) + var/target_y = clamp(T.y + off_y, 1, world.maxy) var/turf/target = locate(target_x, target_y, T.z) var/area/target_area = get_area(target) diff --git a/code/modules/cm_marines/shuttle_backend.dm b/code/modules/cm_marines/shuttle_backend.dm index 142caa81eb8a..6974e078e2de 100644 --- a/code/modules/cm_marines/shuttle_backend.dm +++ b/code/modules/cm_marines/shuttle_backend.dm @@ -123,8 +123,8 @@ DOCUMENTATION ON HOW TO ADD A NEW SHUTTLE: Fourkhan, 6/7/19 y = C.y_pos C1.x_pos = x*cos(deg) + y*sin(deg) C1.y_pos = y*cos(deg) - x*sin(deg) - C1.x_pos = roundNearest(C.x_pos) //Sometimes you get very close to the right number but off by around 1e-15 and I want integers dammit - C1.y_pos = roundNearest(C.y_pos) + C1.x_pos = round(C.x_pos, 1) //Sometimes you get very close to the right number but off by around 1e-15 and I want integers dammit + C1.y_pos = round(C.y_pos, 1) toReturn += i toReturn[i] = C1 diff --git a/code/modules/cm_tech/resources/resource.dm b/code/modules/cm_tech/resources/resource.dm index 44af2234afd3..02c46e3e8910 100644 --- a/code/modules/cm_tech/resources/resource.dm +++ b/code/modules/cm_tech/resources/resource.dm @@ -82,7 +82,7 @@ update_icon() /obj/structure/resource_node/proc/take_damage(damage) - health = Clamp(health - damage, 0, max_health) + health = clamp(health - damage, 0, max_health) healthcheck() /obj/structure/resource_node/bullet_act(obj/projectile/P) diff --git a/code/modules/defenses/bell_tower.dm b/code/modules/defenses/bell_tower.dm index 52207298c4b0..8ef4fe913079 100644 --- a/code/modules/defenses/bell_tower.dm +++ b/code/modules/defenses/bell_tower.dm @@ -210,7 +210,7 @@ if(turned_on) if(cloak_alpha_current < cloak_alpha_max) cloak_alpha_current = cloak_alpha_max - cloak_alpha_current = Clamp(cloak_alpha_current + incremental_ring_camo_penalty, cloak_alpha_max, 255) + cloak_alpha_current = clamp(cloak_alpha_current + incremental_ring_camo_penalty, cloak_alpha_max, 255) cloakebelltower.alpha = cloak_alpha_current addtimer(CALLBACK(src, PROC_REF(cloaker_fade_out_finish), cloakebelltower), camouflage_break, TIMER_OVERRIDE|TIMER_UNIQUE) animate(cloakebelltower, alpha = cloak_alpha_max, time = camouflage_break, easing = LINEAR_EASING, flags = ANIMATION_END_NOW) diff --git a/code/modules/economy/cash.dm b/code/modules/economy/cash.dm index ad09eaf3fa09..6ab8164c248d 100644 --- a/code/modules/economy/cash.dm +++ b/code/modules/economy/cash.dm @@ -88,7 +88,7 @@ ..() var/oldloc = loc var/amount = tgui_input_number(user, "How many dollars do you want to take? (0 to [src.worth])", "Take Money", 0, src.worth, 0) - amount = round(Clamp(amount, 0, src.worth)) + amount = round(clamp(amount, 0, src.worth)) if(amount == 0) return if(QDELETED(src) || loc != oldloc) diff --git a/code/modules/lighting/lighting_mask/shadow_calculator.dm b/code/modules/lighting/lighting_mask/shadow_calculator.dm index 42f98b47e789..cfd4a86f5f3a 100644 --- a/code/modules/lighting/lighting_mask/shadow_calculator.dm +++ b/code/modules/lighting/lighting_mask/shadow_calculator.dm @@ -95,7 +95,7 @@ SSlighting.total_shadow_calculations ++ //Ceiling the range since we need it in integer form - var/range = CEILING(radius, 1) + var/range = Ceiling(radius) DO_SOMETHING_IF_DEBUGGING_SHADOWS(var/timer = TICK_USAGE) //Work out our position diff --git a/code/modules/lighting/lighting_static/static_lighting_source.dm b/code/modules/lighting/lighting_static/static_lighting_source.dm index e650a432fc63..cfbfb49ceda3 100644 --- a/code/modules/lighting/lighting_static/static_lighting_source.dm +++ b/code/modules/lighting/lighting_static/static_lighting_source.dm @@ -223,8 +223,8 @@ var/list/turf/turfs = list() if (source_turf) var/oldlum = source_turf.luminosity - source_turf.luminosity = CEILING(light_range, 1) - for(var/turf/T in view(CEILING(light_range, 1), source_turf)) + source_turf.luminosity = Ceiling(light_range) + for(var/turf/T in view(Ceiling(light_range), source_turf)) if(!IS_OPAQUE_TURF(T)) if (!T.lighting_corners_initialised) T.static_generate_missing_corners() diff --git a/code/modules/mob/dead/observer/orbit.dm b/code/modules/mob/dead/observer/orbit.dm index 50496cef31c5..bad8e74d4ff1 100644 --- a/code/modules/mob/dead/observer/orbit.dm +++ b/code/modules/mob/dead/observer/orbit.dm @@ -110,7 +110,7 @@ if(isliving(M)) var/mob/living/player = M - serialized["health"] = FLOOR((player.health / player.maxHealth * 100), 1) + serialized["health"] = Floor(player.health / player.maxHealth * 100) if(isxeno(player)) var/mob/living/carbon/xenomorph/xeno = player @@ -126,7 +126,7 @@ var/obj/item/card/id/id_card = human.get_idcard() var/datum/species/human_species = human.species var/max_health = human_species.total_health != human.maxHealth ? human_species.total_health : human.maxHealth - serialized["health"] = FLOOR((player.health / max_health * 100), 1) + serialized["health"] = Floor(player.health / max_health * 100) serialized["job"] = id_card?.assignment ? id_card.assignment : human.job serialized["nickname"] = human.real_name diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index cebbbd6086bb..942c20482230 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -34,7 +34,7 @@ var/datum/internal_organ/brain/sponge = internal_organs_by_name["brain"] if(sponge) sponge.take_damage(amount) - sponge.damage = Clamp(sponge.damage, 0, maxHealth*2) + sponge.damage = clamp(sponge.damage, 0, maxHealth*2) brainloss = sponge.damage else brainloss = 200 @@ -49,7 +49,7 @@ if(species.has_organ["brain"]) var/datum/internal_organ/brain/sponge = internal_organs_by_name["brain"] if(sponge) - sponge.damage = Clamp(amount, 0, maxHealth*2) + sponge.damage = clamp(amount, 0, maxHealth*2) brainloss = sponge.damage else brainloss = 200 diff --git a/code/modules/mob/living/carbon/human/life/handle_environment.dm b/code/modules/mob/living/carbon/human/life/handle_environment.dm index 143d9d500793..65bc7213810e 100644 --- a/code/modules/mob/living/carbon/human/life/handle_environment.dm +++ b/code/modules/mob/living/carbon/human/life/handle_environment.dm @@ -19,7 +19,7 @@ if(thermal_protection < 1) temp_adj = (1 - thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR) - bodytemperature += Clamp(temp_adj, BODYTEMP_COOLING_MAX, BODYTEMP_HEATING_MAX) + bodytemperature += clamp(temp_adj, BODYTEMP_COOLING_MAX, BODYTEMP_HEATING_MAX) //+/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt. if(bodytemperature > species.heat_level_1) diff --git a/code/modules/mob/living/carbon/human/powers/issue_order.dm b/code/modules/mob/living/carbon/human/powers/issue_order.dm index 775c4f645516..1becf805c027 100644 --- a/code/modules/mob/living/carbon/human/powers/issue_order.dm +++ b/code/modules/mob/living/carbon/human/powers/issue_order.dm @@ -72,14 +72,14 @@ switch(order) if(COMMAND_ORDER_MOVE) mobility_aura_count++ - mobility_aura = Clamp(mobility_aura, strength, ORDER_MOVE_MAX_LEVEL) + mobility_aura = clamp(mobility_aura, strength, ORDER_MOVE_MAX_LEVEL) if(COMMAND_ORDER_HOLD) protection_aura_count++ - protection_aura = Clamp(protection_aura, strength, ORDER_HOLD_MAX_LEVEL) + protection_aura = clamp(protection_aura, strength, ORDER_HOLD_MAX_LEVEL) pain.apply_pain_reduction(protection_aura * PAIN_REDUCTION_AURA) if(COMMAND_ORDER_FOCUS) marksman_aura_count++ - marksman_aura = Clamp(marksman_aura, strength, ORDER_FOCUS_MAX_LEVEL) + marksman_aura = clamp(marksman_aura, strength, ORDER_FOCUS_MAX_LEVEL) hud_set_order() diff --git a/code/modules/mob/living/carbon/human/species/human.dm b/code/modules/mob/living/carbon/human/species/human.dm index add78365a350..684bfa672b19 100644 --- a/code/modules/mob/living/carbon/human/species/human.dm +++ b/code/modules/mob/living/carbon/human/species/human.dm @@ -28,7 +28,7 @@ else if(chem_effect_flags & CHEM_EFFECT_ORGAN_STASIS) b_volume *= 1 else if(heart.damage >= heart.organ_status >= ORGAN_BRUISED) - b_volume *= Clamp(100 - (2 * heart.damage), 30, 100) / 100 + b_volume *= clamp(100 - (2 * heart.damage), 30, 100) / 100 //Effects of bloodloss if(b_volume <= BLOOD_VOLUME_SAFE) @@ -37,7 +37,7 @@ /// How much oxyloss will there be from the next time blood processes var/additional_oxyloss = (100 - blood_percentage) / 5 /// The limit of the oxyloss gained, ignoring oxyloss from the switch statement - var/maximum_oxyloss = Clamp((100 - blood_percentage) / 2, oxyloss, 100) + var/maximum_oxyloss = clamp((100 - blood_percentage) / 2, oxyloss, 100) if(oxyloss < maximum_oxyloss) oxyloss += round(max(additional_oxyloss, 0)) diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm index 3ec07014b2d1..daad0362e91e 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm @@ -366,9 +366,9 @@ if (behavior.rage == 0) to_chat(xeno, SPAN_XENODANGER("We cannot eviscerate when we have 0 rage!")) return - damage = damage_at_rage_levels[Clamp(behavior.rage, 1, behavior.max_rage)] - range = range_at_rage_levels[Clamp(behavior.rage, 1, behavior.max_rage)] - windup_reduction = windup_reduction_at_rage_levels[Clamp(behavior.rage, 1, behavior.max_rage)] + damage = damage_at_rage_levels[clamp(behavior.rage, 1, behavior.max_rage)] + range = range_at_rage_levels[clamp(behavior.rage, 1, behavior.max_rage)] + windup_reduction = windup_reduction_at_rage_levels[clamp(behavior.rage, 1, behavior.max_rage)] behavior.decrement_rage(behavior.rage) apply_cooldown() @@ -420,7 +420,7 @@ // This is the heal if(!xeno.on_fire) - xeno.gain_health(Clamp(valid_count * lifesteal_per_marine, 0, max_lifesteal)) + xeno.gain_health(clamp(valid_count * lifesteal_per_marine, 0, max_lifesteal)) REMOVE_TRAIT(xeno, TRAIT_IMMOBILIZED, TRAIT_SOURCE_ABILITY("Eviscerate")) xeno.anchored = FALSE diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm b/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm index ca15c6e37306..8ed720c7ed91 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm @@ -231,7 +231,7 @@ if(!cooldown_to_apply) return - cooldown_to_apply = cooldown_to_apply * (1 - Clamp(X.cooldown_reduction_percentage, 0, 0.5)) + cooldown_to_apply = cooldown_to_apply * (1 - clamp(X.cooldown_reduction_percentage, 0, 0.5)) // Add a unique timer cooldown_timer_id = addtimer(CALLBACK(src, PROC_REF(on_cooldown_end)), cooldown_to_apply, TIMER_UNIQUE|TIMER_STOPPABLE) @@ -253,7 +253,7 @@ var/mob/living/carbon/xenomorph/X = owner // Note: no check to see if we're already on CD. we just flat override whatever's there - cooldown_duration = cooldown_duration * (1 - Clamp(X.cooldown_reduction_percentage, 0, 0.5)) + cooldown_duration = cooldown_duration * (1 - clamp(X.cooldown_reduction_percentage, 0, 0.5)) cooldown_timer_id = addtimer(CALLBACK(src, PROC_REF(on_cooldown_end)), cooldown_duration, TIMER_OVERRIDE|TIMER_UNIQUE|TIMER_STOPPABLE) current_cooldown_duration = cooldown_duration current_cooldown_start_time = world.time diff --git a/code/modules/mob/living/carbon/xenomorph/castes/Warrior.dm b/code/modules/mob/living/carbon/xenomorph/castes/Warrior.dm index 04996af8f8db..b19978a33766 100644 --- a/code/modules/mob/living/carbon/xenomorph/castes/Warrior.dm +++ b/code/modules/mob/living/carbon/xenomorph/castes/Warrior.dm @@ -161,7 +161,7 @@ emote_cooldown = world.time + 5 SECONDS addtimer(CALLBACK(src, PROC_REF(lifesteal_lock)), lifesteal_lock_duration/2) - bound_xeno.gain_health(Clamp(final_lifesteal / 100 * (bound_xeno.maxHealth - bound_xeno.health), 20, 40)) + bound_xeno.gain_health(clamp(final_lifesteal / 100 * (bound_xeno.maxHealth - bound_xeno.health), 20, 40)) /datum/behavior_delegate/warrior_base/proc/lifesteal_lock() bound_xeno.remove_filter("empower_rage") diff --git a/code/modules/mob/living/carbon/xenomorph/hive_status.dm b/code/modules/mob/living/carbon/xenomorph/hive_status.dm index 7cc5850e3701..ab812cba5c97 100644 --- a/code/modules/mob/living/carbon/xenomorph/hive_status.dm +++ b/code/modules/mob/living/carbon/xenomorph/hive_status.dm @@ -737,7 +737,7 @@ if(is_mainship_level(turf?.z)) shipside_humans_weighted_count += GLOB.RoleAuthority.calculate_role_weight(job) hijack_burrowed_surge = TRUE - hijack_burrowed_left = max(n_ceil(shipside_humans_weighted_count * 0.5) - xenos_count, 5) + hijack_burrowed_left = max(Ceiling(shipside_humans_weighted_count * 0.5) - xenos_count, 5) hivecore_cooldown = FALSE xeno_message(SPAN_XENOBOLDNOTICE("The weeds have recovered! A new hive core can be built!"),3,hivenumber) diff --git a/code/modules/mob/living/carbon/xenomorph/mutators/strains/praetorian/warden.dm b/code/modules/mob/living/carbon/xenomorph/mutators/strains/praetorian/warden.dm index 1db9ad6550e2..4328058c8a8e 100644 --- a/code/modules/mob/living/carbon/xenomorph/mutators/strains/praetorian/warden.dm +++ b/code/modules/mob/living/carbon/xenomorph/mutators/strains/praetorian/warden.dm @@ -88,7 +88,7 @@ if (internal_hitpoints >= internal_hitpoints_max) return to_chat(bound_xeno, SPAN_XENODANGER("You feel your internal health reserves increase!")) - internal_hitpoints = Clamp(internal_hitpoints + amount, 0, internal_hitpoints_max) + internal_hitpoints = clamp(internal_hitpoints + amount, 0, internal_hitpoints_max) /datum/behavior_delegate/praetorian_warden/proc/remove_internal_hitpoints(amount) add_internal_hitpoints(-1*amount) diff --git a/code/modules/mob/living/carbon/xenomorph/update_icons.dm b/code/modules/mob/living/carbon/xenomorph/update_icons.dm index 65795634a27c..55995ec0b264 100644 --- a/code/modules/mob/living/carbon/xenomorph/update_icons.dm +++ b/code/modules/mob/living/carbon/xenomorph/update_icons.dm @@ -301,7 +301,7 @@ return var/health_threshold - health_threshold = max(CEILING((health * 4) / (maxHealth), 1), 0) //From 0 to 4, in 25% chunks + health_threshold = max(Ceiling((health * 4) / (maxHealth)), 0) //From 0 to 4, in 25% chunks if(health > HEALTH_THRESHOLD_DEAD) if(health_threshold > 3) wound_icon_holder.icon_state = "none" diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 4061f26f7bb1..b19afb0450cd 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -174,7 +174,7 @@ switch(fire_reagent.fire_type) if(FIRE_VARIANT_TYPE_B) max_stacks = 10 //Armor Shredding Greenfire caps at 1 resist/pat - fire_stacks = Clamp(fire_stacks + add_fire_stacks, min_stacks, max_stacks) + fire_stacks = clamp(fire_stacks + add_fire_stacks, min_stacks, max_stacks) if(on_fire && fire_stacks <= 0) ExtinguishMob() diff --git a/code/modules/mob/living/living_health_procs.dm b/code/modules/mob/living/living_health_procs.dm index fb80c50042a3..819b3397c289 100644 --- a/code/modules/mob/living/living_health_procs.dm +++ b/code/modules/mob/living/living_health_procs.dm @@ -359,7 +359,7 @@ switch(client.prefs?.pain_overlay_pref_level) if(PAIN_OVERLAY_IMPAIR) - overlay_fullscreen("eye_blur", /atom/movable/screen/fullscreen/impaired, CEILING(clamp(eye_blurry * 0.3, 1, 6), 1)) + overlay_fullscreen("eye_blur", /atom/movable/screen/fullscreen/impaired, Ceiling(clamp(eye_blurry * 0.3, 1, 6))) if(PAIN_OVERLAY_LEGACY) overlay_fullscreen("eye_blur", /atom/movable/screen/fullscreen/blurry) else // PAIN_OVERLAY_BLURRY diff --git a/code/modules/mob/living/simple_animal/hostile/alien.dm b/code/modules/mob/living/simple_animal/hostile/alien.dm index 6e8d0b8a2867..ba7bf741f6c0 100644 --- a/code/modules/mob/living/simple_animal/hostile/alien.dm +++ b/code/modules/mob/living/simple_animal/hostile/alien.dm @@ -110,7 +110,7 @@ wound_icon_holder.layer = layer + 0.01 wound_icon_holder.dir = dir - var/health_threshold = max(CEILING((health * 4) / (maxHealth), 1), 0) //From 0 to 4, in 25% chunks + var/health_threshold = max(Ceiling((health * 4) / (maxHealth)), 0) //From 0 to 4, in 25% chunks if(health > HEALTH_THRESHOLD_DEAD) if(health_threshold > 3) wound_icon_holder.icon_state = "none" diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index a1ef9032e435..caf47b2824bb 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -323,7 +323,7 @@ explosion_throw(severity, direction) /mob/living/simple_animal/adjustBruteLoss(damage) - health = Clamp(health - damage, 0, maxHealth) + health = clamp(health - damage, 0, maxHealth) /mob/living/simple_animal/proc/SA_attackable(target_mob) if (isliving(target_mob)) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 4f9244126c36..ce9e16e3747e 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -331,7 +331,7 @@ GLOBAL_LIST_INIT(limb_types_by_name, list( while(i < steps) animate(pixel_x = old_X + rand(-(strength), strength), pixel_y = old_y + rand(-(strength), strength), easing = JUMP_EASING, time = time_per_step) i++ - animate(pixel_x = old_X, pixel_y = old_y,time = Clamp(Floor(strength/PIXELS_PER_STRENGTH_VAL),2,4))//ease it back + animate(pixel_x = old_X, pixel_y = old_y,time = clamp(Floor(strength/PIXELS_PER_STRENGTH_VAL),2,4))//ease it back #undef PIXELS_PER_STRENGTH_VAL diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 8e9a513fdc88..0629ef47de01 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -181,7 +181,7 @@ if((mob.flags_atom & DIRLOCK) && mob.dir != direct) move_delay += MOVE_REDUCTION_DIRECTION_LOCKED // by Geeves - mob.cur_speed = Clamp(10/(move_delay + 0.5), MIN_SPEED, MAX_SPEED) + mob.cur_speed = clamp(10/(move_delay + 0.5), MIN_SPEED, MAX_SPEED) next_movement = world.time + MINIMAL_MOVEMENT_INTERVAL // We pre-set this now for the crawling case. If crawling do_after fails, next_movement would be set after the attempt end instead of now. //Try to crawl first diff --git a/code/modules/movement/launching/launching.dm b/code/modules/movement/launching/launching.dm index f72a7c773490..e3eccf8dd1c2 100644 --- a/code/modules/movement/launching/launching.dm +++ b/code/modules/movement/launching/launching.dm @@ -164,7 +164,7 @@ animation_spin(5, 1 + min(1, LM.range/20)) var/old_speed = cur_speed - cur_speed = Clamp(LM.speed, MIN_SPEED, MAX_SPEED) // Sanity check, also ~1 sec delay between each launch move is not very reasonable + cur_speed = clamp(LM.speed, MIN_SPEED, MAX_SPEED) // Sanity check, also ~1 sec delay between each launch move is not very reasonable var/delay = 10/cur_speed - 0.5 // scales delay back to deciseconds for when sleep is called var/pass_flags = LM.pass_flags diff --git a/code/modules/nightmare/nmnodes/mapload.dm b/code/modules/nightmare/nmnodes/mapload.dm index 6f75a46ed125..4b9ae2a3014b 100644 --- a/code/modules/nightmare/nmnodes/mapload.dm +++ b/code/modules/nightmare/nmnodes/mapload.dm @@ -100,7 +100,7 @@ if(!matcher.Find(filename)) continue #if !defined(UNIT_TESTS) - var/fprob = Clamp(text2num(matcher.group[1]) / 100, 0, 1) + var/fprob = clamp(text2num(matcher.group[1]) / 100, 0, 1) if(fprob < rand()) continue #endif // Remove the possibility of chance for testing diff --git a/code/modules/organs/limbs.dm b/code/modules/organs/limbs.dm index 949104c5d673..f2d73c8ce0ec 100644 --- a/code/modules/organs/limbs.dm +++ b/code/modules/organs/limbs.dm @@ -1091,7 +1091,7 @@ treat_grafted var tells it to apply to grafted but unsalved wounds, for burn kit //if the chance was not set by what called fracture(), the endurance check is done instead if(bonebreak_probability == null) //bone break chance is based on endurance, 25% for survivors, erts, 100% for most everyone else. - bonebreak_probability = 100 / Clamp(owner.skills?.get_skill_level(SKILL_ENDURANCE)-1,1,100) //can't be zero + bonebreak_probability = 100 / clamp(owner.skills?.get_skill_level(SKILL_ENDURANCE)-1,1,100) //can't be zero var/list/bonebreak_data = list("bonebreak_probability" = bonebreak_probability) SEND_SIGNAL(owner, COMSIG_HUMAN_BONEBREAK_PROBABILITY, bonebreak_data) diff --git a/code/modules/projectiles/ammunition.dm b/code/modules/projectiles/ammunition.dm index 594ad6b69dce..a3ba517c0cae 100644 --- a/code/modules/projectiles/ammunition.dm +++ b/code/modules/projectiles/ammunition.dm @@ -199,7 +199,7 @@ They're all essentially identical when it comes to getting the job done. var/severity = round(current_rounds / 50) //the more ammo inside, the faster and harder it cooks off if(severity > 0) - addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(explosion), loc, -1, ((severity > 4) ? 0 : -1), Clamp(severity, 0, 1), Clamp(severity, 0, 2), 1, 0, 0, flame_cause_data), max(5 - severity, 2)) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(explosion), loc, -1, ((severity > 4) ? 0 : -1), clamp(severity, 0, 1), clamp(severity, 0, 2), 1, 0, 0, flame_cause_data), max(5 - severity, 2)) if(!QDELETED(src)) qdel(src) diff --git a/code/modules/projectiles/guns/flamer/flamer.dm b/code/modules/projectiles/guns/flamer/flamer.dm index 282edcab9fd6..b9582cf5adb2 100644 --- a/code/modules/projectiles/guns/flamer/flamer.dm +++ b/code/modules/projectiles/guns/flamer/flamer.dm @@ -205,12 +205,12 @@ var/flameshape = R.flameshape var/fire_type = R.fire_type - R.intensityfire = Clamp(R.intensityfire, current_mag.reagents.min_fire_int, current_mag.reagents.max_fire_int) - R.durationfire = Clamp(R.durationfire, current_mag.reagents.min_fire_dur, current_mag.reagents.max_fire_dur) - R.rangefire = Clamp(R.rangefire, current_mag.reagents.min_fire_rad, current_mag.reagents.max_fire_rad) + R.intensityfire = clamp(R.intensityfire, current_mag.reagents.min_fire_int, current_mag.reagents.max_fire_int) + R.durationfire = clamp(R.durationfire, current_mag.reagents.min_fire_dur, current_mag.reagents.max_fire_dur) + R.rangefire = clamp(R.rangefire, current_mag.reagents.min_fire_rad, current_mag.reagents.max_fire_rad) var/max_range = R.rangefire if (max_range < fuel_pressure) //Used for custom tanks, allows for higher ranges - max_range = Clamp(fuel_pressure, 0, current_mag.reagents.max_fire_rad) + max_range = clamp(fuel_pressure, 0, current_mag.reagents.max_fire_rad) if(R.rangefire == -1) max_range = current_mag.reagents.max_fire_rad diff --git a/code/modules/projectiles/magazines/flamer.dm b/code/modules/projectiles/magazines/flamer.dm index 787a0585640a..7fba325177c6 100644 --- a/code/modules/projectiles/magazines/flamer.dm +++ b/code/modules/projectiles/magazines/flamer.dm @@ -94,7 +94,7 @@ to_chat(user, SPAN_WARNING("This chemical is not potent enough to be used in a flamethrower!")) return - var/fuel_amt_to_remove = Clamp(to_add.volume, 0, max_rounds - reagents.get_reagent_amount(to_add.id)) + var/fuel_amt_to_remove = clamp(to_add.volume, 0, max_rounds - reagents.get_reagent_amount(to_add.id)) if(!fuel_amt_to_remove) if(!max_rounds) to_chat(user, SPAN_WARNING("[target] is empty!")) @@ -171,7 +171,7 @@ if(usr.get_active_hand() != src) return - var/set_pressure = Clamp(tgui_input_number(usr, "Change fuel pressure to: (max: [max_pressure])", "Fuel pressure", fuel_pressure, 10, 1), 1 ,max_pressure) + var/set_pressure = clamp(tgui_input_number(usr, "Change fuel pressure to: (max: [max_pressure])", "Fuel pressure", fuel_pressure, 10, 1), 1 ,max_pressure) if(!set_pressure) to_chat(usr, SPAN_WARNING("You can't find that setting on the regulator!")) else diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index ee9caa61d7a7..f87b86a20c1f 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -217,15 +217,15 @@ ammo.fire_bonus_projectiles(src) path = getline2(starting, target_turf) - p_x += Clamp((rand()-0.5)*scatter*3, -8, 8) - p_y += Clamp((rand()-0.5)*scatter*3, -8, 8) + p_x += clamp((rand()-0.5)*scatter*3, -8, 8) + p_y += clamp((rand()-0.5)*scatter*3, -8, 8) update_angle(starting, target_turf) src.speed = speed // Randomize speed by a small factor to help bullet animations look okay // Otherwise you get a s t r e a m of warping bullets in same positions src.speed *= (1 + (rand()-0.5) * 0.30) // 15.0% variance either way - src.speed = Clamp(src.speed, 0.1, 100) // Safety to avoid loop hazards + src.speed = clamp(src.speed, 0.1, 100) // Safety to avoid loop hazards // Also give it some headstart, flying it now ahead of tick var/delta_time = world.tick_lag * rand() * 0.4 @@ -237,8 +237,8 @@ SSprojectiles.queue_projectile(src) /obj/projectile/proc/update_angle(turf/source_turf, turf/aim_turf) - p_x = Clamp(p_x, -16, 16) - p_y = Clamp(p_y, -16, 16) + p_x = clamp(p_x, -16, 16) + p_y = clamp(p_y, -16, 16) if(process_start_turf != vis_source) vis_travelled = 0 @@ -274,9 +274,6 @@ return FALSE -//#define LERP(a, b, t) (a + (b - a) * CLAMP01(t)) -#define LERP_UNCLAMPED(a, b, t) (a + (b - a) * t) - /// Animates the projectile across the process'ed flight. /obj/projectile/proc/animate_flight(turf/start_turf, start_pixel_x, start_pixel_y, delta_time) //Get pixelspace coordinates of start and end of visual path @@ -301,8 +298,8 @@ var/vis_current = vis_travelled + speed * (time_carry * 0.1) //speed * (time_carry * 0.1) for remainder time movement, visually "catching up" to where it should be var/vis_interpolant = vis_current / vis_length - var/pixel_x_lerped = LERP_UNCLAMPED(pixel_x_source, pixel_x_target, vis_interpolant) - var/pixel_y_lerped = LERP_UNCLAMPED(pixel_y_source, pixel_y_target, vis_interpolant) + var/pixel_x_lerped = LERP(pixel_x_source, pixel_x_target, vis_interpolant) + var/pixel_y_lerped = LERP(pixel_y_source, pixel_y_target, vis_interpolant) //Convert pixelspace to pixel offset relative to current loc @@ -319,7 +316,7 @@ var/dist_current = distance_travelled + speed * (time_carry * 0.1) //speed * (time_carry * 0.1) for remainder time fade-in var/alpha_interpolant = dist_current - 1 //-1 so it transitions from transparent to opaque between dist 1-2 - var/alpha_new = LERP_UNCLAMPED(0, 255, alpha_interpolant) + var/alpha_new = LERP(0, 255, alpha_interpolant) //Animate the visuals from starting position to new position @@ -332,9 +329,6 @@ var/anim_time = delta_time * 0.1 animate(src, pixel_x = pixel_x_rel_new, pixel_y = pixel_y_rel_new, alpha = alpha_new, time = anim_time, flags = ANIMATION_END_NOW) -//#undef LERP -#undef LERP_UNCLAMPED - /// Flies the projectile forward one single turf /obj/projectile/proc/fly() SHOULD_NOT_SLEEP(TRUE) @@ -1208,8 +1202,8 @@ if(P.ammo.sound_bounce) playsound(src, P.ammo.sound_bounce, 50, 1) var/image/I = image('icons/obj/items/weapons/projectiles.dmi', src, P.ammo.ping, 10) - var/offset_x = Clamp(P.pixel_x + pixel_x_offset, -10, 10) - var/offset_y = Clamp(P.pixel_y + pixel_y_offset, -10, 10) + var/offset_x = clamp(P.pixel_x + pixel_x_offset, -10, 10) + var/offset_y = clamp(P.pixel_y + pixel_y_offset, -10, 10) I.pixel_x += round(rand(-4,4) + offset_x, 1) I.pixel_y += round(rand(-4,4) + offset_y, 1) diff --git a/code/modules/reagents/chemistry_machinery/chem_master.dm b/code/modules/reagents/chemistry_machinery/chem_master.dm index 1e7e3bb08384..dc5206bb2df5 100644 --- a/code/modules/reagents/chemistry_machinery/chem_master.dm +++ b/code/modules/reagents/chemistry_machinery/chem_master.dm @@ -215,7 +215,7 @@ return if(href_list["createpill_multiple"]) - count = Clamp(tgui_input_number(user, "Select the number of pills to make. (max: [max_pill_count])", "Pills to make", pillamount, max_pill_count, 1), 0, max_pill_count) + count = clamp(tgui_input_number(user, "Select the number of pills to make. (max: [max_pill_count])", "Pills to make", pillamount, max_pill_count, 1), 0, max_pill_count) if(!count) return diff --git a/code/modules/reagents/chemistry_machinery/chem_simulator.dm b/code/modules/reagents/chemistry_machinery/chem_simulator.dm index 8dc34f208549..8a95e3f3b07e 100644 --- a/code/modules/reagents/chemistry_machinery/chem_simulator.dm +++ b/code/modules/reagents/chemistry_machinery/chem_simulator.dm @@ -443,7 +443,7 @@ for(var/datum/chem_property/P in creation_template) creation_cost += max(abs(P.value), 1) * P.level if(P.level > 5) // a penalty is added at each level above 5 (+1 at 6, +2 at 7, +4 at 8, +5 at 9, +7 at 10) - creation_cost += P.level - 6 + n_ceil((P.level - 5) / 2) + creation_cost += P.level - 6 + Ceiling((P.level - 5) / 2) creation_cost += ((new_od_level - 10) / 5) * 3 //3 cost for every 5 units above 10 for(var/rarity in creation_complexity) switch(rarity) diff --git a/code/modules/reagents/chemistry_properties/prop_neutral.dm b/code/modules/reagents/chemistry_properties/prop_neutral.dm index 3048b12ee296..e1e59b8b886c 100644 --- a/code/modules/reagents/chemistry_properties/prop_neutral.dm +++ b/code/modules/reagents/chemistry_properties/prop_neutral.dm @@ -29,7 +29,7 @@ return list(REAGENT_CANCEL = TRUE) var/effectiveness = 1 if(M.stat != DEAD) - effectiveness = Clamp(max(M.oxyloss / 10, (BLOOD_VOLUME_NORMAL - M.blood_volume) / BLOOD_VOLUME_NORMAL) * 0.1 * level, 0.1, 1) + effectiveness = clamp(max(M.oxyloss / 10, (BLOOD_VOLUME_NORMAL - M.blood_volume) / BLOOD_VOLUME_NORMAL) * 0.1 * level, 0.1, 1) return list(REAGENT_FORCE = TRUE, REAGENT_EFFECT = effectiveness) /datum/chem_property/neutral/excreting diff --git a/code/modules/shuttle/computers/dropship_computer.dm b/code/modules/shuttle/computers/dropship_computer.dm index d357a15b36f8..ba6683321f9c 100644 --- a/code/modules/shuttle/computers/dropship_computer.dm +++ b/code/modules/shuttle/computers/dropship_computer.dm @@ -467,7 +467,7 @@ if("set-automate") var/almayer_lz = params["hangar_id"] var/ground_lz = params["ground_id"] - var/delay = Clamp(params["delay"] SECONDS, DROPSHIP_MIN_AUTO_DELAY, DROPSHIP_MAX_AUTO_DELAY) + var/delay = clamp(params["delay"] SECONDS, DROPSHIP_MIN_AUTO_DELAY, DROPSHIP_MAX_AUTO_DELAY) // TODO verify if(almayer_lz == ground_lz) diff --git a/code/modules/vehicles/hardpoints/primary/minigun.dm b/code/modules/vehicles/hardpoints/primary/minigun.dm index 3acf37eec268..03d1e7be0077 100644 --- a/code/modules/vehicles/hardpoints/primary/minigun.dm +++ b/code/modules/vehicles/hardpoints/primary/minigun.dm @@ -75,7 +75,7 @@ spin_stage -= delta_stage / spindown_time else return - spin_stage = Clamp(spin_stage, 1, stage_rate_len) + spin_stage = clamp(spin_stage, 1, stage_rate_len) var/old_stage_rate = stage_rate[Floor(old_spin_stage)] var/new_stage_rate = stage_rate[Floor(spin_stage)]