mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 00:58:26 +01:00
[MIRROR] Builds logic that manages turfs contained inside an area [MDB IGNORE] (#17379)
* Builds logic that manages turfs contained inside an area * Mirror Conflict * Modular! Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: Funce <funce.973@gmail.com> Co-authored-by: tastyfish <crazychris32@gmail.com>
This commit is contained in:
co-authored by
LemonInTheDark
Funce
tastyfish
parent
bd4e73411d
commit
24eb8217c0
@@ -115,7 +115,7 @@ SUBSYSTEM_DEF(mapping)
|
||||
initialize_biomes()
|
||||
loadWorld()
|
||||
determine_fake_sale()
|
||||
repopulate_sorted_areas()
|
||||
require_area_resort()
|
||||
process_teleport_locs() //Sets up the wizard teleport locations
|
||||
preloadTemplates()
|
||||
|
||||
@@ -142,7 +142,7 @@ SUBSYSTEM_DEF(mapping)
|
||||
run_map_generation()
|
||||
// Add the transit level
|
||||
transit = add_new_zlevel("Transit/Reserved", list(ZTRAIT_RESERVED = TRUE))
|
||||
repopulate_sorted_areas()
|
||||
require_area_resort()
|
||||
// Set up Z-level transitions.
|
||||
setup_map_transitions()
|
||||
generate_station_area_list()
|
||||
@@ -155,6 +155,7 @@ SUBSYSTEM_DEF(mapping)
|
||||
// Cache for sonic speed
|
||||
var/list/unused_turfs = src.unused_turfs
|
||||
var/list/world_contents = GLOB.areas_by_type[world.area].contents
|
||||
var/list/world_turf_contents = GLOB.areas_by_type[world.area].contained_turfs
|
||||
var/list/lists_to_reserve = src.lists_to_reserve
|
||||
var/index = 0
|
||||
while(index < length(lists_to_reserve))
|
||||
@@ -168,8 +169,11 @@ SUBSYSTEM_DEF(mapping)
|
||||
T.empty(RESERVED_TURF_TYPE, RESERVED_TURF_TYPE, null, TRUE)
|
||||
LAZYINITLIST(unused_turfs["[T.z]"])
|
||||
unused_turfs["[T.z]"] |= T
|
||||
var/area/old_area = T.loc
|
||||
old_area.turfs_to_uncontain += T
|
||||
T.flags_1 |= UNUSED_RESERVATION_TURF
|
||||
world_contents += T
|
||||
world_turf_contents += T
|
||||
packet.len--
|
||||
packetlen = length(packet)
|
||||
|
||||
@@ -362,7 +366,7 @@ Used by the AI doomsday and the self-destruct nuke.
|
||||
var/start_z = world.maxz + 1
|
||||
var/i = 0
|
||||
for (var/level in traits)
|
||||
add_new_zlevel("[name][i ? " [i + 1]" : ""]", level)
|
||||
add_new_zlevel("[name][i ? " [i + 1]" : ""]", level, contain_turfs = FALSE)
|
||||
++i
|
||||
|
||||
SSautomapper.preload_templates_from_toml(files) // SKYRAT EDIT ADDITION - We need to load our templates AFTER the Z level exists, otherwise, there is no z level to preload.
|
||||
@@ -372,7 +376,7 @@ Used by the AI doomsday and the self-destruct nuke.
|
||||
for (var/P in parsed_maps)
|
||||
var/datum/parsed_map/pm = P
|
||||
pm.turf_blacklist = turf_blacklist // SKYRAT EDIT ADDITION - apply blacklist
|
||||
if (!pm.load(1, 1, start_z + parsed_maps[P], no_changeturf = TRUE))
|
||||
if (!pm.load(1, 1, start_z + parsed_maps[P], no_changeturf = TRUE, new_z = TRUE))
|
||||
errorList |= pm.original_path
|
||||
// SKYRAT EDIT ADDITION BEGIN - We need to load our templates from cache after our space has been carved out.
|
||||
if(!LAZYLEN(errorList))
|
||||
@@ -431,7 +435,7 @@ Used by the AI doomsday and the self-destruct nuke.
|
||||
GLOBAL_LIST_EMPTY(the_station_areas)
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/generate_station_area_list()
|
||||
for(var/area/station/station_area in world)
|
||||
for(var/area/station/station_area in GLOB.areas)
|
||||
if (!(station_area.area_flags & UNIQUE_AREA))
|
||||
continue
|
||||
if (is_station_level(station_area.z))
|
||||
@@ -441,7 +445,7 @@ GLOBAL_LIST_EMPTY(the_station_areas)
|
||||
log_world("ERROR: Station areas list failed to generate!")
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/run_map_generation()
|
||||
for(var/area/A in world)
|
||||
for(var/area/A as anything in GLOB.areas)
|
||||
A.RunGeneration()
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/maprotate()
|
||||
@@ -724,7 +728,7 @@ GLOBAL_LIST_EMPTY(the_station_areas)
|
||||
|
||||
/// Takes a z level datum, and tells the mapping subsystem to manage it
|
||||
/// Also handles things like plane offset generation, and other things that happen on a z level to z level basis
|
||||
/datum/controller/subsystem/mapping/proc/manage_z_level(datum/space_level/new_z)
|
||||
/datum/controller/subsystem/mapping/proc/manage_z_level(datum/space_level/new_z, filled_with_space, contain_turfs = TRUE)
|
||||
// First, add the z
|
||||
z_list += new_z
|
||||
|
||||
@@ -743,11 +747,26 @@ GLOBAL_LIST_EMPTY(the_station_areas)
|
||||
if(below_offset)
|
||||
update_plane_tracking(new_z)
|
||||
|
||||
if(contain_turfs)
|
||||
build_area_turfs(z_value, filled_with_space)
|
||||
|
||||
// And finally, misc global generation
|
||||
|
||||
// We'll have to update this if offsets change, because we load lowest z to highest z
|
||||
generate_lighting_appearance_by_z(z_value)
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/build_area_turfs(z_level, space_guaranteed)
|
||||
// If we know this is filled with default tiles, we can use the default area
|
||||
// Faster
|
||||
if(space_guaranteed)
|
||||
var/area/global_area = GLOB.areas_by_type[world.area]
|
||||
global_area.contained_turfs += Z_TURFS(z_level)
|
||||
return
|
||||
|
||||
for(var/turf/to_contain as anything in Z_TURFS(z_level))
|
||||
var/area/our_area = to_contain.loc
|
||||
our_area.contained_turfs += to_contain
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/update_plane_tracking(datum/space_level/update_with)
|
||||
// We're essentially going to walk down the stack of connected z levels, and set their plane offset as we go
|
||||
// Yes this will cause infinite loops if our templating is fucked. Fuck off
|
||||
|
||||
Reference in New Issue
Block a user