Makes math helpers defines for performance (#5654)

This commit is contained in:
kevinz000
2018-12-06 13:13:59 -08:00
committed by Atermonera
parent ec57465a5c
commit 8da11c17a2
48 changed files with 911 additions and 849 deletions

View File

@@ -1,18 +1,228 @@
// Credits to Nickr5 for the useful procs I've taken from his library resource.
// This file is quadruple wrapped for your pleasure
// (
#define NUM_E 2.71828183
#define M_PI (3.14159265)
#define INFINITY (1.#INF) //closer then enough
#define SHORT_REAL_LIMIT 16777216
//"fancy" math for calculating time in ms from tick_usage percentage and the length of ticks //"fancy" math for calculating time in ms from tick_usage percentage and the length of ticks
//percent_of_tick_used * (ticklag * 100(to convert to ms)) / 100(percent ratio) //percent_of_tick_used * (ticklag * 100(to convert to ms)) / 100(percent ratio)
//collapsed to percent_of_tick_used * tick_lag //collapsed to percent_of_tick_used * tick_lag
#define TICK_DELTA_TO_MS(percent_of_tick_used) ((percent_of_tick_used) * world.tick_lag) #define TICK_DELTA_TO_MS(percent_of_tick_used) ((percent_of_tick_used) * world.tick_lag)
#define TICK_USAGE_TO_MS(starting_tickusage) (TICK_DELTA_TO_MS(TICK_USAGE-starting_tickusage)) #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))
//time of day but automatically adjusts to the server going into the next day within the same round. //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. //for when you need a reliable time number that doesn't depend on byond time.
#define REALTIMEOFDAY (world.timeofday + (MIDNIGHT_ROLLOVER * MIDNIGHT_ROLLOVER_CHECK)) #define REALTIMEOFDAY (world.timeofday + (MIDNIGHT_ROLLOVER * MIDNIGHT_ROLLOVER_CHECK))
#define MIDNIGHT_ROLLOVER_CHECK ( rollovercheck_last_timeofday != world.timeofday ? update_midnight_rollover() : midnight_rollovers ) #define MIDNIGHT_ROLLOVER_CHECK ( rollovercheck_last_timeofday != world.timeofday ? update_midnight_rollover() : midnight_rollovers )
#define SHORT_REAL_LIMIT 16777216 // 2^24 - Maximum integer that can be exactly represented in a float (BYOND num var) #define SIGN(x) ( (x)!=0 ? (x) / abs(x) : 0 )
#define CEILING(x, y) ( -round(-(x) / (y)) * (y) ) #define CEILING(x, y) ( -round(-(x) / (y)) * (y) )
// round() acts like floor(x, 1) by default but can't handle other values // round() acts like floor(x, 1) by default but can't handle other values
#define FLOOR(x, y) ( round((x) / (y)) * (y) ) #define FLOOR(x, y) ( round((x) / (y)) * (y) )
// Check if a BYOND dir var is a cardinal direction (power of two)
#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))
// Secant
#define SEC(x) (1 / cos(x))
// Cosecant
#define CSC(x) (1 / sin(x))
#define ATAN2(x, y) ( !(x) && !(y) ? 0 : (y) >= 0 ? arccos((x) / sqrt((x)*(x) + (y)*(y))) : -arccos((x) / sqrt((x)*(x) + (y)*(y))) )
// Greatest Common Divisor - Euclid's algorithm
/proc/GCD(a, b)
return b ? GCD(b, (a) % (b)) : a
// Least Common Multiple
#define LCM(a, b) (abs(a) / GCD(a, b) * abs(b))
#define IS_CARDINAL(x) ((x & (x - 1)) == 0) #define IS_CARDINAL(x) ((x & (x - 1)) == 0)
#define INVERSE(x) ( 1/(x) )
// Used for calculating the radioactive strength falloff
#define INVERSE_SQUARE(initial_strength,cur_distance,initial_distance) ( (initial_strength)*((initial_distance)**2/(cur_distance)**2) )
#define ISABOUTEQUAL(a, b, deviation) (deviation ? abs((a) - (b)) <= deviation : abs((a) - (b)) <= 0.1)
#define ISEVEN(x) (x % 2 == 0)
#define ISODD(x) (x % 2 != 0)
// Returns true if val is from min to max, inclusive.
#define ISINRANGE(val, min, max) (min <= val && val <= max)
// Same as above, exclusive.
#define ISINRANGE_EX(val, min, max) (min < val && val > max)
#define ISINTEGER(x) (round(x) == x)
#define ISMULTIPLE(x, y) ((x) % (y) == 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 )
// Returns the nth root of x.
#define ROOT(n, x) ((x) ** (1 / (n)))
/proc/Mean(...)
var/sum = 0
for(var/val in args)
sum += val
return sum / args.len
// The quadratic formula. Returns a list with the solutions, or an empty list
// if they are imaginary.
/proc/SolveQuadratic(a, b, c)
ASSERT(a)
. = list()
var/d = b*b - 4 * a * c
var/bottom = 2 * a
// Return if the roots are imaginary.
if(d < 0)
return
var/root = sqrt(d)
. += (-b + root) / bottom
// If discriminant == 0, there would be two roots at the same position.
if(!d)
return
. += (-b - root) / bottom
// 180 / Pi ~ 57.2957795
#define TODEGREES(radians) ((radians) * 57.2957795)
// Pi / 180 ~ 0.0174532925
#define TORADIANS(degrees) ((degrees) * 0.0174532925)
// Will filter out extra rotations and negative rotations
// E.g: 540 becomes 180. -180 becomes 180.
#define SIMPLIFY_DEGREES(degrees) (MODULUS((degrees), 360))
#define GET_ANGLE_OF_INCIDENCE(face, input) (MODULUS((face) - (input), 360))
//Finds the shortest angle that angle A has to change to get to angle B. Aka, whether to move clock or counterclockwise.
/proc/closer_angle_difference(a, b)
if(!isnum(a) || !isnum(b))
return
a = SIMPLIFY_DEGREES(a)
b = SIMPLIFY_DEGREES(b)
var/inc = b - a
if(inc < 0)
inc += 360
var/dec = a - b
if(dec < 0)
dec += 360
. = inc > dec? -dec : inc
//A logarithm that converts an integer to a number scaled between 0 and 1.
//Currently, this is used for hydroponics-produce sprite transforming, but could be useful for other transform functions.
#define TRANSFORM_USING_VARIABLE(input, max) ( sin((90*(input))/(max))**2 )
//converts a uniform distributed random number into a normal distributed one
//since this method produces two random numbers, one is saved for subsequent calls
//(making the cost negligble for every second call)
//This will return +/- decimals, situated about mean with standard deviation stddev
//68% chance that the number is within 1stddev
//95% chance that the number is within 2stddev
//98% chance that the number is within 3stddev...etc
#define ACCURACY 10000
/proc/gaussian(mean, stddev)
var/static/gaussian_next
var/R1;var/R2;var/working
if(gaussian_next != null)
R1 = gaussian_next
gaussian_next = null
else
do
R1 = rand(-ACCURACY,ACCURACY)/ACCURACY
R2 = rand(-ACCURACY,ACCURACY)/ACCURACY
working = R1*R1 + R2*R2
while(working >= 1 || working==0)
working = sqrt(-2 * log(working) / working)
R1 *= working
gaussian_next = R2 * working
return (mean + stddev * R1)
#undef ACCURACY
/proc/get_turf_in_angle(angle, turf/starting, increments)
var/pixel_x = 0
var/pixel_y = 0
for(var/i in 1 to increments)
pixel_x += sin(angle)+16*sin(angle)*2
pixel_y += cos(angle)+16*cos(angle)*2
var/new_x = starting.x
var/new_y = starting.y
while(pixel_x > 16)
pixel_x -= 32
new_x++
while(pixel_x < -16)
pixel_x += 32
new_x--
while(pixel_y > 16)
pixel_y -= 32
new_y++
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)
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
/proc/get_overlap(x1, y1, x2, y2, x3, y3, x4, y4)
var/list/region_x1 = list()
var/list/region_y1 = list()
var/list/region_x2 = list()
var/list/region_y2 = list()
// These loops create loops filled with x/y values that the boundaries inhabit
// ex: list(5, 6, 7, 8, 9)
for(var/i in min(x1, x2) to max(x1, x2))
region_x1["[i]"] = TRUE
for(var/i in min(y1, y2) to max(y1, y2))
region_y1["[i]"] = TRUE
for(var/i in min(x3, x4) to max(x3, x4))
region_x2["[i]"] = TRUE
for(var/i in min(y3, y4) to max(y3, y4))
region_y2["[i]"] = TRUE
return list(region_x1 & region_x2, region_y1 & region_y2)
// )
#define RAND_F(LOW, HIGH) (rand()*(HIGH-LOW) + LOW)
#define SQUARE(x) (x*x)
//Vector Algebra
#define SQUAREDNORM(x, y) (x*x+y*y)
#define NORM(x, y) (sqrt(SQUAREDNORM(x,y)))
#define ISPOWEROFTWO(x) ((x & (x - 1)) == 0)
#define ROUNDUPTOPOWEROFTWO(x) (2 ** -round(-log(2,x)))
#define DEFAULT(a, b) (a? a : b)

