Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluespace drive #20053

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2773a08
first iteration
FluffyGhoster Aug 21, 2024
a59abec
Merge branch 'master' into bluespace_drive
FluffyGhoster Aug 21, 2024
fffa441
SOULLING_START
FluffyGhoster Aug 23, 2024
8dc766c
Merge branch 'master' into bluespace_drive
FluffyGhoster Aug 23, 2024
3e4afbe
Merge branch 'master' into bluespace_drive
FluffyGhoster Oct 14, 2024
b8bd56b
sda
FluffyGhoster Oct 14, 2024
9461899
Bluespace Drive
FluffyGhoster Oct 14, 2024
352ee33
Merge branch 'master' into bluespace_drive
FluffyGhoster Oct 14, 2024
aad6b40
sadf
FluffyGhoster Oct 14, 2024
952356c
sadfsad
FluffyGhoster Oct 14, 2024
11f9140
sdfas
FluffyGhoster Oct 14, 2024
28d3191
normal doors + names + access
FluffyGhoster Oct 15, 2024
50c9b64
some map tweaks
FluffyGhoster Oct 15, 2024
b72f57f
sdfas
FluffyGhoster Oct 15, 2024
f20ad87
map tweaks, manual, power from main distribution, bigger room
FluffyGhoster Oct 15, 2024
5982332
sad
FluffyGhoster Oct 15, 2024
5ca868a
cameras for the drive room!
FluffyGhoster Oct 15, 2024
b125dbe
forgot two internal walls
FluffyGhoster Oct 15, 2024
7de0284
i hate this
FluffyGhoster Oct 15, 2024
37073e9
da changes for da mapping (#4)
courierbravo Oct 17, 2024
1df43e3
tweaks
FluffyGhoster Oct 17, 2024
b65fc65
Merge branch 'master' into bluespace_drive
FluffyGhoster Oct 17, 2024
3573cf5
fixes pipes
FluffyGhoster Oct 17, 2024
6eb5117
sdaf
FluffyGhoster Oct 17, 2024
64fdac2
Changelog changes from courier
FluffyGhoster Oct 17, 2024
5b88ece
sadfas
FluffyGhoster Oct 17, 2024
c806733
afsadf
FluffyGhoster Oct 17, 2024
1c73a88
fix power cable notified by popper
FluffyGhoster Oct 18, 2024
2aea8c5
Merge branch 'master' into bluespace_drive
FluffyGhoster Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aurorastation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,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
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 @@ -1210,10 +1167,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 @@ -130,6 +130,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
Loading