Skip to content

Commit

Permalink
Merge branch 'master' into dominian-research-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
furrycactus committed Nov 19, 2024
2 parents fbb82dd + 8c700ad commit 1ecd763
Show file tree
Hide file tree
Showing 85 changed files with 15,067 additions and 11,133 deletions.
2 changes: 2 additions & 0 deletions aurorastation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@
#include "code\game\machinery\Beacon.dm"
#include "code\game\machinery\biogenerator.dm"
#include "code\game\machinery\bioprinter.dm"
#include "code\game\machinery\bluespace_drive.dm"
#include "code\game\machinery\bluespacerelay.dm"
#include "code\game\machinery\body_scanner.dm"
#include "code\game\machinery\buttons.dm"
Expand Down Expand Up @@ -3750,6 +3751,7 @@
#include "code\unit_tests\loadout_tests.dm"
#include "code\unit_tests\map_tests.dm"
#include "code\unit_tests\mob_tests.dm"
#include "code\unit_tests\modular_computers_tests.dm"
#include "code\unit_tests\object_tests.dm"
#include "code\unit_tests\observation_tests.dm"
#include "code\unit_tests\origins_tests.dm"
Expand Down
5 changes: 3 additions & 2 deletions code/__DEFINES/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#define CONSULAR_ROLE /datum/job/consular
#define JOURNALIST_ROLE /datum/job/journalist
#define CHAPLAIN_ROLE /datum/job/chaplain
#define CONSULAR_AIDE_ROLE /datum/job/consular_assistant
#define DIPLOMATIC_AIDE_ROLE /datum/job/diplomatic_aide
#define CORPORATE_AIDE_ROLE /datum/job/corporate_aide

//Event Roles
//Used for generic department jobs for off-ship events
Expand Down Expand Up @@ -48,4 +49,4 @@
#define ZENG_ROLES list(SCIENCE_ROLES, MEDICAL_ROLES, CIVILIAN_ROLES, REPRESENTATIVE_ROLE)
#define HEPH_ROLES list(OPERATIONS_ROLES, ENGINEERING_ROLES, CIVILIAN_ROLES, REPRESENTATIVE_ROLE)
#define ORION_ROLES list(OPERATIONS_ROLES, CIVILIAN_ROLES, REPRESENTATIVE_ROLE, SERVICE_ROLES)
#define INDEP_ROLES list(NON_CREW_CIVILIAN_ROLES, CONSULAR_ROLE, JOURNALIST_ROLE, CHAPLAIN_ROLE, OFF_DUTY_CREW_MEMBER_ROLE, JOURNALIST_ROLE, CONSULAR_AIDE_ROLE)
#define INDEP_ROLES list(NON_CREW_CIVILIAN_ROLES, CONSULAR_ROLE, JOURNALIST_ROLE, CHAPLAIN_ROLE, OFF_DUTY_CREW_MEMBER_ROLE, JOURNALIST_ROLE, DIPLOMATIC_AIDE_ROLE)
5 changes: 3 additions & 2 deletions code/__DEFINES/machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@
#define NETWORK_FIRST_DECK "First Deck"
#define NETWORK_SECOND_DECK "Second Deck"
#define NETWORK_THIRD_DECK "Third Deck"
#define NETWORK_INTREPID "Intrepid"
#define NETWORK_CANARY "Canary"
#define NETWORK_INTREPID "Intrepid" // horizon shuttle, expedition/transport
#define NETWORK_CANARY "Canary" // horizon shuttle, scout/fighter
#define NETWORK_QUARK "Quark" // horizon shuttle, xenoarch/science
#define NETWORK_NEWS "News"


Expand Down
155 changes: 107 additions & 48 deletions code/__HELPERS/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,113 @@
else if(x < 0)
. += 360