View File

@@ -1,10 +1,13 @@
// Math constants. // Math constants.
#define M_PI 3.14159265
#define R_IDEAL_GAS_EQUATION 8.31 // kPa*L/(K*mol). #define R_IDEAL_GAS_EQUATION 8.31 // kPa*L/(K*mol).
#define ONE_ATMOSPHERE 101.325 // kPa. #define ONE_ATMOSPHERE 101.325 // kPa.
#define IDEAL_GAS_ENTROPY_CONSTANT 1164 // (mol^3 * s^3) / (kg^3 * L). #define IDEAL_GAS_ENTROPY_CONSTANT 1164 // (mol^3 * s^3) / (kg^3 * L).
#define T0C 273.15 // 0.0 degrees celcius
#define T20C 293.15 // 20.0 degrees celcius
#define TCMB 2.7 // -270.3 degrees celcius
#define TN60C 213.15 // -60 degrees celcius
// Radiation constants. // Radiation constants.
#define STEFAN_BOLTZMANN_CONSTANT 5.6704e-8 // W/(m^2*K^4). #define STEFAN_BOLTZMANN_CONSTANT 5.6704e-8 // W/(m^2*K^4).
#define COSMIC_RADIATION_TEMPERATURE 3.15 // K. #define COSMIC_RADIATION_TEMPERATURE 3.15 // K.
@@ -15,18 +18,7 @@
#define RADIATOR_EXPOSED_SURFACE_AREA_RATIO 0.04 // (3 cm + 100 cm * sin(3deg))/(2*(3+100 cm)). Unitless ratio. #define RADIATOR_EXPOSED_SURFACE_AREA_RATIO 0.04 // (3 cm + 100 cm * sin(3deg))/(2*(3+100 cm)). Unitless ratio.
#define HUMAN_EXPOSED_SURFACE_AREA 5.2 //m^2, surface area of 1.7m (H) x 0.46m (D) cylinder #define HUMAN_EXPOSED_SURFACE_AREA 5.2 //m^2, surface area of 1.7m (H) x 0.46m (D) cylinder
#define T0C 273.15 // 0.0 degrees celcius
#define T20C 293.15 // 20.0 degrees celcius
#define TCMB 2.7 // -270.3 degrees celcius
#define TN60C 213.15 // -60 degrees celcius
#define CLAMP01(x) max(0, min(1, x))
#define QUANTIZE(variable) (round(variable,0.0001)) #define QUANTIZE(variable) (round(variable,0.0001))
#define INFINITY 1.#INF #define TICKS_IN_DAY (TICKS_IN_SECOND * 60 * 60 * 24)
#define TICKS_IN_SECOND (world.fps)
#define TICKS_IN_DAY 24*60*60*10
#define TICKS_IN_SECOND 10
#define SIMPLE_SIGN(X) ((X) < 0 ? -1 : 1)
#define SIGN(X) ((X) ? SIMPLE_SIGN(X) : 0)

View File

@@ -1,131 +0,0 @@
// Macro functions.
#define RAND_F(LOW, HIGH) (rand()*(HIGH-LOW) + LOW)
#define ceil(x) (-round(-(x)))
// min is inclusive, max is exclusive
/proc/Wrap(val, min, max)
var/d = max - min
var/t = Floor((val - min) / d)
return val - (t * d)
/proc/Default(a, b)
return a ? a : b
// Trigonometric functions.
/proc/Tan(x)
return sin(x) / cos(x)
/proc/Csc(x)
return 1 / sin(x)
/proc/Sec(x)
return 1 / cos(x)
/proc/Cot(x)
return 1 / Tan(x)
/proc/Atan2(x, y)
if(!x && !y) return 0
var/a = arccos(x / sqrt(x*x + y*y))
return y >= 0 ? a : -a
/proc/Floor(x)
return round(x)
/proc/Ceiling(x)
return -round(-x)
// Greatest Common Divisor: Euclid's algorithm.
/proc/Gcd(a, b)
while (1)
if (!b) return a
a %= b
if (!a) return b
b %= a
// Least Common Multiple. The formula is a consequence of: a*b = LCM*GCD.
/proc/Lcm(a, b)
return abs(a) * abs(b) / Gcd(a, b)
// Useful in the cases when x is a large expression, e.g. x = 3a/2 + b^2 + Function(c)
/proc/Square(x)
return x*x
/proc/Inverse(x)
return 1 / x
// Condition checks.
/proc/IsAboutEqual(a, b, delta = 0.1)
return abs(a - b) <= delta
// Returns true if val is from min to max, inclusive.
/proc/IsInRange(val, min, max)
return (val >= min) && (val <= max)
/proc/IsInteger(x)
return Floor(x) == x
/proc/IsMultiple(x, y)
return x % y == 0
/proc/IsEven(x)
return !(x & 0x1)
/proc/IsOdd(x)
return (x & 0x1)
// Performs a linear interpolation between a and b.
// Note: weight=0 returns a, weight=1 returns b, and weight=0.5 returns the mean of a and b.
/proc/Interpolate(a, b, weight = 0.5)
return a + (b - a) * weight // Equivalent to: a*(1 - weight) + b*weight
/proc/Mean(...)
var/sum = 0
for(var/val in args)
sum += val
return sum / args.len
// Returns the nth root of x.
/proc/Root(n, x)
return x ** (1 / n)
// The quadratic formula. Returns a list with the solutions, or an empty list
// if they are imaginary.
/proc/SolveQuadratic(a, b, c)
ASSERT(a)
. = list()
var/discriminant = b*b - 4*a*c
var/bottom = 2*a
// Return if the roots are imaginary.
if(discriminant < 0)
return
var/root = sqrt(discriminant)
. += (-b + root) / bottom
// If discriminant == 0, there would be two roots at the same position.
if(discriminant != 0)
. += (-b - root) / bottom
/proc/ToDegrees(radians)
// 180 / Pi ~ 57.2957795
return radians * 57.2957795
/proc/ToRadians(degrees)
// Pi / 180 ~ 0.0174532925
return degrees * 0.0174532925
// Vector algebra.
/proc/squaredNorm(x, y)
return x*x + y*y
/proc/norm(x, y)
return sqrt(squaredNorm(x, y))
/proc/IsPowerOfTwo(var/val)
return (val & (val-1)) == 0
/proc/RoundUpToPowerOfTwo(var/val)
return 2 ** -round(-log(2,val))

