Skip to content

Commit

Permalink
Defines cleanup (#5439)
Browse files Browse the repository at this point in the history
# 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


<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game

Less duplication leads to greater maintainability.
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
No player-facing changes.
  • Loading branch information
Doubleumc authored Jan 15, 2024
1 parent b82feaf commit 5a11150
Show file tree
Hide file tree
Showing 67 changed files with 115 additions and 134 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/_math.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
18 changes: 1 addition & 17 deletions code/__HELPERS/#maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,23 @@ 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))

#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)
Expand All @@ -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)

Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions code/__HELPERS/_time.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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, ":")
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/minimap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/timer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/x_evolution.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/beam.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/overlay_lighting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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]"]
Expand Down
6 changes: 3 additions & 3 deletions code/datums/diseases/advance/advance.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/datums/stamina/_stamina.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/jobs/job/civilians/other/survivors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/jobs/slot_scaling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/research.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/telecomms/presets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/motion_detector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/fulton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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!"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/storage/pouch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/barricade/barricade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/pipes/vents/vents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/structures/surface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions code/game/turfs/open.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/buildmode/buildmode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand Down
4 changes: 2 additions & 2 deletions code/modules/clothing/suits/marine_armor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/cm_aliens/structures/fruit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 5a11150

Please sign in to comment.