From b76b3fa298d480b96c98e7fef893b3610ae9e2b7 Mon Sep 17 00:00:00 2001 From: Menshin Date: Sat, 4 Oct 2014 21:16:23 +0200 Subject: [PATCH] * The Space Cube is now generated at world start, before away missions are loaded This means away missions don't have space transitions * The setup_map_transition proc is protected from excessive tiles proceeding (the proc is set to the background if too much tiles are processed) * Added a comment explaining the Space Cube, by Incoming * Fixes #4903 : "mobs don't maintain momentum on z-level transition" * Serendipitiously fixes #2614 --- code/controllers/master_controller.dm | 1 - code/game/turfs/space/space.dm | 24 +++++++++++++++++++++++- code/world.dm | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index b55bdcc749b..acf02a77bc8 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -68,7 +68,6 @@ var/global/pipe_processing_killed = 0 world.tick_lag = config.Ticklag setup_objects() - setup_map_transistions() setupgenetics() setupfactions() diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index 314b81d1dac..fe355624d19 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -70,6 +70,10 @@ var/turf/T = get_step(L.loc,turn(A.dir, 180)) L.pulling.loc = T + //now we're on the new z_level, proceed the space drifting + if ((A && A.loc)) + A.loc.Entered(A) + /turf/space/proc/Sandbox_Spacemove(atom/movable/A) var/cur_x var/cur_y @@ -122,7 +126,19 @@ else if (y >= (world.maxy - TRANSITIONEDGE - 1)) //north destination_y = TRANSITIONEDGE + 1 -/datum/controller/game_controller/proc/setup_map_transistions() //listamania +/* + Set the space turf transitions for the "space cube" + + Connections: + ___ ___ + /_A_/| /_F_/| + | |C| | |E| + |_B_|/ |_D_|/ + + Note that all maps except F are oriented with north towards A. A and F are oriented with north towards D. + The characters on the second cube should be upside down in this illustration, but aren't because of a lack of unicode support. +*/ +proc/setup_map_transitions() //listamania var/list/unplaced_z_levels = accessable_z_levels var/list/free_zones = list("A", "B", "C", "D", "E", "F") @@ -134,11 +150,17 @@ var/list/z_level_order = list() var/z_level var/placement + var/total_processed = 0 for(var/turf/space/S in world) //Define the transistions of the z levels + total_processed++ if (S.x == TRANSITIONEDGE || S.x == (world.maxx - TRANSITIONEDGE - 1) || S.y == TRANSITIONEDGE || S.y == (world.maxy - TRANSITIONEDGE - 1)) turfs_needing_transition += S + //if we've processed lots of turfs, switch to background processing to prevent being mistaken for an infinite loop + if(total_processed > 450000) + set background = 1 + while(free_zones.len != 0) //Assign the sides of the cube if(!unplaced_z_levels) //if we're somehow unable to fill the cube, pad with deep space z_level = 6 diff --git a/code/world.dm b/code/world.dm index 9d52ffe0c05..82f3817b3c2 100644 --- a/code/world.dm +++ b/code/world.dm @@ -77,6 +77,8 @@ slmaster.layer = FLY_LAYER slmaster.mouse_opacity = 0 + setup_map_transitions() + for(var/i=0, i