View File

@@ -78,13 +78,13 @@ return_location()
return return
// calculate the angle // calculate the angle
angle = Atan2(dx, dy) + angle_offset angle = ATAN2(dx, dy) + angle_offset
// and some rounding to stop the increments jumping whole turfs - because byond favours certain angles // and some rounding to stop the increments jumping whole turfs - because byond favours certain angles
if(angle > -135 && angle < 45) if(angle > -135 && angle < 45)
angle = Ceiling(angle) angle = CEILING(angle, 1)
else else
angle = Floor(angle) angle = FLOOR(angle, 1)
// calculate the offset per increment step // calculate the offset per increment step
if(abs(angle) in list(0, 45, 90, 135, 180)) // check if the angle is a cardinal if(abs(angle) in list(0, 45, 90, 135, 180)) // check if the angle is a cardinal
@@ -93,11 +93,11 @@ return_location()
if(abs(angle) in list(45, 90, 135)) if(abs(angle) in list(45, 90, 135))
offset_y = sign(dy) offset_y = sign(dy)
else if(abs(dy) > abs(dx)) else if(abs(dy) > abs(dx))
offset_x = Cot(abs(angle)) // otherwise set the offsets offset_x = COT(abs(angle)) // otherwise set the offsets
offset_y = sign(dy) offset_y = sign(dy)
else else
offset_x = sign(dx) offset_x = sign(dx)
offset_y = Tan(angle) offset_y = TAN(angle)
if(dx < 0) if(dx < 0)
offset_y = -offset_y offset_y = -offset_y

View File

@@ -168,7 +168,7 @@ var/global/image/appearance_bro = new() // Temporarily super-global because of B
* Adds specific overlay(s) to the atom. * Adds specific overlay(s) to the atom.
* It is designed so any of the types allowed to be added to /atom/overlays can be added here too. More details below. * It is designed so any of the types allowed to be added to /atom/overlays can be added here too. More details below.
* *
* @param overlays The overlay(s) to add. These may be * @param overlays The overlay(s) to add. These may be
* - A string: In which case it is treated as an icon_state of the atom's icon. * - A string: In which case it is treated as an icon_state of the atom's icon.
* - An icon: It is treated as an icon. * - An icon: It is treated as an icon.
* - An atom: Its own overlays are compiled and then it's appearance is added. (Meaning its current apperance is frozen). * - An atom: Its own overlays are compiled and then it's appearance is added. (Meaning its current apperance is frozen).
@@ -205,7 +205,7 @@ var/global/image/appearance_bro = new() // Temporarily super-global because of B
/** /**
* Copy the overlays from another atom, either replacing all of ours or appending to our existing overlays. * Copy the overlays from another atom, either replacing all of ours or appending to our existing overlays.
* Note: This copies only the normal overlays, not the "priority" overlays. * Note: This copies only the normal overlays, not the "priority" overlays.
* *
* @param other The atom to copy overlays from. * @param other The atom to copy overlays from.
* @param cut_old If true, all of our overlays will be *replaced* by the other's. If other is null, that means cutting all ours. * @param cut_old If true, all of our overlays will be *replaced* by the other's. If other is null, that means cutting all ours.
*/ */

View File

@@ -102,11 +102,11 @@
//Position the effect so the beam is one continous line //Position the effect so the beam is one continous line
var/a var/a
if(abs(Pixel_x)>32) if(abs(Pixel_x)>32)
a = Pixel_x > 0 ? round(Pixel_x/32) : Ceiling(Pixel_x/32) a = Pixel_x > 0 ? round(Pixel_x/32) : CEILING(Pixel_x/32, 1)
X.x += a X.x += a
Pixel_x %= 32 Pixel_x %= 32
if(abs(Pixel_y)>32) if(abs(Pixel_y)>32)
a = Pixel_y > 0 ? round(Pixel_y/32) : Ceiling(Pixel_y/32) a = Pixel_y > 0 ? round(Pixel_y/32) : CEILING(Pixel_y/32, 1)
X.y += a X.y += a
Pixel_y %= 32 Pixel_y %= 32

View File

@@ -287,7 +287,7 @@
/obj/machinery/organ_printer/robot/dismantle() /obj/machinery/organ_printer/robot/dismantle()
if(stored_matter >= matter_amount_per_sheet) if(stored_matter >= matter_amount_per_sheet)
new /obj/item/stack/material/steel(get_turf(src), Floor(stored_matter/matter_amount_per_sheet)) new /obj/item/stack/material/steel(get_turf(src), FLOOR(stored_matter/matter_amount_per_sheet, 1))
return ..() return ..()
/obj/machinery/organ_printer/robot/print_organ(var/choice) /obj/machinery/organ_printer/robot/print_organ(var/choice)
@@ -305,7 +305,7 @@
return return
var/obj/item/stack/S = W var/obj/item/stack/S = W
var/space_left = max_stored_matter - stored_matter var/space_left = max_stored_matter - stored_matter
var/sheets_to_take = min(S.amount, Floor(space_left/matter_amount_per_sheet)) var/sheets_to_take = min(S.amount, FLOOR(space_left/matter_amount_per_sheet, 1))
if(sheets_to_take <= 0) if(sheets_to_take <= 0)
to_chat(user, "<span class='warning'>\The [src] is too full.</span>") to_chat(user, "<span class='warning'>\The [src] is too full.</span>")
return return

View File

@@ -194,7 +194,7 @@
occupant.adjustCloneLoss(-2 * heal_rate) occupant.adjustCloneLoss(-2 * heal_rate)
//Premature clones may have brain damage. //Premature clones may have brain damage.
occupant.adjustBrainLoss(-(ceil(0.5*heal_rate))) occupant.adjustBrainLoss(-(CEILING(0.5*heal_rate, 1)))
//So clones don't die of oxyloss in a running pod. //So clones don't die of oxyloss in a running pod.
if(occupant.reagents.get_reagent_amount("inaprovaline") < 30) if(occupant.reagents.get_reagent_amount("inaprovaline") < 30)

View File

