diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index 5eb987f2f33..8b9e6c5b8d9 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -39,6 +39,8 @@ var/datum/subsystem/air/SSair var/list/currentrun = list() var/currentpart = SSAIR_PIPENETS + var/map_loading = TRUE + var/list/queued_for_activation /datum/subsystem/air/New() NEW_SS_GLOBAL(SSair) @@ -61,6 +63,7 @@ var/datum/subsystem/air/SSair /datum/subsystem/air/Initialize(timeofday) + map_loading = FALSE setup_allturfs() setup_atmos_machinery() setup_pipenets() @@ -244,7 +247,6 @@ var/datum/subsystem/air/SSair if(T.excited_group) T.excited_group.garbage_collect() - /datum/subsystem/air/proc/add_to_active(turf/open/T, blockchanges = 1) if(istype(T) && T.air) T.excited = 1 @@ -253,10 +255,25 @@ var/datum/subsystem/air/SSair currentrun |= T if(blockchanges && T.excited_group) T.excited_group.garbage_collect() - else + else if(T.initialized) for(var/turf/S in T.atmos_adjacent_turfs) add_to_active(S) + else if(map_loading) + if(queued_for_activation) + queued_for_activation[T] = T + return + else + T.requires_activation = TRUE +/datum/subsystem/air/proc/begin_map_load() + LAZYINITLIST(queued_for_activation) + map_loading = TRUE + +/datum/subsystem/air/proc/end_map_load() + map_loading = FALSE + for(var/T in queued_for_activation) + add_to_active(T) + queued_for_activation.Cut() /datum/subsystem/air/proc/setup_allturfs() var/list/turfs_to_init = block(locate(1, 1, 1), locate(world.maxx, world.maxy, world.maxz)) diff --git a/code/controllers/subsystem/processing/objects.dm b/code/controllers/subsystem/processing/objects.dm index 01957e766f4..6bbd0ffeb32 100644 --- a/code/controllers/subsystem/processing/objects.dm +++ b/code/controllers/subsystem/processing/objects.dm @@ -27,26 +27,52 @@ var/datum/subsystem/objects/SSobj /datum/subsystem/objects/proc/InitializeAtoms(list/objects = null) if(initialized == INITIALIZATION_INSSOBJ) return + + var/list/late_loaders + initialized = INITIALIZATION_INNEW_MAPLOAD + if(objects) for(var/I in objects) var/atom/A = I if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call var/start_tick = world.time - A.Initialize(TRUE) + if(A.Initialize(TRUE)) + LAZYADD(late_loaders, A) if(start_tick != world.time) WARNING("[A]: [A.type] slept during it's Initialize!") CHECK_TICK + testing("Initialized [objects.len] atoms") else + #ifdef TESTING + var/count = 0 + #endif for(var/atom/A in world) if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call var/start_tick = world.time - A.Initialize(TRUE) + if(A.Initialize(TRUE)) + LAZYADD(late_loaders, A) + #ifdef TESTING + else + ++count + #endif TESTING if(start_tick != world.time) WARNING("[A]: [A.type] slept during it's Initialize!") CHECK_TICK + testing("Roundstart initialized [count] atoms") + initialized = INITIALIZATION_INNEW_REGULAR + if(late_loaders) + for(var/I in late_loaders) + var/atom/A = I + var/start_tick = world.time + A.Initialize(FALSE) + if(start_tick != world.time) + WARNING("[A]: [A.type] slept during it's Initialize!") + CHECK_TICK + testing("Late-initialized [late_loaders.len] atoms") + /datum/subsystem/objects/proc/map_loader_begin() old_initialized = initialized initialized = INITIALIZATION_INSSOBJ diff --git a/code/datums/helper_datums/map_template.dm b/code/datums/helper_datums/map_template.dm index 19f9c1ff0da..10fd9da880c 100644 --- a/code/datums/helper_datums/map_template.dm +++ b/code/datums/helper_datums/map_template.dm @@ -43,6 +43,7 @@ SSobj.InitializeAtoms(atoms) SSmachine.setup_template_powernets(cables) SSair.setup_template_machinery(atmos_machines) + SSair.end_map_load() /datum/map_template/proc/load(turf/T, centered = FALSE) if(centered) @@ -54,8 +55,10 @@ if(T.y+height > world.maxy) return + SSair.begin_map_load() var/list/bounds = maploader.load_map(get_file(), T.x, T.y, T.z, cropMap=TRUE) if(!bounds) + SSair.end_map_load() return 0 //initialize things that are normally initialized after map load diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 1c4e67bb8e7..57e4032b988 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -41,11 +41,26 @@ if(luminosity) light = new(src) - var/initialized = SSobj.initialized - if(initialized > INITIALIZATION_INSSOBJ) - Initialize(initialized == INITIALIZATION_INNEW_MAPLOAD) + var/do_initialize = SSobj.initialized + if(do_initialize > INITIALIZATION_INSSOBJ) + Initialize(do_initialize == INITIALIZATION_INNEW_MAPLOAD) //. = ..() //uncomment if you are dumb enough to add a /datum/New() proc +//Called after New if the map is being loaded. mapload = TRUE +//Called from base of New if the map is being loaded. mapload = FALSE +//This base must be called or derivatives must set initialized to TRUE to prevent repeat calls +//Derivatives must not sleep +//Returning TRUE while mapload is TRUE will cause the object to be initialized again with mapload = FALSE when everything else is done +//(Useful for things that requires turfs to have air). This base may only be called once, however + +//Note: the following functions don't call the base for optimization and must copypasta: +// /turf/Initialize +// /turf/open/space/Initialize +/atom/proc/Initialize(mapload) + if(initialized) + stack_trace("Warning: [src]([type]) initialized multiple times!") + initialized = TRUE + /atom/Destroy() if(alternate_appearances) for(var/aakey in alternate_appearances) @@ -435,17 +450,6 @@ var/list/blood_splatter_icons = list() sleep(1) stoplag() -//Called after New if the world is not loaded with TRUE -//Called from base of New if the world is loaded with FALSE -//This base must be called or derivatives must set initialized to TRUE to prevent repeat calls -//Derivatives must not sleep -/atom/proc/Initialize(mapload) -#ifdef TESTING - if(initialized) - stack_trace("Warning: [src]([type]) initialized multiple times!") -#endif - initialized = TRUE - //the vision impairment to give to the mob whose perspective is set to that atom (e.g. an unfocused camera giving you an impaired vision when looking through it) /atom/proc/get_remote_view_fullscreens(mob/user) return diff --git a/code/game/turfs/closed.dm b/code/game/turfs/closed.dm index a4202d2b812..2c8456f3386 100644 --- a/code/game/turfs/closed.dm +++ b/code/game/turfs/closed.dm @@ -34,7 +34,7 @@ layer = FLY_LAYER var/titlescreen = TITLESCREEN -/turf/closed/indestructible/splashscreen/New() +/turf/closed/indestructible/splashscreen/Initialize() ..() if(titlescreen) icon_state = titlescreen @@ -44,11 +44,6 @@ icon_state = "riveted" smooth = SMOOTH_TRUE -/turf/closed/indestructible/New() - ..() - if(smooth) - queue_smooth(src) - /turf/closed/indestructible/riveted/uranium icon = 'icons/turf/walls/uranium_wall.dmi' icon_state = "uranium" @@ -66,7 +61,7 @@ smooth = SMOOTH_TRUE icon = 'icons/obj/smooth_structures/reinforced_window.dmi' -/turf/closed/indestructible/fakeglass/New() +/turf/closed/indestructible/fakeglass/Initialize() ..() icon_state = null //set the icon state to null, so our base state isn't visible var/image/I = image('icons/obj/structures.dmi', loc = src, icon_state = "grille") diff --git a/code/game/turfs/open.dm b/code/game/turfs/open.dm index df3b680b914..b39fc1dd112 100644 --- a/code/game/turfs/open.dm +++ b/code/game/turfs/open.dm @@ -29,7 +29,7 @@ baseturf = /turf/open/indestructible/necropolis initial_gas_mix = "o2=14;n2=23;TEMP=300" -/turf/open/indestructible/necropolis/New() +/turf/open/indestructible/necropolis/Initialize() ..() if(prob(12)) icon_state = "necro[rand(2,3)]" @@ -40,11 +40,6 @@ baseturf = /turf/open/indestructible/hierophant smooth = SMOOTH_TRUE -/turf/open/indestructible/hierophant/New() - ..() - if(smooth) - queue_smooth(src) - /turf/open/indestructible/hierophant/two /turf/open/indestructible/paper diff --git a/code/game/turfs/simulated/chasm.dm b/code/game/turfs/simulated/chasm.dm index f1e71ff25d1..2f478df8bad 100644 --- a/code/game/turfs/simulated/chasm.dm +++ b/code/game/turfs/simulated/chasm.dm @@ -69,7 +69,7 @@ L.adjustBruteLoss(30) -/turf/open/chasm/straight_down/New() +/turf/open/chasm/straight_down/Initialize() ..() drop_x = x drop_y = y diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index f478f1e27c0..88d58314cba 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -33,7 +33,7 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," var/list/broken_states var/list/burnt_states -/turf/open/floor/New() +/turf/open/floor/Initialize(mapload) if (!broken_states) broken_states = list("damaged1", "damaged2", "damaged3", "damaged4", "damaged5") if (!burnt_states) @@ -43,6 +43,8 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," icon_regular_floor = "floor" else icon_regular_floor = icon_state + if(mapload) + MakeDirty() /turf/open/floor/ex_act(severity, target) var/shielded = is_shielded() @@ -179,10 +181,5 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," if(.) ChangeTurf(/turf/open/floor/clockwork) -/turf/open/floor/Initialize(mapload) - ..() - if(mapload) - MakeDirty() - /turf/open/floor/acid_melt() ChangeTurf(baseturf) diff --git a/code/game/turfs/simulated/floor/fancy_floor.dm b/code/game/turfs/simulated/floor/fancy_floor.dm index 5b8482cc522..d303d8ac537 100644 --- a/code/game/turfs/simulated/floor/fancy_floor.dm +++ b/code/game/turfs/simulated/floor/fancy_floor.dm @@ -36,10 +36,9 @@ flags = NONE var/ore_type = /obj/item/weapon/ore/glass -/turf/open/floor/grass/New() +/turf/open/floor/grass/Initialize() ..() - spawn(1) - update_icon() + update_icon() /turf/open/floor/grass/attackby(obj/item/C, mob/user, params) if(istype(C, /obj/item/weapon/shovel) && params) @@ -76,7 +75,7 @@ initial_gas_mix = "o2=14;n2=23;TEMP=300" slowdown = 0 -/turf/open/floor/grass/snow/basalt/New() +/turf/open/floor/grass/snow/basalt/Initialize() ..() if(prob(15)) icon_state = "basalt[rand(0, 12)]" @@ -96,10 +95,9 @@ canSmoothWith = null flags = NONE -/turf/open/floor/carpet/New() +/turf/open/floor/carpet/Initialize() ..() - spawn(1) - update_icon() + update_icon() /turf/open/floor/carpet/update_icon() if(!..()) @@ -131,6 +129,6 @@ broken_states = list("damaged") plane = PLANE_SPACE -/turf/open/floor/fakespace/New() +/turf/open/floor/fakespace/Initialize() ..() icon_state = "[rand(0,25)]" diff --git a/code/game/turfs/simulated/floor/light_floor.dm b/code/game/turfs/simulated/floor/light_floor.dm index 19a13575048..b078a220c4f 100644 --- a/code/game/turfs/simulated/floor/light_floor.dm +++ b/code/game/turfs/simulated/floor/light_floor.dm @@ -12,7 +12,7 @@ var/can_modify_colour = TRUE -/turf/open/floor/light/New() +/turf/open/floor/light/Initialize() ..() update_icon() diff --git a/code/game/turfs/simulated/floor/mineral_floor.dm b/code/game/turfs/simulated/floor/mineral_floor.dm index 73ffc696c8a..64c6be65207 100644 --- a/code/game/turfs/simulated/floor/mineral_floor.dm +++ b/code/game/turfs/simulated/floor/mineral_floor.dm @@ -16,7 +16,7 @@ -/turf/open/floor/mineral/New() +/turf/open/floor/mineral/Initialize() broken_states = list("[initial(icon_state)]_dam") ..() if (!icons) @@ -221,7 +221,7 @@ floor_tile = /obj/item/stack/tile/mineral/abductor icons = list("alienpod1", "alienpod2", "alienpod3", "alienpod4", "alienpod5", "alienpod6", "alienpod7", "alienpod8", "alienpod9") -/turf/open/floor/mineral/abductor/New() +/turf/open/floor/mineral/abductor/Initialize() ..() icon_state = "alienpod[rand(1,9)]" diff --git a/code/game/turfs/simulated/floor/misc_floor.dm b/code/game/turfs/simulated/floor/misc_floor.dm index 2d9cd76f4a4..82eb9c7bd77 100644 --- a/code/game/turfs/simulated/floor/misc_floor.dm +++ b/code/game/turfs/simulated/floor/misc_floor.dm @@ -13,9 +13,9 @@ icon_state = "bcircuit" floor_tile = /obj/item/stack/tile/plasteel -/turf/open/floor/bluegrid/New() - ..() +/turf/open/floor/bluegrid/Initialize() SSmapping.nuke_tiles += src + ..() /turf/open/floor/bluegrid/Destroy() SSmapping.nuke_tiles -= src @@ -67,7 +67,7 @@ icon_state = "plating" var/obj/effect/clockwork/overlay/floor/realappearence -/turf/open/floor/clockwork/New() +/turf/open/floor/clockwork/Initialize() ..() new /obj/effect/overlay/temp/ratvar/floor(src) new /obj/effect/overlay/temp/ratvar/beam(src) diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm index de9cabe70bf..c65865786c4 100644 --- a/code/game/turfs/simulated/floor/plating.dm +++ b/code/game/turfs/simulated/floor/plating.dm @@ -13,7 +13,7 @@ icon_state = "plating" intact = 0 -/turf/open/floor/plating/New() +/turf/open/floor/plating/Initialize() if (!broken_states) broken_states = list("platingdmg1", "platingdmg2", "platingdmg3") if (!burnt_states) diff --git a/code/game/turfs/simulated/floor/plating/asteroid.dm b/code/game/turfs/simulated/floor/plating/asteroid.dm index 272e3a68e12..9cc15172f95 100644 --- a/code/game/turfs/simulated/floor/plating/asteroid.dm +++ b/code/game/turfs/simulated/floor/plating/asteroid.dm @@ -15,7 +15,7 @@ var/sand_type = /obj/item/weapon/ore/glass var/floor_variance = 20 //probability floor has a different icon state -/turf/open/floor/plating/asteroid/New() +/turf/open/floor/plating/asteroid/Initialize() var/proper_name = name ..() name = proper_name @@ -117,7 +117,7 @@ /turf/open/floor/plating/asteroid/basalt/airless initial_gas_mix = "TEMP=2.7" -/turf/open/floor/plating/asteroid/basalt/New() +/turf/open/floor/plating/asteroid/basalt/Initialize() ..() switch(icon_state) if("basalt1", "basalt2", "basalt3") //5 and 9 are too dark to glow and make the amount of glows in tunnels too high @@ -176,7 +176,7 @@ /turf/open/floor/plating/asteroid/airless/cave/volcanic/has_data //subtype for producing a tunnel with given data has_data = TRUE -/turf/open/floor/plating/asteroid/airless/cave/New(loc) +/turf/open/floor/plating/asteroid/airless/cave/Initialize() if (!mob_spawn_list) mob_spawn_list = list(/mob/living/simple_animal/hostile/asteroid/goldgrub = 1, /mob/living/simple_animal/hostile/asteroid/goliath = 5, /mob/living/simple_animal/hostile/asteroid/basilisk = 4, /mob/living/simple_animal/hostile/asteroid/hivelord = 3) if (!megafauna_spawn_list) @@ -186,7 +186,8 @@ if(!has_data) produce_tunnel_from_data() - ..() + else + ..() //do not continue after changeturfing or we will do a double initialize /turf/open/floor/plating/asteroid/airless/cave/proc/get_cave_data(set_length, exclude_dir = -1) // If set_length (arg1) isn't defined, get a random length; otherwise assign our length to the length arg. diff --git a/code/game/turfs/simulated/floor/plating/lava.dm b/code/game/turfs/simulated/floor/plating/lava.dm index 68aa66a1c30..4b524203948 100644 --- a/code/game/turfs/simulated/floor/plating/lava.dm +++ b/code/game/turfs/simulated/floor/plating/lava.dm @@ -7,12 +7,6 @@ baseturf = /turf/open/floor/plating/lava //lava all the way down slowdown = 2 luminosity = 1 - var/static/list/safeties_typecache = list(/obj/structure/lattice/catwalk) - //if anything matching this typecache is found in the lava, we don't burn things - -/turf/open/floor/plating/lava/New() - ..() - safeties_typecache = typecacheof(safeties_typecache) /turf/open/floor/plating/lava/ex_act() return @@ -51,7 +45,9 @@ /turf/open/floor/plating/lava/proc/is_safe() - var/list/found_safeties = typecache_filter_list(contents, safeties_typecache) + //if anything matching this typecache is found in the lava, we don't burn things + var/static/list/lava_safeties_typecache = typecacheof(list(/obj/structure/lattice/catwalk)) + var/list/found_safeties = typecache_filter_list(contents, lava_safeties_typecache) return LAZYLEN(found_safeties) diff --git a/code/game/turfs/simulated/floor/plating/misc_plating.dm b/code/game/turfs/simulated/floor/plating/misc_plating.dm index 730cc7b0ab6..081b4becc6b 100644 --- a/code/game/turfs/simulated/floor/plating/misc_plating.dm +++ b/code/game/turfs/simulated/floor/plating/misc_plating.dm @@ -7,7 +7,7 @@ name = "alien floor" icon_state = "alienpod1" -/turf/open/floor/plating/abductor/New() +/turf/open/floor/plating/abductor/Initialize() ..() icon_state = "alienpod[rand(1,9)]" @@ -41,7 +41,7 @@ initial_gas_mix = "o2=14;n2=23;TEMP=300" planetary_atmos = TRUE -/turf/open/floor/plating/ashplanet/New() +/turf/open/floor/plating/ashplanet/Initialize() if(smooth) pixel_y = -4 pixel_x = -4 @@ -72,7 +72,7 @@ icon_state = "wateryrock" slowdown = 2 -/turf/open/floor/plating/ashplanet/wateryrock/New() +/turf/open/floor/plating/ashplanet/wateryrock/Initialize() icon_state = "[icon_state][rand(1, 9)]" ..() @@ -113,7 +113,7 @@ name = "iron sand" desc = "Like sand, but more metal." -/turf/open/floor/plating/ironsand/New() +/turf/open/floor/plating/ironsand/Initialize() ..() icon_state = "ironsand[rand(1,15)]" diff --git a/code/game/turfs/simulated/floor/reinf_floor.dm b/code/game/turfs/simulated/floor/reinf_floor.dm index 8ee346905d5..ab01971446a 100644 --- a/code/game/turfs/simulated/floor/reinf_floor.dm +++ b/code/game/turfs/simulated/floor/reinf_floor.dm @@ -106,7 +106,7 @@ icon_state = "plating" var/obj/effect/clockwork/overlay/floor/bloodcult/realappearence -/turf/open/floor/engine/cult/New() +/turf/open/floor/engine/cult/Initialize() ..() new /obj/effect/overlay/temp/cult/turf/floor(src) realappearence = new /obj/effect/clockwork/overlay/floor/bloodcult(src) diff --git a/code/game/turfs/simulated/minerals.dm b/code/game/turfs/simulated/minerals.dm index b15607f5b60..0883c19491a 100644 --- a/code/game/turfs/simulated/minerals.dm +++ b/code/game/turfs/simulated/minerals.dm @@ -24,7 +24,7 @@ var/scan_state = null //Holder for the image we display when we're pinged by a mining scanner var/defer_change = 0 -/turf/closed/mineral/New() +/turf/closed/mineral/Initialize() if (!canSmoothWith) canSmoothWith = list(/turf/closed) pixel_y = -4 @@ -139,7 +139,7 @@ var/mineralChance = 13 var/display_icon_state = "rock" -/turf/closed/mineral/random/New() +/turf/closed/mineral/random/Initialize() if (!mineralSpawnChanceList) mineralSpawnChanceList = list( /turf/closed/mineral/uranium = 5, /turf/closed/mineral/diamond = 1, /turf/closed/mineral/gold = 10, @@ -385,7 +385,7 @@ var/activated_name = null var/activated_image = null -/turf/closed/mineral/gibtonite/New() +/turf/closed/mineral/gibtonite/Initialize() det_time = rand(8,10) //So you don't know exactly when the hot potato will explode ..() diff --git a/code/game/turfs/simulated/wall/misc_walls.dm b/code/game/turfs/simulated/wall/misc_walls.dm index ce0b8a61074..a2828271a91 100644 --- a/code/game/turfs/simulated/wall/misc_walls.dm +++ b/code/game/turfs/simulated/wall/misc_walls.dm @@ -8,7 +8,7 @@ sheet_amount = 1 girder_type = /obj/structure/girder/cult -/turf/closed/wall/mineral/cult/New() +/turf/closed/wall/mineral/cult/Initialize() new /obj/effect/overlay/temp/cult/turf(src) ..() @@ -50,7 +50,7 @@ var/obj/effect/clockwork/overlay/wall/realappearence var/obj/structure/destructible/clockwork/cache/linkedcache -/turf/closed/wall/clockwork/New() +/turf/closed/wall/clockwork/Initialize() ..() new /obj/effect/overlay/temp/ratvar/wall(src) new /obj/effect/overlay/temp/ratvar/beam(src) diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index f922ba7dcea..c0190a0fb29 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -15,15 +15,16 @@ var/global/datum/gas_mixture/space/space_gas = new plane = PLANE_SPACE -/turf/open/space/New() +/turf/open/space/Initialize() icon_state = SPACE_ICON_STATE air = space_gas + + if(initialized) + stack_trace("Warning: [src]([type]) initialized multiple times!") + initialized = TRUE -/turf/open/space/Destroy(force) - if(force) - . = ..() - else - return QDEL_HINT_LETMELIVE + if(requires_activation) + SSair.add_to_active(src) /turf/open/space/attack_ghost(mob/dead/observer/user) if(destination_z) diff --git a/code/game/turfs/space/transit.dm b/code/game/turfs/space/transit.dm index 11e66e16804..dd772aa1acb 100644 --- a/code/game/turfs/space/transit.dm +++ b/code/game/turfs/space/transit.dm @@ -61,14 +61,12 @@ /turf/open/space/transit/attackby() return -/turf/open/space/transit/New() +/turf/open/space/transit/Initialize() ..() update_icon() for(var/atom/movable/AM in src) throw_atom(AM) - - /turf/open/space/transit/proc/update_icon() var/p = 9 var/angle = 0 diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 15c72dd107f..640095ae48b 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -23,14 +23,17 @@ var/explosion_id = 0 var/list/decals + var/requires_activation //add to air processing after initialize? /turf/SDQL_update(const/var_name, new_value) if(var_name == "x" || var_name == "y" || var_name == "z") return FALSE . = ..() -/turf/New() - ..() +/turf/Initialize() + if(initialized) + stack_trace("Warning: [src]([type]) initialized multiple times!") + initialized = TRUE levelupdate() if(smooth) @@ -40,11 +43,17 @@ for(var/atom/movable/AM in src) Entered(AM) + if(requires_activation) + CalculateAdjacentTurfs() + SSair.add_to_active(src) + /turf/proc/Initalize_Atmos(times_fired) CalculateAdjacentTurfs() /turf/Destroy() visibilityChanged() + initialized = FALSE + requires_activation = FALSE ..() return QDEL_HINT_HARDDEL_NOW @@ -454,4 +463,4 @@ /turf/proc/remove_decal(group) LAZYINITLIST(decals) overlays -= decals[group] - decals[group] = null \ No newline at end of file + decals[group] = null diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm index dadb31ba611..47fa5299128 100644 --- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm +++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm @@ -35,11 +35,11 @@ var/list/atmos_overlay_types //gas IDs of current active gas overlays -/turf/open/New() - ..() +/turf/open/Initialize() if(!blocks_air) air = new air.copy_from_turf(src) + ..() /turf/open/Destroy() if(active_hotspot) @@ -113,11 +113,12 @@ /turf/open/proc/tile_graphic() . = new /list - var/list/gases = air.gases - for(var/id in gases) - var/gas = gases[id] - if(gas[GAS_META][META_GAS_OVERLAY] && gas[MOLES] > gas[GAS_META][META_GAS_MOLES_VISIBLE]) - . += gas[GAS_META][META_GAS_OVERLAY] + if(air) + var/list/gases = air.gases + for(var/id in gases) + var/gas = gases[id] + if(gas[GAS_META][META_GAS_OVERLAY] && gas[MOLES] > gas[GAS_META][META_GAS_MOLES_VISIBLE]) + . += gas[GAS_META][META_GAS_OVERLAY] /////////////////////////////SIMULATION/////////////////////////////////// diff --git a/code/modules/holodeck/area_copy.dm b/code/modules/holodeck/area_copy.dm index a3c3e6c2b3a..a8e0bebf208 100644 --- a/code/modules/holodeck/area_copy.dm +++ b/code/modules/holodeck/area_copy.dm @@ -110,7 +110,7 @@ if(V == "air") var/turf/open/O1 = B var/turf/open/O2 = T - O1.air.copy_from(O2.air) + O1.air.copy_from(O2.return_air()) continue B.vars[V] = T.vars[V] toupdate += B diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm index de43b317afe..e1778946517 100644 --- a/code/modules/holodeck/computer.dm +++ b/code/modules/holodeck/computer.dm @@ -64,25 +64,25 @@ ..() /obj/machinery/computer/holodeck/Initialize(mapload) - ..() - if(!mapload && ticker.current_state < GAME_STATE_PLAYING) - return - program_cache = list() - emag_programs = list() - for(var/typekey in subtypesof(program_type)) - var/area/holodeck/A = locate(typekey) - if(!A || A == offline_program) continue - if(A.contents.len == 0) continue // not loaded - if(A.restricted) - emag_programs += A - else - program_cache += A - if(typekey == init_program) - load_program(A,force=1) - if(random_program && program_cache.len && init_program == null) - load_program(pick(program_cache),force=1) - else if(!program) - load_program(offline_program) + . = mapload //late-initialize, area_copy need turfs to have air + if(!mapload) + ..() + program_cache = list() + emag_programs = list() + for(var/typekey in subtypesof(program_type)) + var/area/holodeck/A = locate(typekey) + if(!A || A == offline_program) continue + if(A.contents.len == 0) continue // not loaded + if(A.restricted) + emag_programs += A + else + program_cache += A + if(typekey == init_program) + load_program(A,force=1) + if(random_program && program_cache.len && init_program == null) + load_program(pick(program_cache),force=1) + else if(!program) + load_program(offline_program) /obj/machinery/computer/holodeck/power_change() ..() diff --git a/code/modules/holodeck/turfs.dm b/code/modules/holodeck/turfs.dm index e62fb393fe9..b853f6d336b 100644 --- a/code/modules/holodeck/turfs.dm +++ b/code/modules/holodeck/turfs.dm @@ -42,7 +42,7 @@ name = "asteroid" icon_state = "asteroid0" -/turf/open/floor/holofloor/asteroid/New() +/turf/open/floor/holofloor/asteroid/Initialize() icon_state = "asteroid[pick(0,1,2,3,4,5,6,7,8,9,10,11,12)]" ..() @@ -50,7 +50,7 @@ name = "basalt" icon_state = "basalt0" -/turf/open/floor/holofloor/basalt/New() +/turf/open/floor/holofloor/basalt/Initialize() icon_state = "basalt[pick(0,1,2,3,4,5,6,7,8,9,10,11,12)]" ..() @@ -59,7 +59,7 @@ icon = 'icons/turf/space.dmi' icon_state = "0" -/turf/open/floor/holofloor/space/New() +/turf/open/floor/holofloor/space/Initialize() icon_state = SPACE_ICON_STATE // so realistic ..() @@ -68,11 +68,11 @@ icon = 'icons/turf/space.dmi' icon_state = "speedspace_ns_1" -/turf/open/floor/holofloor/hyperspace/New() +/turf/open/floor/holofloor/hyperspace/Initialize() icon_state = "speedspace_ns_[(x + 5*y + (y%2+1)*7)%15+1]" ..() -/turf/open/floor/holofloor/hyperspace/ns/New() +/turf/open/floor/holofloor/hyperspace/ns/Initialize() ..() icon_state = "speedspace_ns_[(x + 5*y + (y%2+1)*7)%15+1]" @@ -86,7 +86,7 @@ smooth = SMOOTH_TRUE canSmoothWith = null -/turf/open/floor/holofloor/carpet/New() +/turf/open/floor/holofloor/carpet/Initialize() ..() addtimer(CALLBACK(src, .proc/update_icon), 1) diff --git a/code/modules/recycling/disposal-unit.dm b/code/modules/recycling/disposal-unit.dm index 34236736125..80c123397da 100644 --- a/code/modules/recycling/disposal-unit.dm +++ b/code/modules/recycling/disposal-unit.dm @@ -62,16 +62,17 @@ deconstruct() /obj/machinery/disposal/Initialize(mapload) - ..() - if(!mapload) - return - //this will get a copy of the air turf and take a SEND PRESSURE amount of air from it - var/atom/L = loc - var/datum/gas_mixture/env = new - env.copy_from(L.return_air()) - var/datum/gas_mixture/removed = env.remove(SEND_PRESSURE + 1) - air_contents.merge(removed) - trunk_check() + . = mapload //late-initialize, we need turfs to have air + if(initialized) //will only be run on late mapload initialization + //this will get a copy of the air turf and take a SEND PRESSURE amount of air from it + var/atom/L = loc + var/datum/gas_mixture/env = new + env.copy_from(L.return_air()) + var/datum/gas_mixture/removed = env.remove(SEND_PRESSURE + 1) + air_contents.merge(removed) + trunk_check() + else + ..() /obj/machinery/disposal/attackby(obj/item/I, mob/user, params) add_fingerprint(user)