mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 18:44:48 +01:00
Moves to BYOND 513 (#13650)
* Fixes Orbiting * moves to 513 * travis update * check for minor version too
This commit is contained in:
@@ -8,4 +8,4 @@ export PHP_VERSION=5.6
|
||||
# Byond Major
|
||||
export BYOND_MAJOR=513
|
||||
# Byond Minor
|
||||
export BYOND_MINOR=1505
|
||||
export BYOND_MINOR=1514
|
||||
|
||||
@@ -177,7 +177,7 @@
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
target_pressure = Clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -232,7 +232,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
target_pressure = Clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -228,7 +228,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
rate = text2num(rate)
|
||||
. = TRUE
|
||||
if(.)
|
||||
transfer_rate = Clamp(rate, 0, MAX_TRANSFER_RATE)
|
||||
transfer_rate = clamp(rate, 0, MAX_TRANSFER_RATE)
|
||||
investigate_log("was set to [transfer_rate] L/s by [key_name(usr)]", "atmos")
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -237,7 +237,7 @@ Filter types:
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
target_pressure = Clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
if(href_list["filter"])
|
||||
filter_type = text2num(href_list["filter"])
|
||||
|
||||
@@ -202,7 +202,7 @@
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
target_pressure = Clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
|
||||
if(href_list["node1"])
|
||||
var/value = text2num(href_list["node1"])
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Atoms
|
||||
#define isatom(A) istype(A, /atom)
|
||||
#define ismovableatom(A) istype(A, /atom/movable)
|
||||
#define isatom(A) (isloc(A))
|
||||
|
||||
// Mobs
|
||||
#define ismegafauna(A) istype(A, /mob/living/simple_animal/hostile/megafauna)
|
||||
|
||||
+211
-32
@@ -1,59 +1,238 @@
|
||||
#define NUM_E 2.71828183
|
||||
|
||||
#define PI 3.1415
|
||||
#define SPEED_OF_LIGHT 3e8 //not exact but hey!
|
||||
#define SPEED_OF_LIGHT_SQ 9e+16
|
||||
#define INFINITY 1e31 //closer than enough
|
||||
|
||||
#define Clamp(x, y, z) ((x) <= (y) ? (y) : ((x) >= (z) ? (z) : (x)))
|
||||
#define CLAMP01(x) (Clamp((x), 0, 1))
|
||||
|
||||
// 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))) )
|
||||
|
||||
#define SIMPLE_SIGN(X) ((X) < 0 ? -1 : 1)
|
||||
#define SIGN(X) ((X) ? SIMPLE_SIGN(X) : 0)
|
||||
#define hypotenuse(Ax, Ay, Bx, By) (sqrt(((Ax) - (Bx))**2 + ((Ay) - (By))**2))
|
||||
#define Ceiling(x) (-round(-(x)))
|
||||
#define Tan(x) (sin(x) / cos(x))
|
||||
#define Cot(x) (1 / Tan(x))
|
||||
#define Csc(x) (1 / sin(x))
|
||||
#define Sec(x) (1 / cos(x))
|
||||
#define Floor(x) (round(x))
|
||||
#define Inverse(x) (1 / (x))
|
||||
#define IsEven(x) ((x) % 2 == 0)
|
||||
#define IsOdd(x) ((x) % 2 == 1)
|
||||
#define IsInRange(val, min, max) ((min) <= (val) && (val) <= (max))
|
||||
#define IsInteger(x) (Floor(x) == (x))
|
||||
#define IsMultiple(x, y) ((x) % (y) == 0)
|
||||
#define Lcm(a, b) (abs(a) / Gcd((a), (b)) * abs(b))
|
||||
#define Root(n, x) ((x) ** (1 / (n)))
|
||||
#define ToDegrees(radians) ((radians) * 57.2957795) // 180 / Pi
|
||||
#define ToRadians(degrees) ((degrees) * 0.0174532925) // Pi / 180
|
||||
|
||||
#define SHORT_REAL_LIMIT 16777216
|
||||
|
||||
// Real modulus that handles decimals
|
||||
#define MODULUS(x, y) ( (x) - (y) * round((x) / (y)) )
|
||||
|
||||
|
||||
//"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)
|
||||
//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_USAGE_TO_MS(starting_tickusage) (TICK_DELTA_TO_MS(TICK_USAGE_REAL - 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.
|
||||
//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 MIDNIGHT_ROLLOVER_CHECK ( GLOB.rollovercheck_last_timeofday != world.timeofday ? update_midnight_rollover() : GLOB.midnight_rollovers )
|
||||
|
||||
#define SIMPLE_SIGN(X) ((X) < 0 ? -1 : 1)
|
||||
|
||||
#define SIGN(x) ( (x)!=0 ? (x) / abs(x) : 0 )
|
||||
|
||||
#define CEILING(x, y) ( -round(-(x) / (y)) * (y) )
|
||||
|
||||
// round() acts like floor(x, 1) by default but can't handle other values
|
||||
#define FLOOR(x, y) ( round((x) / (y)) * (y) )
|
||||
|
||||
// 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) clamp(( min == max ? min : (val) - (round(((val) - (min))/((max) - (min))) * ((max) - (min))) ),min,max)
|
||||
|
||||
// Real modulus that handles decimals
|
||||
#define MODULUS(x, y) ( (x) - (y) * round((x) / (y)) )
|
||||
|
||||
// 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))) )
|
||||
|
||||
#define HYPOTENUSE(Ax, Ay, Bx, By) (sqrt(((Ax) - (Bx))**2 + ((Ay) - (By))**2))
|
||||
|
||||
// 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 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)))
|
||||
|
||||
// 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
|
||||
if(d < 0)
|
||||
return
|
||||
var/root = sqrt(d)
|
||||
. += (-b + root) / bottom
|
||||
if(!d)
|
||||
return
|
||||
. += (-b - root) / bottom
|
||||
|
||||
#define TODEGREES(radians) ((radians) * 57.2957795)
|
||||
|
||||
#define TORADIANS(degrees) ((degrees) * 0.0174532925)
|
||||
|
||||
/// Gets shift x that would be required the bitflag (1<<x)
|
||||
#define TOBITSHIFT(bit) ( log(2, bit) )
|
||||
|
||||
// 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 EXP_DISTRIBUTION(desired_mean) ( -(1/(1/desired_mean)) * log(rand(1, 1000) * 0.001) )
|
||||
|
||||
#define LORENTZ_DISTRIBUTION(x, s) ( s*tan(TODEGREES(PI*(rand()-0.5))) + x )
|
||||
#define LORENTZ_CUMULATIVE_DISTRIBUTION(x, y, s) ( (1/PI)*TORADIANS(arctan((x-y)/s)) + 1/2 )
|
||||
|
||||
#define RULE_OF_THREE(a, b, x) ((a*x)/b)
|
||||
// )
|
||||
|
||||
/proc/RaiseToPower(num, power)
|
||||
if(!power)
|
||||
return 1
|
||||
return (power-- > 1 ? num * RaiseToPower(num, power) : num)
|
||||
|
||||
// oof, what a mouthful
|
||||
// Used in status_procs' "adjust" to let them modify a status effect by a given
|
||||
// amount, without inadverdently increasing it in the wrong direction
|
||||
/proc/directional_bounded_sum(orig_val, modifier, bound_lower, bound_upper)
|
||||
var/new_val = orig_val + modifier
|
||||
if(modifier > 0)
|
||||
if(new_val > bound_upper)
|
||||
new_val = max(orig_val, bound_upper)
|
||||
else if(modifier < 0)
|
||||
if(new_val < bound_lower)
|
||||
new_val = min(orig_val, bound_lower)
|
||||
return new_val
|
||||
|
||||
// sqrt, but if you give it a negative number, you get 0 instead of a runtime
|
||||
/proc/sqrtor0(num)
|
||||
if(num < 0)
|
||||
return 0
|
||||
return sqrt(num)
|
||||
|
||||
/proc/round_down(num)
|
||||
if(round(num) != num)
|
||||
return round(num--)
|
||||
else
|
||||
return num
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
var/adjacencies = 0
|
||||
|
||||
var/atom/movable/AM
|
||||
if(ismovableatom(A))
|
||||
if(ismovable(A))
|
||||
AM = A
|
||||
if(AM.can_be_unanchored && !AM.anchored)
|
||||
return 0
|
||||
|
||||
@@ -580,7 +580,7 @@ world
|
||||
var/B = RGB[2]
|
||||
|
||||
var/Y = (0.2126 * R) + (0.7152 * G) + (0.0722 * B)
|
||||
return Clamp((Y * 0.01), 0, 1) //Returns the brightness of a color in decimal percentage format. Can multiply light_power by this to receive 100% brightness or a lower brightness. Not a higher brightness.
|
||||
return clamp((Y * 0.01), 0, 1) //Returns the brightness of a color in decimal percentage format. Can multiply light_power by this to receive 100% brightness or a lower brightness. Not a higher brightness.
|
||||
|
||||
/proc/HueToAngle(hue)
|
||||
// normalize hsv in case anything is screwy
|
||||
@@ -899,9 +899,9 @@ The _flatIcons list is a cache for generated icon files.
|
||||
if(!value) return color
|
||||
|
||||
var/list/RGB = ReadRGB(color)
|
||||
RGB[1] = Clamp(RGB[1]+value,0,255)
|
||||
RGB[2] = Clamp(RGB[2]+value,0,255)
|
||||
RGB[3] = Clamp(RGB[3]+value,0,255)
|
||||
RGB[1] = clamp(RGB[1]+value,0,255)
|
||||
RGB[2] = clamp(RGB[2]+value,0,255)
|
||||
RGB[3] = clamp(RGB[3]+value,0,255)
|
||||
return rgb(RGB[1],RGB[2],RGB[3])
|
||||
|
||||
/proc/sort_atoms_by_layer(var/list/atoms)
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
// Credits to Nickr5 for the useful procs I've taken from his library resource.
|
||||
|
||||
#define MATH_E 2.71828183
|
||||
#define SQRT2 1.41421356
|
||||
|
||||
/proc/Atan2(x, y)
|
||||
if(!x && !y) return 0
|
||||
var/a = arccos(x / sqrt(x*x + y*y))
|
||||
return y >= 0 ? a : -a
|
||||
|
||||
// Greatest Common Divisor - Euclid's algorithm
|
||||
/proc/Gcd(a, b)
|
||||
return b ? Gcd(b, a % b) : a
|
||||
|
||||
/proc/IsAboutEqual(a, b, deviation = 0.1)
|
||||
return abs(a - b) <= deviation
|
||||
|
||||
// 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.
|
||||
/proc/Lerp(a, b, amount = 0.5)
|
||||
return a + (b - a) * amount
|
||||
|
||||
/proc/Mean(...)
|
||||
var/values = 0
|
||||
var/sum = 0
|
||||
for(var/val in args)
|
||||
values++
|
||||
sum += val
|
||||
return sum / values
|
||||
|
||||
// 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
|
||||
if(d < 0) return
|
||||
var/root = sqrt(d)
|
||||
. += (-b + root) / bottom
|
||||
if(!d) return
|
||||
. += (-b - root) / bottom
|
||||
|
||||
// Will filter out extra rotations and negative rotations
|
||||
// E.g: 540 becomes 180. -180 becomes 180.
|
||||
/proc/SimplifyDegrees(degrees)
|
||||
degrees = degrees % 360
|
||||
if(degrees < 0)
|
||||
degrees += 360
|
||||
return degrees
|
||||
|
||||
// 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)
|
||||
|
||||
//A logarithm that converts an integer to a number scaled between 0 and 1 (can be tweaked to be higher).
|
||||
//Currently, this is used for hydroponics-produce sprite transforming, but could be useful for other transform functions.
|
||||
/proc/TransformUsingVariable(input, inputmaximum, scaling_modifier = 0)
|
||||
|
||||
var/inputToDegrees = (input/inputmaximum)*180 //Converting from a 0 -> 100 scale to a 0 -> 180 scale. The 0 -> 180 scale corresponds to degrees
|
||||
var/size_factor = ((-cos(inputToDegrees) +1) /2) //returns a value from 0 to 1
|
||||
|
||||
return size_factor + scaling_modifier //scale mod of 0 results in a number from 0 to 1. A scale modifier of +0.5 returns 0.5 to 1.5
|
||||
//world<< "Transform multiplier of [src] is [size_factor + scaling_modifer]"
|
||||
|
||||
/proc/RaiseToPower(num, power)
|
||||
if(!power) return 1
|
||||
return (power-- > 1 ? num * RaiseToPower(num, power) : num)
|
||||
|
||||
//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
|
||||
GLOBAL_VAR(gaussian_next)
|
||||
#define ACCURACY 10000
|
||||
/proc/gaussian(mean, stddev)
|
||||
var/R1;var/R2;var/working
|
||||
if(GLOB.gaussian_next != null)
|
||||
R1 = GLOB.gaussian_next
|
||||
GLOB.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
|
||||
GLOB.gaussian_next = R2 * working
|
||||
return (mean + stddev * R1)
|
||||
#undef ACCURACY
|
||||
|
||||
|
||||
|
||||
// oof, what a mouthful
|
||||
// Used in status_procs' "adjust" to let them modify a status effect by a given
|
||||
// amount, without inadverdently increasing it in the wrong direction
|
||||
/proc/directional_bounded_sum(orig_val, modifier, bound_lower, bound_upper)
|
||||
var/new_val = orig_val + modifier
|
||||
if(modifier > 0)
|
||||
if(new_val > bound_upper)
|
||||
new_val = max(orig_val, bound_upper)
|
||||
else if(modifier < 0)
|
||||
if(new_val < bound_lower)
|
||||
new_val = min(orig_val, bound_lower)
|
||||
return new_val
|
||||
|
||||
// sqrt, but if you give it a negative number, you get 0 instead of a runtime
|
||||
/proc/sqrtor0(num)
|
||||
if(num < 0)
|
||||
return 0
|
||||
return sqrt(num)
|
||||
|
||||
/proc/round_down(num)
|
||||
if(round(num) != num)
|
||||
return round(num--)
|
||||
else return num
|
||||
|
||||
// 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)
|
||||
@@ -434,16 +434,6 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
||||
return "[round((powerused * 0.000001), 0.001)] MW"
|
||||
return "[round((powerused * 0.000000001), 0.0001)] GW"
|
||||
|
||||
//E = MC^2
|
||||
/proc/convert2energy(var/M)
|
||||
var/E = M*(SPEED_OF_LIGHT_SQ)
|
||||
return E
|
||||
|
||||
//M = E/C^2
|
||||
/proc/convert2mass(var/E)
|
||||
var/M = E/(SPEED_OF_LIGHT_SQ)
|
||||
return M
|
||||
|
||||
//Forces a variable to be posative
|
||||
/proc/modulus(var/M)
|
||||
if(M >= 0)
|
||||
@@ -537,21 +527,6 @@ Returns 1 if the chain up to the area contains the given typepath
|
||||
/proc/between(var/low, var/middle, var/high)
|
||||
return max(min(middle, high), low)
|
||||
|
||||
|
||||
|
||||
#if DM_VERSION > 513
|
||||
#warn 513 is definitely stable now, remove this
|
||||
#endif
|
||||
#if DM_VERSION < 513
|
||||
/proc/arctan(x)
|
||||
var/y=arcsin(x/sqrt(1+x*x))
|
||||
return y
|
||||
/proc/islist(list/list)
|
||||
if(istype(list))
|
||||
return 1
|
||||
return 0
|
||||
#endif
|
||||
|
||||
//returns random gauss number
|
||||
proc/GaussRand(var/sigma)
|
||||
var/x,y,rsq
|
||||
@@ -1517,7 +1492,7 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
|
||||
//orbit() can run without it (swap orbiting for A)
|
||||
//but then you can never stop it and that's just silly.
|
||||
/atom/movable/var/atom/orbiting = null
|
||||
|
||||
/atom/movable/var/cached_transform = null
|
||||
//A: atom to orbit
|
||||
//radius: range to orbit at, radius of the circle formed by orbiting
|
||||
//clockwise: whether you orbit clockwise or anti clockwise
|
||||
@@ -1535,6 +1510,7 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
|
||||
|
||||
orbiting = A
|
||||
var/matrix/initial_transform = matrix(transform)
|
||||
cached_transform = initial_transform
|
||||
var/lastloc = loc
|
||||
|
||||
//Head first!
|
||||
@@ -1552,8 +1528,6 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
|
||||
|
||||
SpinAnimation(rotation_speed, -1, clockwise, rotation_segments)
|
||||
|
||||
//we stack the orbits up client side, so we can assign this back to normal server side without it breaking the orbit
|
||||
transform = initial_transform
|
||||
while(orbiting && orbiting == A && A.loc)
|
||||
var/targetloc = get_turf(A)
|
||||
if(!lockinorbit && loc != lastloc && loc != targetloc)
|
||||
@@ -1567,12 +1541,14 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
|
||||
|
||||
if(orbiting == A) //make sure we haven't started orbiting something else.
|
||||
orbiting = null
|
||||
SpinAnimation(0,0)
|
||||
SpinAnimation(0, 0)
|
||||
transform = cached_transform
|
||||
|
||||
|
||||
|
||||
/atom/movable/proc/stop_orbit()
|
||||
orbiting = null
|
||||
transform = cached_transform
|
||||
|
||||
//Centers an image.
|
||||
//Requires:
|
||||
@@ -2032,8 +2008,8 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
|
||||
tX = splittext(tX[1], ":")
|
||||
tX = tX[1]
|
||||
var/list/actual_view = getviewsize(C ? C.view : world.view)
|
||||
tX = Clamp(origin.x + text2num(tX) - round(actual_view[1] / 2) - 1, 1, world.maxx)
|
||||
tY = Clamp(origin.y + text2num(tY) - round(actual_view[2] / 2) - 1, 1, world.maxy)
|
||||
tX = clamp(origin.x + text2num(tX) - round(actual_view[1] / 2) - 1, 1, world.maxx)
|
||||
tY = clamp(origin.y + text2num(tY) - round(actual_view[2] / 2) - 1, 1, world.maxy)
|
||||
return locate(tX, tY, tZ)
|
||||
|
||||
/proc/CallAsync(datum/source, proctype, list/arguments)
|
||||
|
||||
@@ -18,11 +18,13 @@
|
||||
#define MAX_BOOK_MESSAGE_LEN 9216
|
||||
#define MAX_NAME_LEN 50 //diona names can get loooooooong
|
||||
|
||||
// Version check, terminates compilation if someone is using a version of BYOND that's too old
|
||||
#if DM_VERSION < 510
|
||||
#error OUTDATED VERSION ERROR - \
|
||||
Due to BYOND features used in this codebase, you must update to version 510 or later to compile. \
|
||||
This may require updating to a beta release.
|
||||
//Update this whenever you need to take advantage of more recent byond features
|
||||
#define MIN_COMPILER_VERSION 513
|
||||
#define MIN_COMPILER_BUILD 1514
|
||||
#if DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD
|
||||
//Don't forget to update this part
|
||||
#error Your version of BYOND is too out-of-date to compile this project. Go to https://secure.byond.com/download and update.
|
||||
#error You need version 513.1514 or higher
|
||||
#endif
|
||||
|
||||
// Macros that must exist before world.dm
|
||||
|
||||
@@ -246,7 +246,7 @@
|
||||
if(!view)
|
||||
view = world.view
|
||||
var/list/new_overlays = list()
|
||||
var/count = Ceiling(view/(480/world.icon_size))+1
|
||||
var/count = CEILING(view/(480/world.icon_size), 1)+1
|
||||
for(var/x in -count to count)
|
||||
for(var/y in -count to count)
|
||||
if(x == 0 && y == 0)
|
||||
|
||||
@@ -102,8 +102,8 @@
|
||||
overlays += standard_background
|
||||
|
||||
/obj/screen/movable/pic_in_pic/proc/set_view_size(width, height, do_refresh = TRUE)
|
||||
width = Clamp(width, 0, max_dimensions)
|
||||
height = Clamp(height, 0, max_dimensions)
|
||||
width = clamp(width, 0, max_dimensions)
|
||||
height = clamp(height, 0, max_dimensions)
|
||||
src.width = width
|
||||
src.height = height
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
if(!R.robot_modules_background)
|
||||
return
|
||||
|
||||
var/display_rows = Ceiling(R.module.modules.len / 8)
|
||||
var/display_rows = CEILING(R.module.modules.len / 8, 1)
|
||||
R.robot_modules_background.screen_loc = "CENTER-4:16,SOUTH+1:7 to CENTER+3:16,SOUTH+[display_rows]:7"
|
||||
R.client.screen += R.robot_modules_background
|
||||
|
||||
|
||||
@@ -135,9 +135,9 @@
|
||||
/obj/item/proc/get_clamped_volume()
|
||||
if(w_class)
|
||||
if(force)
|
||||
return Clamp((force + w_class) * 4, 30, 100)// Add the item's force to its weight class and multiply by 4, then clamp the value between 30 and 100
|
||||
return clamp((force + w_class) * 4, 30, 100)// Add the item's force to its weight class and multiply by 4, then clamp the value between 30 and 100
|
||||
else
|
||||
return Clamp(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100
|
||||
return clamp(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100
|
||||
|
||||
/mob/living/proc/send_item_attack_message(obj/item/I, mob/living/user, hit_area)
|
||||
if(I.discrete)
|
||||
|
||||
+2
-2
@@ -99,11 +99,11 @@
|
||||
//Position the effect so the beam is one continous line
|
||||
var/a
|
||||
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
|
||||
Pixel_x %= 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
|
||||
Pixel_y %= 32
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
var/list/say_lines
|
||||
|
||||
/datum/component/edit_complainer/Initialize(list/text)
|
||||
if(!ismovableatom(parent))
|
||||
if(!ismovable(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
var/static/list/default_lines = list(
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
if(!isatom(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
RegisterSignal(parent, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_BLOB_ACT, COMSIG_ATOM_HULK_ATTACK, COMSIG_PARENT_ATTACKBY), .proc/play_squeak)
|
||||
if(ismovableatom(parent))
|
||||
if(ismovable(parent))
|
||||
RegisterSignal(parent, list(COMSIG_MOVABLE_BUMP, COMSIG_MOVABLE_IMPACT), .proc/play_squeak)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/play_squeak_crossed)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react)
|
||||
|
||||
@@ -195,9 +195,9 @@ GLOBAL_LIST_INIT(advance_cures, list(
|
||||
visibility_flags = HIDDEN_SCANNER|HIDDEN_PANDEMIC
|
||||
|
||||
// The more symptoms we have, the less transmittable it is but some symptoms can make up for it.
|
||||
SetSpread(Clamp(2 ** (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
|
||||
SetSpread(clamp(2 ** (properties["transmittable"] - symptoms.len), BLOOD, AIRBORNE))
|
||||
permeability_mod = max(CEILING(0.4 * properties["transmittable"], 1), 1)
|
||||
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)
|
||||
@@ -244,7 +244,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)
|
||||
// to_chat(world, "Res = [res]")
|
||||
cures = list(GLOB.advance_cures[res])
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/datum/element/waddling/Attach(datum/target)
|
||||
. = ..()
|
||||
if(!ismovableatom(target))
|
||||
if(!ismovable(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
if(isliving(target))
|
||||
RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/LivingWaddle)
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
if(user.client)
|
||||
user.client.images += bar
|
||||
|
||||
progress = Clamp(progress, 0, goal)
|
||||
progress = clamp(progress, 0, goal)
|
||||
bar.icon_state = "prog_bar_[round(((progress / goal) * 100), 5)]"
|
||||
if(!shown)
|
||||
user.client.images += bar
|
||||
|
||||
@@ -423,7 +423,7 @@
|
||||
M.Weaken(stun_amt)
|
||||
to_chat(M, "<span class='userdanger'>You're thrown back by a mystical force!</span>")
|
||||
spawn(0)
|
||||
AM.throw_at(throwtarget, ((Clamp((maxthrow - (Clamp(distfromcaster - 2, 0, distfromcaster))), 3, maxthrow))), 1)//So stuff gets tossed around at the same time.
|
||||
AM.throw_at(throwtarget, ((clamp((maxthrow - (clamp(distfromcaster - 2, 0, distfromcaster))), 3, maxthrow))), 1)//So stuff gets tossed around at the same time.
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/sacred_flame
|
||||
name = "Sacred Flame"
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
/mob/living/simple_animal/hostile/blob/blobspore/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume, global_overlay = TRUE)
|
||||
..()
|
||||
adjustBruteLoss(Clamp(0.01 * exposed_temperature, 1, 5))
|
||||
adjustBruteLoss(clamp(0.01 * exposed_temperature, 1, 5))
|
||||
|
||||
|
||||
/mob/living/simple_animal/hostile/blob/blobspore/CanPass(atom/movable/mover, turf/target, height=0)
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
/mob/camera/blob/proc/add_points(var/points)
|
||||
if(points != 0)
|
||||
blob_points = Clamp(blob_points + points, 0, max_blob_points)
|
||||
blob_points = clamp(blob_points + points, 0, max_blob_points)
|
||||
if(hud_used)
|
||||
hud_used.blobpwrdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#82ed00'>[round(src.blob_points)]</font></div>"
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
/obj/structure/blob/CanAStarPass(ID, dir, caller)
|
||||
. = 0
|
||||
if(ismovableatom(caller))
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || mover.checkpass(PASSBLOB)
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
new /obj/effect/hallucination/delusion(target.loc, target, force_kind = "custom", duration = 200, skip_nearby = 0, custom_icon = icon_state, custom_icon_file = icon)
|
||||
else
|
||||
if(prob(45))
|
||||
if(ismovableatom(target))
|
||||
if(ismovable(target))
|
||||
var/atom/movable/M = target
|
||||
if(!M.anchored && M != summoner)
|
||||
new /obj/effect/temp_visual/guardian/phase/out(get_turf(M))
|
||||
|
||||
@@ -141,7 +141,7 @@ proc/issyndicate(mob/living/M as mob)
|
||||
/datum/game_mode/nuclear/proc/scale_telecrystals()
|
||||
var/danger
|
||||
danger = GLOB.player_list.len
|
||||
while(!IsMultiple(++danger, 10)) //Increments danger up to the nearest multiple of ten
|
||||
while(!ISMULTIPLE(++danger, 10)) //Increments danger up to the nearest multiple of ten
|
||||
|
||||
total_tc += danger * NUKESCALINGMODIFIER
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ Made by Xhuis
|
||||
shadowlings--
|
||||
|
||||
var/thrall_scaling = round(num_players() / 3)
|
||||
required_thralls = Clamp(thrall_scaling, 15, 25)
|
||||
required_thralls = clamp(thrall_scaling, 15, 25)
|
||||
thrall_ratio = required_thralls / 15
|
||||
|
||||
warning_threshold = round(0.66 * required_thralls)
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
|
||||
if(href_list["pressure_adj"])
|
||||
var/diff = text2num(href_list["pressure_adj"])
|
||||
target_pressure = Clamp(target_pressure+diff, pressuremin, pressuremax)
|
||||
target_pressure = clamp(target_pressure+diff, pressuremin, pressuremax)
|
||||
update_icon()
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
|
||||
if(href_list["volume_adj"])
|
||||
var/diff = text2num(href_list["volume_adj"])
|
||||
volume_rate = Clamp(volume_rate+diff, minrate, maxrate)
|
||||
volume_rate = clamp(volume_rate+diff, minrate, maxrate)
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
|
||||
|
||||
@@ -309,13 +309,13 @@
|
||||
|
||||
if(href_list["remove_from_queue"])
|
||||
var/index = text2num(href_list["remove_from_queue"])
|
||||
if(isnum(index) && IsInRange(index, 1, queue.len))
|
||||
if(isnum(index) && ISINRANGE(index, 1, queue.len))
|
||||
remove_from_queue(index)
|
||||
if(href_list["queue_move"] && href_list["index"])
|
||||
var/index = text2num(href_list["index"])
|
||||
var/new_index = index + text2num(href_list["queue_move"])
|
||||
if(isnum(index) && isnum(new_index))
|
||||
if(IsInRange(new_index, 1, queue.len))
|
||||
if(ISINRANGE(new_index, 1, queue.len))
|
||||
queue.Swap(index,new_index)
|
||||
if(href_list["clear_queue"])
|
||||
queue = list()
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
WELDER_ATTEMPT_REPAIR_MESSAGE
|
||||
if(I.use_tool(src, user, 40, volume = I.tool_volume))
|
||||
WELDER_REPAIR_SUCCESS_MESSAGE
|
||||
obj_integrity = Clamp(obj_integrity + 20, 0, max_integrity)
|
||||
obj_integrity = clamp(obj_integrity + 20, 0, max_integrity)
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@
|
||||
/obj/machinery/syndicatebomb/proc/settings(mob/user)
|
||||
var/new_timer = input(user, "Please set the timer.", "Timer", "[timer_set]") as num
|
||||
if(can_interact(user)) //No running off and setting bombs from across the station
|
||||
timer_set = Clamp(new_timer, minimum_timer, maximum_timer)
|
||||
timer_set = clamp(new_timer, minimum_timer, maximum_timer)
|
||||
loc.visible_message("<span class='notice'>[bicon(src)] timer set for [timer_set] seconds.</span>")
|
||||
if(alert(user,"Would you like to start the countdown now?",,"Yes","No") == "Yes" && can_interact(user))
|
||||
if(defused || active)
|
||||
|
||||
@@ -390,7 +390,7 @@
|
||||
var/index = afilter.getNum("index")
|
||||
var/new_index = index + afilter.getNum("queue_move")
|
||||
if(isnum(index) && isnum(new_index))
|
||||
if(IsInRange(new_index,1,queue.len))
|
||||
if(ISINRANGE(new_index,1,queue.len))
|
||||
queue.Swap(index,new_index)
|
||||
return update_queue_on_page()
|
||||
if(href_list["clear_queue"])
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
var/list/affecting = list()
|
||||
|
||||
/obj/effect/step_trigger/thrower/Trigger(atom/A)
|
||||
if(!A || !ismovableatom(A))
|
||||
if(!A || !ismovable(A))
|
||||
return
|
||||
var/atom/movable/AM = A
|
||||
var/curtiles = 0
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
var/turf/T = A
|
||||
if(!T)
|
||||
continue
|
||||
var/dist = hypotenuse(T.x, T.y, x0, y0)
|
||||
var/dist = HYPOTENUSE(T.x, T.y, x0, y0)
|
||||
|
||||
if(config.reactionary_explosions)
|
||||
var/turf/Trajectory = T
|
||||
@@ -209,7 +209,7 @@
|
||||
var/list/wipe_colours = list()
|
||||
for(var/turf/T in spiral_range_turfs(max_range, epicenter))
|
||||
wipe_colours += T
|
||||
var/dist = hypotenuse(T.x, T.y, x0, y0)
|
||||
var/dist = HYPOTENUSE(T.x, T.y, x0, y0)
|
||||
|
||||
if(newmode == "Yes")
|
||||
var/turf/TT = T
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
|
||||
// Negative numbers will subtract
|
||||
/obj/item/lightreplacer/proc/AddUses(amount = 1)
|
||||
uses = Clamp(uses + amount, 0, max_uses)
|
||||
uses = clamp(uses + amount, 0, max_uses)
|
||||
|
||||
/obj/item/lightreplacer/proc/AddShards(amount = 1, user)
|
||||
bulb_shards += amount
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
desc = "A box suited for pizzas."
|
||||
icon_state = "pizzabox1"
|
||||
return
|
||||
timer = Clamp(timer, 10, 100)
|
||||
timer = clamp(timer, 10, 100)
|
||||
icon_state = "pizzabox1"
|
||||
to_chat(user, "<span class='notice'>You set the timer to [timer / 10] before activating the payload and closing \the [src].")
|
||||
message_admins("[key_name_admin(usr)] has set a timer on a pizza bomb to [timer/10] seconds at <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[loc.x];Y=[loc.y];Z=[loc.z]'>(JMP)</a>.")
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
else if(href_list["code"])
|
||||
code += text2num(href_list["code"])
|
||||
code = round(code)
|
||||
code = Clamp(code, 1, 100)
|
||||
code = clamp(code, 1, 100)
|
||||
|
||||
else if(href_list["power"])
|
||||
on = !on
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
/obj/item/weldingtool/update_icon()
|
||||
if(low_fuel_changes_icon)
|
||||
var/ratio = GET_FUEL / maximum_fuel
|
||||
ratio = Ceiling(ratio*4) * 25
|
||||
ratio = CEILING(ratio*4, 1) * 25
|
||||
if(ratio == 100)
|
||||
icon_state = initial(icon_state)
|
||||
else
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
|
||||
/obj/structure/chrono_field/update_icon()
|
||||
var/ttk_frame = 1 - (tickstokill / initial(tickstokill))
|
||||
ttk_frame = Clamp(Ceiling(ttk_frame * CHRONO_FRAME_COUNT), 1, CHRONO_FRAME_COUNT)
|
||||
ttk_frame = clamp(CEILING(ttk_frame * CHRONO_FRAME_COUNT, 1), 1, CHRONO_FRAME_COUNT)
|
||||
if(ttk_frame != RPpos)
|
||||
RPpos = ttk_frame
|
||||
mob_underlay.icon_state = "frame[RPpos]"
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
if(powered) //so it doesn't show charge if it's unpowered
|
||||
if(cell)
|
||||
var/ratio = cell.charge / cell.maxcharge
|
||||
ratio = Ceiling(ratio*4) * 25
|
||||
ratio = CEILING(ratio*4, 1) * 25
|
||||
overlays += "[icon_state]-charge[ratio]"
|
||||
|
||||
/obj/item/defibrillator/CheckParts(list/parts_list)
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
/obj/item/dice/proc/diceroll(mob/user)
|
||||
result = roll(sides)
|
||||
if(rigged != DICE_NOT_RIGGED && result != rigged_value)
|
||||
if(rigged == DICE_BASICALLY_RIGGED && prob(Clamp(1/(sides - 1) * 100, 25, 80)))
|
||||
if(rigged == DICE_BASICALLY_RIGGED && prob(clamp(1/(sides - 1) * 100, 25, 80)))
|
||||
result = rigged_value
|
||||
else if(rigged == DICE_TOTALLY_RIGGED)
|
||||
result = rigged_value
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
return
|
||||
var/newtime = input(usr, "Please set the timer.", "Timer", det_time) as num
|
||||
if(user.is_in_active_hand(src))
|
||||
newtime = Clamp(newtime, 10, 60000)
|
||||
newtime = clamp(newtime, 10, 60000)
|
||||
det_time = newtime
|
||||
to_chat(user, "Timer set for [det_time] seconds.")
|
||||
|
||||
|
||||
@@ -34,15 +34,15 @@
|
||||
if(TH.force_wielded > initial(TH.force_wielded))
|
||||
to_chat(user, "<span class='warning'>[TH] has already been refined before. It cannot be sharpened further!</span>")
|
||||
return
|
||||
TH.force_wielded = Clamp(TH.force_wielded + increment, 0, max)//wieldforce is increased since normal force wont stay
|
||||
TH.force_wielded = clamp(TH.force_wielded + increment, 0, max)//wieldforce is increased since normal force wont stay
|
||||
if(I.force > initial(I.force))
|
||||
to_chat(user, "<span class='warning'>[I] has already been refined before. It cannot be sharpened further!</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] sharpens [I] with [src]!</span>", "<span class='notice'>You sharpen [I], making it much more deadly than before.</span>")
|
||||
if(!requires_sharpness)
|
||||
I.sharp = 1
|
||||
I.force = Clamp(I.force + increment, 0, max)
|
||||
I.throwforce = Clamp(I.throwforce + increment, 0, max)
|
||||
I.force = clamp(I.force + increment, 0, max)
|
||||
I.throwforce = clamp(I.throwforce + increment, 0, max)
|
||||
I.name = "[prefix] [I.name]"
|
||||
playsound(get_turf(src), usesound, 50, 1)
|
||||
name = "worn out [name]"
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
if(damage_flag)
|
||||
armor_protection = armor.getRating(damage_flag)
|
||||
if(armor_protection) //Only apply weak-against-armor/hollowpoint effects if there actually IS armor.
|
||||
armor_protection = Clamp(armor_protection - armour_penetration, min(armor_protection, 0), 100)
|
||||
armor_protection = clamp(armor_protection - armour_penetration, min(armor_protection, 0), 100)
|
||||
return round(damage_amount * (100 - armor_protection)*0.01, DAMAGE_PRECISION)
|
||||
|
||||
///the sound played when the obj is damaged.
|
||||
@@ -201,7 +201,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e
|
||||
return
|
||||
..()
|
||||
if(exposed_temperature && !(resistance_flags & FIRE_PROOF))
|
||||
take_damage(Clamp(0.02 * exposed_temperature, 0, 20), BURN, "fire", 0)
|
||||
take_damage(clamp(0.02 * exposed_temperature, 0, 20), BURN, "fire", 0)
|
||||
if(!(resistance_flags & ON_FIRE) && (resistance_flags & FLAMMABLE) && !(resistance_flags & FIRE_PROOF))
|
||||
resistance_flags |= ON_FIRE
|
||||
SSfires.processing[src] = src
|
||||
|
||||
@@ -374,7 +374,7 @@
|
||||
|
||||
/obj/structure/girder/CanAStarPass(ID, dir, caller)
|
||||
. = !density
|
||||
if(ismovableatom(caller))
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || mover.checkpass(PASSGRILLE)
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
|
||||
/obj/structure/grille/CanAStarPass(ID, dir, caller)
|
||||
. = !density
|
||||
if(ismovableatom(caller))
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || mover.checkpass(PASSGRILLE)
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@
|
||||
|
||||
/obj/structure/tray/m_tray/CanAStarPass(ID, dir, caller)
|
||||
. = !density
|
||||
if(ismovableatom(caller))
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || mover.checkpass(PASSTABLE)
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ GLOBAL_LIST_EMPTY(safes)
|
||||
|
||||
var/ticks = text2num(href_list["turnright"])
|
||||
for(var/i = 1 to ticks)
|
||||
dial = Wrap(dial - 1, 0, 100)
|
||||
dial = WRAP(dial - 1, 0, 100)
|
||||
|
||||
var/invalid_turn = current_tumbler_index % 2 == 0 || current_tumbler_index > number_of_tumblers
|
||||
if(invalid_turn) // The moment you turn the wrong way or go too far, the tumblers reset
|
||||
@@ -274,7 +274,7 @@ GLOBAL_LIST_EMPTY(safes)
|
||||
|
||||
var/ticks = text2num(href_list["turnleft"])
|
||||
for(var/i = 1 to ticks)
|
||||
dial = Wrap(dial + 1, 0, 100)
|
||||
dial = WRAP(dial + 1, 0, 100)
|
||||
|
||||
var/invalid_turn = current_tumbler_index % 2 != 0 || current_tumbler_index > number_of_tumblers
|
||||
if(invalid_turn) // The moment you turn the wrong way or go too far, the tumblers reset
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
|
||||
/obj/structure/table/CanAStarPass(ID, dir, caller)
|
||||
. = !density
|
||||
if(ismovableatom(caller))
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || mover.checkpass(PASSTABLE)
|
||||
|
||||
@@ -224,8 +224,8 @@
|
||||
if(!click_params || !click_params["icon-x"] || !click_params["icon-y"])
|
||||
return
|
||||
//Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf)
|
||||
I.pixel_x = Clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
I.pixel_y = Clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
I.pixel_x = clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
I.pixel_y = clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
item_placed(I)
|
||||
else
|
||||
return ..()
|
||||
@@ -666,7 +666,7 @@
|
||||
|
||||
/obj/structure/rack/CanAStarPass(ID, dir, caller)
|
||||
. = !density
|
||||
if(ismovableatom(caller))
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || mover.checkpass(PASSTABLE)
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ GLOBAL_LIST_INIT(megafauna_spawn_list, list(/mob/living/simple_animal/hostile/me
|
||||
break
|
||||
|
||||
var/list/L = list(45)
|
||||
if(IsOdd(dir2angle(dir))) // We're going at an angle and we want thick angled tunnels.
|
||||
if(ISODD(dir2angle(dir))) // We're going at an angle and we want thick angled tunnels.
|
||||
L += -45
|
||||
|
||||
// Expand the edges of our tunnel
|
||||
|
||||
+1
-7
@@ -1,5 +1,3 @@
|
||||
#define RECOMMENDED_VERSION 510
|
||||
|
||||
GLOBAL_LIST_INIT(map_transition_config, MAP_TRANSITION_CONFIG)
|
||||
|
||||
/world/New()
|
||||
@@ -12,7 +10,7 @@ GLOBAL_LIST_INIT(map_transition_config, MAP_TRANSITION_CONFIG)
|
||||
log_world("World loaded at [time_stamp()]")
|
||||
log_world("[GLOB.vars.len - GLOB.gvars_datum_in_built_vars.len] global variables")
|
||||
|
||||
if(byond_version < RECOMMENDED_VERSION)
|
||||
if(byond_version < MIN_COMPILER_VERSION || byond_build < MIN_COMPILER_BUILD)
|
||||
log_world("Your server's byond version does not meet the recommended requirements for this code. Please update BYOND")
|
||||
|
||||
if(config && config.server_name != null && config.server_suffix && world.port > 0)
|
||||
@@ -34,10 +32,6 @@ GLOBAL_LIST_INIT(map_transition_config, MAP_TRANSITION_CONFIG)
|
||||
populate_robolimb_list()
|
||||
|
||||
Master.Initialize(10, FALSE)
|
||||
|
||||
|
||||
#undef RECOMMENDED_VERSION
|
||||
|
||||
return
|
||||
|
||||
//world/Topic(href, href_list[])
|
||||
|
||||
@@ -430,7 +430,7 @@
|
||||
else if(expression[start + 1] == "\[" && islist(v))
|
||||
var/list/L = v
|
||||
var/index = SDQL_expression(source, expression[start + 2])
|
||||
if(isnum(index) && (!IsInteger(index) || L.len < index))
|
||||
if(isnum(index) && (!ISINTEGER(index) || L.len < index))
|
||||
to_chat(world, "<span class='danger'>Invalid list index: [index]</span>")
|
||||
return null
|
||||
return L[index]
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
var/matrix/mat = matrix()
|
||||
mat.Translate(0, 16)
|
||||
mat.Scale(1, sqrt((x_offset * x_offset) + (y_offset * y_offset)) / 32)
|
||||
mat.Turn(90 - Atan2(x_offset, y_offset)) // So... You pass coords in order x,y to this version of atan2. It should be called acsc2.
|
||||
mat.Turn(90 - ATAN2(x_offset, y_offset)) // So... You pass coords in order x,y to this version of atan2. It should be called acsc2.
|
||||
mat.Translate(atom_a.pixel_x, atom_a.pixel_y)
|
||||
|
||||
transform = mat
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
if(stored)
|
||||
DuplicateObject(stored, perfectcopy=1, sameloc=0,newloc=T)
|
||||
else if(right_click)
|
||||
if(ismovableatom(object)) // No copying turfs for now.
|
||||
if(ismovable(object)) // No copying turfs for now.
|
||||
to_chat(user, "<span class='notice'>[object] set as template.</span>")
|
||||
stored = object
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
UI_style_alpha='[UI_style_alpha]',
|
||||
be_role='[sanitizeSQL(list2params(be_special))]',
|
||||
default_slot='[default_slot]',
|
||||
toggles='[num2text(toggles, Ceiling(log(10, (TOGGLES_TOTAL))))]',
|
||||
toggles='[num2text(toggles, CEILING(log(10, (TOGGLES_TOTAL)), 1))]',
|
||||
atklog='[atklog]',
|
||||
sound='[sound]',
|
||||
randomslot='[randomslot]',
|
||||
|
||||
@@ -531,7 +531,7 @@
|
||||
|
||||
/obj/item/clothing/suit/space/hardsuit/shielded/process()
|
||||
if(world.time > recharge_cooldown && current_charges < max_charges)
|
||||
current_charges = Clamp((current_charges + recharge_rate), 0, max_charges)
|
||||
current_charges = clamp((current_charges + recharge_rate), 0, max_charges)
|
||||
playsound(loc, 'sound/magic/charge.ogg', 50, TRUE)
|
||||
if(current_charges == max_charges)
|
||||
playsound(loc, 'sound/machines/ding.ogg', 50, TRUE)
|
||||
|
||||
@@ -552,7 +552,7 @@
|
||||
|
||||
data["charge"] = cell ? round(cell.charge,1) : 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["coverlock"] = locked
|
||||
|
||||
@@ -159,7 +159,7 @@ GLOBAL_VAR(current_date_string)
|
||||
var/account_name = href_list["holder_name"]
|
||||
var/starting_funds = max(text2num(href_list["starting_funds"]), 0)
|
||||
|
||||
starting_funds = Clamp(starting_funds, 0, GLOB.station_account.money) // Not authorized to put the station in debt.
|
||||
starting_funds = clamp(starting_funds, 0, GLOB.station_account.money) // Not authorized to put the station in debt.
|
||||
starting_funds = min(starting_funds, fund_cap) // Not authorized to give more than the fund cap.
|
||||
|
||||
var/datum/money_account/M = create_account(account_name, starting_funds, src)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
if(!newAnomaly)
|
||||
kill()
|
||||
return
|
||||
if(IsMultiple(activeFor, 5))
|
||||
if(ISMULTIPLE(activeFor, 5))
|
||||
newAnomaly.anomalyEffect()
|
||||
|
||||
/datum/event/anomaly/anomaly_pyro/end()
|
||||
|
||||
@@ -55,12 +55,12 @@
|
||||
kill()
|
||||
return
|
||||
|
||||
if(IsMultiple(activeFor, 4))
|
||||
if(ISMULTIPLE(activeFor, 4))
|
||||
var/obj/machinery/vending/rebel = pick(vendingMachines)
|
||||
vendingMachines.Remove(rebel)
|
||||
infectedMachines.Add(rebel)
|
||||
rebel.shut_up = 0
|
||||
rebel.shoot_inventory = 1
|
||||
|
||||
if(IsMultiple(activeFor, 8))
|
||||
if(ISMULTIPLE(activeFor, 8))
|
||||
originMachine.speak(pick(rampant_speeches))
|
||||
|
||||
@@ -438,7 +438,7 @@
|
||||
overlays += I
|
||||
return
|
||||
|
||||
var/offset = Floor(20/cards.len + 1)
|
||||
var/offset = FLOOR(20/cards.len + 1, 1)
|
||||
|
||||
var/matrix/M = matrix()
|
||||
if(direction)
|
||||
|
||||
@@ -327,7 +327,7 @@
|
||||
else if(href_list["create"])
|
||||
var/amount = (text2num(href_list["amount"]))
|
||||
//Can't be outside these (if you change this keep a sane limit)
|
||||
amount = Clamp(amount, 1, 10)
|
||||
amount = clamp(amount, 1, 10)
|
||||
var/datum/design/D = locate(href_list["create"])
|
||||
create_product(D, amount)
|
||||
updateUsrDialog()
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
for(var/obj/item/stock_parts/micro_laser/ML in component_parts)
|
||||
var/wratemod = ML.rating * 2.5
|
||||
min_wrate = Floor(10-wratemod) // 7,5,2,0 Clamps at 0 and 10 You want this low
|
||||
min_wrate = FLOOR(10-wratemod, 1) // 7,5,2,0 Clamps at 0 and 10 You want this low
|
||||
min_wchance = 67-(ML.rating*16) // 48,35,19,3 Clamps at 0 and 67 You want this low
|
||||
for(var/obj/item/circuitboard/plantgenes/vaultcheck in component_parts)
|
||||
if(istype(vaultcheck, /obj/item/circuitboard/plantgenes/vault)) // TRAIT_DUMB BOTANY TUTS
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
for(var/datum/plant_gene/trait/T in seed.genes)
|
||||
T.on_new(src, newloc)
|
||||
seed.prepare_result(src)
|
||||
transform *= TransformUsingVariable(seed.potency, 100, 0.5) //Makes the resulting produce's sprite larger or smaller based on potency!
|
||||
transform *= TRANSFORM_USING_VARIABLE(seed.potency, 100) + 0.5 //Makes the resulting produce's sprite larger or smaller based on potency!
|
||||
add_juice()
|
||||
|
||||
/obj/item/reagent_containers/food/snacks/grown/Destroy()
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
if(istype(src, seed.product)) // no adding reagents if it is just a trash item
|
||||
seed.prepare_result(src)
|
||||
transform *= TransformUsingVariable(seed.potency, 100, 0.5)
|
||||
transform *= TRANSFORM_USING_VARIABLE(seed.potency, 100) + 0.5
|
||||
add_juice()
|
||||
|
||||
/obj/item/grown/Destroy()
|
||||
|
||||
@@ -949,30 +949,30 @@
|
||||
|
||||
/// Tray Setters - The following procs adjust the tray or plants variables, and make sure that the stat doesn't go out of bounds.///
|
||||
/obj/machinery/hydroponics/proc/adjustNutri(adjustamt)
|
||||
nutrilevel = Clamp(nutrilevel + adjustamt, 0, maxnutri)
|
||||
nutrilevel = clamp(nutrilevel + adjustamt, 0, maxnutri)
|
||||
plant_hud_set_nutrient()
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustWater(adjustamt)
|
||||
waterlevel = Clamp(waterlevel + adjustamt, 0, maxwater)
|
||||
waterlevel = clamp(waterlevel + adjustamt, 0, maxwater)
|
||||
plant_hud_set_water()
|
||||
if(adjustamt>0)
|
||||
adjustToxic(-round(adjustamt/4))//Toxicity dilutation code. The more water you put in, the lesser the toxin concentration.
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustHealth(adjustamt)
|
||||
if(myseed && !dead)
|
||||
plant_health = Clamp(plant_health + adjustamt, 0, myseed.endurance)
|
||||
plant_health = clamp(plant_health + adjustamt, 0, myseed.endurance)
|
||||
plant_hud_set_health()
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustToxic(adjustamt)
|
||||
toxic = Clamp(toxic + adjustamt, 0, 100)
|
||||
toxic = clamp(toxic + adjustamt, 0, 100)
|
||||
plant_hud_set_toxin()
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustPests(adjustamt)
|
||||
pestlevel = Clamp(pestlevel + adjustamt, 0, 10)
|
||||
pestlevel = clamp(pestlevel + adjustamt, 0, 10)
|
||||
plant_hud_set_pest()
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustWeeds(adjustamt)
|
||||
weedlevel = Clamp(weedlevel + adjustamt, 0, 10)
|
||||
weedlevel = clamp(weedlevel + adjustamt, 0, 10)
|
||||
plant_hud_set_weed()
|
||||
|
||||
/obj/machinery/hydroponics/proc/spawnplant() // why would you put strange reagent in a hydro tray you monster I bet you also feed them blood
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
/// Setters procs ///
|
||||
/obj/item/seeds/proc/adjust_yield(adjustamt)
|
||||
if(yield != -1) // Unharvestable shouldn't suddenly turn harvestable
|
||||
yield = Clamp(yield + adjustamt, 0, 10)
|
||||
yield = clamp(yield + adjustamt, 0, 10)
|
||||
|
||||
if(yield <= 0 && get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
|
||||
yield = 1 // Mushrooms always have a minimum yield of 1.
|
||||
@@ -191,39 +191,39 @@
|
||||
C.value = yield
|
||||
|
||||
/obj/item/seeds/proc/adjust_lifespan(adjustamt)
|
||||
lifespan = Clamp(lifespan + adjustamt, 10, 100)
|
||||
lifespan = clamp(lifespan + adjustamt, 10, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/lifespan)
|
||||
if(C)
|
||||
C.value = lifespan
|
||||
|
||||
/obj/item/seeds/proc/adjust_endurance(adjustamt)
|
||||
endurance = Clamp(endurance + adjustamt, 10, 100)
|
||||
endurance = clamp(endurance + adjustamt, 10, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/endurance)
|
||||
if(C)
|
||||
C.value = endurance
|
||||
|
||||
/obj/item/seeds/proc/adjust_production(adjustamt)
|
||||
if(yield != -1)
|
||||
production = Clamp(production + adjustamt, 1, 10)
|
||||
production = clamp(production + adjustamt, 1, 10)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/production)
|
||||
if(C)
|
||||
C.value = production
|
||||
|
||||
/obj/item/seeds/proc/adjust_potency(adjustamt)
|
||||
if(potency != -1)
|
||||
potency = Clamp(potency + adjustamt, 0, 100)
|
||||
potency = clamp(potency + adjustamt, 0, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/potency)
|
||||
if(C)
|
||||
C.value = potency
|
||||
|
||||
/obj/item/seeds/proc/adjust_weed_rate(adjustamt)
|
||||
weed_rate = Clamp(weed_rate + adjustamt, 0, 10)
|
||||
weed_rate = clamp(weed_rate + adjustamt, 0, 10)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_rate)
|
||||
if(C)
|
||||
C.value = weed_rate
|
||||
|
||||
/obj/item/seeds/proc/adjust_weed_chance(adjustamt)
|
||||
weed_chance = Clamp(weed_chance + adjustamt, 0, 67)
|
||||
weed_chance = clamp(weed_chance + adjustamt, 0, 67)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_chance)
|
||||
if(C)
|
||||
C.value = weed_chance
|
||||
@@ -232,7 +232,7 @@
|
||||
|
||||
/obj/item/seeds/proc/set_yield(adjustamt)
|
||||
if(yield != -1) // Unharvestable shouldn't suddenly turn harvestable
|
||||
yield = Clamp(adjustamt, 0, 10)
|
||||
yield = clamp(adjustamt, 0, 10)
|
||||
|
||||
if(yield <= 0 && get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
|
||||
yield = 1 // Mushrooms always have a minimum yield of 1.
|
||||
@@ -241,39 +241,39 @@
|
||||
C.value = yield
|
||||
|
||||
/obj/item/seeds/proc/set_lifespan(adjustamt)
|
||||
lifespan = Clamp(adjustamt, 10, 100)
|
||||
lifespan = clamp(adjustamt, 10, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/lifespan)
|
||||
if(C)
|
||||
C.value = lifespan
|
||||
|
||||
/obj/item/seeds/proc/set_endurance(adjustamt)
|
||||
endurance = Clamp(adjustamt, 10, 100)
|
||||
endurance = clamp(adjustamt, 10, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/endurance)
|
||||
if(C)
|
||||
C.value = endurance
|
||||
|
||||
/obj/item/seeds/proc/set_production(adjustamt)
|
||||
if(yield != -1)
|
||||
production = Clamp(adjustamt, 1, 10)
|
||||
production = clamp(adjustamt, 1, 10)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/production)
|
||||
if(C)
|
||||
C.value = production
|
||||
|
||||
/obj/item/seeds/proc/set_potency(adjustamt)
|
||||
if(potency != -1)
|
||||
potency = Clamp(adjustamt, 0, 100)
|
||||
potency = clamp(adjustamt, 0, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/potency)
|
||||
if(C)
|
||||
C.value = potency
|
||||
|
||||
/obj/item/seeds/proc/set_weed_rate(adjustamt)
|
||||
weed_rate = Clamp(adjustamt, 0, 10)
|
||||
weed_rate = clamp(adjustamt, 0, 10)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_rate)
|
||||
if(C)
|
||||
C.value = weed_rate
|
||||
|
||||
/obj/item/seeds/proc/set_weed_chance(adjustamt)
|
||||
weed_chance = Clamp(adjustamt, 0, 67)
|
||||
weed_chance = clamp(adjustamt, 0, 67)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_chance)
|
||||
if(C)
|
||||
C.value = weed_chance
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font>"
|
||||
else
|
||||
num_results = src.get_num_results()
|
||||
num_pages = Ceiling(num_results/LIBRARY_BOOKS_PER_PAGE)
|
||||
num_pages = CEILING(num_results/LIBRARY_BOOKS_PER_PAGE, 1)
|
||||
dat += {"<ul>
|
||||
<li><A href='?src=[UID()];id=-1'>(Order book by SS<sup>13</sup>BN)</A></li>
|
||||
</ul>"}
|
||||
@@ -224,13 +224,13 @@
|
||||
else
|
||||
var/pn = text2num(href_list["pagenum"])
|
||||
if(!isnull(pn))
|
||||
page_num = Clamp(pn, 1, num_pages)
|
||||
page_num = clamp(pn, 1, num_pages)
|
||||
|
||||
if(href_list["page"])
|
||||
if(num_pages == 0)
|
||||
page_num = 1
|
||||
else
|
||||
page_num = Clamp(text2num(href_list["page"]), 1, num_pages)
|
||||
page_num = clamp(text2num(href_list["page"]), 1, num_pages)
|
||||
if(href_list["settitle"])
|
||||
var/newtitle = input("Enter a title to search for:") as text|null
|
||||
if(newtitle)
|
||||
@@ -252,7 +252,7 @@
|
||||
|
||||
if(href_list["search"])
|
||||
num_results = src.get_num_results()
|
||||
num_pages = Ceiling(num_results/LIBRARY_BOOKS_PER_PAGE)
|
||||
num_pages = CEILING(num_results/LIBRARY_BOOKS_PER_PAGE, 1)
|
||||
page_num = 1
|
||||
|
||||
screenstate = 4
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
else
|
||||
var/pn = text2num(href_list["pagenum"])
|
||||
if(!isnull(pn))
|
||||
page_num = Clamp(pn, 1, num_pages)
|
||||
page_num = clamp(pn, 1, num_pages)
|
||||
|
||||
if(href_list["settitle"])
|
||||
var/newtitle = input("Enter a title to search for:") as text|null
|
||||
@@ -100,11 +100,11 @@
|
||||
if(num_pages == 0)
|
||||
page_num = 1
|
||||
else
|
||||
page_num = Clamp(text2num(href_list["page"]), 1, num_pages)
|
||||
page_num = clamp(text2num(href_list["page"]), 1, num_pages)
|
||||
|
||||
if(href_list["search"])
|
||||
num_results = src.get_num_results()
|
||||
num_pages = Ceiling(num_results/LIBRARY_BOOKS_PER_PAGE)
|
||||
num_pages = CEILING(num_results/LIBRARY_BOOKS_PER_PAGE, 1)
|
||||
page_num = 1
|
||||
|
||||
screenstate = 1
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
if(!light_power || !light_range) // We won't emit light anyways, destroy the light source.
|
||||
QDEL_NULL(light)
|
||||
else
|
||||
if(!ismovableatom(loc)) // We choose what atom should be the top atom of the light here.
|
||||
if(!ismovable(loc)) // We choose what atom should be the top atom of the light here.
|
||||
. = src
|
||||
else
|
||||
. = loc
|
||||
|
||||
@@ -97,13 +97,13 @@
|
||||
force = 0
|
||||
var/ghost_counter = ghost_check()
|
||||
|
||||
force = Clamp((ghost_counter * 4), 0, 75)
|
||||
force = clamp((ghost_counter * 4), 0, 75)
|
||||
user.visible_message("<span class='danger'>[user] strikes with the force of [ghost_counter] vengeful spirits!</span>")
|
||||
..()
|
||||
|
||||
/obj/item/melee/ghost_sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
|
||||
var/ghost_counter = ghost_check()
|
||||
final_block_chance += Clamp((ghost_counter * 5), 0, 75)
|
||||
final_block_chance += clamp((ghost_counter * 5), 0, 75)
|
||||
owner.visible_message("<span class='danger'>[owner] is protected by a ring of [ghost_counter] ghosts!</span>")
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
if(materials.materials[href_list["choose"]])
|
||||
chosen = href_list["choose"]
|
||||
if(href_list["chooseAmt"])
|
||||
coinsToProduce = Clamp(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000)
|
||||
coinsToProduce = clamp(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000)
|
||||
if(href_list["makeCoins"])
|
||||
var/temp_coins = coinsToProduce
|
||||
processing = TRUE
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
for(var/i = 0;i<name_count;i++)
|
||||
new_name = ""
|
||||
for(var/x = rand(Floor(syllable_count/2),syllable_count);x>0;x--)
|
||||
for(var/x = rand(FLOOR(syllable_count/2, 1),syllable_count);x>0;x--)
|
||||
new_name += pick(syllables)
|
||||
full_name += " [capitalize(lowertext(new_name))]"
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
if(dna.species && amount > 0)
|
||||
if(use_brain_mod)
|
||||
amount = amount * dna.species.brain_mod
|
||||
sponge.damage = Clamp(sponge.damage + amount, 0, 120)
|
||||
sponge.damage = clamp(sponge.damage + amount, 0, 120)
|
||||
if(sponge.damage >= 120)
|
||||
visible_message("<span class='alert'><B>[src]</B> goes limp, [p_their()] facial expression utterly blank.</span>")
|
||||
death()
|
||||
@@ -48,7 +48,7 @@
|
||||
if(dna.species && amount > 0)
|
||||
if(use_brain_mod)
|
||||
amount = amount * dna.species.brain_mod
|
||||
sponge.damage = Clamp(amount, 0, 120)
|
||||
sponge.damage = clamp(amount, 0, 120)
|
||||
if(sponge.damage >= 120)
|
||||
visible_message("<span class='alert'><B>[src]</B> goes limp, [p_their()] facial expression utterly blank.</span>")
|
||||
death()
|
||||
|
||||
@@ -185,19 +185,19 @@ emp_act
|
||||
var/block_chance_modifier = round(damage / -3)
|
||||
|
||||
if(l_hand && !istype(l_hand, /obj/item/clothing))
|
||||
var/final_block_chance = l_hand.block_chance - (Clamp((armour_penetration-l_hand.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example
|
||||
var/final_block_chance = l_hand.block_chance - (clamp((armour_penetration-l_hand.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example
|
||||
if(l_hand.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
|
||||
return 1
|
||||
if(r_hand && !istype(r_hand, /obj/item/clothing))
|
||||
var/final_block_chance = r_hand.block_chance - (Clamp((armour_penetration-r_hand.armour_penetration)/2,0,100)) + block_chance_modifier //Need to reset the var so it doesn't carry over modifications between attempts
|
||||
var/final_block_chance = r_hand.block_chance - (clamp((armour_penetration-r_hand.armour_penetration)/2,0,100)) + block_chance_modifier //Need to reset the var so it doesn't carry over modifications between attempts
|
||||
if(r_hand.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
|
||||
return 1
|
||||
if(wear_suit)
|
||||
var/final_block_chance = wear_suit.block_chance - (Clamp((armour_penetration-wear_suit.armour_penetration)/2,0,100)) + block_chance_modifier
|
||||
var/final_block_chance = wear_suit.block_chance - (clamp((armour_penetration-wear_suit.armour_penetration)/2,0,100)) + block_chance_modifier
|
||||
if(wear_suit.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
|
||||
return 1
|
||||
if(w_uniform)
|
||||
var/final_block_chance = w_uniform.block_chance - (Clamp((armour_penetration-w_uniform.armour_penetration)/2,0,100)) + block_chance_modifier
|
||||
var/final_block_chance = w_uniform.block_chance - (clamp((armour_penetration-w_uniform.armour_penetration)/2,0,100)) + block_chance_modifier
|
||||
if(w_uniform.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
|
||||
if(!(RADIMMUNE in dna.species.species_traits))
|
||||
if(radiation)
|
||||
radiation = Clamp(radiation, 0, 200)
|
||||
radiation = clamp(radiation, 0, 200)
|
||||
|
||||
var/autopsy_damage = 0
|
||||
switch(radiation)
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
//TOXINS/PLASMA
|
||||
if(Toxins_partialpressure > safe_tox_max)
|
||||
var/ratio = (breath.toxins/safe_tox_max) * 10
|
||||
adjustToxLoss(Clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE))
|
||||
adjustToxLoss(clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE))
|
||||
throw_alert("too_much_tox", /obj/screen/alert/too_much_tox)
|
||||
else
|
||||
clear_alert("too_much_tox")
|
||||
@@ -243,7 +243,7 @@
|
||||
adjustToxLoss(3)
|
||||
updatehealth("handle mutations and radiation(75-100)")
|
||||
|
||||
radiation = Clamp(radiation, 0, 100)
|
||||
radiation = clamp(radiation, 0, 100)
|
||||
|
||||
|
||||
/mob/living/carbon/handle_chemicals_in_body()
|
||||
|
||||
@@ -79,9 +79,9 @@
|
||||
|
||||
/obj/item/proc/get_volume_by_throwforce_and_or_w_class()
|
||||
if(throwforce && w_class)
|
||||
return Clamp((throwforce + w_class) * 5, 30, 100)// Add the item's throwforce to its weight class and multiply by 5, then clamp the value between 30 and 100
|
||||
return clamp((throwforce + w_class) * 5, 30, 100)// Add the item's throwforce to its weight class and multiply by 5, then clamp the value between 30 and 100
|
||||
else if(w_class)
|
||||
return Clamp(w_class * 8, 20, 100) // Multiply the item's weight class by 8, then clamp the value between 20 and 100
|
||||
return clamp(w_class * 8, 20, 100) // Multiply the item's weight class by 8, then clamp the value between 20 and 100
|
||||
else
|
||||
return 0
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
return
|
||||
|
||||
/mob/living/proc/adjust_fire_stacks(add_fire_stacks) //Adjusting the amount of fire_stacks we have on person
|
||||
fire_stacks = Clamp(fire_stacks + add_fire_stacks, -20, 20)
|
||||
fire_stacks = clamp(fire_stacks + add_fire_stacks, -20, 20)
|
||||
if(on_fire && fire_stacks <= 0)
|
||||
ExtinguishMob()
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
if(is_component_functioning("power cell") && cell.charge)
|
||||
if(cell.charge <= 100)
|
||||
uneq_all()
|
||||
var/amt = Clamp((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell.
|
||||
var/amt = clamp((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell.
|
||||
cell.use(amt) //Usage table: 1/tick if off/lowest setting, 4 = 4/tick, 6 = 8/tick, 8 = 12/tick, 10 = 16/tick
|
||||
else
|
||||
uneq_all()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
if(status_flags & GODMODE)
|
||||
return FALSE
|
||||
var/oldbruteloss = bruteloss
|
||||
bruteloss = Clamp(bruteloss + amount, 0, maxHealth)
|
||||
bruteloss = clamp(bruteloss + amount, 0, maxHealth)
|
||||
if(oldbruteloss == bruteloss)
|
||||
updating_health = FALSE
|
||||
. = STATUS_UPDATE_NONE
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
icon_dead = "maid_dead"
|
||||
|
||||
/mob/living/simple_animal/hostile/alien/maid/AttackingTarget()
|
||||
if(ismovableatom(target))
|
||||
if(ismovable(target))
|
||||
if(istype(target, /obj/effect/decal/cleanable))
|
||||
visible_message("<span class='notice'>\The [src] cleans up \the [target].</span>")
|
||||
qdel(target)
|
||||
|
||||
@@ -116,8 +116,8 @@ Difficulty: Hard
|
||||
if(charging)
|
||||
return
|
||||
|
||||
anger_modifier = Clamp(((maxHealth - health)/60),0,20)
|
||||
enrage_time = initial(enrage_time) * Clamp(anger_modifier / 20, 0.5, 1)
|
||||
anger_modifier = clamp(((maxHealth - health)/60),0,20)
|
||||
enrage_time = initial(enrage_time) * clamp(anger_modifier / 20, 0.5, 1)
|
||||
ranged_cooldown = world.time + 50
|
||||
|
||||
if(client)
|
||||
|
||||
@@ -83,7 +83,7 @@ Difficulty: Very Hard
|
||||
chosen_attack_num = 4
|
||||
|
||||
/mob/living/simple_animal/hostile/megafauna/colossus/OpenFire()
|
||||
anger_modifier = Clamp(((maxHealth - health)/50),0,20)
|
||||
anger_modifier = clamp(((maxHealth - health)/50),0,20)
|
||||
ranged_cooldown = world.time + 120
|
||||
|
||||
if(client)
|
||||
|
||||
@@ -103,7 +103,7 @@ Difficulty: Medium
|
||||
if(swooping)
|
||||
return
|
||||
|
||||
anger_modifier = Clamp(((maxHealth - health)/50),0,20)
|
||||
anger_modifier = clamp(((maxHealth - health)/50),0,20)
|
||||
ranged_cooldown = world.time + ranged_cooldown_time
|
||||
|
||||
if(client)
|
||||
@@ -254,7 +254,7 @@ Difficulty: Medium
|
||||
/mob/living/simple_animal/hostile/megafauna/dragon/proc/line_target(var/offset, var/range, var/atom/at = target)
|
||||
if(!at)
|
||||
return
|
||||
var/angle = Atan2(at.x - src.x, at.y - src.y) + offset
|
||||
var/angle = ATAN2(at.x - src.x, at.y - src.y) + offset
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/i in 1 to range)
|
||||
var/turf/check = locate(src.x + cos(angle) * i, src.y + sin(angle) * i, src.z)
|
||||
@@ -344,10 +344,10 @@ Difficulty: Medium
|
||||
|
||||
//ensure swoop direction continuity.
|
||||
if(negative)
|
||||
if(IsInRange(x, initial_x + 1, initial_x + DRAKE_SWOOP_DIRECTION_CHANGE_RANGE))
|
||||
if(ISINRANGE(x, initial_x + 1, initial_x + DRAKE_SWOOP_DIRECTION_CHANGE_RANGE))
|
||||
negative = FALSE
|
||||
else
|
||||
if(IsInRange(x, initial_x - DRAKE_SWOOP_DIRECTION_CHANGE_RANGE, initial_x - 1))
|
||||
if(ISINRANGE(x, initial_x - DRAKE_SWOOP_DIRECTION_CHANGE_RANGE, initial_x - 1))
|
||||
negative = TRUE
|
||||
new /obj/effect/temp_visual/dragon_flight/end(loc, negative)
|
||||
new /obj/effect/temp_visual/dragon_swoop(loc)
|
||||
|
||||
@@ -482,7 +482,7 @@ Difficulty: Hard
|
||||
|
||||
/mob/living/simple_animal/hostile/megafauna/hierophant/proc/calculate_rage() //how angry we are overall
|
||||
did_reset = FALSE //oh hey we're doing SOMETHING, clearly we might need to heal if we recall
|
||||
anger_modifier = Clamp(((maxHealth - health) / 42),0,50)
|
||||
anger_modifier = clamp(((maxHealth - health) / 42),0,50)
|
||||
burst_range = initial(burst_range) + round(anger_modifier * 0.08)
|
||||
beam_range = initial(beam_range) + round(anger_modifier * 0.12)
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
neststep = 4
|
||||
else
|
||||
spider_lastspawn = world.time
|
||||
var/spiders_left_to_spawn = Clamp( (spider_max_per_nest - CountSpiders()), 1, 10)
|
||||
var/spiders_left_to_spawn = clamp( (spider_max_per_nest - CountSpiders()), 1, 10)
|
||||
DoLayTerrorEggs(pick(spider_types_standard), spiders_left_to_spawn)
|
||||
if(4)
|
||||
// Nest should be full. Otherwise, start replenishing nest (stage 5).
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
|
||||
/mob/living/simple_animal/updatehealth(reason = "none given")
|
||||
..(reason)
|
||||
health = Clamp(health, 0, maxHealth)
|
||||
health = clamp(health, 0, maxHealth)
|
||||
med_hud_set_health()
|
||||
|
||||
/mob/living/simple_animal/StartResting(updating = 1)
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
step_away(M,src)
|
||||
M.Friends = Friends.Copy()
|
||||
babies += M
|
||||
M.mutation_chance = Clamp(mutation_chance+(rand(5,-5)),0,100)
|
||||
M.mutation_chance = clamp(mutation_chance+(rand(5,-5)),0,100)
|
||||
feedback_add_details("slime_babies_born", "slimebirth_[replacetext(M.colour," ","_")]")
|
||||
|
||||
var/mob/living/simple_animal/slime/new_slime = pick(babies)
|
||||
|
||||
@@ -207,4 +207,4 @@
|
||||
|
||||
/mob/proc/adjust_bodytemperature(amount, min_temp = 0, max_temp = INFINITY)
|
||||
if(bodytemperature >= min_temp && bodytemperature <= max_temp)
|
||||
bodytemperature = Clamp(bodytemperature + amount, min_temp, max_temp)
|
||||
bodytemperature = clamp(bodytemperature + amount, min_temp, max_temp)
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
if(href_list["change_supplied_law_position"])
|
||||
var/new_position = input(usr, "Enter new supplied law position between 1 and [MAX_SUPPLIED_LAW_NUMBER], inclusive. Inherent laws at the same index as a supplied law will not be stated.", "Law Position", supplied_law_position) as num|null
|
||||
if(isnum(new_position) && can_still_topic())
|
||||
supplied_law_position = Clamp(new_position, 1, MAX_SUPPLIED_LAW_NUMBER)
|
||||
supplied_law_position = clamp(new_position, 1, MAX_SUPPLIED_LAW_NUMBER)
|
||||
return 1
|
||||
|
||||
if(href_list["edit_law"])
|
||||
|
||||
@@ -177,7 +177,7 @@
|
||||
/obj/machinery/power/apc/Destroy()
|
||||
GLOB.apcs -= src
|
||||
if(malfai && operating)
|
||||
malfai.malf_picker.processing_time = Clamp(malfai.malf_picker.processing_time - 10,0,1000)
|
||||
malfai.malf_picker.processing_time = clamp(malfai.malf_picker.processing_time - 10,0,1000)
|
||||
area.power_light = 0
|
||||
area.power_equip = 0
|
||||
area.power_environ = 0
|
||||
@@ -1333,7 +1333,7 @@
|
||||
|
||||
/obj/machinery/power/apc/proc/set_broken()
|
||||
if(malfai && operating)
|
||||
malfai.malf_picker.processing_time = Clamp(malfai.malf_picker.processing_time - 10,0,1000)
|
||||
malfai.malf_picker.processing_time = clamp(malfai.malf_picker.processing_time - 10,0,1000)
|
||||
stat |= BROKEN
|
||||
operating = 0
|
||||
if(occupier)
|
||||
|
||||
@@ -125,7 +125,7 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
|
||||
/obj/structure/cable/proc/surplus()
|
||||
if(powernet)
|
||||
return Clamp(powernet.avail-powernet.load, 0, powernet.avail)
|
||||
return clamp(powernet.avail-powernet.load, 0, powernet.avail)
|
||||
else
|
||||
return 0
|
||||
|
||||
@@ -141,7 +141,7 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
|
||||
/obj/structure/cable/proc/delayed_surplus()
|
||||
if(powernet)
|
||||
return Clamp(powernet.newavail - powernet.delayedload, 0, powernet.newavail)
|
||||
return clamp(powernet.newavail - powernet.delayedload, 0, powernet.newavail)
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
|
||||
/obj/item/stock_parts/cell/proc/get_electrocute_damage()
|
||||
if(charge >= 1000)
|
||||
return Clamp(20 + round(charge / 25000), 20, 195) + rand(-5, 5)
|
||||
return clamp(20 + round(charge / 25000), 20, 195) + rand(-5, 5)
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
/obj/machinery/power/proc/surplus()
|
||||
if(powernet)
|
||||
return Clamp(powernet.avail-powernet.load, 0, powernet.avail)
|
||||
return clamp(powernet.avail-powernet.load, 0, powernet.avail)
|
||||
else
|
||||
return 0
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
/obj/machinery/power/proc/delayed_surplus()
|
||||
if(powernet)
|
||||
return Clamp(powernet.newavail - powernet.delayedload, 0, powernet.newavail)
|
||||
return clamp(powernet.newavail - powernet.delayedload, 0, powernet.newavail)
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
@@ -97,6 +97,6 @@
|
||||
|
||||
/datum/powernet/proc/get_electrocute_damage()
|
||||
if(avail >= 1000)
|
||||
return Clamp(20 + round(avail / 25000), 20, 195) + rand(-5, 5)
|
||||
return clamp(20 + round(avail / 25000), 20, 195) + rand(-5, 5)
|
||||
else
|
||||
return 0
|
||||
|
||||
@@ -218,7 +218,7 @@
|
||||
damage = max(0, damage + between(-DAMAGE_RATE_LIMIT, (removed.temperature - CRITICAL_TEMPERATURE) / 150, damage_inc_limit))
|
||||
|
||||
//Maxes out at 100% oxygen pressure
|
||||
oxygen = Clamp((removed.oxygen - (removed.nitrogen * NITROGEN_RETARDATION_FACTOR)) / removed.total_moles(), 0, 1)
|
||||
oxygen = clamp((removed.oxygen - (removed.nitrogen * NITROGEN_RETARDATION_FACTOR)) / removed.total_moles(), 0, 1)
|
||||
|
||||
var/temp_factor
|
||||
var/equilibrium_power
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user