/// Angle between two arbitrary points and horizontal line same as [/proc/get_angle]
/proc/get_angle_raw(start_x, start_y, start_pixel_x, start_pixel_y, end_x, end_y, end_pixel_x, end_pixel_y)
var/dy = (32 * end_y + end_pixel_y) - (32 * start_y + start_pixel_y)
var/dx = (32 * end_x + end_pixel_x) - (32 * start_x + start_pixel_x)
if(!dy)
return (dx >= 0) ? 90 : 270
. = arctan(dx/dy)
if(dy < 0)
. += 180
else if(dx < 0)
. += 360

///for getting the angle when animating something's pixel_x and pixel_y
/proc/get_pixel_angle(y, x)
if(!y)
return (x >= 0) ? 90 : 270
. = arctan(x/y)
if(y < 0)
. += 180
else if(x < 0)
. += 360

/**
* Get a list of turfs in a perimeter given the `center_atom` and `radius`.
* Automatically rounds down decimals and does not accept values less than positive 1 as they dont play well with it.
* Is efficient on large circles but ugly on small ones
* Uses [Jesko`s method to the midpoint circle Algorithm](https://en.wikipedia.org/wiki/Midpoint_circle_algorithm).
*/
/proc/get_perimeter(atom/center, radius)
if(radius < 1)
return
var/rounded_radius = round(radius)
var/x = center.x
var/y = center.y
var/z = center.z
var/t1 = rounded_radius/16
var/dx = rounded_radius
var/dy = 0
var/t2
var/list/perimeter = list()
while(dx >= dy)
perimeter += locate(x + dx, y + dy, z)
perimeter += locate(x - dx, y + dy, z)
perimeter += locate(x + dx, y - dy, z)
perimeter += locate(x - dx, y - dy, z)
perimeter += locate(x + dy, y + dx, z)
perimeter += locate(x - dy, y + dx, z)
perimeter += locate(x + dy, y - dx, z)
perimeter += locate(x - dy, y - dx, z)
dy += 1
t1 += dy
t2 = t1 - dx
if(t2 > 0)
t1 = t2
dx -= 1
return perimeter

/**
* Get a list of turfs in a line from `starting_atom` to `ending_atom`.
*
* Uses the ultra-fast [Bresenham Line-Drawing Algorithm](https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm).
*/
/proc/get_line(atom/starting_atom, atom/ending_atom)
var/current_x_step = starting_atom.x//start at x and y, then add 1 or -1 to these to get every turf from starting_atom to ending_atom
var/current_y_step = starting_atom.y
var/starting_z = starting_atom.z

var/list/line = list(get_turf(starting_atom))//get_turf(atom) is faster than locate(x, y, z)

var/x_distance = ending_atom.x - current_x_step //x distance
var/y_distance = ending_atom.y - current_y_step

var/abs_x_distance = abs(x_distance)//Absolute value of x distance
var/abs_y_distance = abs(y_distance)

var/x_distance_sign = SIGN(x_distance) //Sign of x distance (+ or -)
var/y_distance_sign = SIGN(y_distance)

var/x = abs_x_distance >> 1 //Counters for steps taken, setting to distance/2
var/y = abs_y_distance >> 1 //Bit-shifting makes me l33t. It also makes get_line() unnessecarrily fast.

if(abs_x_distance >= abs_y_distance) //x distance is greater than y
for(var/distance_counter in 0 to (abs_x_distance - 1))//It'll take abs_x_distance steps to get there
y += abs_y_distance

if(y >= abs_x_distance) //Every abs_y_distance steps, step once in y direction
y -= abs_x_distance
current_y_step += y_distance_sign

current_x_step += x_distance_sign //Step on in x direction
line += locate(current_x_step, current_y_step, starting_z)//Add the turf to the list
else
for(var/distance_counter in 0 to (abs_y_distance - 1))
x += abs_x_distance

if(x >= abs_y_distance)
x -= abs_y_distance
current_x_step += x_distance_sign

current_y_step += y_distance_sign
line += locate(current_x_step, current_y_step, starting_z)
return line

/*#####################
AURORA SNOWFLAKE
#####################*/

