[MIRROR] Space/Changeturf fixes and optimizations [MDB IGNORE] (#19201)

Space/Changeturf fixes and optimizations

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-02-28 21:23:35 +01:00
committed by GitHub
parent f558095a40
commit db33d75a5e
20 changed files with 231 additions and 120 deletions

View File

@@ -800,11 +800,11 @@ GLOBAL_LIST_EMPTY(map_model_default)
//The next part of the code assumes there's ALWAYS an /area AND a /turf on a given tile
//first instance the /area and remove it from the members list
index = members.len
var/area/old_area
if(members[index] != /area/template_noop)
var/area/area_instance
if(members_attributes[index] != default_list)
world.preloader_setup(members_attributes[index], members[index])//preloader for assigning set variables on atom creation
area_instance = loaded_areas[members[index]]
var/area/area_instance = loaded_areas[members[index]]
if(!area_instance)
var/area_type = members[index]
// If this parsed map doesn't have that area already, we check the global cache
@@ -817,7 +817,7 @@ GLOBAL_LIST_EMPTY(map_model_default)
loaded_areas[area_type] = area_instance
if(!new_z)
var/area/old_area = crds.loc
old_area = crds.loc
old_area.turfs_to_uncontain += crds
area_instance.contained_turfs.Add(crds)
area_instance.contents.Add(crds)
@@ -845,6 +845,9 @@ GLOBAL_LIST_EMPTY(map_model_default)
if(GLOB.use_preloader && instance)//second preloader pass, for those atoms that don't ..() in New()
world.preloader_load(instance)
// If this isn't template work, we didn't change our turf and we changed area, then we've gotta handle area lighting transfer
else if(!no_changeturf && old_area)
crds.transfer_area_lighting(old_area, crds.loc)
MAPLOADING_CHECK_TICK
//finally instance all remainings objects/mobs

View File

@@ -19,6 +19,8 @@
manage_z_level(S, filled_with_space = FALSE)
generate_z_level_linkages() // Default Zs don't use add_new_zlevel() so they don't automatically generate z-linkages.
/// Generates a real, honest to god new z level. Will create the actual space, and also generate a datum that holds info about the new plot of land
/// Accepts the name, traits list, datum type, and if we should manage the turfs we create
/datum/controller/subsystem/mapping/proc/add_new_zlevel(name, traits = list(), z_type = /datum/space_level, contain_turfs = TRUE)
UNTIL(!adding_new_zlevel)
adding_new_zlevel = TRUE