@@ -151,7 +151,7 @@
return return
else if(istype(C, /obj/item/stack/material) && C.get_material_name() == "plasteel") // Repairing. else if(istype(C, /obj/item/stack/material) && C.get_material_name() == "plasteel") // Repairing.
var/amt = Ceiling((maxhealth - health)/150) var/amt = CEILING((maxhealth - health)/150, 1)
if(!amt) if(!amt)
to_chat(user, "<span class='notice'>\The [src] is already fully repaired.</span>") to_chat(user, "<span class='notice'>\The [src] is already fully repaired.</span>")
return return

View File

@@ -130,9 +130,9 @@
var/offset = 0 var/offset = 0
var/points = round((radius * 2 * M_PI) / arcLength) var/points = round((radius * 2 * M_PI) / arcLength)
var/angle = round(ToDegrees(arcLength / radius), 1) var/angle = round(TODEGREES(arcLength / radius), 1)
if(!IsInteger(radius)) if(!ISINTEGER(radius))
offset = 45 //degrees offset = 45 //degrees
for(var/j = 0, j < points, j++) for(var/j = 0, j < points, j++)

View File

@@ -53,7 +53,7 @@
else else
new_overlays += "[initial(icon_state)]-powered" new_overlays += "[initial(icon_state)]-powered"
var/ratio = Ceiling(bcell.percent()/25) * 25 var/ratio = CEILING(bcell.percent()/25, 1) * 25
new_overlays += "[initial(icon_state)]-charge[ratio]" new_overlays += "[initial(icon_state)]-charge[ratio]"
else else
new_overlays += "[initial(icon_state)]-nocell" new_overlays += "[initial(icon_state)]-nocell"

View File

@@ -95,6 +95,6 @@
usr << "<span class='notice'>You are not adding enough telecrystals to fuel \the [src].</span>" usr << "<span class='notice'>You are not adding enough telecrystals to fuel \the [src].</span>"
return return
uses += T.amount/2 //Gives 5 uses per 10 TC uses += T.amount/2 //Gives 5 uses per 10 TC
uses = ceil(uses) //Ensures no decimal uses nonsense, rounds up to be nice uses = CEILING(uses, 1) //Ensures no decimal uses nonsense, rounds up to be nice
usr << "<span class='notice'>You add \the [O] to \the [src]. Increasing the uses of \the [src] to [uses].</span>" usr << "<span class='notice'>You add \the [O] to \the [src]. Increasing the uses of \the [src] to [uses].</span>"
qdel(O) qdel(O)

File diff suppressed because it is too large Load Diff

View File

@@ -46,7 +46,7 @@
// adjust locker size to hold all items with 5 units of free store room // adjust locker size to hold all items with 5 units of free store room
var/content_size = 0 var/content_size = 0
for(I in src.contents) for(I in src.contents)
content_size += Ceiling(I.w_class/2) content_size += CEILING(I.w_class/2, 1)
if(content_size > storage_capacity-5) if(content_size > storage_capacity-5)
storage_capacity = content_size + 5 storage_capacity = content_size + 5
update_icon() update_icon()
@@ -56,7 +56,7 @@
var/content_size = 0 var/content_size = 0
for(var/obj/item/I in src.contents) for(var/obj/item/I in src.contents)
if(!I.anchored) if(!I.anchored)
content_size += Ceiling(I.w_class/2) content_size += CEILING(I.w_class/2, 1)
if(!content_size) if(!content_size)
to_chat(user, "It is empty.") to_chat(user, "It is empty.")
else if(storage_capacity > content_size*4) else if(storage_capacity > content_size*4)
@@ -153,7 +153,7 @@
/obj/structure/closet/proc/store_items(var/stored_units) /obj/structure/closet/proc/store_items(var/stored_units)
var/added_units = 0 var/added_units = 0
for(var/obj/item/I in src.loc) for(var/obj/item/I in src.loc)
var/item_size = Ceiling(I.w_class / 2) var/item_size = CEILING(I.w_class / 2, 1)
if(stored_units + added_units + item_size > storage_capacity) if(stored_units + added_units + item_size > storage_capacity)
continue continue
if(!I.anchored) if(!I.anchored)

View File

@@ -449,7 +449,7 @@
// Damage overlays. // Damage overlays.
var/ratio = health / maxhealth var/ratio = health / maxhealth
ratio = Ceiling(ratio * 4) * 25 ratio = CEILING(ratio * 4, 1) * 25
if(ratio > 75) if(ratio > 75)
return return

View File

@@ -239,7 +239,7 @@ proc/admin_notice(var/message, var/rights)
// Display the notes on the current page // Display the notes on the current page
var/number_pages = note_keys.len / PLAYER_NOTES_ENTRIES_PER_PAGE var/number_pages = note_keys.len / PLAYER_NOTES_ENTRIES_PER_PAGE
// Emulate ceil(why does BYOND not have ceil) // Emulate CEILING(why does BYOND not have ceil, 1)
if(number_pages != round(number_pages)) if(number_pages != round(number_pages))
number_pages = round(number_pages) + 1 number_pages = round(number_pages) + 1
var/page_index = page - 1 var/page_index = page - 1

View File

@@ -545,7 +545,7 @@
data["charge"] = cell ? round(cell.charge,1) : 0 data["charge"] = cell ? round(cell.charge,1) : 0
data["maxcharge"] = cell ? cell.maxcharge : 0 data["maxcharge"] = cell ? cell.maxcharge : 0
data["chargestatus"] = cell ? Floor((cell.charge/cell.maxcharge)*50) : 0 data["chargestatus"] = cell ? FLOOR((cell.charge/cell.maxcharge)*50, 1) : 0
data["emagged"] = subverted data["emagged"] = subverted
data["coverlock"] = locked data["coverlock"] = locked

View File