// round() acts like floor(x, 1) by default but can't handle other values
#define FLOOR_FLOAT(x, y) ( round((x) / (y)) * (y) )

Expand Down Expand Up @@ -182,54 +289,6 @@
#define Frand(low, high) ( rand() * ((high) - (low)) + (low) )


/**
* Get a list of turfs in a line from `starting_atom` to `ending_atom`.
*
* Uses the ultra-fast [Bresenham Line-Drawing Algorithm](https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm).
*/
/proc/get_line(atom/starting_atom, atom/ending_atom)
var/current_x_step = starting_atom.x // start at X and Y, then add 1 or -1 to these to get every turf from start to end
var/current_y_step = starting_atom.y
var/starting_z = starting_atom.z

var/list/line = list(get_turf(starting_atom))

var/x_distance = ending_atom.x - current_x_step
var/y_distance = ending_atom.y - current_y_step

var/abs_x_distance = abs(x_distance)
var/abs_y_distance = abs(y_distance)

var/x_distance_sign = SIGN(x_distance)
var/y_distance_sign = SIGN(y_distance)

var/x = abs_x_distance >> 1
var/y = abs_y_distance >> 1

if (abs_x_distance >= abs_y_distance)
for (var/distance_counter in 0 to (abs_x_distance - 1))
y += abs_y_distance

if(y >= abs_x_distance) // Every abs_y_distance steps, step once in y direction
y -= abs_x_distance
current_y_step += y_distance_sign

current_x_step += x_distance_sign // Step in x direction
line += locate(current_x_step, current_y_step, starting_z)
else
for (var/distance_counter in 0 to (abs_y_distance - 1))
x += abs_x_distance

if(x >= abs_y_distance)
x -= abs_y_distance
current_x_step += x_distance_sign

current_y_step += y_distance_sign
line += locate(current_x_step, current_y_step, starting_z)

return line


/// Returns the distance between two points
#define DIST_BETWEEN_TWO_POINTS(ax, ay, bx, by) (sqrt((bx-ax)*(bx-ax))+((by-ay)*(by-ay)))

Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/spatial_info.dm
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
var/list/sliced_turfs = list()

for(var/turf/checked_turf as anything in turfs)
var/angle_to = Get_Angle(center_turf, checked_turf)
var/angle_to = get_angle(center_turf, checked_turf)
if(angle_to < inner_angle || angle_to > outer_angle)
continue
sliced_turfs += checked_turf
Expand Down
49 changes: 1 addition & 48 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,6 @@
/proc/dd_range(var/low, var/high, var/num)
return max(low,min(high,num))

//Returns whether or not A is the middle most value
/proc/InRange(var/A, var/lower, var/upper)
if(A < lower) return 0
if(A > upper) return 0
return 1


/proc/Get_Angle(atom/movable/start, atom/movable/end) //For beams.
if(!start || !end)
return FALSE
var/dy = (32 * end.y + end.pixel_y) - (32 * start.y + start.pixel_y)
var/dx = (32 * end.x + end.pixel_x) - (32 * start.x + start.pixel_x)
if(!dy)
return (dx >= 0) ? 90 : 270
. = arctan(dx / dy)
if(dy < 0)
. += 180
else if(dx < 0)
. += 360

