mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* Add the system for managed global variables * Travis ban old globals * So you CAN inline proccall, that's neat * Fix that * master.dm * Remove the hack procs * Move InitGlobals to the proper spot * configuration.dm * Fix the missing pre-slash * clockcult.dm * This is probably for the best * Doy * Fix shit * Rest of the DEFINES tree * Fix * Use global. for access * Update find_references_in_globals Always hated that proc Whoever made it must've bee a r e a l idiot... * __HELPERS tree * Move global initialization to master. Fix the declaration * database.dm * Dat newline * I said DECLARATIVE order! * Here's something you can chew on @Iamgoofball * game_modes.dm * Fix this * genetics.dm * flavor_misc.dm * More stuff * Do it mso's way. Keep the controllers as global * Make master actually see it * Fix * Finish _globalvars/lists * Finish the rest of the _globalvars tree * This is weird * Migrate the controllers * SLOTH -> GLOB * Lighting globals * round_start_time -> ticker * PAI card list -> pai SS * record_id_num -> static * Diseases list -> SSdisease * More disease globals to the SS * More disease stuff * Emote list * Better and better * Bluh * So much stuff * Ahh * Wires * dview * station_areas * Teleportlocs * blood_splatter_icons * Stuff and such * More stuff * RAD IO * More stuff and such * Blob shit * Changeling stuff * Add "Balance" to changelogs * Balance for changelog compiler + Auto Tagging * Update the PR template * hivemind_bank * Bip * sacrificed * Good shit * Better define * More cult shit * Devil shit * Gang shit * > borers Fix shit * Rename the define * Nuke * Objectives * Sandbox * Multiverse sword * Announce systems * Stuff and such * TC con * Airlock * doppllllerrrrrr * holopads * Shut up byond you inconsistent fuck * Sneaky fuck * Burp * Bip * Fixnshit * Port without regard * askdlfjs; * asdfjasoidojfi * Protected globals and more * SO MANY * ajsimkvahsaoisd * akfdsiaopwimfeoiwafaw * gsdfigjosidjfgiosdg * AHHHHHHHHHHHHHHHHHHHHHHH!!!!! * facerolll * ASDFASDFASDF * Removes the unused parts of dmm_suite * WIP * Fix quote * asdfjauwfnkjs * afwlunhskjfda * asfjlaiwuefhaf * SO CLOSE * wwwweeeeeewwwww * agdgmoewranwg * HOLY MOTHER OF FUCK AND THATS JUST HALF THE JOB?!? * Fix syntax errors * 100 errors * Another 100 * So many... * Ugh * More shit * kilme * Stuuuuuufffff * ajrgmrlshio;djfa;sdkl * jkbhkhjbmjvjmh * soi soi soi * butt * TODAY WE LEARNED THAT GLOBAL AND STATIC ARE THE EXACT SAME FUCKING THING * lllllllllllllllllllllllllllllllllllllllllll * afsdijfiawhnflnjhnwsdfs * yugykihlugk,kj * time to go * STUFFF!!! * AAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!! * ngoaijdjlfkamsdlkf * Break time * aufjsdklfalsjfi * CONTROL KAY AND PRAY * IT COMPILEELEELELAKLJFKLDAFJLKFDJLADKJHFLJKAJGAHIEJALDFJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Goteem * Fix testing mode * This does not belong in this PR * Convert it to a controller * Eh, fuck this option * Revert controllerization Ill do it some other time * Fix * Working controllerization * FOR THE LOVE OF CHRIST PROTECT THE LOGS * Protect admins and deadmins * Use the inbuilt proc
165 lines
5.6 KiB
Plaintext
165 lines
5.6 KiB
Plaintext
//This is a simple 3 by 3 grid working off the corpse of the space torus. The donut is dead, cube has been avenged!
|
|
|
|
#define Z_LEVEL_NORTH "1"
|
|
#define Z_LEVEL_SOUTH "2"
|
|
#define Z_LEVEL_EAST "4"
|
|
#define Z_LEVEL_WEST "8"
|
|
|
|
GLOBAL_LIST_EMPTY(z_levels_list)
|
|
|
|
/datum/space_level
|
|
var/name = "Your config settings failed, you need to fix this for the datum space levels to work"
|
|
var/list/neigbours = list()
|
|
var/z_value = 1 //actual z placement
|
|
var/linked = SELFLOOPING
|
|
var/xi
|
|
var/yi //imaginary placements on the grid
|
|
|
|
/datum/space_level/New(transition_type)
|
|
linked = transition_type
|
|
if(linked == SELFLOOPING)
|
|
neigbours = list()
|
|
var/list/L = list(Z_LEVEL_NORTH,Z_LEVEL_SOUTH,Z_LEVEL_EAST,Z_LEVEL_WEST)
|
|
for(var/A in L)
|
|
neigbours[A] = src
|
|
|
|
/datum/space_level/proc/set_neigbours(list/L)
|
|
for(var/datum/point/P in L)
|
|
if(P.x == xi)
|
|
if(P.y == yi+1)
|
|
neigbours[Z_LEVEL_NORTH] = P.spl
|
|
P.spl.neigbours[Z_LEVEL_SOUTH] = src
|
|
else if(P.y == yi-1)
|
|
neigbours[Z_LEVEL_SOUTH] = P.spl
|
|
P.spl.neigbours[Z_LEVEL_NORTH] = src
|
|
else if(P.y == yi)
|
|
if(P.x == xi+1)
|
|
neigbours[Z_LEVEL_EAST] = P.spl
|
|
P.spl.neigbours[Z_LEVEL_WEST] = src
|
|
else if(P.x == xi-1)
|
|
neigbours[Z_LEVEL_WEST] = P.spl
|
|
P.spl.neigbours[Z_LEVEL_EAST] = src
|
|
|
|
/datum/point //this is explicitly utilitarian datum type made specially for the space map generation and are absolutely unusable for anything else
|
|
var/list/neigbours = list()
|
|
var/x
|
|
var/y
|
|
var/datum/space_level/spl
|
|
|
|
/datum/point/New(nx, ny, list/point_grid)
|
|
if(!point_grid)
|
|
qdel(src)
|
|
return
|
|
var/list/L = point_grid[1]
|
|
if(nx > point_grid.len || ny > L.len)
|
|
qdel(src)
|
|
return
|
|
x = nx
|
|
y = ny
|
|
if(point_grid[x][y])
|
|
return
|
|
point_grid[x][y] = src
|
|
|
|
/datum/point/proc/set_neigbours(list/grid)
|
|
var/max_X = grid.len
|
|
var/list/max_Y = grid[1]
|
|
max_Y = max_Y.len
|
|
neigbours.Cut()
|
|
if(x+1 <= max_X)
|
|
neigbours |= grid[x+1][y]
|
|
if(x-1 >= 1)
|
|
neigbours |= grid[x-1][y]
|
|
if(y+1 <= max_Y)
|
|
neigbours |= grid[x][y+1]
|
|
if(y-1 >= 1)
|
|
neigbours |= grid[x][y-1]
|
|
|
|
/proc/setup_map_transitions() //listamania
|
|
var/list/SLS = list()
|
|
var/datum/space_level/D
|
|
var/list/cached_transitions = SSmapping.config.transition_config
|
|
var/conf_set_len = cached_transitions.len
|
|
var/k = 1
|
|
for(var/A in cached_transitions)
|
|
D = new(cached_transitions[A])
|
|
D.name = A
|
|
D.z_value = k
|
|
if(D.linked != CROSSLINKED)
|
|
GLOB.z_levels_list["[D.z_value]"] = D
|
|
else
|
|
SLS.Add(D)
|
|
k++
|
|
var/list/point_grid[conf_set_len*2+1][conf_set_len*2+1]
|
|
var/list/grid = list()
|
|
var/datum/point/P
|
|
for(var/i = 1, i<=conf_set_len*2+1, i++)
|
|
for(var/j = 1, j<=conf_set_len*2+1, j++)
|
|
P = new/datum/point(i,j, point_grid)
|
|
point_grid[i][j] = P
|
|
grid.Add(P)
|
|
for(var/datum/point/pnt in grid)
|
|
pnt.set_neigbours(point_grid)
|
|
P = point_grid[conf_set_len+1][conf_set_len+1]
|
|
var/list/possible_points = list()
|
|
var/list/used_points = list()
|
|
grid.Cut()
|
|
while(SLS.len)
|
|
D = pick_n_take(SLS)
|
|
D.xi = P.x
|
|
D.yi = P.y
|
|
P.spl = D
|
|
possible_points |= P.neigbours
|
|
used_points |= P
|
|
possible_points.Remove(used_points)
|
|
D.set_neigbours(used_points)
|
|
P = pick(possible_points)
|
|
grid["[D.z_value]"] = D
|
|
|
|
for(var/A in GLOB.z_levels_list)
|
|
grid[A] = GLOB.z_levels_list[A]
|
|
|
|
//Lists below are pre-calculated values arranged in the list in such a way to be easily accessable in the loop by the counter
|
|
//Its either this or madness with lotsa math
|
|
|
|
var/list/x_pos_beginning = list(1, 1, world.maxx - TRANSITIONEDGE, 1) //x values of the lowest-leftest turfs of the respective 4 blocks on each side of zlevel
|
|
var/list/y_pos_beginning = list(world.maxy - TRANSITIONEDGE, 1, TRANSITIONEDGE, TRANSITIONEDGE) //y values respectively
|
|
var/list/x_pos_ending = list(world.maxx, world.maxx, world.maxx, TRANSITIONEDGE) //x values of the highest-rightest turfs of the respective 4 blocks on each side of zlevel
|
|
var/list/y_pos_ending = list(world.maxy, TRANSITIONEDGE, world.maxy - TRANSITIONEDGE, world.maxy - TRANSITIONEDGE) //y values respectively
|
|
var/list/x_pos_transition = list(1, 1, TRANSITIONEDGE + 2, world.maxx - TRANSITIONEDGE - 2) //values of x for the transition from respective blocks on the side of zlevel, 1 is being translated into turfs respective x value later in the code
|
|
var/list/y_pos_transition = list(TRANSITIONEDGE + 2, world.maxy - TRANSITIONEDGE - 2, 1, 1) //values of y for the transition from respective blocks on the side of zlevel, 1 is being translated into turfs respective y value later in the code
|
|
|
|
for(var/zlevelnumber = 1, zlevelnumber<=grid.len, zlevelnumber++)
|
|
D = grid["[zlevelnumber]"]
|
|
if(!D)
|
|
CRASH("[zlevelnumber] position has no space level datum.")
|
|
if(!(D.neigbours.len))
|
|
continue
|
|
for(var/side = 1, side<5, side++)
|
|
var/turf/beginning = locate(x_pos_beginning[side], y_pos_beginning[side], zlevelnumber)
|
|
var/turf/ending = locate(x_pos_ending[side], y_pos_ending[side], zlevelnumber)
|
|
var/list/turfblock = block(beginning, ending)
|
|
var/dirside = 2**(side-1)
|
|
var/zdestination = zlevelnumber
|
|
if(D.neigbours["[dirside]"] && D.neigbours["[dirside]"] != D)
|
|
D = D.neigbours["[dirside]"]
|
|
zdestination = D.z_value
|
|
else
|
|
dirside = turn(dirside, 180)
|
|
while(D.neigbours["[dirside]"] && D.neigbours["[dirside]"] != D)
|
|
D = D.neigbours["[dirside]"]
|
|
zdestination = D.z_value
|
|
D = grid["[zlevelnumber]"]
|
|
for(var/turf/open/space/S in turfblock)
|
|
S.destination_x = x_pos_transition[side] == 1 ? S.x : x_pos_transition[side]
|
|
S.destination_y = y_pos_transition[side] == 1 ? S.y : y_pos_transition[side]
|
|
S.destination_z = zdestination
|
|
//S.maptext = "[zdestination]" // for debugging
|
|
|
|
for(var/A in grid)
|
|
GLOB.z_levels_list[A] = grid[A]
|
|
|
|
#undef Z_LEVEL_NORTH
|
|
#undef Z_LEVEL_SOUTH
|
|
#undef Z_LEVEL_EAST
|
|
#undef Z_LEVEL_WEST
|