@@ -33,7 +33,7 @@
kill() kill()
return return
if(IsMultiple(activeFor, 5)) if(ISMULTIPLE(activeFor, 5))
if(prob(15)) if(prob(15))
var/obj/machinery/vending/infectedMachine = pick(vendingMachines) var/obj/machinery/vending/infectedMachine = pick(vendingMachines)
vendingMachines.Remove(infectedMachine) vendingMachines.Remove(infectedMachine)
@@ -41,7 +41,7 @@
infectedMachine.shut_up = 0 infectedMachine.shut_up = 0
infectedMachine.shoot_inventory = 1 infectedMachine.shoot_inventory = 1
if(IsMultiple(activeFor, 12)) if(ISMULTIPLE(activeFor, 12))
originMachine.speak(pick("Try our aggressive new marketing strategies!", \ originMachine.speak(pick("Try our aggressive new marketing strategies!", \
"You should buy products to feed your lifestyle obsession!", \ "You should buy products to feed your lifestyle obsession!", \
"Consume!", \ "Consume!", \

View File

@@ -171,7 +171,7 @@
cooking_obj = null cooking_obj = null
else else
var/failed var/failed
var/overcook_period = max(Floor(cook_time/5),1) var/overcook_period = max(FLOOR(cook_time/5, 1),1)
cooking_obj = result cooking_obj = result
var/count = overcook_period var/count = overcook_period
while(1) while(1)

View File

@@ -32,7 +32,7 @@
var/activeness = ((metric.assess_department(ROLE_SECURITY) + metric.assess_department(ROLE_ENGINEERING) + metric.assess_department(ROLE_MEDICAL)) / 3) var/activeness = ((metric.assess_department(ROLE_SECURITY) + metric.assess_department(ROLE_ENGINEERING) + metric.assess_department(ROLE_MEDICAL)) / 3)
activeness = max(activeness, 20) activeness = max(activeness, 20)
carp_amount = Ceiling(station_strength * (activeness / 100) + 1) carp_amount = CEILING(station_strength * (activeness / 100) + 1, 1)
/datum/gm_action/carp_migration/start() /datum/gm_action/carp_migration/start()
..() ..()

View File

@@ -413,7 +413,7 @@
overlays += I overlays += I
return return
var/offset = Floor(20/cards.len) var/offset = FLOOR(20/cards.len, 1)
var/matrix/M = matrix() var/matrix/M = matrix()
if(direction) if(direction)

View File

@@ -265,7 +265,7 @@
pull_data() pull_data()
var/incoming = get_pin_data(IC_INPUT, 1) var/incoming = get_pin_data(IC_INPUT, 1)
if(!isnull(incoming)) if(!isnull(incoming))
result = ToDegrees(incoming) result = TODEGREES(incoming)
set_pin_data(IC_OUTPUT, 1, result) set_pin_data(IC_OUTPUT, 1, result)
push_data() push_data()
@@ -283,7 +283,7 @@
pull_data() pull_data()
var/incoming = get_pin_data(IC_INPUT, 1) var/incoming = get_pin_data(IC_INPUT, 1)
if(!isnull(incoming)) if(!isnull(incoming))
result = ToRadians(incoming) result = TORADIANS(incoming)
set_pin_data(IC_OUTPUT, 1, result) set_pin_data(IC_OUTPUT, 1, result)
push_data() push_data()

View File

@@ -71,7 +71,7 @@
var/result = null var/result = null
var/A = get_pin_data(IC_INPUT, 1) var/A = get_pin_data(IC_INPUT, 1)
if(!isnull(A)) if(!isnull(A))
result = Tan(A) result = TAN(A)
set_pin_data(IC_OUTPUT, 1, result) set_pin_data(IC_OUTPUT, 1, result)
push_data() push_data()
@@ -91,7 +91,7 @@
var/result = null var/result = null
var/A = get_pin_data(IC_INPUT, 1) var/A = get_pin_data(IC_INPUT, 1)
if(!isnull(A)) if(!isnull(A))
result = Csc(A) result = CSC(A)
set_pin_data(IC_OUTPUT, 1, result) set_pin_data(IC_OUTPUT, 1, result)
push_data() push_data()
@@ -112,7 +112,7 @@
var/result = null var/result = null
var/A = get_pin_data(IC_INPUT, 1) var/A = get_pin_data(IC_INPUT, 1)
if(!isnull(A)) if(!isnull(A))
result = Sec(A) result = SEC(A)
set_pin_data(IC_OUTPUT, 1, result) set_pin_data(IC_OUTPUT, 1, result)
push_data() push_data()
@@ -133,7 +133,7 @@
var/result = null var/result = null
var/A = get_pin_data(IC_INPUT, 1) var/A = get_pin_data(IC_INPUT, 1)
if(!isnull(A)) if(!isnull(A))
result = Cot(A) result = COT(A)
set_pin_data(IC_OUTPUT, 1, result) set_pin_data(IC_OUTPUT, 1, result)
push_data() push_data()

View File

@@ -202,7 +202,7 @@ var/list/mining_overlay_cache = list()
if(severity <= 2) // Now to expose the ore lying under the sand. if(severity <= 2) // Now to expose the ore lying under the sand.
spawn(1) // Otherwise most of the ore is lost to the explosion, which makes this rather moot. spawn(1) // Otherwise most of the ore is lost to the explosion, which makes this rather moot.
for(var/ore in resources) for(var/ore in resources)
var/amount_to_give = rand(Ceiling(resources[ore]/2), resources[ore]) // Should result in at least one piece of ore. var/amount_to_give = rand(CEILING(resources[ore]/2, 1), resources[ore]) // Should result in at least one piece of ore.
for(var/i=1, i <= amount_to_give, i++) for(var/i=1, i <= amount_to_give, i++)
var/oretype = ore_types[ore] var/oretype = ore_types[ore]
new oretype(src) new oretype(src)

View File

@@ -32,7 +32,7 @@
for(var/i = 0;i<name_count;i++) for(var/i = 0;i<name_count;i++)
new_name = "" new_name = ""
for(var/x = rand(Floor(syllable_count/syllable_divisor),syllable_count);x>0;x--) for(var/x = rand(FLOOR(syllable_count/syllable_divisor, 1),syllable_count);x>0;x--)
new_name += pick(syllables) new_name += pick(syllables)
full_name += " [capitalize(lowertext(new_name))]" full_name += " [capitalize(lowertext(new_name))]"

View File

@@ -363,7 +363,7 @@
stop_pulling() stop_pulling()
src << "<span class='warning'>You slipped on [slipped_on]!</span>" src << "<span class='warning'>You slipped on [slipped_on]!</span>"
playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3) playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3)
Weaken(Floor(stun_duration/2)) Weaken(FLOOR(stun_duration/2, 1))
return 1 return 1
/mob/living/carbon/proc/add_chemical_effect(var/effect, var/magnitude = 1) /mob/living/carbon/proc/add_chemical_effect(var/effect, var/magnitude = 1)

View File

@@ -34,7 +34,7 @@
chargen_value_descriptors = list() chargen_value_descriptors = list()
for(var/i = 1 to LAZYLEN(standalone_value_descriptors)) for(var/i = 1 to LAZYLEN(standalone_value_descriptors))
chargen_value_descriptors[standalone_value_descriptors[i]] = i chargen_value_descriptors[standalone_value_descriptors[i]] = i
default_value = ceil(LAZYLEN(standalone_value_descriptors) * 0.5) default_value = CEILING(LAZYLEN(standalone_value_descriptors) * 0.5, 1)
..() ..()
/datum/mob_descriptor/proc/get_third_person_message_start(var/datum/gender/my_gender) /datum/mob_descriptor/proc/get_third_person_message_start(var/datum/gender/my_gender)
@@ -99,10 +99,10 @@
/datum/mob_descriptor/proc/get_comparative_value_string_smaller(var/value, var/datum/gender/my_gender, var/datum/gender/other_gender) /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) var/maxval = LAZYLEN(comparative_value_descriptors_smaller)
value = Clamp(ceil(value * maxval), 1, maxval) value = Clamp(CEILING(value * maxval, 1), 1, maxval)
return comparative_value_descriptors_smaller[value] 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) /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) var/maxval = LAZYLEN(comparative_value_descriptors_larger)
value = Clamp(ceil(value * maxval), 1, maxval) value = Clamp(CEILING(value * maxval, 1), 1, maxval)
return comparative_value_descriptors_larger[value] return comparative_value_descriptors_larger[value]

View File

@@ -165,4 +165,4 @@
else else
src << "<span class='notice'>I am not ready to reproduce yet...</span>" src << "<span class='notice'>I am not ready to reproduce yet...</span>"
else else
src << "<span class='notice'>I am not old enough to reproduce yet...</span>" src << "<span class='notice'>I am not old enough to reproduce yet...</span>"

View File

