mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-13 19:52:13 +00:00
* Upkeep on Mech code. Assembly Mines fixed, they do not spawn with an explosive payload from parent. Vehicles no longer ignore cliffs. Exosuits no longer ignore cliffs. Objects can fall off cliffs. Objects with a buckled person will hurt the person. (Rollerbeds looking at you.) Jumpjets added to allow planetary traversal, primarily useful upon the Serenity, Hoverpods, and Marauders (adminspawn). When toggled, they allow movement vertically, and prevent falling through open spaces. When used as the active equipment, it will launch the exosuit toward the target turf. When not on one of the above mentioned suits, it will cause a small explosion on launch, damaging the exosuit and anything directly nearby. * Fighters are flying. * Revert step delay floor adjustment. Flat strafing modifier of 1/5th of a second should be enough. * Correction and Tweak. * Fix stupidity.
125 lines
4.0 KiB
Plaintext
125 lines
4.0 KiB
Plaintext
/matrix/proc/TurnTo(old_angle, new_angle)
|
|
. = new_angle - old_angle
|
|
Turn(.) //BYOND handles cases such as -270, 360, 540 etc. DOES NOT HANDLE 180 TURNS WELL, THEY TWEEN AND LOOK LIKE SHIT
|
|
|
|
|
|
/atom/proc/SpinAnimation(speed = 10, loops = -1, clockwise = 1, segments = 3, pixel_x_offset = 0, pixel_y_offset = 0, pixel_z_offset = 0)
|
|
if(!segments)
|
|
return
|
|
var/segment = 360/segments
|
|
if(!clockwise)
|
|
segment = -segment
|
|
var/list/matrices = list()
|
|
for(var/i in 1 to segments-1)
|
|
var/matrix/M = matrix(transform)
|
|
M.Turn(segment*i)
|
|
matrices += M
|
|
var/matrix/last = matrix(transform)
|
|
matrices += last
|
|
|
|
speed /= segments
|
|
|
|
animate(src, transform = matrices[1], time = speed, loops, pixel_x = pixel_x_offset, pixel_y = pixel_y_offset, pixel_z = pixel_z_offset,)
|
|
for(var/i in 2 to segments) //2 because 1 is covered above
|
|
animate(transform = matrices[i], time = speed)
|
|
//doesn't have an object argument because this is "Stacking" with the animate call above
|
|
//3 billion% intentional
|
|
|
|
//The X pixel offset of this matrix
|
|
/matrix/proc/get_x_shift()
|
|
. = c
|
|
|
|
//The Y pixel offset of this matrix
|
|
/matrix/proc/get_y_shift()
|
|
. = f
|
|
// Color matrices:
|
|
|
|
//Luma coefficients suggested for HDTVs. If you change these, make sure they add up to 1.
|
|
#define LUMR 0.2126
|
|
#define LUMG 0.7152
|
|
#define LUMB 0.0722
|
|
|
|
//Still need color matrix addition, negation, and multiplication.
|
|
|
|
//Returns an identity color matrix which does nothing
|
|
/proc/color_identity()
|
|
return list(1,0,0, 0,1,0, 0,0,1)
|
|
|
|
//Moves all colors angle degrees around the color wheel while maintaining intensity of the color and not affecting whites
|
|
//TODO: Need a version that only affects one color (ie shift red to blue but leave greens and blues alone)
|
|
/proc/color_rotation(angle)
|
|
if(angle == 0)
|
|
return color_identity()
|
|
angle = clamp(angle, -180, 180)
|
|
var/cos = cos(angle)
|
|
var/sin = sin(angle)
|
|
|
|
var/constA = 0.143
|
|
var/constB = 0.140
|
|
var/constC = -0.283
|
|
return list(
|
|
LUMR + cos * (1-LUMR) + sin * -LUMR, LUMR + cos * -LUMR + sin * constA, LUMR + cos * -LUMR + sin * -(1-LUMR),
|
|
LUMG + cos * -LUMG + sin * -LUMG, LUMG + cos * (1-LUMG) + sin * constB, LUMG + cos * -LUMG + sin * LUMG,
|
|
LUMB + cos * -LUMB + sin * (1-LUMB), LUMB + cos * -LUMB + sin * constC, LUMB + cos * (1-LUMB) + sin * LUMB
|
|
)
|
|
|
|
//Makes everything brighter or darker without regard to existing color or brightness
|
|
/proc/color_brightness(power)
|
|
power = clamp(power, -255, 255)
|
|
power = power/255
|
|
|
|
return list(1,0,0, 0,1,0, 0,0,1, power,power,power)
|
|
|
|
var/global/list/delta_index = list(
|
|
0, 0.01, 0.02, 0.04, 0.05, 0.06, 0.07, 0.08, 0.1, 0.11,
|
|
0.12, 0.14, 0.15, 0.16, 0.17, 0.18, 0.20, 0.21, 0.22, 0.24,
|
|
0.25, 0.27, 0.28, 0.30, 0.32, 0.34, 0.36, 0.38, 0.40, 0.42,
|
|
0.44, 0.46, 0.48, 0.5, 0.53, 0.56, 0.59, 0.62, 0.65, 0.68,
|
|
0.71, 0.74, 0.77, 0.80, 0.83, 0.86, 0.89, 0.92, 0.95, 0.98,
|
|
1.0, 1.06, 1.12, 1.18, 1.24, 1.30, 1.36, 1.42, 1.48, 1.54,
|
|
1.60, 1.66, 1.72, 1.78, 1.84, 1.90, 1.96, 2.0, 2.12, 2.25,
|
|
2.37, 2.50, 2.62, 2.75, 2.87, 3.0, 3.2, 3.4, 3.6, 3.8,
|
|
4.0, 4.3, 4.7, 4.9, 5.0, 5.5, 6.0, 6.5, 6.8, 7.0,
|
|
7.3, 7.5, 7.8, 8.0, 8.4, 8.7, 9.0, 9.4, 9.6, 9.8,
|
|
10.0)
|
|
|
|
//Exxagerates or removes brightness
|
|
/proc/color_contrast(value)
|
|
value = clamp(value, -100, 100)
|
|
if(value == 0)
|
|
return color_identity()
|
|
|
|
var/x = 0
|
|
if (value < 0)
|
|
x = 127 + value / 100 * 127;
|
|
else
|
|
x = value % 1
|
|
if(x == 0)
|
|
x = delta_index[value]
|
|
else
|
|
x = delta_index[value] * (1-x) + delta_index[value+1] * x//use linear interpolation for more granularity.
|
|
x = x * 127 + 127
|
|
|
|
var/mult = x / 127
|
|
var/add = 0.5 * (127-x) / 255
|
|
return list(mult,0,0, 0,mult,0, 0,0,mult, add,add,add)
|
|
|
|
//Exxagerates or removes colors
|
|
/proc/color_saturation(value as num)
|
|
if(value == 0)
|
|
return color_identity()
|
|
value = clamp(value, -100, 100)
|
|
if(value > 0)
|
|
value *= 3
|
|
var/x = 1 + value / 100
|
|
var/inv = 1 - x
|
|
var/R = LUMR * inv
|
|
var/G = LUMG * inv
|
|
var/B = LUMB * inv
|
|
|
|
return list(R + x,R,R, G,G + x,G, B,B,B + x)
|
|
|
|
#undef LUMR
|
|
#undef LUMG
|
|
#undef LUMB
|