Merge pull request #5496 from Citadel-Station-13/upstream-merge-35339
[MIRROR] Support stations with multiple z-levels
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in GLOB.machines)
|
||||
if(QDELETED(temp_vent))
|
||||
continue
|
||||
if(temp_vent.loc.z == ZLEVEL_STATION_PRIMARY && !temp_vent.welded)
|
||||
if(temp_vent.loc.z == SSmapping.station_start && !temp_vent.welded)
|
||||
var/datum/pipeline/temp_vent_parent = temp_vent.parents[1]
|
||||
if(temp_vent_parent.other_atmosmch.len > 20)
|
||||
vents += temp_vent
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
var/datum/map_template/pirate_event_ship/ship = new
|
||||
var/x = rand(TRANSITIONEDGE,world.maxx - TRANSITIONEDGE - ship.width)
|
||||
var/y = rand(TRANSITIONEDGE,world.maxy - TRANSITIONEDGE - ship.height)
|
||||
var/z = ZLEVEL_EMPTY_SPACE
|
||||
var/z = SSmapping.empty_space.z_value
|
||||
var/turf/T = locate(x,y,z)
|
||||
if(!T)
|
||||
CRASH("Pirate event found no turf to load in")
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
var/x = round((world.maxx - width)/2)
|
||||
var/y = round((world.maxy - height)/2)
|
||||
|
||||
var/datum/space_level/level = SSmapping.add_new_zlevel(name, UNAFFECTED, list(ZTRAIT_AWAY = TRUE))
|
||||
var/datum/space_level/level = SSmapping.add_new_zlevel(name, list(ZTRAIT_AWAY = TRUE))
|
||||
var/list/bounds = maploader.load_map(file(mappath), x, y, level.z_value, no_changeturf=(SSatoms.initialized == INITIALIZATION_INSSATOMS), placeOnTop=TRUE)
|
||||
if(!bounds)
|
||||
return FALSE
|
||||
|
||||
@@ -94,7 +94,7 @@ GLOBAL_DATUM_INIT(_preloader, /dmm_suite/preloader, new)
|
||||
var/zcrd = text2num(dmmRegex.group[5]) + z_offset - 1
|
||||
|
||||
var/zexpansion = zcrd > world.maxz
|
||||
if(zexpansion)
|
||||
if(zexpansion && !measureOnly)
|
||||
if(cropMap)
|
||||
continue
|
||||
else
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/datum/space_level
|
||||
var/name = "Your config settings failed, you need to fix this for the datum space levels to work"
|
||||
var/name = "NAME MISSING"
|
||||
var/list/neigbours = list()
|
||||
var/list/traits
|
||||
var/z_value = 1 //actual z placement
|
||||
@@ -7,8 +7,8 @@
|
||||
var/xi
|
||||
var/yi //imaginary placements on the grid
|
||||
|
||||
/datum/space_level/New(new_z, new_name, new_linkage = SELFLOOPING, list/new_traits = list())
|
||||
/datum/space_level/New(new_z, new_name, list/new_traits = list())
|
||||
z_value = new_z
|
||||
name = new_name
|
||||
traits = new_traits
|
||||
set_linkage(new_linkage)
|
||||
set_linkage(new_traits[ZTRAIT_LINKAGE])
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/datum/space_level/proc/set_linkage(new_linkage)
|
||||
linkage = new_linkage
|
||||
if(linkage == SELFLOOPING)
|
||||
neigbours = list()
|
||||
var/list/L = list(TEXT_NORTH,TEXT_SOUTH,TEXT_EAST,TEXT_WEST)
|
||||
for(var/A in L)
|
||||
neigbours = list(TEXT_NORTH,TEXT_SOUTH,TEXT_EAST,TEXT_WEST)
|
||||
for(var/A in neigbours)
|
||||
neigbours[A] = src
|
||||
|
||||
/datum/space_level/proc/set_neigbours(list/L)
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
// Look up levels[z].traits[trait]
|
||||
/datum/controller/subsystem/mapping/proc/level_trait(z, trait)
|
||||
if (!z)
|
||||
if (!isnum(z) || z < 1)
|
||||
return null
|
||||
var/list/trait_list
|
||||
if (z_list)
|
||||
if (z > z_list.len)
|
||||
stack_trace("Unmanaged z-level [z]! maxz = [world.maxz], z_list.len = [z_list.len]")
|
||||
return list()
|
||||
var/datum/space_level/S = get_level(z)
|
||||
trait_list = S.traits
|
||||
return S.traits[trait]
|
||||
else
|
||||
var/list/default_map_traits = DEFAULT_MAP_TRAITS
|
||||
trait_list = default_map_traits[z][DL_TRAITS]
|
||||
return trait_list[trait]
|
||||
var/list/default = DEFAULT_MAP_TRAITS
|
||||
if (z > default.len)
|
||||
stack_trace("Unmanaged z-level [z]! maxz = [world.maxz], default.len = [default.len]")
|
||||
return list()
|
||||
return default[z][DL_TRAITS][trait]
|
||||
|
||||
// Check if levels[z] has any of the specified traits
|
||||
/datum/controller/subsystem/mapping/proc/level_has_any_trait(z, list/traits)
|
||||
@@ -45,6 +49,24 @@
|
||||
. += S.z_value
|
||||
break
|
||||
|
||||
// Attempt to get the turf below the provided one according to Z traits
|
||||
/datum/controller/subsystem/mapping/proc/get_turf_below(turf/T)
|
||||
if (!T)
|
||||
return
|
||||
var/offset = level_trait(T.z, ZTRAIT_DOWN)
|
||||
if (!offset)
|
||||
return
|
||||
return locate(T.x, T.y, T.z + offset)
|
||||
|
||||
// Attempt to get the turf above the provided one according to Z traits
|
||||
/datum/controller/subsystem/mapping/proc/get_turf_above(turf/T)
|
||||
if (!T)
|
||||
return
|
||||
var/offset = level_trait(T.z, ZTRAIT_UP)
|
||||
if (!offset)
|
||||
return
|
||||
return locate(T.x, T.y, T.z + offset)
|
||||
|
||||
// Prefer not to use this one too often
|
||||
/datum/controller/subsystem/mapping/proc/get_station_center()
|
||||
var/station_z = levels_by_trait(ZTRAIT_STATION)[1]
|
||||
|
||||
@@ -13,20 +13,20 @@
|
||||
|
||||
for (var/I in 1 to default_map_traits.len)
|
||||
var/list/features = default_map_traits[I]
|
||||
var/datum/space_level/S = new(I, features[DL_NAME], features[DL_LINKAGE], features[DL_TRAITS])
|
||||
var/datum/space_level/S = new(I, features[DL_NAME], features[DL_TRAITS])
|
||||
z_list += S
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/add_new_zlevel(name, linkage = SELFLOOPING, traits = list(), z_type = /datum/space_level)
|
||||
/datum/controller/subsystem/mapping/proc/add_new_zlevel(name, traits = list(), z_type = /datum/space_level)
|
||||
var/new_z = z_list.len + 1
|
||||
if (world.maxz < new_z)
|
||||
world.incrementMaxZ()
|
||||
CHECK_TICK
|
||||
// TODO: sleep here if the Z level needs to be cleared
|
||||
var/datum/space_level/S = new z_type(new_z, name, linkage, traits)
|
||||
var/datum/space_level/S = new z_type(new_z, name, traits)
|
||||
z_list += S
|
||||
return S
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/get_level(z)
|
||||
. = z_list[z]
|
||||
if (!.)
|
||||
CRASH("Unmanaged z-level: '[z]'")
|
||||
if (z_list && z >= 1 && z <= z_list.len)
|
||||
return z_list[z]
|
||||
CRASH("Unmanaged z-level [z]! maxz = [world.maxz], z_list.len = [z_list ? z_list.len : "null"]")
|
||||
|
||||
@@ -20,11 +20,15 @@
|
||||
if(!istype(mother, /datum/mapGenerator/repair/reload_station_map))
|
||||
return
|
||||
var/datum/mapGenerator/repair/reload_station_map/mother1 = mother
|
||||
if(!is_station_level(mother1.z))
|
||||
return //This is only for reloading station blocks!
|
||||
GLOB.reloading_map = TRUE
|
||||
var/static/dmm_suite/reloader = new
|
||||
var/list/bounds = reloader.load_map(file(SSmapping.config.GetFullMapPath()),measureOnly = FALSE, no_changeturf = FALSE,x_offset = 0, y_offset = 0, z_offset = ZLEVEL_STATION_PRIMARY, cropMap=TRUE, lower_crop_x = mother1.x_low, lower_crop_y = mother1.y_low, upper_crop_x = mother1.x_high, upper_crop_y = mother1.y_high)
|
||||
// This is kind of finicky on multi-Z maps but the reader would need to be
|
||||
// changed to allow Z cropping and that's a mess
|
||||
var/z_offset = SSmapping.station_start
|
||||
var/list/bounds
|
||||
for (var/path in SSmapping.config.GetFullMapPaths())
|
||||
bounds = reloader.load_map(file(path), measureOnly = FALSE, no_changeturf = FALSE,x_offset = 0, y_offset = 0, z_offset = z_offset, cropMap=TRUE, lower_crop_x = mother1.x_low, lower_crop_y = mother1.y_low, upper_crop_x = mother1.x_high, upper_crop_y = mother1.y_high)
|
||||
z_offset += bounds[MAP_MAXZ] - bounds[MAP_MINZ] + 1
|
||||
|
||||
var/list/obj/machinery/atmospherics/atmos_machines = list()
|
||||
var/list/obj/structure/cable/cables = list()
|
||||
@@ -32,8 +36,8 @@
|
||||
|
||||
repopulate_sorted_areas()
|
||||
|
||||
for(var/L in block(locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]),
|
||||
locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])))
|
||||
for(var/L in block(locate(bounds[MAP_MINX], bounds[MAP_MINY], SSmapping.station_start),
|
||||
locate(bounds[MAP_MAXX], bounds[MAP_MAXY], z_offset - 1)))
|
||||
set waitfor = FALSE
|
||||
var/turf/B = L
|
||||
atoms += B
|
||||
@@ -93,7 +97,7 @@
|
||||
y_low = min(start.y, end.y)
|
||||
x_high = max(start.x, end.x)
|
||||
y_high = max(start.y, end.y)
|
||||
z = ZLEVEL_STATION_PRIMARY
|
||||
z = SSmapping.station_start
|
||||
|
||||
GLOBAL_VAR_INIT(reloading_map, FALSE)
|
||||
|
||||
|
||||
@@ -100,9 +100,16 @@
|
||||
/obj/structure/mirror/magic/pride/curse(mob/user)
|
||||
user.visible_message("<span class='danger'><B>The ground splits beneath [user] as [user.p_their()] hand leaves the mirror!</B></span>", \
|
||||
"<span class='notice'>Perfect. Much better! Now <i>nobody</i> will be able to resist yo-</span>")
|
||||
|
||||
var/turf/T = get_turf(user)
|
||||
T.ChangeTurf(/turf/open/chasm/straight_down)
|
||||
var/list/levels = SSmapping.levels_by_trait(ZTRAIT_SPACE_RUINS)
|
||||
var/turf/dest
|
||||
if (levels.len)
|
||||
dest = locate(T.x, T.y, pick(levels))
|
||||
|
||||
T.ChangeTurf(/turf/open/chasm)
|
||||
var/turf/open/chasm/C = T
|
||||
C.set_target(dest)
|
||||
C.drop(user)
|
||||
|
||||
//can't be bothered to do sloth right now, will make later
|
||||
|
||||
Reference in New Issue
Block a user