@@ -674,7 +674,7 @@
//Robots take half damage from basic attacks. //Robots take half damage from basic attacks.
/mob/living/silicon/robot/attack_generic(var/mob/user, var/damage, var/attack_message) /mob/living/silicon/robot/attack_generic(var/mob/user, var/damage, var/attack_message)
return ..(user,Floor(damage/2),attack_message) return ..(user,FLOOR(damage/2, 1),attack_message)
/mob/living/silicon/robot/proc/allowed(mob/M) /mob/living/silicon/robot/proc/allowed(mob/M)
//check if it doesn't require any access at all //check if it doesn't require any access at all

View File

@@ -188,9 +188,9 @@ Nurse Family
for(var/I = 1 to spiderling_count) for(var/I = 1 to spiderling_count)
if(prob(10) && src) if(prob(10) && src)
var/mob/living/simple_animal/hostile/giant_spider/swarmling = new swarmling_type(src.loc) var/mob/living/simple_animal/hostile/giant_spider/swarmling = new swarmling_type(src.loc)
var/swarm_health = Floor(swarmling.maxHealth * 0.4) var/swarm_health = FLOOR(swarmling.maxHealth * 0.4, 1)
var/swarm_dam_lower = Floor(melee_damage_lower * 0.4) var/swarm_dam_lower = FLOOR(melee_damage_lower * 0.4, 1)
var/swarm_dam_upper = Floor(melee_damage_upper * 0.4) var/swarm_dam_upper = FLOOR(melee_damage_upper * 0.4, 1)
swarmling.name = "spiderling" swarmling.name = "spiderling"
swarmling.maxHealth = swarm_health swarmling.maxHealth = swarm_health
swarmling.health = swarm_health swarmling.health = swarm_health

View File

@@ -38,9 +38,9 @@
for(var/i = 1 to spiderling_count) for(var/i = 1 to spiderling_count)
if(prob(swarmling_prob) && src) if(prob(swarmling_prob) && src)
var/mob/living/simple_mob/animal/giant_spider/swarmling = new swarmling_type(src.loc) var/mob/living/simple_mob/animal/giant_spider/swarmling = new swarmling_type(src.loc)
var/swarm_health = Floor(swarmling.maxHealth * 0.4) var/swarm_health = FLOOR(swarmling.maxHealth * 0.4, 1)
var/swarm_dam_lower = Floor(melee_damage_lower * 0.4) var/swarm_dam_lower = FLOOR(melee_damage_lower * 0.4, 1)
var/swarm_dam_upper = Floor(melee_damage_upper * 0.4) var/swarm_dam_upper = FLOOR(melee_damage_upper * 0.4, 1)
swarmling.name = "spiderling" swarmling.name = "spiderling"
swarmling.maxHealth = swarm_health swarmling.maxHealth = swarm_health
swarmling.health = swarm_health swarmling.health = swarm_health

View File