/**
* Gets all turfs inside a cone, return a `/list` of `/turf` that are inside the cone
*
Expand Down Expand Up @@ -86,7 +66,7 @@
var/angle_right = (middle_angle + angle_spread) % 360

for(var/turf/turf in range(distance, source))
var/angle_between_source_and_target = Get_Angle(source, turf)
var/angle_between_source_and_target = get_angle(source, turf)

// Ensure correct handling of angles spanning the 0-degree mark
if(angle_left <= angle_right)
Expand Down Expand Up @@ -469,13 +449,6 @@ Turf and target are seperate in case you want to teleport some distance from a t
// mob_list.Add(M)
return moblist

///Forces a variable to be posative
/proc/modulus(var/M)
if(M >= 0)
return M
if(M < 0)
return -M

/**
* Returns the turf located at the map edge in the specified direction relative to A
* used for mass driver
Expand Down Expand Up @@ -543,10 +516,6 @@ Turf and target are seperate in case you want to teleport some distance from a t
while(rsq>1 || !rsq)
return sigma*y*sqrt(-2*log(rsq)/rsq)

///Returns random gauss number, rounded to 'roundto'
/proc/GaussRandRound(var/sigma,var/roundto)
return round(GaussRand(sigma),roundto)

///Step-towards method of determining whether one atom can see another. Similar to viewers()
/proc/can_see(var/atom/source, var/atom/target, var/length=5) // I couldn't be arsed to do actual raycasting :I This is horribly inaccurate.
var/turf/current = get_turf(source)
Expand Down Expand Up @@ -867,10 +836,6 @@ Turf and target are seperate in case you want to teleport some distance from a t
else
return NORTH

//chances are 1:value. anyprob(1) will always return true
/proc/anyprob(value)
return (rand(1,value)==value)

/proc/view_or_range(distance = world.view , center = usr , type)
switch(type)
if("view")
Expand All @@ -879,14 +844,6 @@ Turf and target are seperate in case you want to teleport some distance from a t
. = range(distance,center)
return

/proc/oview_or_orange(distance = world.view , center = usr , type)
switch(type)
if("view")
. = oview(distance,center)
if("range")
. = orange(distance,center)
return

/proc/get_mob_with_client_list()
var/list/mobs = list()
for(var/mob/M in GLOB.mob_list)
Expand Down Expand Up @@ -1191,10 +1148,6 @@ var/global/known_proc = /proc/get_type_ref_bytes
colour += temp_col
return "#[colour]"

/proc/color_square(red, green, blue, hex)
var/color = hex ? hex : "#[num2hex(red, 2)][num2hex(green, 2)][num2hex(blue, 2)]"
return "<span style='font-face: fixedsys; font-size: 14px; background-color: [color]; color: [color]'>___</span>"

// call to generate a stack trace and print to runtime logs
/proc/crash_with(msg)
CRASH(msg)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystems/explosives.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ SUBSYSTEM_DEF(explosives)
continue

var/dist = get_dist(M_turf, epicenter)
var/explosion_dir = angle2text(Get_Angle(M_turf, epicenter))
var/explosion_dir = angle2text(get_angle(M_turf, epicenter))
if (reception == 2 && (M.ear_deaf <= 0 || !M.ear_deaf)) //Dont play sounds to deaf people

// Anyone with sensitive hearing gets a bonus to hearing explosions
Expand Down
3 changes: 2 additions & 1 deletion code/datums/beam.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
return ..()

/datum/beam/proc/Draw()
var/Angle = round(Get_Angle(origin.z ? origin : get_turf(origin), target.z ? target : get_turf(target)))
var/Angle = round(get_angle(origin.z ? origin : get_turf(origin), target.z ? target : get_turf(target)))
var/matrix/rot_matrix = matrix()
rot_matrix.Turn(Angle)

Expand Down Expand Up @@ -206,6 +206,7 @@
/obj/effect/ebeam
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
anchored = 1
plane = EFFECTS_ABOVE_LIGHTING_PLANE
layer = BEAM_PROJECTILE_LAYER
blend_mode = BLEND_ADD
var/datum/beam/owner
Expand Down
6 changes: 3 additions & 3 deletions code/game/gamemodes/endgame/bluespace_jump/bluespace_jump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@
icon = 'icons/effects/effects.dmi'
icon_state = "mfoam"
screen_loc = "WEST,SOUTH to EAST,NORTH"
color = "#ff9900"
alpha = 100
blend_mode = BLEND_SUBTRACT
alpha = 80
color = "#000050"
blend_mode = BLEND_ADD
Loading

0 comments on commit 1ecd763

Please sign in to comment.