mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
defines math (#33498)
This commit is contained in:
committed by
Jordan Brown
parent
c4062c9af5
commit
25080ff2c4
@@ -12,6 +12,12 @@
|
|||||||
|
|
||||||
//ATMOS
|
//ATMOS
|
||||||
//stuff you should probably leave well alone!
|
//stuff you should probably leave well alone!
|
||||||
|
#define R_IDEAL_GAS_EQUATION 8.31 //kPa*L/(K*mol)
|
||||||
|
#define ONE_ATMOSPHERE 101.325 //kPa
|
||||||
|
#define T0C 273.15 // 0degC
|
||||||
|
#define T20C 293.15 // 20degC
|
||||||
|
#define TCMB 2.7 // -270.3degC
|
||||||
|
|
||||||
#define MOLES_CELLSTANDARD (ONE_ATMOSPHERE*CELL_VOLUME/(T20C*R_IDEAL_GAS_EQUATION)) //moles in a 2.5 m^3 cell at 101.325 Pa and 20 degC
|
#define MOLES_CELLSTANDARD (ONE_ATMOSPHERE*CELL_VOLUME/(T20C*R_IDEAL_GAS_EQUATION)) //moles in a 2.5 m^3 cell at 101.325 Pa and 20 degC
|
||||||
#define M_CELL_WITH_RATIO (MOLES_CELLSTANDARD * 0.005) //compared against for superconductivity
|
#define M_CELL_WITH_RATIO (MOLES_CELLSTANDARD * 0.005) //compared against for superconductivity
|
||||||
#define O2STANDARD 0.21 //percentage of oxygen in a normal mixture of air
|
#define O2STANDARD 0.21 //percentage of oxygen in a normal mixture of air
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
#define PI 3.1415
|
|
||||||
#define SPEED_OF_LIGHT 3e8 //not exact but hey!
|
|
||||||
#define SPEED_OF_LIGHT_SQ 9e+16
|
|
||||||
#define INFINITY 1e31 //closer then enough
|
|
||||||
|
|
||||||
//atmos
|
|
||||||
#define R_IDEAL_GAS_EQUATION 8.31 //kPa*L/(K*mol)
|
|
||||||
#define ONE_ATMOSPHERE 101.325 //kPa
|
|
||||||
#define T0C 273.15 // 0degC
|
|
||||||
#define T20C 293.15 // 20degC
|
|
||||||
#define TCMB 2.7 // -270.3degC
|
|
||||||
|
|
||||||
#define SHORT_REAL_LIMIT 16777216
|
|
||||||
|
|
||||||
//"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 )
|
|
||||||
209
code/__DEFINES/maths.dm
Normal file
209
code/__DEFINES/maths.dm
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
// 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 NUM_SQRT2 1.41421356
|
||||||
|
|
||||||
|
#define PI 3.1415
|
||||||
|
#define SPEED_OF_LIGHT 3e8 //not exact but hey!
|
||||||
|
#define SPEED_OF_LIGHT_SQ 9e+16
|
||||||
|
#define INFINITY 1e31 //closer then enough
|
||||||
|
|
||||||
|
#define SHORT_REAL_LIMIT 16777216
|
||||||
|
|
||||||
|
//"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 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) )
|
||||||
|
|
||||||
|
#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 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) + ((b) - (a)) * 0.5)
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
|
||||||
|
// 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))
|
||||||
|
|
||||||
|
//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/mouse_angle_from_client(client/client)
|
||||||
|
var/list/mouse_control = params2list(client.mouseParams)
|
||||||
|
if(mouse_control["screen-loc"] && client)
|
||||||
|
var/list/screen_loc_params = splittext(mouse_control["screen-loc"], ",")
|
||||||
|
var/list/screen_loc_X = splittext(screen_loc_params[1],":")
|
||||||
|
var/list/screen_loc_Y = splittext(screen_loc_params[2],":")
|
||||||
|
var/x = (text2num(screen_loc_X[1]) * 32 + text2num(screen_loc_X[2]) - 32)
|
||||||
|
var/y = (text2num(screen_loc_Y[1]) * 32 + text2num(screen_loc_Y[2]) - 32)
|
||||||
|
var/list/screenview = getviewsize(client.view)
|
||||||
|
var/screenviewX = screenview[1] * world.icon_size
|
||||||
|
var/screenviewY = screenview[2] * world.icon_size
|
||||||
|
var/ox = round(screenviewX/2) - client.pixel_x //"origin" x
|
||||||
|
var/oy = round(screenviewY/2) - client.pixel_y //"origin" y
|
||||||
|
var/angle = SIMPLIFY_DEGREES(ATAN2(y - oy, x - ox))
|
||||||
|
return angle
|
||||||
|
|
||||||
|
/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)
|
||||||
|
|
||||||
|
// )
|
||||||
@@ -43,8 +43,8 @@
|
|||||||
//Returns list element or null. Should prevent "index out of bounds" error.
|
//Returns list element or null. Should prevent "index out of bounds" error.
|
||||||
/proc/listgetindex(list/L, index)
|
/proc/listgetindex(list/L, index)
|
||||||
if(LAZYLEN(L))
|
if(LAZYLEN(L))
|
||||||
if(isnum(index) && IsInteger(index))
|
if(isnum(index) && ISINTEGER(index))
|
||||||
if(IsInRange(index,1,L.len))
|
if(ISINRANGE(index,1,L.len))
|
||||||
return L[index]
|
return L[index]
|
||||||
else if(index in L)
|
else if(index in L)
|
||||||
return L[index]
|
return L[index]
|
||||||
|
|||||||
@@ -1,257 +0,0 @@
|
|||||||
// Credits to Nickr5 for the useful procs I've taken from his library resource.
|
|
||||||
|
|
||||||
GLOBAL_VAR_INIT(E, 2.71828183)
|
|
||||||
GLOBAL_VAR_INIT(Sqrt2, 1.41421356)
|
|
||||||
|
|
||||||
// List of square roots for the numbers 1-100.
|
|
||||||
GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
|
|
||||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
|
||||||
8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10))
|
|
||||||
|
|
||||||
/proc/sign(x)
|
|
||||||
return x!=0?x/abs(x):0
|
|
||||||
|
|
||||||
/proc/Atan2(x, y)
|
|
||||||
if(!x && !y)
|
|
||||||
return 0
|
|
||||||
var/a = arccos(x / sqrt(x*x + y*y))
|
|
||||||
return y >= 0 ? a : -a
|
|
||||||
|
|
||||||
/proc/Ceiling(x, y=1)
|
|
||||||
return -round(-x / y) * y
|
|
||||||
|
|
||||||
/proc/Floor(x, y=1)
|
|
||||||
return round(x / y) * y
|
|
||||||
|
|
||||||
#define Clamp(CLVALUE,CLMIN,CLMAX) ( max( (CLMIN), min((CLVALUE), (CLMAX)) ) )
|
|
||||||
|
|
||||||
/proc/Modulus(x, y) //Byond's modulus doesn't work with decimals.
|
|
||||||
return x - y * round(x / y)
|
|
||||||
|
|
||||||
// cotangent
|
|
||||||
/proc/Cot(x)
|
|
||||||
return 1 / Tan(x)
|
|
||||||
|
|
||||||
// cosecant
|
|
||||||
/proc/Csc(x)
|
|
||||||
return 1 / sin(x)
|
|
||||||
|
|
||||||
/proc/Default(a, b)
|
|
||||||
return a ? a : b
|
|
||||||
|
|
||||||
// Greatest Common Divisor - Euclid's algorithm
|
|
||||||
/proc/Gcd(a, b)
|
|
||||||
return b ? Gcd(b, a % b) : a
|
|
||||||
|
|
||||||
/proc/Inverse(x)
|
|
||||||
return 1 / x
|
|
||||||
|
|
||||||
#define InverseSquareLaw(initial_strength,cur_distance,initial_distance) (initial_strength*(initial_distance**2/cur_distance**2))
|
|
||||||
|
|
||||||
/proc/IsAboutEqual(a, b, deviation = 0.1)
|
|
||||||
return abs(a - b) <= deviation
|
|
||||||
|
|
||||||
/proc/IsEven(x)
|
|
||||||
return x % 2 == 0
|
|
||||||
|
|
||||||
// Returns true if val is from min to max, inclusive.
|
|
||||||
/proc/IsInRange(val, min, max)
|
|
||||||
return min <= val && val <= max
|
|
||||||
|
|
||||||
/proc/IsInteger(x)
|
|
||||||
return round(x) == x
|
|
||||||
|
|
||||||
/proc/IsOdd(x)
|
|
||||||
return !IsEven(x)
|
|
||||||
|
|
||||||
/proc/IsMultiple(x, y)
|
|
||||||
return x % y == 0
|
|
||||||
|
|
||||||
// Least Common Multiple
|
|
||||||
/proc/Lcm(a, b)
|
|
||||||
return abs(a) / Gcd(a, b) * abs(b)
|
|
||||||
|
|
||||||
// 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
|
|
||||||
|
|
||||||
//Calculates the sum of a list of numbers.
|
|
||||||
/proc/Sum(var/list/data)
|
|
||||||
. = 0
|
|
||||||
for(var/val in data)
|
|
||||||
.+= val
|
|
||||||
|
|
||||||
//Calculates the mean of a list of numbers.
|
|
||||||
/proc/Mean(var/list/data)
|
|
||||||
. = Sum(data) / (data.len)
|
|
||||||
|
|
||||||
|
|
||||||
// Returns the nth root of x.
|
|
||||||
/proc/Root(n, x)
|
|
||||||
return x ** (1 / n)
|
|
||||||
|
|
||||||
// secant
|
|
||||||
/proc/Sec(x)
|
|
||||||
return 1 / cos(x)
|
|
||||||
|
|
||||||
// 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
|
|
||||||
|
|
||||||
// tangent
|
|
||||||
/proc/Tan(x)
|
|
||||||
return sin(x) / cos(x)
|
|
||||||
|
|
||||||
/proc/ToDegrees(radians)
|
|
||||||
// 180 / Pi
|
|
||||||
return radians * 57.2957795
|
|
||||||
|
|
||||||
/proc/ToRadians(degrees)
|
|
||||||
// Pi / 180
|
|
||||||
return degrees * 0.0174532925
|
|
||||||
|
|
||||||
// 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 = round((val - min) / d)
|
|
||||||
return val - (t * d)
|
|
||||||
|
|
||||||
#define NORM_ROT(rot) ((((rot % 360) + (rot - round(rot, 1))) >= 0) ? ((rot % 360) + (rot - round(rot, 1))) : (((rot % 360) + (rot - round(rot, 1))) + 360))
|
|
||||||
|
|
||||||
/proc/get_angle_of_incidence(face_angle, angle_in, auto_normalize = TRUE)
|
|
||||||
|
|
||||||
var/angle_in_s = NORM_ROT(angle_in)
|
|
||||||
var/face_angle_s = NORM_ROT(face_angle)
|
|
||||||
var/incidence = face_angle_s - angle_in_s
|
|
||||||
var/incidence_s = incidence
|
|
||||||
while(incidence_s < -90)
|
|
||||||
incidence_s += 180
|
|
||||||
while(incidence_s > 90)
|
|
||||||
incidence_s -= 180
|
|
||||||
if(auto_normalize)
|
|
||||||
return incidence_s
|
|
||||||
else
|
|
||||||
return incidence
|
|
||||||
|
|
||||||
//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
|
|
||||||
|
|
||||||
//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/mouse_angle_from_client(client/client)
|
|
||||||
var/list/mouse_control = params2list(client.mouseParams)
|
|
||||||
if(mouse_control["screen-loc"] && client)
|
|
||||||
var/list/screen_loc_params = splittext(mouse_control["screen-loc"], ",")
|
|
||||||
var/list/screen_loc_X = splittext(screen_loc_params[1],":")
|
|
||||||
var/list/screen_loc_Y = splittext(screen_loc_params[2],":")
|
|
||||||
var/x = (text2num(screen_loc_X[1]) * 32 + text2num(screen_loc_X[2]) - 32)
|
|
||||||
var/y = (text2num(screen_loc_Y[1]) * 32 + text2num(screen_loc_Y[2]) - 32)
|
|
||||||
var/list/screenview = getviewsize(client.view)
|
|
||||||
var/screenviewX = screenview[1] * world.icon_size
|
|
||||||
var/screenviewY = screenview[2] * world.icon_size
|
|
||||||
var/ox = round(screenviewX/2) - client.pixel_x //"origin" x
|
|
||||||
var/oy = round(screenviewY/2) - client.pixel_y //"origin" y
|
|
||||||
var/angle = NORM_ROT(Atan2(y - oy, x - ox))
|
|
||||||
return angle
|
|
||||||
|
|
||||||
/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)
|
|
||||||
|
|
||||||
/proc/round_down(num)
|
|
||||||
if(round(num) != num)
|
|
||||||
return round(num--)
|
|
||||||
else return num
|
|
||||||
|
|
||||||
//proc/get_overlap()
|
|
||||||
// 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)
|
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
/proc/sanitize_frequency(frequency, free = FALSE)
|
/proc/sanitize_frequency(frequency, free = FALSE)
|
||||||
. = round(frequency)
|
. = round(frequency)
|
||||||
if(free)
|
if(free)
|
||||||
. = Clamp(frequency, MIN_FREE_FREQ, MAX_FREE_FREQ)
|
. = CLAMP(frequency, MIN_FREE_FREQ, MAX_FREE_FREQ)
|
||||||
else
|
else
|
||||||
. = Clamp(frequency, MIN_FREQ, MAX_FREQ)
|
. = CLAMP(frequency, MIN_FREQ, MAX_FREQ)
|
||||||
if(!(. % 2)) // Ensure the last digit is an odd number
|
if(!(. % 2)) // Ensure the last digit is an odd number
|
||||||
. += 1
|
. += 1
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0)
|
|||||||
if(!second)
|
if(!second)
|
||||||
return "0 seconds"
|
return "0 seconds"
|
||||||
if(second >= 60)
|
if(second >= 60)
|
||||||
minute = round_down(second/60)
|
minute = FLOOR(second/60, 1)
|
||||||
second = round(second - (minute*60), 0.1)
|
second = round(second - (minute*60), 0.1)
|
||||||
second_rounded = TRUE
|
second_rounded = TRUE
|
||||||
if(second) //check if we still have seconds remaining to format, or if everything went into minute.
|
if(second) //check if we still have seconds remaining to format, or if everything went into minute.
|
||||||
@@ -91,7 +91,7 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0)
|
|||||||
if(!minute)
|
if(!minute)
|
||||||
return "[second]"
|
return "[second]"
|
||||||
if(minute >= 60)
|
if(minute >= 60)
|
||||||
hour = round_down(minute/60,1)
|
hour = FLOOR(minute/60, 1)
|
||||||
minute = (minute - (hour*60))
|
minute = (minute - (hour*60))
|
||||||
if(minute) //alot simpler from here since you don't have to worry about fractions
|
if(minute) //alot simpler from here since you don't have to worry about fractions
|
||||||
if(minute != 1)
|
if(minute != 1)
|
||||||
@@ -114,7 +114,7 @@ GLOBAL_VAR_INIT(rollovercheck_last_timeofday, 0)
|
|||||||
if(!hour)
|
if(!hour)
|
||||||
return "[minute][second]"
|
return "[minute][second]"
|
||||||
if(hour >= 24)
|
if(hour >= 24)
|
||||||
day = round_down(hour/24,1)
|
day = FLOOR(hour/24, 1)
|
||||||
hour = (hour - (day*24))
|
hour = (hour - (day*24))
|
||||||
if(hour)
|
if(hour)
|
||||||
if(hour != 1)
|
if(hour != 1)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
//Converts an angle (degrees) into an ss13 direction
|
//Converts an angle (degrees) into an ss13 direction
|
||||||
/proc/angle2dir(degree)
|
/proc/angle2dir(degree)
|
||||||
|
|
||||||
degree = SimplifyDegrees(degree)
|
degree = SIMPLIFY_DEGREES(degree)
|
||||||
switch(degree)
|
switch(degree)
|
||||||
if(0 to 22.5) //north requires two angle ranges
|
if(0 to 22.5) //north requires two angle ranges
|
||||||
return NORTH
|
return NORTH
|
||||||
|
|||||||
@@ -147,10 +147,10 @@ Turf and target are separate in case you want to teleport some distance from a t
|
|||||||
var/line[] = list(locate(px,py,M.z))
|
var/line[] = list(locate(px,py,M.z))
|
||||||
var/dx=N.x-px //x distance
|
var/dx=N.x-px //x distance
|
||||||
var/dy=N.y-py
|
var/dy=N.y-py
|
||||||
var/dxabs=abs(dx)//Absolute value of x distance
|
var/dxabs = abs(dx)//Absolute value of x distance
|
||||||
var/dyabs=abs(dy)
|
var/dyabs = abs(dy)
|
||||||
var/sdx=sign(dx) //Sign of x distance (+ or -)
|
var/sdx = SIGN(dx) //Sign of x distance (+ or -)
|
||||||
var/sdy=sign(dy)
|
var/sdy = SIGN(dy)
|
||||||
var/x=dxabs>>1 //Counters for steps taken, setting to distance/2
|
var/x=dxabs>>1 //Counters for steps taken, setting to distance/2
|
||||||
var/y=dyabs>>1 //Bit-shifting makes me l33t. It also makes getline() unnessecarrily fast.
|
var/y=dyabs>>1 //Bit-shifting makes me l33t. It also makes getline() unnessecarrily fast.
|
||||||
var/j //Generic integer for counting
|
var/j //Generic integer for counting
|
||||||
@@ -955,8 +955,8 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
|
|||||||
tY = tY[1]
|
tY = tY[1]
|
||||||
tX = splittext(tX[1], ":")
|
tX = splittext(tX[1], ":")
|
||||||
tX = tX[1]
|
tX = tX[1]
|
||||||
tX = Clamp(origin.x + text2num(tX) - world.view - 1, 1, world.maxx)
|
tX = CLAMP(origin.x + text2num(tX) - world.view - 1, 1, world.maxx)
|
||||||
tY = Clamp(origin.y + text2num(tY) - world.view - 1, 1, world.maxy)
|
tY = CLAMP(origin.y + text2num(tY) - world.view - 1, 1, world.maxy)
|
||||||
return locate(tX, tY, tZ)
|
return locate(tX, tY, tZ)
|
||||||
|
|
||||||
/proc/screen_loc2turf(text, turf/origin)
|
/proc/screen_loc2turf(text, turf/origin)
|
||||||
@@ -968,8 +968,8 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
|
|||||||
tX = splittext(tZ[2], "-")
|
tX = splittext(tZ[2], "-")
|
||||||
tX = text2num(tX[2])
|
tX = text2num(tX[2])
|
||||||
tZ = origin.z
|
tZ = origin.z
|
||||||
tX = Clamp(origin.x + 7 - tX, 1, world.maxx)
|
tX = CLAMP(origin.x + 7 - tX, 1, world.maxx)
|
||||||
tY = Clamp(origin.y + 7 - tY, 1, world.maxy)
|
tY = CLAMP(origin.y + 7 - tY, 1, world.maxy)
|
||||||
return locate(tX, tY, tZ)
|
return locate(tX, tY, tZ)
|
||||||
|
|
||||||
/proc/IsValidSrc(datum/D)
|
/proc/IsValidSrc(datum/D)
|
||||||
@@ -1274,7 +1274,7 @@ proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
|
|||||||
. = 0
|
. = 0
|
||||||
var/i = DS2TICKS(initial_delay)
|
var/i = DS2TICKS(initial_delay)
|
||||||
do
|
do
|
||||||
. += Ceiling(i*DELTA_CALC)
|
. += CEILING(i*DELTA_CALC, 1)
|
||||||
sleep(i*world.tick_lag*DELTA_CALC)
|
sleep(i*world.tick_lag*DELTA_CALC)
|
||||||
i *= 2
|
i *= 2
|
||||||
while (TICK_USAGE > min(TICK_LIMIT_TO_RUN, Master.current_ticklimit))
|
while (TICK_USAGE > min(TICK_LIMIT_TO_RUN, Master.current_ticklimit))
|
||||||
|
|||||||
@@ -257,8 +257,8 @@
|
|||||||
view = world.view
|
view = world.view
|
||||||
|
|
||||||
var/list/viewscales = getviewsize(view)
|
var/list/viewscales = getviewsize(view)
|
||||||
var/countx = Ceiling((viewscales[1]/2)/(480/world.icon_size))+1
|
var/countx = CEILING((viewscales[1]/2)/(480/world.icon_size), 1)+1
|
||||||
var/county = Ceiling((viewscales[2]/2)/(480/world.icon_size))+1
|
var/county = CEILING((viewscales[2]/2)/(480/world.icon_size), 1)+1
|
||||||
var/list/new_overlays = new
|
var/list/new_overlays = new
|
||||||
for(var/x in -countx to countx)
|
for(var/x in -countx to countx)
|
||||||
for(var/y in -county to county)
|
for(var/y in -county to county)
|
||||||
|
|||||||
@@ -213,7 +213,7 @@
|
|||||||
if(!R.robot_modules_background)
|
if(!R.robot_modules_background)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/display_rows = Ceiling(length(R.module.get_inactive_modules()) / 8)
|
var/display_rows = CEILING(length(R.module.get_inactive_modules()) / 8, 1)
|
||||||
R.robot_modules_background.screen_loc = "CENTER-4:16,SOUTH+1:7 to CENTER+3:16,SOUTH+[display_rows]:7"
|
R.robot_modules_background.screen_loc = "CENTER-4:16,SOUTH+1:7 to CENTER+3:16,SOUTH+[display_rows]:7"
|
||||||
screenmob.client.screen += R.robot_modules_background
|
screenmob.client.screen += R.robot_modules_background
|
||||||
|
|
||||||
|
|||||||
@@ -119,9 +119,9 @@
|
|||||||
/obj/item/proc/get_clamped_volume()
|
/obj/item/proc/get_clamped_volume()
|
||||||
if(w_class)
|
if(w_class)
|
||||||
if(force)
|
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
|
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)
|
/mob/living/proc/send_item_attack_message(obj/item/I, mob/living/user, hit_area)
|
||||||
var/message_verb = "attacked"
|
var/message_verb = "attacked"
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
return FALSE
|
return FALSE
|
||||||
var/temp = text2num(trim(str_val))
|
var/temp = text2num(trim(str_val))
|
||||||
if(!isnull(temp))
|
if(!isnull(temp))
|
||||||
value = Clamp(integer ? round(temp) : temp, min_val, max_val)
|
value = CLAMP(integer ? round(temp) : temp, min_val, max_val)
|
||||||
if(value != temp && !var_edited)
|
if(value != temp && !var_edited)
|
||||||
log_config("Changing [name] from [temp] to [value]!")
|
log_config("Changing [name] from [temp] to [value]!")
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
//Byond resumed us late. assume it might have to do the same next tick
|
//Byond resumed us late. assume it might have to do the same next tick
|
||||||
if (last_run + Ceiling(world.tick_lag * (processing * sleep_delta), world.tick_lag) < world.time)
|
if (last_run + CEILING(world.tick_lag * (processing * sleep_delta), world.tick_lag) < world.time)
|
||||||
sleep_delta += 1
|
sleep_delta += 1
|
||||||
|
|
||||||
sleep_delta = MC_AVERAGE_FAST(sleep_delta, 1) //decay sleep_delta
|
sleep_delta = MC_AVERAGE_FAST(sleep_delta, 1) //decay sleep_delta
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ SUBSYSTEM_DEF(throwing)
|
|||||||
last_move = world.time
|
last_move = world.time
|
||||||
|
|
||||||
//calculate how many tiles to move, making up for any missed ticks.
|
//calculate how many tiles to move, making up for any missed ticks.
|
||||||
var/tilestomove = Ceiling(min(((((world.time+world.tick_lag) - start_time + delayed_time) * speed) - (dist_travelled ? dist_travelled : -1)), speed*MAX_TICKS_TO_MAKE_UP) * (world.tick_lag * SSthrowing.wait))
|
var/tilestomove = CEILING(min(((((world.time+world.tick_lag) - start_time + delayed_time) * speed) - (dist_travelled ? dist_travelled : -1)), speed*MAX_TICKS_TO_MAKE_UP) * (world.tick_lag * SSthrowing.wait), 1)
|
||||||
while (tilestomove-- > 0)
|
while (tilestomove-- > 0)
|
||||||
if ((dist_travelled >= maxrange || AM.loc == target_turf) && AM.has_gravity(AM.loc))
|
if ((dist_travelled >= maxrange || AM.loc == target_turf) && AM.has_gravity(AM.loc))
|
||||||
finalize()
|
finalize()
|
||||||
|
|||||||
@@ -128,11 +128,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
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
var/datum/callback/callback
|
var/datum/callback/callback
|
||||||
|
|
||||||
/datum/component/archaeology/Initialize(_prob2drop, list/_archdrops = list(), datum/callback/_callback)
|
/datum/component/archaeology/Initialize(_prob2drop, list/_archdrops = list(), datum/callback/_callback)
|
||||||
prob2drop = Clamp(_prob2drop, 0, 100)
|
prob2drop = CLAMP(_prob2drop, 0, 100)
|
||||||
archdrops = _archdrops
|
archdrops = _archdrops
|
||||||
callback = _callback
|
callback = _callback
|
||||||
RegisterSignal(COMSIG_PARENT_ATTACKBY,.proc/Dig)
|
RegisterSignal(COMSIG_PARENT_ATTACKBY,.proc/Dig)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
if(old_dir == new_dir)
|
if(old_dir == new_dir)
|
||||||
return
|
return
|
||||||
remove()
|
remove()
|
||||||
var/rotation = SimplifyDegrees(dir2angle(new_dir)-dir2angle(old_dir))
|
var/rotation = SIMPLIFY_DEGREES(dir2angle(new_dir)-dir2angle(old_dir))
|
||||||
pic.dir = turn(pic.dir, rotation)
|
pic.dir = turn(pic.dir, rotation)
|
||||||
apply()
|
apply()
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
addtimer(CALLBACK(src, .proc/charge), charge_rate)
|
addtimer(CALLBACK(src, .proc/charge), charge_rate)
|
||||||
|
|
||||||
/datum/action/innate/dash/proc/charge()
|
/datum/action/innate/dash/proc/charge()
|
||||||
current_charges = Clamp(current_charges + 1, 0, max_charges)
|
current_charges = CLAMP(current_charges + 1, 0, max_charges)
|
||||||
holder.update_action_buttons_icon()
|
holder.update_action_buttons_icon()
|
||||||
if(recharge_sound)
|
if(recharge_sound)
|
||||||
playsound(dashing_item, recharge_sound, 50, 1)
|
playsound(dashing_item, recharge_sound, 50, 1)
|
||||||
|
|||||||
@@ -185,10 +185,10 @@
|
|||||||
if(properties["stealth"] >= 2)
|
if(properties["stealth"] >= 2)
|
||||||
visibility_flags = HIDDEN_SCANNER
|
visibility_flags = HIDDEN_SCANNER
|
||||||
|
|
||||||
SetSpread(Clamp(2 ** (properties["transmittable"] - symptoms.len), VIRUS_SPREAD_BLOOD, VIRUS_SPREAD_AIRBORNE))
|
SetSpread(CLAMP(2 ** (properties["transmittable"] - symptoms.len), VIRUS_SPREAD_BLOOD, VIRUS_SPREAD_AIRBORNE))
|
||||||
|
|
||||||
permeability_mod = max(Ceiling(0.4 * properties["transmittable"]), 1)
|
permeability_mod = max(CEILING(0.4 * properties["transmittable"], 1), 1)
|
||||||
cure_chance = 15 - Clamp(properties["resistance"], -5, 5) // can be between 10 and 20
|
cure_chance = 15 - CLAMP(properties["resistance"], -5, 5) // can be between 10 and 20
|
||||||
stage_prob = max(properties["stage_rate"], 2)
|
stage_prob = max(properties["stage_rate"], 2)
|
||||||
SetSeverity(properties["severity"])
|
SetSeverity(properties["severity"])
|
||||||
GenerateCure(properties)
|
GenerateCure(properties)
|
||||||
@@ -243,7 +243,7 @@
|
|||||||
// Will generate a random cure, the less resistance the symptoms have, the harder the cure.
|
// Will generate a random cure, the less resistance the symptoms have, the harder the cure.
|
||||||
/datum/disease/advance/proc/GenerateCure()
|
/datum/disease/advance/proc/GenerateCure()
|
||||||
if(properties && properties.len)
|
if(properties && properties.len)
|
||||||
var/res = Clamp(properties["resistance"] - (symptoms.len / 2), 1, advance_cures.len)
|
var/res = CLAMP(properties["resistance"] - (symptoms.len / 2), 1, advance_cures.len)
|
||||||
cures = list(advance_cures[res])
|
cures = list(advance_cures[res])
|
||||||
|
|
||||||
// Get the cure name from the cure_id
|
// Get the cure name from the cure_id
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ GLOBAL_LIST_EMPTY(explosions)
|
|||||||
M.playsound_local(epicenter, null, 100, 1, frequency, falloff = 5, S = explosion_sound)
|
M.playsound_local(epicenter, null, 100, 1, frequency, falloff = 5, S = explosion_sound)
|
||||||
// You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station.
|
// You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station.
|
||||||
else if(dist <= far_dist)
|
else if(dist <= far_dist)
|
||||||
var/far_volume = Clamp(far_dist, 30, 50) // Volume is based on explosion size and dist
|
var/far_volume = CLAMP(far_dist, 30, 50) // Volume is based on explosion size and dist
|
||||||
far_volume += (dist <= far_dist * 0.5 ? 50 : 0) // add 50 volume if the mob is pretty close to the explosion
|
far_volume += (dist <= far_dist * 0.5 ? 50 : 0) // add 50 volume if the mob is pretty close to the explosion
|
||||||
M.playsound_local(epicenter, null, far_volume, 1, frequency, falloff = 5, S = far_explosion_sound)
|
M.playsound_local(epicenter, null, far_volume, 1, frequency, falloff = 5, S = far_explosion_sound)
|
||||||
EX_PREPROCESS_CHECK_TICK
|
EX_PREPROCESS_CHECK_TICK
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
"<span class='userdanger'>[A] slams your chest! You can't breathe!</span>")
|
"<span class='userdanger'>[A] slams your chest! You can't breathe!</span>")
|
||||||
playsound(get_turf(A), 'sound/effects/hit_punch.ogg', 50, 1, -1)
|
playsound(get_turf(A), 'sound/effects/hit_punch.ogg', 50, 1, -1)
|
||||||
if(D.losebreath <= 10)
|
if(D.losebreath <= 10)
|
||||||
D.losebreath = Clamp(D.losebreath + 5, 0, 10)
|
D.losebreath = CLAMP(D.losebreath + 5, 0, 10)
|
||||||
D.adjustOxyLoss(10)
|
D.adjustOxyLoss(10)
|
||||||
add_logs(A, D, "quickchoked")
|
add_logs(A, D, "quickchoked")
|
||||||
return 1
|
return 1
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
playsound(get_turf(A), 'sound/effects/hit_punch.ogg', 50, 1, -1)
|
playsound(get_turf(A), 'sound/effects/hit_punch.ogg', 50, 1, -1)
|
||||||
D.apply_damage(5, BRUTE)
|
D.apply_damage(5, BRUTE)
|
||||||
if(D.silent <= 10)
|
if(D.silent <= 10)
|
||||||
D.silent = Clamp(D.silent + 10, 0, 10)
|
D.silent = CLAMP(D.silent + 10, 0, 10)
|
||||||
add_logs(A, D, "neck chopped")
|
add_logs(A, D, "neck chopped")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
if (user.client)
|
if (user.client)
|
||||||
user.client.images += bar
|
user.client.images += bar
|
||||||
|
|
||||||
progress = Clamp(progress, 0, goal)
|
progress = CLAMP(progress, 0, goal)
|
||||||
bar.icon_state = "prog_bar_[round(((progress / goal) * 100), 5)]"
|
bar.icon_state = "prog_bar_[round(((progress / goal) * 100), 5)]"
|
||||||
if (!shown)
|
if (!shown)
|
||||||
user.client.images += bar
|
user.client.images += bar
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
var/strength
|
var/strength
|
||||||
if(steps>1)
|
if(steps>1)
|
||||||
strength = InverseSquareLaw(intensity, max(range_modifier*steps, 1), 1)
|
strength = INVERSE_SQUARE(intensity, max(range_modifier*steps, 1), 1)
|
||||||
else
|
else
|
||||||
strength = intensity
|
strength = intensity
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
qdel(src)
|
qdel(src)
|
||||||
return
|
return
|
||||||
|
|
||||||
radiate(atoms, Floor(strength))
|
radiate(atoms, FLOOR(strength, 1))
|
||||||
|
|
||||||
check_obstructions(atoms) // reduce our overall strength if there are radiation insulators
|
check_obstructions(atoms) // reduce our overall strength if there are radiation insulators
|
||||||
|
|
||||||
|
|||||||
@@ -60,8 +60,8 @@
|
|||||||
if(istype(L)) //this is probably more safety than actually needed
|
if(istype(L)) //this is probably more safety than actually needed
|
||||||
var/vanguard = L.stun_absorption["vanguard"]
|
var/vanguard = L.stun_absorption["vanguard"]
|
||||||
desc = initial(desc)
|
desc = initial(desc)
|
||||||
desc += "<br><b>[Floor(vanguard["stuns_absorbed"] * 0.1)]</b> seconds of stuns held back.\
|
desc += "<br><b>[FLOOR(vanguard["stuns_absorbed"] * 0.1, 1)]</b> seconds of stuns held back.\
|
||||||
[GLOB.ratvar_awakens ? "":"<br><b>[Floor(min(vanguard["stuns_absorbed"] * 0.025, 20))]</b> seconds of stun will affect you."]"
|
[GLOB.ratvar_awakens ? "":"<br><b>[FLOOR(min(vanguard["stuns_absorbed"] * 0.025, 20), 1)]</b> seconds of stun will affect you."]"
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/datum/status_effect/vanguard_shield/Destroy()
|
/datum/status_effect/vanguard_shield/Destroy()
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
var/vanguard = owner.stun_absorption["vanguard"]
|
var/vanguard = owner.stun_absorption["vanguard"]
|
||||||
var/stuns_blocked = 0
|
var/stuns_blocked = 0
|
||||||
if(vanguard)
|
if(vanguard)
|
||||||
stuns_blocked = Floor(min(vanguard["stuns_absorbed"] * 0.25, 400))
|
stuns_blocked = FLOOR(min(vanguard["stuns_absorbed"] * 0.25, 400), 1)
|
||||||
vanguard["end_time"] = 0 //so it doesn't absorb the stuns we're about to apply
|
vanguard["end_time"] = 0 //so it doesn't absorb the stuns we're about to apply
|
||||||
if(owner.stat != DEAD)
|
if(owner.stat != DEAD)
|
||||||
var/message_to_owner = "<span class='warning'>You feel your Vanguard quietly fade...</span>"
|
var/message_to_owner = "<span class='warning'>You feel your Vanguard quietly fade...</span>"
|
||||||
|
|||||||
@@ -230,7 +230,7 @@
|
|||||||
if(prob(severity * 0.15))
|
if(prob(severity * 0.15))
|
||||||
to_chat(owner, "<span class='sevtug[span_part]'>\"[text2ratvar(pick(mania_messages))]\"</span>")
|
to_chat(owner, "<span class='sevtug[span_part]'>\"[text2ratvar(pick(mania_messages))]\"</span>")
|
||||||
owner.playsound_local(get_turf(motor), hum, severity, 1)
|
owner.playsound_local(get_turf(motor), hum, severity, 1)
|
||||||
owner.adjust_drugginess(Clamp(max(severity * 0.075, 1), 0, max(0, 50 - owner.druggy))) //7.5% of severity per second, minimum 1
|
owner.adjust_drugginess(CLAMP(max(severity * 0.075, 1), 0, max(0, 50 - owner.druggy))) //7.5% of severity per second, minimum 1
|
||||||
if(owner.hallucination < 50)
|
if(owner.hallucination < 50)
|
||||||
owner.hallucination = min(owner.hallucination + max(severity * 0.075, 1), 50) //7.5% of severity per second, minimum 1
|
owner.hallucination = min(owner.hallucination + max(severity * 0.075, 1), 50) //7.5% of severity per second, minimum 1
|
||||||
if(owner.dizziness < 50)
|
if(owner.dizziness < 50)
|
||||||
@@ -310,7 +310,7 @@
|
|||||||
var/icon/I = icon(owner.icon, owner.icon_state, owner.dir)
|
var/icon/I = icon(owner.icon, owner.icon_state, owner.dir)
|
||||||
var/icon_height = I.Height()
|
var/icon_height = I.Height()
|
||||||
bleed_overlay.pixel_x = -owner.pixel_x
|
bleed_overlay.pixel_x = -owner.pixel_x
|
||||||
bleed_overlay.pixel_y = Floor(icon_height * 0.25)
|
bleed_overlay.pixel_y = FLOOR(icon_height * 0.25, 1)
|
||||||
bleed_overlay.transform = matrix() * (icon_height/world.icon_size) //scale the bleed overlay's size based on the target's icon size
|
bleed_overlay.transform = matrix() * (icon_height/world.icon_size) //scale the bleed overlay's size based on the target's icon size
|
||||||
bleed_underlay.pixel_x = -owner.pixel_x
|
bleed_underlay.pixel_x = -owner.pixel_x
|
||||||
bleed_underlay.transform = matrix() * (icon_height/world.icon_size) * 3
|
bleed_underlay.transform = matrix() * (icon_height/world.icon_size) * 3
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
/mob/living/simple_animal/hostile/blob/fire_act(exposed_temperature, exposed_volume)
|
/mob/living/simple_animal/hostile/blob/fire_act(exposed_temperature, exposed_volume)
|
||||||
..()
|
..()
|
||||||
if(exposed_temperature)
|
if(exposed_temperature)
|
||||||
adjustFireLoss(Clamp(0.01 * exposed_temperature, 1, 5))
|
adjustFireLoss(CLAMP(0.01 * exposed_temperature, 1, 5))
|
||||||
else
|
else
|
||||||
adjustFireLoss(5)
|
adjustFireLoss(5)
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ GLOBAL_LIST_EMPTY(blob_nodes)
|
|||||||
B.hud_used.blobpwrdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#82ed00'>[round(blob_core.obj_integrity)]</font></div>"
|
B.hud_used.blobpwrdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#82ed00'>[round(blob_core.obj_integrity)]</font></div>"
|
||||||
|
|
||||||
/mob/camera/blob/proc/add_points(points)
|
/mob/camera/blob/proc/add_points(points)
|
||||||
blob_points = Clamp(blob_points + points, 0, max_blob_points)
|
blob_points = CLAMP(blob_points + points, 0, max_blob_points)
|
||||||
hud_used.blobpwrdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#82ed00'>[round(blob_points)]</font></div>"
|
hud_used.blobpwrdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#82ed00'>[round(blob_points)]</font></div>"
|
||||||
|
|
||||||
/mob/camera/blob/say(message)
|
/mob/camera/blob/say(message)
|
||||||
|
|||||||
@@ -207,7 +207,7 @@
|
|||||||
to_chat(cyborg, "<span class='brass'>You start to charge from the [sigil_name]...</span>")
|
to_chat(cyborg, "<span class='brass'>You start to charge from the [sigil_name]...</span>")
|
||||||
if(!do_after(cyborg, 50, target = src, extra_checks = CALLBACK(src, .proc/cyborg_checks, cyborg, TRUE)))
|
if(!do_after(cyborg, 50, target = src, extra_checks = CALLBACK(src, .proc/cyborg_checks, cyborg, TRUE)))
|
||||||
return
|
return
|
||||||
var/giving_power = min(Floor(cyborg.cell.maxcharge - cyborg.cell.charge, MIN_CLOCKCULT_POWER), get_clockwork_power()) //give the borg either all our power or their missing power floored to MIN_CLOCKCULT_POWER
|
var/giving_power = min(FLOOR(cyborg.cell.maxcharge - cyborg.cell.charge, MIN_CLOCKCULT_POWER), get_clockwork_power()) //give the borg either all our power or their missing power floored to MIN_CLOCKCULT_POWER
|
||||||
if(adjust_clockwork_power(-giving_power))
|
if(adjust_clockwork_power(-giving_power))
|
||||||
cyborg.visible_message("<span class='warning'>[cyborg] glows a brilliant orange!</span>")
|
cyborg.visible_message("<span class='warning'>[cyborg] glows a brilliant orange!</span>")
|
||||||
var/previous_color = cyborg.color
|
var/previous_color = cyborg.color
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
if(amount_temp < 2)
|
if(amount_temp < 2)
|
||||||
to_chat(user, "<span class='warning'>You need at least <b>2</b> floor tiles to convert into power.</span>")
|
to_chat(user, "<span class='warning'>You need at least <b>2</b> floor tiles to convert into power.</span>")
|
||||||
return TRUE
|
return TRUE
|
||||||
if(IsOdd(amount_temp))
|
if(ISODD(amount_temp))
|
||||||
amount_temp--
|
amount_temp--
|
||||||
no_delete = TRUE
|
no_delete = TRUE
|
||||||
use(amount_temp)
|
use(amount_temp)
|
||||||
@@ -239,7 +239,7 @@
|
|||||||
if(!do_after(user, repair_values["healing_for_cycle"] * fabricator.speed_multiplier, target = src, \
|
if(!do_after(user, repair_values["healing_for_cycle"] * fabricator.speed_multiplier, target = src, \
|
||||||
extra_checks = CALLBACK(fabricator, /obj/item/clockwork/replica_fabricator.proc/fabricator_repair_checks, repair_values, src, user, TRUE)))
|
extra_checks = CALLBACK(fabricator, /obj/item/clockwork/replica_fabricator.proc/fabricator_repair_checks, repair_values, src, user, TRUE)))
|
||||||
break
|
break
|
||||||
obj_integrity = Clamp(obj_integrity + repair_values["healing_for_cycle"], 0, max_integrity)
|
obj_integrity = CLAMP(obj_integrity + repair_values["healing_for_cycle"], 0, max_integrity)
|
||||||
adjust_clockwork_power(-repair_values["power_required"])
|
adjust_clockwork_power(-repair_values["power_required"])
|
||||||
playsound(src, 'sound/machines/click.ogg', 50, 1)
|
playsound(src, 'sound/machines/click.ogg', 50, 1)
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
if(ishuman(M.current))
|
if(ishuman(M.current))
|
||||||
human_servants++
|
human_servants++
|
||||||
construct_limit = human_servants / 4 //1 per 4 human servants, and a maximum of 3 marauders
|
construct_limit = human_servants / 4 //1 per 4 human servants, and a maximum of 3 marauders
|
||||||
construct_limit = Clamp(construct_limit, 1, 3)
|
construct_limit = CLAMP(construct_limit, 1, 3)
|
||||||
|
|
||||||
/datum/clockwork_scripture/create_object/construct/clockwork_marauder/pre_recital()
|
/datum/clockwork_scripture/create_object/construct/clockwork_marauder/pre_recital()
|
||||||
channel_time = initial(channel_time)
|
channel_time = initial(channel_time)
|
||||||
|
|||||||
@@ -60,4 +60,4 @@
|
|||||||
break
|
break
|
||||||
if(!M)
|
if(!M)
|
||||||
M = H.apply_status_effect(STATUS_EFFECT_MANIAMOTOR, src)
|
M = H.apply_status_effect(STATUS_EFFECT_MANIAMOTOR, src)
|
||||||
M.severity = Clamp(M.severity + ((11 - get_dist(src, H)) * efficiency * efficiency), 0, MAX_MANIA_SEVERITY)
|
M.severity = CLAMP(M.severity + ((11 - get_dist(src, H)) * efficiency * efficiency), 0, MAX_MANIA_SEVERITY)
|
||||||
|
|||||||
@@ -57,5 +57,5 @@
|
|||||||
L.confused = min(L.confused + 15, 50)
|
L.confused = min(L.confused + 15, 50)
|
||||||
L.dizziness = min(L.dizziness + 15, 50)
|
L.dizziness = min(L.dizziness + 15, 50)
|
||||||
if(L.confused >= 25)
|
if(L.confused >= 25)
|
||||||
L.Knockdown(Floor(L.confused * 0.8))
|
L.Knockdown(FLOOR(L.confused * 0.8, 1))
|
||||||
take_damage(max_integrity)
|
take_damage(max_integrity)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
if (prob(meteorminutes/2))
|
if (prob(meteorminutes/2))
|
||||||
wavetype = GLOB.meteors_catastrophic
|
wavetype = GLOB.meteors_catastrophic
|
||||||
|
|
||||||
var/ramp_up_final = Clamp(round(meteorminutes/rampupdelta), 1, 10)
|
var/ramp_up_final = CLAMP(round(meteorminutes/rampupdelta), 1, 10)
|
||||||
|
|
||||||
spawn_meteors(ramp_up_final, wavetype)
|
spawn_meteors(ramp_up_final, wavetype)
|
||||||
|
|
||||||
|
|||||||
@@ -353,7 +353,7 @@
|
|||||||
var/N = text2num(user_input)
|
var/N = text2num(user_input)
|
||||||
if(!N)
|
if(!N)
|
||||||
return
|
return
|
||||||
timer_set = Clamp(N,minimum_timer_set,maximum_timer_set)
|
timer_set = CLAMP(N,minimum_timer_set,maximum_timer_set)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if("safety")
|
if("safety")
|
||||||
if(auth && yes_code)
|
if(auth && yes_code)
|
||||||
|
|||||||
@@ -161,7 +161,7 @@
|
|||||||
return
|
return
|
||||||
log_activity("changed greater than charge filter to \"[new_filter]\"")
|
log_activity("changed greater than charge filter to \"[new_filter]\"")
|
||||||
if(new_filter)
|
if(new_filter)
|
||||||
new_filter = Clamp(new_filter, 0, 100)
|
new_filter = CLAMP(new_filter, 0, 100)
|
||||||
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
|
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
|
||||||
result_filters["Charge Above"] = new_filter
|
result_filters["Charge Above"] = new_filter
|
||||||
if(href_list["below_filter"])
|
if(href_list["below_filter"])
|
||||||
@@ -171,7 +171,7 @@
|
|||||||
return
|
return
|
||||||
log_activity("changed lesser than charge filter to \"[new_filter]\"")
|
log_activity("changed lesser than charge filter to \"[new_filter]\"")
|
||||||
if(new_filter)
|
if(new_filter)
|
||||||
new_filter = Clamp(new_filter, 0, 100)
|
new_filter = CLAMP(new_filter, 0, 100)
|
||||||
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
|
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
|
||||||
result_filters["Charge Below"] = new_filter
|
result_filters["Charge Below"] = new_filter
|
||||||
if(href_list["access_filter"])
|
if(href_list["access_filter"])
|
||||||
|
|||||||
@@ -206,7 +206,7 @@
|
|||||||
if("pressure")
|
if("pressure")
|
||||||
var/target = input("New target pressure:", name, output_info ? output_info["internal"] : 0) as num|null
|
var/target = input("New target pressure:", name, output_info ? output_info["internal"] : 0) as num|null
|
||||||
if(!isnull(target) && !..())
|
if(!isnull(target) && !..())
|
||||||
target = Clamp(target, 0, 50 * ONE_ATMOSPHERE)
|
target = CLAMP(target, 0, 50 * ONE_ATMOSPHERE)
|
||||||
signal.data += list("tag" = output_tag, "set_internal_pressure" = target)
|
signal.data += list("tag" = output_tag, "set_internal_pressure" = target)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
|
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
|
||||||
|
|||||||
@@ -337,12 +337,12 @@
|
|||||||
if(!num)
|
if(!num)
|
||||||
num = round(input(usr, "Choose pulse duration:", "Input an Integer", null) as num|null)
|
num = round(input(usr, "Choose pulse duration:", "Input an Integer", null) as num|null)
|
||||||
if(num)
|
if(num)
|
||||||
radduration = Wrap(num, 1, RADIATION_DURATION_MAX+1)
|
radduration = WRAP(num, 1, RADIATION_DURATION_MAX+1)
|
||||||
if("setstrength")
|
if("setstrength")
|
||||||
if(!num)
|
if(!num)
|
||||||
num = round(input(usr, "Choose pulse strength:", "Input an Integer", null) as num|null)
|
num = round(input(usr, "Choose pulse strength:", "Input an Integer", null) as num|null)
|
||||||
if(num)
|
if(num)
|
||||||
radstrength = Wrap(num, 1, RADIATION_STRENGTH_MAX+1)
|
radstrength = WRAP(num, 1, RADIATION_STRENGTH_MAX+1)
|
||||||
if("screen")
|
if("screen")
|
||||||
current_screen = href_list["text"]
|
current_screen = href_list["text"]
|
||||||
if("rejuv")
|
if("rejuv")
|
||||||
@@ -353,13 +353,13 @@
|
|||||||
if("setbufferlabel")
|
if("setbufferlabel")
|
||||||
var/text = sanitize(input(usr, "Input a new label:", "Input an Text", null) as text|null)
|
var/text = sanitize(input(usr, "Input a new label:", "Input an Text", null) as text|null)
|
||||||
if(num && text)
|
if(num && text)
|
||||||
num = Clamp(num, 1, NUMBER_OF_BUFFERS)
|
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||||
var/list/buffer_slot = buffer[num]
|
var/list/buffer_slot = buffer[num]
|
||||||
if(istype(buffer_slot))
|
if(istype(buffer_slot))
|
||||||
buffer_slot["label"] = text
|
buffer_slot["label"] = text
|
||||||
if("setbuffer")
|
if("setbuffer")
|
||||||
if(num && viable_occupant)
|
if(num && viable_occupant)
|
||||||
num = Clamp(num, 1, NUMBER_OF_BUFFERS)
|
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||||
buffer[num] = list(
|
buffer[num] = list(
|
||||||
"label"="Buffer[num]:[viable_occupant.real_name]",
|
"label"="Buffer[num]:[viable_occupant.real_name]",
|
||||||
"UI"=viable_occupant.dna.uni_identity,
|
"UI"=viable_occupant.dna.uni_identity,
|
||||||
@@ -370,7 +370,7 @@
|
|||||||
)
|
)
|
||||||
if("clearbuffer")
|
if("clearbuffer")
|
||||||
if(num)
|
if(num)
|
||||||
num = Clamp(num, 1, NUMBER_OF_BUFFERS)
|
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||||
var/list/buffer_slot = buffer[num]
|
var/list/buffer_slot = buffer[num]
|
||||||
if(istype(buffer_slot))
|
if(istype(buffer_slot))
|
||||||
buffer_slot.Cut()
|
buffer_slot.Cut()
|
||||||
@@ -387,7 +387,7 @@
|
|||||||
apply_buffer(SCANNER_ACTION_MIXED,num)
|
apply_buffer(SCANNER_ACTION_MIXED,num)
|
||||||
if("injector")
|
if("injector")
|
||||||
if(num && injectorready < world.time)
|
if(num && injectorready < world.time)
|
||||||
num = Clamp(num, 1, NUMBER_OF_BUFFERS)
|
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||||
var/list/buffer_slot = buffer[num]
|
var/list/buffer_slot = buffer[num]
|
||||||
if(istype(buffer_slot))
|
if(istype(buffer_slot))
|
||||||
var/obj/item/dnainjector/timed/I
|
var/obj/item/dnainjector/timed/I
|
||||||
@@ -436,11 +436,11 @@
|
|||||||
injectorready = world.time + INJECTOR_TIMEOUT
|
injectorready = world.time + INJECTOR_TIMEOUT
|
||||||
if("loaddisk")
|
if("loaddisk")
|
||||||
if(num && diskette && diskette.fields)
|
if(num && diskette && diskette.fields)
|
||||||
num = Clamp(num, 1, NUMBER_OF_BUFFERS)
|
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||||
buffer[num] = diskette.fields.Copy()
|
buffer[num] = diskette.fields.Copy()
|
||||||
if("savedisk")
|
if("savedisk")
|
||||||
if(num && diskette && !diskette.read_only)
|
if(num && diskette && !diskette.read_only)
|
||||||
num = Clamp(num, 1, NUMBER_OF_BUFFERS)
|
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||||
var/list/buffer_slot = buffer[num]
|
var/list/buffer_slot = buffer[num]
|
||||||
if(istype(buffer_slot))
|
if(istype(buffer_slot))
|
||||||
diskette.name = "data disk \[[buffer_slot["label"]]\]"
|
diskette.name = "data disk \[[buffer_slot["label"]]\]"
|
||||||
@@ -454,8 +454,8 @@
|
|||||||
delayed_action = list("action"=text2num(href_list["delayaction"]),"buffer"=num)
|
delayed_action = list("action"=text2num(href_list["delayaction"]),"buffer"=num)
|
||||||
if("pulseui","pulsese")
|
if("pulseui","pulsese")
|
||||||
if(num && viable_occupant && connected)
|
if(num && viable_occupant && connected)
|
||||||
radduration = Wrap(radduration, 1, RADIATION_DURATION_MAX+1)
|
radduration = WRAP(radduration, 1, RADIATION_DURATION_MAX+1)
|
||||||
radstrength = Wrap(radstrength, 1, RADIATION_STRENGTH_MAX+1)
|
radstrength = WRAP(radstrength, 1, RADIATION_STRENGTH_MAX+1)
|
||||||
|
|
||||||
var/locked_state = connected.locked
|
var/locked_state = connected.locked
|
||||||
connected.locked = TRUE
|
connected.locked = TRUE
|
||||||
@@ -471,7 +471,7 @@
|
|||||||
switch(href_list["task"]) //Same thing as there but values are even lower, on best part they are about 0.0*, effectively no damage
|
switch(href_list["task"]) //Same thing as there but values are even lower, on best part they are about 0.0*, effectively no damage
|
||||||
if("pulseui")
|
if("pulseui")
|
||||||
var/len = length(viable_occupant.dna.uni_identity)
|
var/len = length(viable_occupant.dna.uni_identity)
|
||||||
num = Wrap(num, 1, len+1)
|
num = WRAP(num, 1, len+1)
|
||||||
num = randomize_radiation_accuracy(num, radduration + (connected.precision_coeff ** 2), len) //Each manipulator level above 1 makes randomization as accurate as selected time + manipulator lvl^2
|
num = randomize_radiation_accuracy(num, radduration + (connected.precision_coeff ** 2), len) //Each manipulator level above 1 makes randomization as accurate as selected time + manipulator lvl^2
|
||||||
//Value is this high for the same reason as with laser - not worth the hassle of upgrading if the bonus is low
|
//Value is this high for the same reason as with laser - not worth the hassle of upgrading if the bonus is low
|
||||||
var/block = round((num-1)/DNA_BLOCK_SIZE)+1
|
var/block = round((num-1)/DNA_BLOCK_SIZE)+1
|
||||||
@@ -487,7 +487,7 @@
|
|||||||
viable_occupant.updateappearance(mutations_overlay_update=1)
|
viable_occupant.updateappearance(mutations_overlay_update=1)
|
||||||
if("pulsese")
|
if("pulsese")
|
||||||
var/len = length(viable_occupant.dna.struc_enzymes)
|
var/len = length(viable_occupant.dna.struc_enzymes)
|
||||||
num = Wrap(num, 1, len+1)
|
num = WRAP(num, 1, len+1)
|
||||||
num = randomize_radiation_accuracy(num, radduration + (connected.precision_coeff ** 2), len)
|
num = randomize_radiation_accuracy(num, radduration + (connected.precision_coeff ** 2), len)
|
||||||
|
|
||||||
var/block = round((num-1)/DNA_BLOCK_SIZE)+1
|
var/block = round((num-1)/DNA_BLOCK_SIZE)+1
|
||||||
@@ -518,10 +518,11 @@
|
|||||||
ran = round(ran) //negative, so floor it
|
ran = round(ran) //negative, so floor it
|
||||||
else
|
else
|
||||||
ran = -round(-ran) //positive, so ceiling it
|
ran = -round(-ran) //positive, so ceiling it
|
||||||
return num2hex(Wrap(hex2num(input)+ran, 0, 16**length), length)
|
return num2hex(WRAP(hex2num(input)+ran, 0, 16**length), length)
|
||||||
|
|
||||||
/obj/machinery/computer/scan_consolenew/proc/randomize_radiation_accuracy(position_we_were_supposed_to_hit, radduration, number_of_blocks)
|
/obj/machinery/computer/scan_consolenew/proc/randomize_radiation_accuracy(position, radduration, number_of_blocks)
|
||||||
return Wrap(round(position_we_were_supposed_to_hit + gaussian(0, RADIATION_ACCURACY_MULTIPLIER/radduration), 1), 1, number_of_blocks+1)
|
var/val = round(gaussian(0, RADIATION_ACCURACY_MULTIPLIER/radduration) + position, 1)
|
||||||
|
return WRAP(val, 1, number_of_blocks+1)
|
||||||
|
|
||||||
/obj/machinery/computer/scan_consolenew/proc/get_viable_occupant()
|
/obj/machinery/computer/scan_consolenew/proc/get_viable_occupant()
|
||||||
var/mob/living/carbon/viable_occupant = null
|
var/mob/living/carbon/viable_occupant = null
|
||||||
@@ -532,7 +533,7 @@
|
|||||||
return viable_occupant
|
return viable_occupant
|
||||||
|
|
||||||
/obj/machinery/computer/scan_consolenew/proc/apply_buffer(action,buffer_num)
|
/obj/machinery/computer/scan_consolenew/proc/apply_buffer(action,buffer_num)
|
||||||
buffer_num = Clamp(buffer_num, 1, NUMBER_OF_BUFFERS)
|
buffer_num = CLAMP(buffer_num, 1, NUMBER_OF_BUFFERS)
|
||||||
var/list/buffer_slot = buffer[buffer_num]
|
var/list/buffer_slot = buffer[buffer_num]
|
||||||
var/mob/living/carbon/viable_occupant = get_viable_occupant()
|
var/mob/living/carbon/viable_occupant = get_viable_occupant()
|
||||||
if(istype(buffer_slot))
|
if(istype(buffer_slot))
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
return
|
return
|
||||||
if(!new_goal)
|
if(!new_goal)
|
||||||
new_goal = default_goal
|
new_goal = default_goal
|
||||||
id.goal = Clamp(new_goal, 0, 1000) //maximum 1000 points
|
id.goal = CLAMP(new_goal, 0, 1000) //maximum 1000 points
|
||||||
if("toggle_open")
|
if("toggle_open")
|
||||||
if(teleporter.locked)
|
if(teleporter.locked)
|
||||||
to_chat(usr, "The teleporter is locked")
|
to_chat(usr, "The teleporter is locked")
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ GLOBAL_LIST_INIT(possible_uplinker_IDs, list("Alfa","Bravo","Charlie","Delta","E
|
|||||||
..()
|
..()
|
||||||
var/list/nukeops = get_antagonists(/datum/antagonist/nukeop)
|
var/list/nukeops = get_antagonists(/datum/antagonist/nukeop)
|
||||||
var/danger = GLOB.joined_player_list.len - nukeops.len
|
var/danger = GLOB.joined_player_list.len - nukeops.len
|
||||||
danger = Ceiling(danger, 10)
|
danger = CEILING(danger, 10)
|
||||||
scaleTC(danger)
|
scaleTC(danger)
|
||||||
|
|
||||||
/obj/machinery/computer/telecrystals/boss/proc/scaleTC(amt)//Its own proc, since it'll probably need a lot of tweaks for balance, use a fancier algorhithm, etc.
|
/obj/machinery/computer/telecrystals/boss/proc/scaleTC(amt)//Its own proc, since it'll probably need a lot of tweaks for balance, use a fancier algorhithm, etc.
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
to_chat(user, "<span class='notice'>You begin repairing [src]...</span>")
|
to_chat(user, "<span class='notice'>You begin repairing [src]...</span>")
|
||||||
playsound(loc, WT.usesound, 40, 1)
|
playsound(loc, WT.usesound, 40, 1)
|
||||||
if(do_after(user, 40*I.toolspeed, target = src))
|
if(do_after(user, 40*I.toolspeed, target = src))
|
||||||
obj_integrity = Clamp(obj_integrity + 20, 0, max_integrity)
|
obj_integrity = CLAMP(obj_integrity + 20, 0, max_integrity)
|
||||||
else
|
else
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@
|
|||||||
. /= 10
|
. /= 10
|
||||||
|
|
||||||
/obj/machinery/door_timer/proc/set_timer(value)
|
/obj/machinery/door_timer/proc/set_timer(value)
|
||||||
var/new_time = Clamp(value,0,MAX_TIMER)
|
var/new_time = CLAMP(value,0,MAX_TIMER)
|
||||||
. = new_time == timer_duration //return 1 on no change
|
. = new_time == timer_duration //return 1 on no change
|
||||||
timer_duration = new_time
|
timer_duration = new_time
|
||||||
|
|
||||||
|
|||||||
@@ -53,9 +53,9 @@
|
|||||||
new /obj/item/pipe_meter(loc)
|
new /obj/item/pipe_meter(loc)
|
||||||
wait = world.time + 15
|
wait = world.time + 15
|
||||||
if(href_list["layer_up"])
|
if(href_list["layer_up"])
|
||||||
piping_layer = Clamp(++piping_layer, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
piping_layer = CLAMP(++piping_layer, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||||
if(href_list["layer_down"])
|
if(href_list["layer_down"])
|
||||||
piping_layer = Clamp(--piping_layer, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
piping_layer = CLAMP(--piping_layer, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/machinery/pipedispenser/attackby(obj/item/W, mob/user, params)
|
/obj/machinery/pipedispenser/attackby(obj/item/W, mob/user, params)
|
||||||
|
|||||||
@@ -262,7 +262,7 @@
|
|||||||
use_stored_power(50)
|
use_stored_power(50)
|
||||||
|
|
||||||
/obj/machinery/shieldwallgen/proc/use_stored_power(amount)
|
/obj/machinery/shieldwallgen/proc/use_stored_power(amount)
|
||||||
power = Clamp(power - amount, 0, maximum_stored_power)
|
power = CLAMP(power - amount, 0, maximum_stored_power)
|
||||||
update_activity()
|
update_activity()
|
||||||
|
|
||||||
/obj/machinery/shieldwallgen/proc/update_activity()
|
/obj/machinery/shieldwallgen/proc/update_activity()
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
settableTemperatureRange = cap * 30
|
settableTemperatureRange = cap * 30
|
||||||
efficiency = (cap + 1) * 10000
|
efficiency = (cap + 1) * 10000
|
||||||
|
|
||||||
targetTemperature = Clamp(targetTemperature,
|
targetTemperature = CLAMP(targetTemperature,
|
||||||
max(settableTemperatureMedian - settableTemperatureRange, TCMB),
|
max(settableTemperatureMedian - settableTemperatureRange, TCMB),
|
||||||
settableTemperatureMedian + settableTemperatureRange)
|
settableTemperatureMedian + settableTemperatureRange)
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
target= text2num(target) + T0C
|
target= text2num(target) + T0C
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if(.)
|
if(.)
|
||||||
targetTemperature = Clamp(round(target),
|
targetTemperature = CLAMP(round(target),
|
||||||
max(settableTemperatureMedian - settableTemperatureRange, TCMB),
|
max(settableTemperatureMedian - settableTemperatureRange, TCMB),
|
||||||
settableTemperatureMedian + settableTemperatureRange)
|
settableTemperatureMedian + settableTemperatureRange)
|
||||||
if("eject")
|
if("eject")
|
||||||
|
|||||||
@@ -205,7 +205,7 @@
|
|||||||
/obj/machinery/syndicatebomb/proc/settings(mob/user)
|
/obj/machinery/syndicatebomb/proc/settings(mob/user)
|
||||||
var/new_timer = input(user, "Please set the timer.", "Timer", "[timer_set]") as num
|
var/new_timer = input(user, "Please set the timer.", "Timer", "[timer_set]") as num
|
||||||
if(in_range(src, user) && isliving(user)) //No running off and setting bombs from across the station
|
if(in_range(src, user) && isliving(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'>[icon2html(src, viewers(src))] timer set for [timer_set] seconds.</span>")
|
loc.visible_message("<span class='notice'>[icon2html(src, viewers(src))] timer set for [timer_set] seconds.</span>")
|
||||||
if(alert(user,"Would you like to start the countdown now?",,"Yes","No") == "Yes" && in_range(src, user) && isliving(user))
|
if(alert(user,"Would you like to start the countdown now?",,"Yes","No") == "Yes" && in_range(src, user) && isliving(user))
|
||||||
if(defused || active)
|
if(defused || active)
|
||||||
|
|||||||
@@ -175,7 +175,7 @@
|
|||||||
for(var/datum/data/vending_product/machine_content in machine)
|
for(var/datum/data/vending_product/machine_content in machine)
|
||||||
if(refill.charges[charge_type] == 0)
|
if(refill.charges[charge_type] == 0)
|
||||||
break
|
break
|
||||||
var/restock = Ceiling(((machine_content.max_amount - machine_content.amount)/to_restock)*tmp_charges)
|
var/restock = CEILING(((machine_content.max_amount - machine_content.amount)/to_restock)*tmp_charges, 1)
|
||||||
if(restock > refill.charges[charge_type])
|
if(restock > refill.charges[charge_type])
|
||||||
restock = refill.charges[charge_type]
|
restock = refill.charges[charge_type]
|
||||||
machine_content.amount += restock
|
machine_content.amount += restock
|
||||||
|
|||||||
@@ -186,7 +186,7 @@
|
|||||||
return queue.len
|
return queue.len
|
||||||
|
|
||||||
/obj/machinery/mecha_part_fabricator/proc/remove_from_queue(index)
|
/obj/machinery/mecha_part_fabricator/proc/remove_from_queue(index)
|
||||||
if(!isnum(index) || !IsInteger(index) || !istype(queue) || (index<1 || index>queue.len))
|
if(!isnum(index) || !ISINTEGER(index) || !istype(queue) || (index<1 || index>queue.len))
|
||||||
return FALSE
|
return FALSE
|
||||||
queue.Cut(index,++index)
|
queue.Cut(index,++index)
|
||||||
return TRUE
|
return TRUE
|
||||||
@@ -373,8 +373,8 @@
|
|||||||
if(href_list["queue_move"] && href_list["index"])
|
if(href_list["queue_move"] && href_list["index"])
|
||||||
var/index = afilter.getNum("index")
|
var/index = afilter.getNum("index")
|
||||||
var/new_index = index + afilter.getNum("queue_move")
|
var/new_index = index + afilter.getNum("queue_move")
|
||||||
if(isnum(index) && isnum(new_index) && IsInteger(index) && IsInteger(new_index))
|
if(isnum(index) && isnum(new_index) && ISINTEGER(index) && ISINTEGER(new_index))
|
||||||
if(IsInRange(new_index,1,queue.len))
|
if(ISINRANGE(new_index,1,queue.len))
|
||||||
queue.Swap(index,new_index)
|
queue.Swap(index,new_index)
|
||||||
return update_queue_on_page()
|
return update_queue_on_page()
|
||||||
if(href_list["clear_queue"])
|
if(href_list["clear_queue"])
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
/obj/mecha/working/ripley/mining/Initialize()
|
/obj/mecha/working/ripley/mining/Initialize()
|
||||||
. = ..()
|
. = ..()
|
||||||
if(cell)
|
if(cell)
|
||||||
cell.charge = Floor(cell.charge * 0.25) //Starts at very low charge
|
cell.charge = FLOOR(cell.charge * 0.25, 1) //Starts at very low charge
|
||||||
if(prob(70)) //Maybe add a drill
|
if(prob(70)) //Maybe add a drill
|
||||||
if(prob(15)) //Possible diamond drill... Feeling lucky?
|
if(prob(15)) //Possible diamond drill... Feeling lucky?
|
||||||
var/obj/item/mecha_parts/mecha_equipment/drill/diamonddrill/D = new
|
var/obj/item/mecha_parts/mecha_equipment/drill/diamonddrill/D = new
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
aSignal.code = rand(1,100)
|
aSignal.code = rand(1,100)
|
||||||
|
|
||||||
aSignal.frequency = rand(MIN_FREE_FREQ, MAX_FREE_FREQ)
|
aSignal.frequency = rand(MIN_FREE_FREQ, MAX_FREE_FREQ)
|
||||||
if(IsMultiple(aSignal.frequency, 2))//signaller frequencies are always uneven!
|
if(ISMULTIPLE(aSignal.frequency, 2))//signaller frequencies are always uneven!
|
||||||
aSignal.frequency++
|
aSignal.frequency++
|
||||||
|
|
||||||
if(new_lifespan)
|
if(new_lifespan)
|
||||||
|
|||||||
@@ -187,7 +187,7 @@
|
|||||||
|
|
||||||
/obj/effect/chrono_field/update_icon()
|
/obj/effect/chrono_field/update_icon()
|
||||||
var/ttk_frame = 1 - (tickstokill / initial(tickstokill))
|
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)
|
if(ttk_frame != RPpos)
|
||||||
RPpos = ttk_frame
|
RPpos = ttk_frame
|
||||||
mob_underlay.icon_state = "frame[RPpos]"
|
mob_underlay.icon_state = "frame[RPpos]"
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
if(powered) //so it doesn't show charge if it's unpowered
|
if(powered) //so it doesn't show charge if it's unpowered
|
||||||
if(cell)
|
if(cell)
|
||||||
var/ratio = cell.charge / cell.maxcharge
|
var/ratio = cell.charge / cell.maxcharge
|
||||||
ratio = Ceiling(ratio*4) * 25
|
ratio = CEILING(ratio*4, 1) * 25
|
||||||
add_overlay("[initial(icon_state)]-charge[ratio]")
|
add_overlay("[initial(icon_state)]-charge[ratio]")
|
||||||
|
|
||||||
/obj/item/defibrillator/CheckParts(list/parts_list)
|
/obj/item/defibrillator/CheckParts(list/parts_list)
|
||||||
|
|||||||
@@ -169,7 +169,7 @@
|
|||||||
|
|
||||||
// Negative numbers will subtract
|
// Negative numbers will subtract
|
||||||
/obj/item/device/lightreplacer/proc/AddUses(amount = 1)
|
/obj/item/device/lightreplacer/proc/AddUses(amount = 1)
|
||||||
uses = Clamp(uses + amount, 0, max_uses)
|
uses = CLAMP(uses + amount, 0, max_uses)
|
||||||
|
|
||||||
/obj/item/device/lightreplacer/proc/AddShards(amount = 1, user)
|
/obj/item/device/lightreplacer/proc/AddShards(amount = 1, user)
|
||||||
bulb_shards += amount
|
bulb_shards += amount
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ effective or pretty fucking useless.
|
|||||||
charge = max(0,charge - 25)//Quick decrease in light
|
charge = max(0,charge - 25)//Quick decrease in light
|
||||||
else
|
else
|
||||||
charge = min(max_charge,charge + 50) //Charge in the dark
|
charge = min(max_charge,charge + 50) //Charge in the dark
|
||||||
animate(user,alpha = Clamp(255 - charge,0,255),time = 10)
|
animate(user,alpha = CLAMP(255 - charge,0,255),time = 10)
|
||||||
|
|
||||||
|
|
||||||
/obj/item/device/jammer
|
/obj/item/device/jammer
|
||||||
|
|||||||
@@ -166,7 +166,7 @@
|
|||||||
/obj/item/dice/proc/diceroll(mob/user)
|
/obj/item/dice/proc/diceroll(mob/user)
|
||||||
result = rand(1, sides)
|
result = rand(1, sides)
|
||||||
if(rigged && result != rigged)
|
if(rigged && result != rigged)
|
||||||
if(prob(Clamp(1/(sides - 1) * 100, 25, 80)))
|
if(prob(CLAMP(1/(sides - 1) * 100, 25, 80)))
|
||||||
result = rigged
|
result = rigged
|
||||||
var/fake_result = rand(1, sides)//Daredevil isn't as good as he used to be
|
var/fake_result = rand(1, sides)//Daredevil isn't as good as he used to be
|
||||||
var/comment = ""
|
var/comment = ""
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
return
|
return
|
||||||
var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num
|
var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num
|
||||||
if(user.get_active_held_item() == src)
|
if(user.get_active_held_item() == src)
|
||||||
newtime = Clamp(newtime, 10, 60000)
|
newtime = CLAMP(newtime, 10, 60000)
|
||||||
det_time = newtime
|
det_time = newtime
|
||||||
to_chat(user, "Timer set for [det_time] seconds.")
|
to_chat(user, "Timer set for [det_time] seconds.")
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@
|
|||||||
/obj/item/grenade/plastic/c4/attack_self(mob/user)
|
/obj/item/grenade/plastic/c4/attack_self(mob/user)
|
||||||
var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num
|
var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num
|
||||||
if(user.get_active_held_item() == src)
|
if(user.get_active_held_item() == src)
|
||||||
newtime = Clamp(newtime, 10, 60000)
|
newtime = CLAMP(newtime, 10, 60000)
|
||||||
timer = newtime
|
timer = newtime
|
||||||
to_chat(user, "Timer set for [timer] seconds.")
|
to_chat(user, "Timer set for [timer] seconds.")
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
drowse()
|
drowse()
|
||||||
return
|
return
|
||||||
if(bloodthirst < HIS_GRACE_CONSUME_OWNER)
|
if(bloodthirst < HIS_GRACE_CONSUME_OWNER)
|
||||||
adjust_bloodthirst(1 + Floor(LAZYLEN(contents) * 0.5)) //Maybe adjust this?
|
adjust_bloodthirst(1 + FLOOR(LAZYLEN(contents) * 0.5, 1)) //Maybe adjust this?
|
||||||
else
|
else
|
||||||
adjust_bloodthirst(1) //don't cool off rapidly once we're at the point where His Grace consumes all.
|
adjust_bloodthirst(1) //don't cool off rapidly once we're at the point where His Grace consumes all.
|
||||||
var/mob/living/master = get_atom_on_turf(src, /mob/living)
|
var/mob/living/master = get_atom_on_turf(src, /mob/living)
|
||||||
@@ -164,9 +164,9 @@
|
|||||||
/obj/item/his_grace/proc/adjust_bloodthirst(amt)
|
/obj/item/his_grace/proc/adjust_bloodthirst(amt)
|
||||||
prev_bloodthirst = bloodthirst
|
prev_bloodthirst = bloodthirst
|
||||||
if(prev_bloodthirst < HIS_GRACE_CONSUME_OWNER)
|
if(prev_bloodthirst < HIS_GRACE_CONSUME_OWNER)
|
||||||
bloodthirst = Clamp(bloodthirst + amt, HIS_GRACE_SATIATED, HIS_GRACE_CONSUME_OWNER)
|
bloodthirst = CLAMP(bloodthirst + amt, HIS_GRACE_SATIATED, HIS_GRACE_CONSUME_OWNER)
|
||||||
else
|
else
|
||||||
bloodthirst = Clamp(bloodthirst + amt, HIS_GRACE_CONSUME_OWNER, HIS_GRACE_FALL_ASLEEP)
|
bloodthirst = CLAMP(bloodthirst + amt, HIS_GRACE_CONSUME_OWNER, HIS_GRACE_FALL_ASLEEP)
|
||||||
update_stats()
|
update_stats()
|
||||||
|
|
||||||
/obj/item/his_grace/proc/update_stats()
|
/obj/item/his_grace/proc/update_stats()
|
||||||
|
|||||||
@@ -198,8 +198,8 @@
|
|||||||
return target
|
return target
|
||||||
var/x_o = (target.x - starting.x)
|
var/x_o = (target.x - starting.x)
|
||||||
var/y_o = (target.y - starting.y)
|
var/y_o = (target.y - starting.y)
|
||||||
var/new_x = Clamp((starting.x + (x_o * range_multiplier)), 0, world.maxx)
|
var/new_x = CLAMP((starting.x + (x_o * range_multiplier)), 0, world.maxx)
|
||||||
var/new_y = Clamp((starting.y + (y_o * range_multiplier)), 0, world.maxy)
|
var/new_y = CLAMP((starting.y + (y_o * range_multiplier)), 0, world.maxy)
|
||||||
var/turf/newtarget = locate(new_x, new_y, starting.z)
|
var/turf/newtarget = locate(new_x, new_y, starting.z)
|
||||||
return newtarget
|
return newtarget
|
||||||
|
|
||||||
|
|||||||
@@ -616,7 +616,7 @@
|
|||||||
continue
|
continue
|
||||||
usage += projectile_tick_speed_ecost
|
usage += projectile_tick_speed_ecost
|
||||||
usage += (tracked[I] * projectile_damage_tick_ecost_coefficient)
|
usage += (tracked[I] * projectile_damage_tick_ecost_coefficient)
|
||||||
energy = Clamp(energy - usage, 0, maxenergy)
|
energy = CLAMP(energy - usage, 0, maxenergy)
|
||||||
if(energy <= 0)
|
if(energy <= 0)
|
||||||
deactivate_field()
|
deactivate_field()
|
||||||
visible_message("<span class='warning'>[src] blinks \"ENERGY DEPLETED\".</span>")
|
visible_message("<span class='warning'>[src] blinks \"ENERGY DEPLETED\".</span>")
|
||||||
@@ -626,7 +626,7 @@
|
|||||||
if(iscyborg(host.loc))
|
if(iscyborg(host.loc))
|
||||||
host = host.loc
|
host = host.loc
|
||||||
else
|
else
|
||||||
energy = Clamp(energy + energy_recharge, 0, maxenergy)
|
energy = CLAMP(energy + energy_recharge, 0, maxenergy)
|
||||||
return
|
return
|
||||||
if((host.cell.charge >= (host.cell.maxcharge * cyborg_cell_critical_percentage)) && (energy < maxenergy))
|
if((host.cell.charge >= (host.cell.maxcharge * cyborg_cell_critical_percentage)) && (energy < maxenergy))
|
||||||
host.cell.use(energy_recharge*energy_recharge_cyborg_drain_coefficient)
|
host.cell.use(energy_recharge*energy_recharge_cyborg_drain_coefficient)
|
||||||
|
|||||||
@@ -35,14 +35,14 @@
|
|||||||
if(TH.force_wielded > initial(TH.force_wielded))
|
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>")
|
to_chat(user, "<span class='warning'>[TH] has already been refined before. It cannot be sharpened further!</span>")
|
||||||
return
|
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))
|
if(I.force > initial(I.force))
|
||||||
to_chat(user, "<span class='warning'>[I] has already been refined before. It cannot be sharpened further!</span>")
|
to_chat(user, "<span class='warning'>[I] has already been refined before. It cannot be sharpened further!</span>")
|
||||||
return
|
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>")
|
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>")
|
||||||
I.sharpness = IS_SHARP_ACCURATE
|
I.sharpness = IS_SHARP_ACCURATE
|
||||||
I.force = Clamp(I.force + increment, 0, max)
|
I.force = CLAMP(I.force + increment, 0, max)
|
||||||
I.throwforce = Clamp(I.throwforce + increment, 0, max)
|
I.throwforce = CLAMP(I.throwforce + increment, 0, max)
|
||||||
I.name = "[prefix] [I.name]"
|
I.name = "[prefix] [I.name]"
|
||||||
name = "worn out [name]"
|
name = "worn out [name]"
|
||||||
desc = "[desc] At least, it used to."
|
desc = "[desc] At least, it used to."
|
||||||
|
|||||||
@@ -48,9 +48,9 @@
|
|||||||
|
|
||||||
/obj/item/stack/proc/update_weight()
|
/obj/item/stack/proc/update_weight()
|
||||||
if(amount <= (max_amount * (1/3)))
|
if(amount <= (max_amount * (1/3)))
|
||||||
w_class = Clamp(full_w_class-2, WEIGHT_CLASS_TINY, full_w_class)
|
w_class = CLAMP(full_w_class-2, WEIGHT_CLASS_TINY, full_w_class)
|
||||||
else if (amount <= (max_amount * (2/3)))
|
else if (amount <= (max_amount * (2/3)))
|
||||||
w_class = Clamp(full_w_class-1, WEIGHT_CLASS_TINY, full_w_class)
|
w_class = CLAMP(full_w_class-1, WEIGHT_CLASS_TINY, full_w_class)
|
||||||
else
|
else
|
||||||
w_class = full_w_class
|
w_class = full_w_class
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@
|
|||||||
pressure = text2num(pressure)
|
pressure = text2num(pressure)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if(.)
|
if(.)
|
||||||
distribute_pressure = Clamp(round(pressure), TANK_MIN_RELEASE_PRESSURE, TANK_MAX_RELEASE_PRESSURE)
|
distribute_pressure = CLAMP(round(pressure), TANK_MIN_RELEASE_PRESSURE, TANK_MAX_RELEASE_PRESSURE)
|
||||||
|
|
||||||
/obj/item/tank/remove_air(amount)
|
/obj/item/tank/remove_air(amount)
|
||||||
return air_contents.remove(amount)
|
return air_contents.remove(amount)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
cut_overlays()
|
cut_overlays()
|
||||||
if(change_icons)
|
if(change_icons)
|
||||||
var/ratio = get_fuel() / max_fuel
|
var/ratio = get_fuel() / max_fuel
|
||||||
ratio = Ceiling(ratio*4) * 25
|
ratio = CEILING(ratio*4, 1) * 25
|
||||||
add_overlay("[initial(icon_state)][ratio]")
|
add_overlay("[initial(icon_state)][ratio]")
|
||||||
update_torch()
|
update_torch()
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e
|
|||||||
if(T.intact && level == 1) //fire can't damage things hidden below the floor.
|
if(T.intact && level == 1) //fire can't damage things hidden below the floor.
|
||||||
return
|
return
|
||||||
if(exposed_temperature && !(resistance_flags & FIRE_PROOF))
|
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))
|
if(!(resistance_flags & ON_FIRE) && (resistance_flags & FLAMMABLE))
|
||||||
resistance_flags |= ON_FIRE
|
resistance_flags |= ON_FIRE
|
||||||
SSfire_burning.processing[src] = src
|
SSfire_burning.processing[src] = src
|
||||||
|
|||||||
@@ -129,7 +129,7 @@
|
|||||||
if(burn_time_remaining() < MAXIMUM_BURN_TIMER)
|
if(burn_time_remaining() < MAXIMUM_BURN_TIMER)
|
||||||
flame_expiry_timer = world.time + MAXIMUM_BURN_TIMER
|
flame_expiry_timer = world.time + MAXIMUM_BURN_TIMER
|
||||||
else
|
else
|
||||||
fuel_added = Clamp(fuel_added + amount, 0, MAXIMUM_BURN_TIMER)
|
fuel_added = CLAMP(fuel_added + amount, 0, MAXIMUM_BURN_TIMER)
|
||||||
|
|
||||||
/obj/structure/fireplace/proc/burn_time_remaining()
|
/obj/structure/fireplace/proc/burn_time_remaining()
|
||||||
if(lit)
|
if(lit)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
var/ratio = obj_integrity / max_integrity
|
var/ratio = obj_integrity / max_integrity
|
||||||
ratio = Ceiling(ratio*4) * 25
|
ratio = CEILING(ratio*4, 1) * 25
|
||||||
|
|
||||||
if(smooth)
|
if(smooth)
|
||||||
queue_smooth(src)
|
queue_smooth(src)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
resistance_flags |= INDESTRUCTIBLE
|
resistance_flags |= INDESTRUCTIBLE
|
||||||
|
|
||||||
/obj/structure/lattice/clockwork/ratvar_act()
|
/obj/structure/lattice/clockwork/ratvar_act()
|
||||||
if(IsOdd(x+y))
|
if(ISODD(x+y))
|
||||||
icon = 'icons/obj/smooth_structures/lattice_clockwork_large.dmi'
|
icon = 'icons/obj/smooth_structures/lattice_clockwork_large.dmi'
|
||||||
pixel_x = -9
|
pixel_x = -9
|
||||||
pixel_y = -9
|
pixel_y = -9
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
resistance_flags |= INDESTRUCTIBLE
|
resistance_flags |= INDESTRUCTIBLE
|
||||||
|
|
||||||
/obj/structure/lattice/catwalk/clockwork/ratvar_act()
|
/obj/structure/lattice/catwalk/clockwork/ratvar_act()
|
||||||
if(IsOdd(x+y))
|
if(ISODD(x+y))
|
||||||
icon = 'icons/obj/smooth_structures/catwalk_clockwork_large.dmi'
|
icon = 'icons/obj/smooth_structures/catwalk_clockwork_large.dmi'
|
||||||
pixel_x = -9
|
pixel_x = -9
|
||||||
pixel_y = -9
|
pixel_y = -9
|
||||||
|
|||||||
@@ -119,7 +119,7 @@
|
|||||||
else
|
else
|
||||||
cur_oct[cur_note] = text2num(ni)
|
cur_oct[cur_note] = text2num(ni)
|
||||||
if(user.dizziness > 0 && prob(user.dizziness / 2))
|
if(user.dizziness > 0 && prob(user.dizziness / 2))
|
||||||
cur_note = Clamp(cur_note + rand(round(-user.dizziness / 10), round(user.dizziness / 10)), 1, 7)
|
cur_note = CLAMP(cur_note + rand(round(-user.dizziness / 10), round(user.dizziness / 10)), 1, 7)
|
||||||
if(user.dizziness > 0 && prob(user.dizziness / 5))
|
if(user.dizziness > 0 && prob(user.dizziness / 5))
|
||||||
if(prob(30))
|
if(prob(30))
|
||||||
cur_acc[cur_note] = "#"
|
cur_acc[cur_note] = "#"
|
||||||
|
|||||||
@@ -165,7 +165,7 @@
|
|||||||
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
|
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
|
||||||
return
|
return
|
||||||
if(!isnull(new_angle))
|
if(!isnull(new_angle))
|
||||||
setAngle(NORM_ROT(new_angle))
|
setAngle(SIMPLIFY_DEGREES(new_angle))
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
/obj/structure/reflector/AltClick(mob/user)
|
/obj/structure/reflector/AltClick(mob/user)
|
||||||
@@ -197,16 +197,12 @@
|
|||||||
anchored = TRUE
|
anchored = TRUE
|
||||||
|
|
||||||
/obj/structure/reflector/single/auto_reflect(obj/item/projectile/P, pdir, turf/ploc, pangle)
|
/obj/structure/reflector/single/auto_reflect(obj/item/projectile/P, pdir, turf/ploc, pangle)
|
||||||
var/incidence = get_angle_of_incidence(rotation_angle, P.Angle)
|
var/incidence = GET_ANGLE_OF_INCIDENCE(rotation_angle, P.Angle)
|
||||||
var/incidence_norm = get_angle_of_incidence(rotation_angle, P.Angle, FALSE)
|
var/norm_inc = WRAP(incidence, -90, 90)
|
||||||
if((incidence_norm > -90) && (incidence_norm < 90))
|
var/new_angle = WRAP(rotation_angle + norm_inc, 180, -180)
|
||||||
|
if(ISINRANGE_EX(norm_inc, -90, 90))
|
||||||
return FALSE
|
return FALSE
|
||||||
var/new_angle_s = rotation_angle + incidence
|
P.Angle = new_angle
|
||||||
while(new_angle_s > 180) // Translate to regular projectile degrees
|
|
||||||
new_angle_s -= 360
|
|
||||||
while(new_angle_s < -180)
|
|
||||||
new_angle_s += 360
|
|
||||||
P.Angle = new_angle_s
|
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
//DOUBLE
|
//DOUBLE
|
||||||
@@ -228,17 +224,12 @@
|
|||||||
anchored = TRUE
|
anchored = TRUE
|
||||||
|
|
||||||
/obj/structure/reflector/double/auto_reflect(obj/item/projectile/P, pdir, turf/ploc, pangle)
|
/obj/structure/reflector/double/auto_reflect(obj/item/projectile/P, pdir, turf/ploc, pangle)
|
||||||
var/incidence = get_angle_of_incidence(rotation_angle, P.Angle)
|
var/incidence = GET_ANGLE_OF_INCIDENCE(rotation_angle, P.Angle)
|
||||||
var/incidence_norm = get_angle_of_incidence(rotation_angle, P.Angle, FALSE)
|
var/norm_inc = WRAP(incidence, -90, 90)
|
||||||
var/invert = ((incidence_norm > -90) && (incidence_norm < 90))
|
var/new_angle = WRAP(rotation_angle + norm_inc, 180, -180)
|
||||||
var/new_angle_s = rotation_angle + incidence
|
if(ISINRANGE_EX(norm_inc, -90, 90))
|
||||||
if(invert)
|
new_angle += 180
|
||||||
new_angle_s += 180
|
P.Angle = new_angle
|
||||||
while(new_angle_s > 180) // Translate to regular projectile degrees
|
|
||||||
new_angle_s -= 360
|
|
||||||
while(new_angle_s < -180)
|
|
||||||
new_angle_s += 360
|
|
||||||
P.Angle = new_angle_s
|
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
//BOX
|
//BOX
|
||||||
|
|||||||
@@ -134,8 +134,8 @@
|
|||||||
if(!click_params || !click_params["icon-x"] || !click_params["icon-y"])
|
if(!click_params || !click_params["icon-x"] || !click_params["icon-y"])
|
||||||
return
|
return
|
||||||
//Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf)
|
//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_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_y = CLAMP(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
return ..()
|
return ..()
|
||||||
|
|||||||
@@ -379,7 +379,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
var/ratio = obj_integrity / max_integrity
|
var/ratio = obj_integrity / max_integrity
|
||||||
ratio = Ceiling(ratio*4) * 25
|
ratio = CEILING(ratio*4, 1) * 25
|
||||||
|
|
||||||
if(smooth)
|
if(smooth)
|
||||||
queue_smooth(src)
|
queue_smooth(src)
|
||||||
|
|||||||
@@ -188,7 +188,7 @@
|
|||||||
break
|
break
|
||||||
|
|
||||||
var/list/L = list(45)
|
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
|
L += -45
|
||||||
|
|
||||||
// Expand the edges of our tunnel
|
// Expand the edges of our tunnel
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
var/turf/p_turf = get_turf(P)
|
var/turf/p_turf = get_turf(P)
|
||||||
var/face_direction = get_dir(src, p_turf)
|
var/face_direction = get_dir(src, p_turf)
|
||||||
var/face_angle = dir2angle(face_direction)
|
var/face_angle = dir2angle(face_direction)
|
||||||
var/incidence_s = get_angle_of_incidence(face_angle, P.Angle)
|
var/incidence_s = WRAP(GET_ANGLE_OF_INCIDENCE(face_angle, P.Angle), -90, 90)
|
||||||
var/new_angle = face_angle + incidence_s
|
var/new_angle = face_angle + incidence_s
|
||||||
var/new_angle_s = new_angle
|
var/new_angle_s = new_angle
|
||||||
while(new_angle_s > 180) // Translate to regular projectile degrees
|
while(new_angle_s > 180) // Translate to regular projectile degrees
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
var/new_volume = input(user, "Choose a volume.", "Sound Emitter", sound_volume) as null|num
|
var/new_volume = input(user, "Choose a volume.", "Sound Emitter", sound_volume) as null|num
|
||||||
if(isnull(new_volume))
|
if(isnull(new_volume))
|
||||||
return
|
return
|
||||||
new_volume = Clamp(new_volume, 0, 100)
|
new_volume = CLAMP(new_volume, 0, 100)
|
||||||
sound_volume = new_volume
|
sound_volume = new_volume
|
||||||
to_chat(user, "<span class='notice'>Volume set to [sound_volume]%.</span>")
|
to_chat(user, "<span class='notice'>Volume set to [sound_volume]%.</span>")
|
||||||
if(href_list["edit_mode"])
|
if(href_list["edit_mode"])
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
var/new_radius = input(user, "Choose a radius.", "Sound Emitter", sound_volume) as null|num
|
var/new_radius = input(user, "Choose a radius.", "Sound Emitter", sound_volume) as null|num
|
||||||
if(isnull(new_radius))
|
if(isnull(new_radius))
|
||||||
return
|
return
|
||||||
new_radius = Clamp(new_radius, 0, 127)
|
new_radius = CLAMP(new_radius, 0, 127)
|
||||||
play_radius = new_radius
|
play_radius = new_radius
|
||||||
to_chat(user, "<span class='notice'>Audible radius set to [play_radius].</span>")
|
to_chat(user, "<span class='notice'>Audible radius set to [play_radius].</span>")
|
||||||
if(href_list["play"])
|
if(href_list["play"])
|
||||||
|
|||||||
@@ -220,7 +220,7 @@
|
|||||||
var/nsd = CONFIG_GET(number/note_stale_days)
|
var/nsd = CONFIG_GET(number/note_stale_days)
|
||||||
var/nfd = CONFIG_GET(number/note_fresh_days)
|
var/nfd = CONFIG_GET(number/note_fresh_days)
|
||||||
if (agegate && type == "note" && isnum(nsd) && isnum(nfd) && nsd > nfd)
|
if (agegate && type == "note" && isnum(nsd) && isnum(nfd) && nsd > nfd)
|
||||||
var/alpha = Clamp(100 - (age - nfd) * (85 / (nsd - nfd)), 15, 100)
|
var/alpha = CLAMP(100 - (age - nfd) * (85 / (nsd - nfd)), 15, 100)
|
||||||
if (alpha < 100)
|
if (alpha < 100)
|
||||||
if (alpha <= 15)
|
if (alpha <= 15)
|
||||||
if (skipped)
|
if (skipped)
|
||||||
|
|||||||
@@ -1937,7 +1937,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
var/list/offset = splittext(href_list["offset"],",")
|
var/list/offset = splittext(href_list["offset"],",")
|
||||||
var/number = Clamp(text2num(href_list["object_count"]), 1, 100)
|
var/number = CLAMP(text2num(href_list["object_count"]), 1, 100)
|
||||||
var/X = offset.len > 0 ? text2num(offset[1]) : 0
|
var/X = offset.len > 0 ? text2num(offset[1]) : 0
|
||||||
var/Y = offset.len > 1 ? text2num(offset[2]) : 0
|
var/Y = offset.len > 1 ? text2num(offset[2]) : 0
|
||||||
var/Z = offset.len > 2 ? text2num(offset[3]) : 0
|
var/Z = offset.len > 2 ? text2num(offset[3]) : 0
|
||||||
|
|||||||
@@ -435,7 +435,7 @@
|
|||||||
else if(expression[start + 1] == "\[" && islist(v))
|
else if(expression[start + 1] == "\[" && islist(v))
|
||||||
var/list/L = v
|
var/list/L = v
|
||||||
var/index = SDQL_expression(source, expression[start + 2])
|
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(usr, "<span class='danger'>Invalid list index: [index]</span>")
|
to_chat(usr, "<span class='danger'>Invalid list index: [index]</span>")
|
||||||
return null
|
return null
|
||||||
return L[index]
|
return L[index]
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
var/vol = input(usr, "What volume would you like the sound to play at?",, 100) as null|num
|
var/vol = input(usr, "What volume would you like the sound to play at?",, 100) as null|num
|
||||||
if(!vol)
|
if(!vol)
|
||||||
return
|
return
|
||||||
vol = Clamp(vol, 1, 100)
|
vol = CLAMP(vol, 1, 100)
|
||||||
|
|
||||||
var/sound/admin_sound = new()
|
var/sound/admin_sound = new()
|
||||||
admin_sound.file = S
|
admin_sound.file = S
|
||||||
|
|||||||
@@ -181,13 +181,13 @@ Acts like a normal vent, but has an input AND output.
|
|||||||
pump_direction = 1
|
pump_direction = 1
|
||||||
|
|
||||||
if("set_input_pressure" in signal.data)
|
if("set_input_pressure" in signal.data)
|
||||||
input_pressure_min = Clamp(text2num(signal.data["set_input_pressure"]),0,ONE_ATMOSPHERE*50)
|
input_pressure_min = CLAMP(text2num(signal.data["set_input_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||||
|
|
||||||
if("set_output_pressure" in signal.data)
|
if("set_output_pressure" in signal.data)
|
||||||
output_pressure_max = Clamp(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
output_pressure_max = CLAMP(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||||
|
|
||||||
if("set_external_pressure" in signal.data)
|
if("set_external_pressure" in signal.data)
|
||||||
external_pressure_bound = Clamp(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
external_pressure_bound = CLAMP(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||||
|
|
||||||
if("status" in signal.data)
|
if("status" in signal.data)
|
||||||
spawn(2)
|
spawn(2)
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ Passive gate is similar to the regular pump except:
|
|||||||
pressure = text2num(pressure)
|
pressure = text2num(pressure)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if(.)
|
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)]", INVESTIGATE_ATMOS)
|
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ Passive gate is similar to the regular pump except:
|
|||||||
on = !on
|
on = !on
|
||||||
|
|
||||||
if("set_output_pressure" in signal.data)
|
if("set_output_pressure" in signal.data)
|
||||||
target_pressure = Clamp(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
target_pressure = CLAMP(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||||
|
|
||||||
if(on != old_on)
|
if(on != old_on)
|
||||||
investigate_log("was turned [on ? "on" : "off"] by a remote signal", INVESTIGATE_ATMOS)
|
investigate_log("was turned [on ? "on" : "off"] by a remote signal", INVESTIGATE_ATMOS)
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ Thus, the two variables affect pump operation are set in New():
|
|||||||
pressure = text2num(pressure)
|
pressure = text2num(pressure)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if(.)
|
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)]", INVESTIGATE_ATMOS)
|
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ Thus, the two variables affect pump operation are set in New():
|
|||||||
on = !on
|
on = !on
|
||||||
|
|
||||||
if("set_output_pressure" in signal.data)
|
if("set_output_pressure" in signal.data)
|
||||||
target_pressure = Clamp(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
target_pressure = CLAMP(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||||
|
|
||||||
if(on != old_on)
|
if(on != old_on)
|
||||||
investigate_log("was turned [on ? "on" : "off"] by a remote signal", INVESTIGATE_ATMOS)
|
investigate_log("was turned [on ? "on" : "off"] by a remote signal", INVESTIGATE_ATMOS)
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ Thus, the two variables affect pump operation are set in New():
|
|||||||
rate = text2num(rate)
|
rate = text2num(rate)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if(.)
|
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)]", INVESTIGATE_ATMOS)
|
investigate_log("was set to [transfer_rate] L/s by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ Thus, the two variables affect pump operation are set in New():
|
|||||||
|
|
||||||
if("set_transfer_rate" in signal.data)
|
if("set_transfer_rate" in signal.data)
|
||||||
var/datum/gas_mixture/air1 = AIR1
|
var/datum/gas_mixture/air1 = AIR1
|
||||||
transfer_rate = Clamp(text2num(signal.data["set_transfer_rate"]),0,air1.volume)
|
transfer_rate = CLAMP(text2num(signal.data["set_transfer_rate"]),0,air1.volume)
|
||||||
|
|
||||||
if(on != old_on)
|
if(on != old_on)
|
||||||
investigate_log("was turned [on ? "on" : "off"] by a remote signal", INVESTIGATE_ATMOS)
|
investigate_log("was turned [on ? "on" : "off"] by a remote signal", INVESTIGATE_ATMOS)
|
||||||
|
|||||||
@@ -162,7 +162,7 @@
|
|||||||
pressure = text2num(pressure)
|
pressure = text2num(pressure)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if(.)
|
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)]", INVESTIGATE_ATMOS)
|
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||||
if("filter")
|
if("filter")
|
||||||
filter_type = null
|
filter_type = null
|
||||||
|
|||||||
@@ -152,7 +152,7 @@
|
|||||||
pressure = text2num(pressure)
|
pressure = text2num(pressure)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if(.)
|
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)]", INVESTIGATE_ATMOS)
|
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||||
if("node1")
|
if("node1")
|
||||||
var/value = text2num(params["concentration"])
|
var/value = text2num(params["concentration"])
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
if("set_volume_rate" in signal.data)
|
if("set_volume_rate" in signal.data)
|
||||||
var/number = text2num(signal.data["set_volume_rate"])
|
var/number = text2num(signal.data["set_volume_rate"])
|
||||||
var/datum/gas_mixture/air_contents = AIR1
|
var/datum/gas_mixture/air_contents = AIR1
|
||||||
volume_rate = Clamp(number, 0, air_contents.volume)
|
volume_rate = CLAMP(number, 0, air_contents.volume)
|
||||||
|
|
||||||
if("status" in signal.data)
|
if("status" in signal.data)
|
||||||
spawn(2)
|
spawn(2)
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
rate = text2num(rate)
|
rate = text2num(rate)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if(.)
|
if(.)
|
||||||
volume_rate = Clamp(rate, 0, MAX_TRANSFER_RATE)
|
volume_rate = CLAMP(rate, 0, MAX_TRANSFER_RATE)
|
||||||
investigate_log("was set to [volume_rate] L/s by [key_name(usr)]", INVESTIGATE_ATMOS)
|
investigate_log("was set to [volume_rate] L/s by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||||
update_icon()
|
update_icon()
|
||||||
broadcast_status()
|
broadcast_status()
|
||||||
|
|||||||
@@ -153,7 +153,7 @@
|
|||||||
target = text2num(target)
|
target = text2num(target)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if(.)
|
if(.)
|
||||||
target_temperature = Clamp(target, min_temperature, max_temperature)
|
target_temperature = CLAMP(target, min_temperature, max_temperature)
|
||||||
investigate_log("was set to [target_temperature] K by [key_name(usr)]", INVESTIGATE_ATMOS)
|
investigate_log("was set to [target_temperature] K by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||||
|
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|||||||
@@ -240,10 +240,10 @@
|
|||||||
pump_direction = text2num(signal.data["direction"])
|
pump_direction = text2num(signal.data["direction"])
|
||||||
|
|
||||||
if("set_internal_pressure" in signal.data)
|
if("set_internal_pressure" in signal.data)
|
||||||
internal_pressure_bound = Clamp(text2num(signal.data["set_internal_pressure"]),0,ONE_ATMOSPHERE*50)
|
internal_pressure_bound = CLAMP(text2num(signal.data["set_internal_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||||
|
|
||||||
if("set_external_pressure" in signal.data)
|
if("set_external_pressure" in signal.data)
|
||||||
external_pressure_bound = Clamp(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
external_pressure_bound = CLAMP(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||||
|
|
||||||
if("reset_external_pressure" in signal.data)
|
if("reset_external_pressure" in signal.data)
|
||||||
external_pressure_bound = ONE_ATMOSPHERE
|
external_pressure_bound = ONE_ATMOSPHERE
|
||||||
@@ -252,10 +252,10 @@
|
|||||||
internal_pressure_bound = 0
|
internal_pressure_bound = 0
|
||||||
|
|
||||||
if("adjust_internal_pressure" in signal.data)
|
if("adjust_internal_pressure" in signal.data)
|
||||||
internal_pressure_bound = Clamp(internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),0,ONE_ATMOSPHERE*50)
|
internal_pressure_bound = CLAMP(internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||||
|
|
||||||
if("adjust_external_pressure" in signal.data)
|
if("adjust_external_pressure" in signal.data)
|
||||||
external_pressure_bound = Clamp(external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
external_pressure_bound = CLAMP(external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||||
|
|
||||||
if("init" in signal.data)
|
if("init" in signal.data)
|
||||||
name = signal.data["init"]
|
name = signal.data["init"]
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
if(initialize_directions & dir)
|
if(initialize_directions & dir)
|
||||||
return ..()
|
return ..()
|
||||||
if((NORTH|EAST) & dir)
|
if((NORTH|EAST) & dir)
|
||||||
user.ventcrawl_layer = Clamp(user.ventcrawl_layer + 1, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
user.ventcrawl_layer = CLAMP(user.ventcrawl_layer + 1, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||||
if((SOUTH|WEST) & dir)
|
if((SOUTH|WEST) & dir)
|
||||||
user.ventcrawl_layer = Clamp(user.ventcrawl_layer - 1, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
user.ventcrawl_layer = CLAMP(user.ventcrawl_layer - 1, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||||
to_chat(user, "You align yourself with the [user.ventcrawl_layer]\th output.")
|
to_chat(user, "You align yourself with the [user.ventcrawl_layer]\th output.")
|
||||||
|
|||||||
@@ -411,7 +411,7 @@
|
|||||||
pressure = text2num(pressure)
|
pressure = text2num(pressure)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if(.)
|
if(.)
|
||||||
release_pressure = Clamp(round(pressure), can_min_release_pressure, can_max_release_pressure)
|
release_pressure = CLAMP(round(pressure), can_min_release_pressure, can_max_release_pressure)
|
||||||
investigate_log("was set to [release_pressure] kPa by [key_name(usr)].", INVESTIGATE_ATMOS)
|
investigate_log("was set to [release_pressure] kPa by [key_name(usr)].", INVESTIGATE_ATMOS)
|
||||||
if("valve")
|
if("valve")
|
||||||
var/logmsg
|
var/logmsg
|
||||||
@@ -455,7 +455,7 @@
|
|||||||
var/N = text2num(user_input)
|
var/N = text2num(user_input)
|
||||||
if(!N)
|
if(!N)
|
||||||
return
|
return
|
||||||
timer_set = Clamp(N,minimum_timer_set,maximum_timer_set)
|
timer_set = CLAMP(N,minimum_timer_set,maximum_timer_set)
|
||||||
log_admin("[key_name(usr)] has activated a prototype valve timer")
|
log_admin("[key_name(usr)] has activated a prototype valve timer")
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if("toggle_timer")
|
if("toggle_timer")
|
||||||
|
|||||||
@@ -131,7 +131,7 @@
|
|||||||
pressure = text2num(pressure)
|
pressure = text2num(pressure)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if(.)
|
if(.)
|
||||||
pump.target_pressure = Clamp(round(pressure), PUMP_MIN_PRESSURE, PUMP_MAX_PRESSURE)
|
pump.target_pressure = CLAMP(round(pressure), PUMP_MIN_PRESSURE, PUMP_MAX_PRESSURE)
|
||||||
investigate_log("was set to [pump.target_pressure] kPa by [key_name(usr)].", INVESTIGATE_ATMOS)
|
investigate_log("was set to [pump.target_pressure] kPa by [key_name(usr)].", INVESTIGATE_ATMOS)
|
||||||
if("eject")
|
if("eject")
|
||||||
if(holding)
|
if(holding)
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
|
|||||||
|
|
||||||
/datum/export/process()
|
/datum/export/process()
|
||||||
..()
|
..()
|
||||||
cost *= GLOB.E**(k_elasticity * (1/30))
|
cost *= NUM_E**(k_elasticity * (1/30))
|
||||||
if(cost > init_cost)
|
if(cost > init_cost)
|
||||||
cost = init_cost
|
cost = init_cost
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
|
|||||||
/datum/export/proc/get_cost(obj/O, contr = 0, emag = 0)
|
/datum/export/proc/get_cost(obj/O, contr = 0, emag = 0)
|
||||||
var/amount = get_amount(O, contr, emag)
|
var/amount = get_amount(O, contr, emag)
|
||||||
if(k_elasticity!=0)
|
if(k_elasticity!=0)
|
||||||
return round((cost/k_elasticity) * (1 - GLOB.E**(-1 * k_elasticity * amount))) //anti-derivative of the marginal cost function
|
return round((cost/k_elasticity) * (1 - NUM_E**(-1 * k_elasticity * amount))) //anti-derivative of the marginal cost function
|
||||||
else
|
else
|
||||||
return round(cost * amount) //alternative form derived from L'Hopital to avoid division by 0
|
return round(cost * amount) //alternative form derived from L'Hopital to avoid division by 0
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
|
|||||||
else
|
else
|
||||||
total_amount += amount
|
total_amount += amount
|
||||||
|
|
||||||
cost *= GLOB.E**(-1*k_elasticity*amount) //marginal cost modifier
|
cost *= NUM_E**(-1*k_elasticity*amount) //marginal cost modifier
|
||||||
SSblackbox.record_feedback("nested tally", "export_sold_cost", 1, list("[O.type]", "[the_cost]"))
|
SSblackbox.record_feedback("nested tally", "export_sold_cost", 1, list("[O.type]", "[the_cost]"))
|
||||||
|
|
||||||
// Total printout for the cargo console.
|
// Total printout for the cargo console.
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ GLOBAL_LIST(external_rsc_urls)
|
|||||||
#if (PRELOAD_RSC == 0)
|
#if (PRELOAD_RSC == 0)
|
||||||
var/static/next_external_rsc = 0
|
var/static/next_external_rsc = 0
|
||||||
if(external_rsc_urls && external_rsc_urls.len)
|
if(external_rsc_urls && external_rsc_urls.len)
|
||||||
next_external_rsc = Wrap(next_external_rsc+1, 1, external_rsc_urls.len+1)
|
next_external_rsc = WRAP(next_external_rsc+1, 1, external_rsc_urls.len+1)
|
||||||
preload_rsc = external_rsc_urls[next_external_rsc]
|
preload_rsc = external_rsc_urls[next_external_rsc]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -674,8 +674,8 @@ GLOBAL_LIST(external_rsc_urls)
|
|||||||
var/viewscale = getviewsize(view)
|
var/viewscale = getviewsize(view)
|
||||||
var/x = viewscale[1]
|
var/x = viewscale[1]
|
||||||
var/y = viewscale[2]
|
var/y = viewscale[2]
|
||||||
x = Clamp(x+change, min, max)
|
x = CLAMP(x+change, min, max)
|
||||||
y = Clamp(y+change, min,max)
|
y = CLAMP(y+change, min,max)
|
||||||
change_view("[x]x[y]")
|
change_view("[x]x[y]")
|
||||||
|
|
||||||
/client/proc/change_view(new_size)
|
/client/proc/change_view(new_size)
|
||||||
|
|||||||
@@ -1232,12 +1232,12 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
|||||||
toggles ^= MIDROUND_ANTAG
|
toggles ^= MIDROUND_ANTAG
|
||||||
|
|
||||||
if("parallaxup")
|
if("parallaxup")
|
||||||
parallax = Wrap(parallax + 1, PARALLAX_INSANE, PARALLAX_DISABLE + 1)
|
parallax = WRAP(parallax + 1, PARALLAX_INSANE, PARALLAX_DISABLE + 1)
|
||||||
if (parent && parent.mob && parent.mob.hud_used)
|
if (parent && parent.mob && parent.mob.hud_used)
|
||||||
parent.mob.hud_used.update_parallax_pref(parent.mob)
|
parent.mob.hud_used.update_parallax_pref(parent.mob)
|
||||||
|
|
||||||
if("parallaxdown")
|
if("parallaxdown")
|
||||||
parallax = Wrap(parallax - 1, PARALLAX_INSANE, PARALLAX_DISABLE + 1)
|
parallax = WRAP(parallax - 1, PARALLAX_INSANE, PARALLAX_DISABLE + 1)
|
||||||
if (parent && parent.mob && parent.mob.hud_used)
|
if (parent && parent.mob && parent.mob.hud_used)
|
||||||
parent.mob.hud_used.update_parallax_pref(parent.mob)
|
parent.mob.hud_used.update_parallax_pref(parent.mob)
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,7 @@
|
|||||||
assembled = TRUE
|
assembled = TRUE
|
||||||
boost_chargerate *= cap
|
boost_chargerate *= cap
|
||||||
boost_drain -= manip
|
boost_drain -= manip
|
||||||
powersetting_high = Clamp(laser, 0, 3)
|
powersetting_high = CLAMP(laser, 0, 3)
|
||||||
emp_disable_threshold = bin*1.25
|
emp_disable_threshold = bin*1.25
|
||||||
stabilizer_decay_amount = scan*3.5
|
stabilizer_decay_amount = scan*3.5
|
||||||
airbrake_decay_amount = manip*8
|
airbrake_decay_amount = manip*8
|
||||||
@@ -194,15 +194,15 @@
|
|||||||
/obj/item/device/flightpack/proc/adjust_momentum(amountx, amounty, reduce_amount_total = 0)
|
/obj/item/device/flightpack/proc/adjust_momentum(amountx, amounty, reduce_amount_total = 0)
|
||||||
if(reduce_amount_total != 0)
|
if(reduce_amount_total != 0)
|
||||||
if(momentum_x > 0)
|
if(momentum_x > 0)
|
||||||
momentum_x = Clamp(momentum_x - reduce_amount_total, 0, momentum_max)
|
momentum_x = CLAMP(momentum_x - reduce_amount_total, 0, momentum_max)
|
||||||
else if(momentum_x < 0)
|
else if(momentum_x < 0)
|
||||||
momentum_x = Clamp(momentum_x + reduce_amount_total, -momentum_max, 0)
|
momentum_x = CLAMP(momentum_x + reduce_amount_total, -momentum_max, 0)
|
||||||
if(momentum_y > 0)
|
if(momentum_y > 0)
|
||||||
momentum_y = Clamp(momentum_y - reduce_amount_total, 0, momentum_max)
|
momentum_y = CLAMP(momentum_y - reduce_amount_total, 0, momentum_max)
|
||||||
else if(momentum_y < 0)
|
else if(momentum_y < 0)
|
||||||
momentum_y = Clamp(momentum_y + reduce_amount_total, -momentum_max, 0)
|
momentum_y = CLAMP(momentum_y + reduce_amount_total, -momentum_max, 0)
|
||||||
momentum_x = Clamp(momentum_x + amountx, -momentum_max, momentum_max)
|
momentum_x = CLAMP(momentum_x + amountx, -momentum_max, momentum_max)
|
||||||
momentum_y = Clamp(momentum_y + amounty, -momentum_max, momentum_max)
|
momentum_y = CLAMP(momentum_y + amounty, -momentum_max, momentum_max)
|
||||||
calculate_momentum_speed()
|
calculate_momentum_speed()
|
||||||
|
|
||||||
/obj/item/device/flightpack/intercept_user_move(dir, mob, newLoc, oldLoc)
|
/obj/item/device/flightpack/intercept_user_move(dir, mob, newLoc, oldLoc)
|
||||||
@@ -314,7 +314,7 @@
|
|||||||
|
|
||||||
/obj/item/device/flightpack/proc/handle_damage()
|
/obj/item/device/flightpack/proc/handle_damage()
|
||||||
if(emp_damage)
|
if(emp_damage)
|
||||||
emp_damage = Clamp(emp_damage-emp_heal_amount, 0, emp_disable_threshold * 10)
|
emp_damage = CLAMP(emp_damage-emp_heal_amount, 0, emp_disable_threshold * 10)
|
||||||
if(emp_damage >= emp_disable_threshold)
|
if(emp_damage >= emp_disable_threshold)
|
||||||
emp_disabled = TRUE
|
emp_disabled = TRUE
|
||||||
if(emp_disabled && (emp_damage <= 0.5))
|
if(emp_disabled && (emp_damage <= 0.5))
|
||||||
@@ -347,11 +347,11 @@
|
|||||||
|
|
||||||
/obj/item/device/flightpack/proc/handle_boost()
|
/obj/item/device/flightpack/proc/handle_boost()
|
||||||
if(boost)
|
if(boost)
|
||||||
boost_charge = Clamp(boost_charge-boost_drain, 0, boost_maxcharge)
|
boost_charge = CLAMP(boost_charge-boost_drain, 0, boost_maxcharge)
|
||||||
if(boost_charge < 1)
|
if(boost_charge < 1)
|
||||||
deactivate_booster()
|
deactivate_booster()
|
||||||
if(boost_charge < boost_maxcharge)
|
if(boost_charge < boost_maxcharge)
|
||||||
boost_charge = Clamp(boost_charge+boost_chargerate, 0, boost_maxcharge)
|
boost_charge = CLAMP(boost_charge+boost_chargerate, 0, boost_maxcharge)
|
||||||
|
|
||||||
/obj/item/device/flightpack/proc/cycle_power()
|
/obj/item/device/flightpack/proc/cycle_power()
|
||||||
powersetting < powersetting_high? (powersetting++) : (powersetting = 1)
|
powersetting < powersetting_high? (powersetting++) : (powersetting = 1)
|
||||||
|
|||||||
@@ -654,7 +654,7 @@
|
|||||||
|
|
||||||
/obj/item/clothing/suit/space/hardsuit/shielded/process()
|
/obj/item/clothing/suit/space/hardsuit/shielded/process()
|
||||||
if(world.time > recharge_cooldown && current_charges < max_charges)
|
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, 1)
|
playsound(loc, 'sound/magic/charge.ogg', 50, 1)
|
||||||
if(current_charges == max_charges)
|
if(current_charges == max_charges)
|
||||||
playsound(loc, 'sound/machines/ding.ogg', 50, 1)
|
playsound(loc, 'sound/machines/ding.ogg', 50, 1)
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
/datum/round_event_control/New()
|
/datum/round_event_control/New()
|
||||||
if(config && !wizardevent) // Magic is unaffected by configs
|
if(config && !wizardevent) // Magic is unaffected by configs
|
||||||
earliest_start = Ceiling(earliest_start * CONFIG_GET(number/events_min_time_mul))
|
earliest_start = CEILING(earliest_start * CONFIG_GET(number/events_min_time_mul), 1)
|
||||||
min_players = Ceiling(min_players * CONFIG_GET(number/events_min_players_mul))
|
min_players = CEILING(min_players * CONFIG_GET(number/events_min_players_mul), 1)
|
||||||
|
|
||||||
/datum/round_event_control/wizard
|
/datum/round_event_control/wizard
|
||||||
wizardevent = 1
|
wizardevent = 1
|
||||||
|
|||||||
@@ -67,12 +67,12 @@
|
|||||||
|
|
||||||
kill()
|
kill()
|
||||||
return
|
return
|
||||||
if(IsMultiple(activeFor, 4))
|
if(ISMULTIPLE(activeFor, 4))
|
||||||
var/obj/machinery/vending/rebel = pick(vendingMachines)
|
var/obj/machinery/vending/rebel = pick(vendingMachines)
|
||||||
vendingMachines.Remove(rebel)
|
vendingMachines.Remove(rebel)
|
||||||
infectedMachines.Add(rebel)
|
infectedMachines.Add(rebel)
|
||||||
rebel.shut_up = 0
|
rebel.shut_up = 0
|
||||||
rebel.shoot_inventory = 1
|
rebel.shoot_inventory = 1
|
||||||
|
|
||||||
if(IsMultiple(activeFor, 8))
|
if(ISMULTIPLE(activeFor, 8))
|
||||||
originMachine.speak(pick(rampant_speeches))
|
originMachine.speak(pick(rampant_speeches))
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/datum/round_event/disease_outbreak/start()
|
/datum/round_event/disease_outbreak/start()
|
||||||
var/advanced_virus = FALSE
|
var/advanced_virus = FALSE
|
||||||
max_severity = 3 + max(Floor((world.time - control.earliest_start)/6000),0) //3 symptoms at 20 minutes, plus 1 per 10 minutes
|
max_severity = 3 + max(FLOOR((world.time - control.earliest_start)/6000, 1),0) //3 symptoms at 20 minutes, plus 1 per 10 minutes
|
||||||
if(prob(20 + (10 * max_severity)))
|
if(prob(20 + (10 * max_severity)))
|
||||||
advanced_virus = TRUE
|
advanced_virus = TRUE
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
priority_announce("Meteors have been detected on collision course with the station.", "Meteor Alert", 'sound/ai/meteors.ogg')
|
priority_announce("Meteors have been detected on collision course with the station.", "Meteor Alert", 'sound/ai/meteors.ogg')
|
||||||
|
|
||||||
/datum/round_event/meteor_wave/tick()
|
/datum/round_event/meteor_wave/tick()
|
||||||
if(IsMultiple(activeFor, 3))
|
if(ISMULTIPLE(activeFor, 3))
|
||||||
spawn_meteors(5, wave_type) //meteor list types defined in gamemode/meteor/meteors.dm
|
spawn_meteors(5, wave_type) //meteor list types defined in gamemode/meteor/meteors.dm
|
||||||
|
|
||||||
/datum/round_event_control/meteor_wave/threatening
|
/datum/round_event_control/meteor_wave/threatening
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
T = safepick(get_area_turfs(pick(station_areas)))
|
T = safepick(get_area_turfs(pick(station_areas)))
|
||||||
hostiles_spawn += T
|
hostiles_spawn += T
|
||||||
|
|
||||||
next_boss_spawn = startWhen + Ceiling(2 * number_of_hostiles / number_of_bosses)
|
next_boss_spawn = startWhen + CEILING(2 * number_of_hostiles / number_of_bosses, 1)
|
||||||
|
|
||||||
/datum/round_event/portal_storm/announce(fake)
|
/datum/round_event/portal_storm/announce(fake)
|
||||||
set waitfor = 0
|
set waitfor = 0
|
||||||
@@ -117,14 +117,14 @@
|
|||||||
/datum/round_event/portal_storm/proc/spawn_hostile()
|
/datum/round_event/portal_storm/proc/spawn_hostile()
|
||||||
if(!hostile_types || !hostile_types.len)
|
if(!hostile_types || !hostile_types.len)
|
||||||
return 0
|
return 0
|
||||||
return IsMultiple(activeFor, 2)
|
return ISMULTIPLE(activeFor, 2)
|
||||||
|
|
||||||
/datum/round_event/portal_storm/proc/spawn_boss()
|
/datum/round_event/portal_storm/proc/spawn_boss()
|
||||||
if(!boss_types || !boss_types.len)
|
if(!boss_types || !boss_types.len)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if(activeFor == next_boss_spawn)
|
if(activeFor == next_boss_spawn)
|
||||||
next_boss_spawn += Ceiling(number_of_hostiles / number_of_bosses)
|
next_boss_spawn += CEILING(number_of_hostiles / number_of_bosses, 1)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/datum/round_event/portal_storm/proc/time_to_end()
|
/datum/round_event/portal_storm/proc/time_to_end()
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user