@@ -275,5 +275,5 @@ var/list/robot_hud_colours = list("#CFCFCF","#AFAFAF","#8F8F8F","#6F6F6F","#4F4F
dam_state = min_dam_state dam_state = min_dam_state
// Apply colour and return product. // Apply colour and return product.
var/list/hud_colours = (robotic < ORGAN_ROBOT) ? flesh_hud_colours : robot_hud_colours var/list/hud_colours = (robotic < ORGAN_ROBOT) ? flesh_hud_colours : robot_hud_colours
hud_damage_image.color = hud_colours[max(1,min(ceil(dam_state*hud_colours.len),hud_colours.len))] hud_damage_image.color = hud_colours[max(1,min(CEILING(dam_state*hud_colours.len, 1),hud_colours.len))]
return hud_damage_image return hud_damage_image

View File

@@ -137,7 +137,7 @@
else else
icon_state = "shredder-off" icon_state = "shredder-off"
// Fullness overlay // Fullness overlay
overlays += "shredder-[max(0,min(5,Floor(paperamount/max_paper*5)))]" overlays += "shredder-[max(0,min(5,FLOOR(paperamount/max_paper*5, 1)))]"
if (panel_open) if (panel_open)
overlays += "panel_open" overlays += "panel_open"

View File

@@ -70,12 +70,12 @@ var/datum/planet/sif/planet_sif = null
high_color = "#FFFFFF" high_color = "#FFFFFF"
min = 0.70 min = 0.70
var/lerp_weight = (abs(min - sun_position)) * 4 var/interpolate_weight = (abs(min - sun_position)) * 4
var/weather_light_modifier = 1 var/weather_light_modifier = 1
if(weather_holder && weather_holder.current_weather) if(weather_holder && weather_holder.current_weather)
weather_light_modifier = weather_holder.current_weather.light_modifier weather_light_modifier = weather_holder.current_weather.light_modifier
var/new_brightness = (Interpolate(low_brightness, high_brightness, weight = lerp_weight) ) * weather_light_modifier var/new_brightness = (LERP(low_brightness, high_brightness, interpolate_weight) ) * weather_light_modifier
var/new_color = null var/new_color = null
if(weather_holder && weather_holder.current_weather && weather_holder.current_weather.light_color) if(weather_holder && weather_holder.current_weather && weather_holder.current_weather.light_color)
@@ -91,9 +91,9 @@ var/datum/planet/sif/planet_sif = null
var/high_g = high_color_list[2] var/high_g = high_color_list[2]
var/high_b = high_color_list[3] var/high_b = high_color_list[3]
var/new_r = Interpolate(low_r, high_r, weight = lerp_weight) var/new_r = LERP(low_r, high_r, interpolate_weight)
var/new_g = Interpolate(low_g, high_g, weight = lerp_weight) var/new_g = LERP(low_g, high_g, interpolate_weight)
var/new_b = Interpolate(low_b, high_b, weight = lerp_weight) var/new_b = LERP(low_b, high_b, interpolate_weight)
new_color = rgb(new_r, new_g, new_b) new_color = rgb(new_r, new_g, new_b)

View File

@@ -54,15 +54,15 @@
var/seconds = remaining_hour % seconds_in_minute / 10 var/seconds = remaining_hour % seconds_in_minute / 10
var/hour_text = num2text(Floor(hours)) var/hour_text = num2text(FLOOR(hours, 1))
if(length(hour_text) < 2) if(length(hour_text) < 2)
hour_text = "0[hour_text]" // Add padding if needed, to look more like time2text(). hour_text = "0[hour_text]" // Add padding if needed, to look more like time2text().
var/minute_text = num2text(Floor(minutes)) var/minute_text = num2text(FLOOR(minutes, 1))
if(length(minute_text) < 2) if(length(minute_text) < 2)
minute_text = "0[minute_text]" minute_text = "0[minute_text]"
var/second_text = num2text(Floor(seconds)) var/second_text = num2text(FLOOR(seconds, 1))
if(length(second_text) < 2) if(length(second_text) < 2)
second_text = "0[second_text]" second_text = "0[second_text]"

View File

@@ -98,7 +98,7 @@
visuals.icon_state = current_weather.icon_state visuals.icon_state = current_weather.icon_state
/datum/weather_holder/proc/update_temperature() /datum/weather_holder/proc/update_temperature()
temperature = Interpolate(current_weather.temp_low, current_weather.temp_high, weight = our_planet.sun_position) temperature = LERP(current_weather.temp_low, current_weather.temp_high, our_planet.sun_position)
our_planet.needs_work |= PLANET_PROCESS_TEMP our_planet.needs_work |= PLANET_PROCESS_TEMP
/datum/weather_holder/proc/get_weather_datum(desired_type) /datum/weather_holder/proc/get_weather_datum(desired_type)

View File

@@ -532,7 +532,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
if(!S || S.robotic < ORGAN_ROBOT || S.open == 3) if(!S || S.robotic < ORGAN_ROBOT || S.open == 3)
return ..() return ..()
var/use_amt = min(src.amount, ceil(S.burn_dam/5), 5) var/use_amt = min(src.amount, CEILING(S.burn_dam/5, 1), 5)
if(can_use(use_amt)) if(can_use(use_amt))
if(S.robo_repair(5*use_amt, BURN, "some damaged wiring", src, user)) if(S.robo_repair(5*use_amt, BURN, "some damaged wiring", src, user))
src.use(use_amt) src.use(use_amt)

View File

@@ -171,8 +171,8 @@
use_power = light_max_power use_power = light_max_power
else else
var/temp_mod = ((plasma_temperature-5000)/20000) var/temp_mod = ((plasma_temperature-5000)/20000)
use_range = light_min_range + ceil((light_max_range-light_min_range)*temp_mod) use_range = light_min_range + CEILING((light_max_range-light_min_range)*temp_mod, 1)
use_power = light_min_power + ceil((light_max_power-light_min_power)*temp_mod) use_power = light_min_power + CEILING((light_max_power-light_min_power)*temp_mod, 1)
if(last_range != use_range || last_power != use_power) if(last_range != use_range || last_power != use_power)
set_light(use_range,use_power) set_light(use_range,use_power)
@@ -318,8 +318,8 @@
/obj/effect/fusion_em_field/proc/Radiate() /obj/effect/fusion_em_field/proc/Radiate()
if(istype(loc, /turf)) if(istype(loc, /turf))
var/empsev = max(1, min(3, ceil(size/2))) var/empsev = max(1, min(3, CEILING(size/2, 1)))
for(var/atom/movable/AM in range(max(1,Floor(size/2)), loc)) for(var/atom/movable/AM in range(max(1,FLOOR(size/2, 1)), loc))
if(AM == src || AM == owned_core || !AM.simulated) if(AM == src || AM == owned_core || !AM.simulated)
continue continue
@@ -386,7 +386,7 @@
//determine a random amount to actually react this cycle, and remove it from the standard pool //determine a random amount to actually react this cycle, and remove it from the standard pool
//this is a hack, and quite nonrealistic :( //this is a hack, and quite nonrealistic :(
for(var/reactant in react_pool) for(var/reactant in react_pool)
react_pool[reactant] = rand(Floor(react_pool[reactant]/2),react_pool[reactant]) react_pool[reactant] = rand(FLOOR(react_pool[reactant]/2, 1),react_pool[reactant])
dormant_reactant_quantities[reactant] -= react_pool[reactant] dormant_reactant_quantities[reactant] -= react_pool[reactant]
if(!react_pool[reactant]) if(!react_pool[reactant])
react_pool -= reactant react_pool -= reactant
@@ -574,7 +574,7 @@
/obj/effect/fusion_em_field/proc/Rupture() /obj/effect/fusion_em_field/proc/Rupture()
visible_message("<span class='danger'>\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!</span>") visible_message("<span class='danger'>\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!</span>")
set_light(15, 15, "#CCCCFF") set_light(15, 15, "#CCCCFF")
empulse(get_turf(src), ceil(plasma_temperature/1000), ceil(plasma_temperature/300)) empulse(get_turf(src), CEILING(plasma_temperature/1000, 1), CEILING(plasma_temperature/300, 1))
global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor") global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor")
RadiateAll() RadiateAll()
var/list/things_in_range = range(10, owned_core) var/list/things_in_range = range(10, owned_core)
@@ -584,7 +584,7 @@
turfs_in_range.Add(T) turfs_in_range.Add(T)
explosion(pick(things_in_range), -1, 5, 5, 5) explosion(pick(things_in_range), -1, 5, 5, 5)
empulse(pick(things_in_range), ceil(plasma_temperature/1000), ceil(plasma_temperature/300)) empulse(pick(things_in_range), CEILING(plasma_temperature/1000, 1), CEILING(plasma_temperature/300, 1))
spawn(25) spawn(25)
explosion(pick(things_in_range), -1, 5, 5, 5) explosion(pick(things_in_range), -1, 5, 5, 5)
spawn(25) spawn(25)
@@ -655,7 +655,7 @@
/obj/effect/fusion_em_field/proc/BluespaceQuenchEvent() //!!FUN!! causes a number of explosions in an area around the core. Will likely destory or heavily damage the reactor. /obj/effect/fusion_em_field/proc/BluespaceQuenchEvent() //!!FUN!! causes a number of explosions in an area around the core. Will likely destory or heavily damage the reactor.
visible_message("<span class='danger'>\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!</span>") visible_message("<span class='danger'>\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!</span>")
set_light(15, 15, "#CCCCFF") set_light(15, 15, "#CCCCFF")
empulse(get_turf(src), ceil(plasma_temperature/1000), ceil(plasma_temperature/300)) empulse(get_turf(src), CEILING(plasma_temperature/1000, 1), CEILING(plasma_temperature/300, 1))
global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor") global_announcer.autosay("WARNING: FIELD RUPTURE IMMINENT!", "Containment Monitor")
RadiateAll() RadiateAll()
var/list/things_in_range = range(10, owned_core) var/list/things_in_range = range(10, owned_core)
@@ -665,7 +665,7 @@
turfs_in_range.Add(T) turfs_in_range.Add(T)
for(var/loopcount = 1 to 10) for(var/loopcount = 1 to 10)
explosion(pick(things_in_range), -1, 5, 5, 5) explosion(pick(things_in_range), -1, 5, 5, 5)
empulse(pick(things_in_range), ceil(plasma_temperature/1000), ceil(plasma_temperature/300)) empulse(pick(things_in_range), CEILING(plasma_temperature/1000, 1), CEILING(plasma_temperature/300, 1))
Destroy() Destroy()
owned_core.Shutdown() owned_core.Shutdown()
return return

View File

@@ -46,7 +46,7 @@
return PROCESS_KILL return PROCESS_KILL
if(istype(loc, /turf)) if(istype(loc, /turf))
radiation_repository.radiate(src, max(1,ceil(radioactivity/30))) radiation_repository.radiate(src, max(1,CEILING(radioactivity/30, 1)))
/obj/item/weapon/fuel_assembly/Destroy() /obj/item/weapon/fuel_assembly/Destroy()
processing_objects -= src processing_objects -= src

View File

@@ -207,7 +207,7 @@
return return
if(istype(W, /obj/item/stack/material) && W.get_material_name() == DEFAULT_WALL_MATERIAL) if(istype(W, /obj/item/stack/material) && W.get_material_name() == DEFAULT_WALL_MATERIAL)
var/amt = Ceiling(( initial(integrity) - integrity)/10) var/amt = CEILING(( initial(integrity) - integrity)/10, 1)
if(!amt) if(!amt)
to_chat(user, "<span class='notice'>\The [src] is already fully repaired.</span>") to_chat(user, "<span class='notice'>\The [src] is already fully repaired.</span>")
return return

View File

@@ -584,7 +584,7 @@
if(one_handed_penalty) if(one_handed_penalty)
if(!held_twohanded) if(!held_twohanded)
acc_mod += -ceil(one_handed_penalty/2) acc_mod += -CEILING(one_handed_penalty/2, 1)
disp_mod += one_handed_penalty*0.5 //dispersion per point of two-handedness disp_mod += one_handed_penalty*0.5 //dispersion per point of two-handedness
//Accuracy modifiers //Accuracy modifiers

View File

@@ -19,10 +19,10 @@
/datum/random_map/noise/set_map_size() /datum/random_map/noise/set_map_size()
// Make sure the grid is a square with limits that are // Make sure the grid is a square with limits that are
// (n^2)+1, otherwise diamond-square won't work. // (n^2)+1, otherwise diamond-square won't work.
if(!IsPowerOfTwo((limit_x-1))) if(!ISPOWEROFTWO((limit_x-1)))
limit_x = RoundUpToPowerOfTwo(limit_x) + 1 limit_x = ROUNDUPTOPOWEROFTWO(limit_x) + 1
if(!IsPowerOfTwo((limit_y-1))) if(!ISPOWEROFTWO((limit_y-1)))
limit_y = RoundUpToPowerOfTwo(limit_y) + 1 limit_y = ROUNDUPTOPOWEROFTWO(limit_y) + 1
// Sides must be identical lengths. // Sides must be identical lengths.
if(limit_x > limit_y) if(limit_x > limit_y)
limit_y = limit_x limit_y = limit_x

View File

@@ -70,7 +70,7 @@
/datum/reagent/toxin/hydrophoron/touch_turf(var/turf/simulated/T) /datum/reagent/toxin/hydrophoron/touch_turf(var/turf/simulated/T)
if(!istype(T)) if(!istype(T))
return return
T.assume_gas("phoron", ceil(volume/2), T20C) T.assume_gas("phoron", CEILING(volume/2, 1), T20C)
for(var/turf/simulated/floor/target_tile in range(0,T)) for(var/turf/simulated/floor/target_tile in range(0,T))
target_tile.assume_gas("phoron", volume/2, 400+T0C) target_tile.assume_gas("phoron", volume/2, 400+T0C)
spawn (0) target_tile.hotspot_expose(700, 400) spawn (0) target_tile.hotspot_expose(700, 400)

View File

@@ -100,7 +100,7 @@
user.setClickCooldown(user.get_attack_speed(src)) //puts a limit on how fast people can eat/drink things user.setClickCooldown(user.get_attack_speed(src)) //puts a limit on how fast people can eat/drink things
self_feed_message(user) self_feed_message(user)
reagents.trans_to_mob(user, issmall(user) ? ceil(amount_per_transfer_from_this/2) : amount_per_transfer_from_this, CHEM_INGEST) reagents.trans_to_mob(user, issmall(user) ? CEILING(amount_per_transfer_from_this/2, 1) : amount_per_transfer_from_this, CHEM_INGEST)
feed_sound(user) feed_sound(user)
return 1 return 1
else else

View File

@@ -154,7 +154,7 @@
// Makes shields become gradually more red as the projector's health decreases. // Makes shields become gradually more red as the projector's health decreases.
/obj/item/shield_projector/proc/update_shield_colors() /obj/item/shield_projector/proc/update_shield_colors()
// This is done at the projector instead of the shields themselves to avoid needing to calculate this more than once every update. // This is done at the projector instead of the shields themselves to avoid needing to calculate this more than once every update.
var/lerp_weight = shield_health / max_shield_health var/interpolate_weight = shield_health / max_shield_health
var/list/low_color_list = hex2rgb(low_color) var/list/low_color_list = hex2rgb(low_color)
var/low_r = low_color_list[1] var/low_r = low_color_list[1]
@@ -166,9 +166,9 @@
var/high_g = high_color_list[2] var/high_g = high_color_list[2]
var/high_b = high_color_list[3] var/high_b = high_color_list[3]
var/new_r = Interpolate(low_r, high_r, weight = lerp_weight) var/new_r = LERP(low_r, high_r, interpolate_weight)
var/new_g = Interpolate(low_g, high_g, weight = lerp_weight) var/new_g = LERP(low_g, high_g, interpolate_weight)
var/new_b = Interpolate(low_b, high_b, weight = lerp_weight) var/new_b = LERP(low_b, high_b, interpolate_weight)
var/new_color = rgb(new_r, new_g, new_b) var/new_color = rgb(new_r, new_g, new_b)

View File

@@ -88,7 +88,7 @@
if(autopilot_delay % 10 == 0) // Every ten ticks. if(autopilot_delay % 10 == 0) // Every ten ticks.
var/seconds_left = autopilot_delay * 2 var/seconds_left = autopilot_delay * 2
if(seconds_left >= 60) // A minute if(seconds_left >= 60) // A minute
var/minutes_left = Floor(seconds_left / 60) var/minutes_left = FLOOR(seconds_left / 60, 1)
seconds_left = seconds_left % 60 seconds_left = seconds_left % 60
autopilot_say("Departing in [minutes_left] minute\s[seconds_left ? ", [seconds_left] seconds":""].") autopilot_say("Departing in [minutes_left] minute\s[seconds_left ? ", [seconds_left] seconds":""].")
else else

View File

@@ -58,7 +58,7 @@
if(NORTH) if(NORTH)
int_panel_x = ux + Floor(lift_size_x/2) int_panel_x = ux + FLOOR(lift_size_x/2, 1)
int_panel_y = uy + 1 int_panel_y = uy + 1
ext_panel_x = ux ext_panel_x = ux
ext_panel_y = ey + 2 ext_panel_y = ey + 2
@@ -75,7 +75,7 @@
if(SOUTH) if(SOUTH)
int_panel_x = ux + Floor(lift_size_x/2) int_panel_x = ux + FLOOR(lift_size_x/2, 1)
int_panel_y = ey - 1 int_panel_y = ey - 1
ext_panel_x = ex ext_panel_x = ex
ext_panel_y = uy - 2 ext_panel_y = uy - 2
@@ -93,7 +93,7 @@
if(EAST) if(EAST)
int_panel_x = ux+1 int_panel_x = ux+1
int_panel_y = uy + Floor(lift_size_y/2) int_panel_y = uy + FLOOR(lift_size_y/2, 1)
ext_panel_x = ex+2 ext_panel_x = ex+2
ext_panel_y = ey ext_panel_y = ey
@@ -110,7 +110,7 @@
if(WEST) if(WEST)
int_panel_x = ex-1 int_panel_x = ex-1
int_panel_y = uy + Floor(lift_size_y/2) int_panel_y = uy + FLOOR(lift_size_y/2, 1)
ext_panel_x = ux-2 ext_panel_x = ux-2
ext_panel_y = uy ext_panel_y = uy

View File

@@ -79,7 +79,6 @@
#include "code\_helpers\icons.dm" #include "code\_helpers\icons.dm"
#include "code\_helpers\lists.dm" #include "code\_helpers\lists.dm"
#include "code\_helpers\logging.dm" #include "code\_helpers\logging.dm"
#include "code\_helpers\maths.dm"
#include "code\_helpers\matrices.dm" #include "code\_helpers\matrices.dm"
#include "code\_helpers\mobs.dm" #include "code\_helpers\mobs.dm"
#include "code\_helpers\names.dm" #include "code\_helpers\names.dm"