Fixes maploading so that the cyberiad and space hotel load cleanly again

This commit is contained in:
Crazylemon64
2018-07-24 20:58:38 -07:00
parent 838e19083f
commit b2d0bb1c0b
26 changed files with 139 additions and 109 deletions
+4 -1
View File
@@ -33,7 +33,6 @@ GLOBAL_DATUM_INIT(pipe_icon_manager, /datum/pipe_icon_manager, new())
if(!armor)
armor = list(melee = 25, bullet = 10, laser = 10, energy = 100, bomb = 0, bio = 100, rad = 100)
..()
SSair.atmos_machinery += src
if(!pipe_color)
pipe_color = color
@@ -42,6 +41,10 @@ GLOBAL_DATUM_INIT(pipe_icon_manager, /datum/pipe_icon_manager, new())
if(!pipe_color_check(pipe_color))
pipe_color = null
/obj/machinery/atmospherics/Initialize()
. = ..()
SSair.atmos_machinery += src
/obj/machinery/atmospherics/proc/atmos_init()
if(can_unwrench)
stored = new(src, make_from = src)
+1 -1
View File
@@ -181,4 +181,4 @@
/obj/effect/hotspot/Crossed(mob/living/L)
..()
if(isliving(L))
L.fire_act()
L.fire_act()
+1 -1
View File
@@ -552,4 +552,4 @@ turf/simulated/proc/radiate_to_spess() //Radiate excess tile heat to space
else
if(!air.check_turf_total(enemy_tile))
excited = 1
SSair.active_turfs |= src
SSair.active_turfs |= src
+5 -1
View File
@@ -1497,6 +1497,10 @@ var/mob/dview/dview_mob = new
/mob/dview/New() //For whatever reason, if this isn't called, then BYOND will throw a type mismatch runtime when attempting to add this to the mobs list. -Fox
/mob/dview/Destroy()
// should never be deleted
return QDEL_HINT_LETMELIVE
/proc/IsValidSrc(A)
if(istype(A, /datum))
var/datum/D = A
@@ -1962,4 +1966,4 @@ var/mob/dview/dview_mob = new
CRASH(msg)
/proc/pass()
return
return
+3
View File
@@ -31,6 +31,9 @@ DECLARE_GLOBAL_CONTROLLER(npcpool, npc_master)
if(istype(toInsert, /mob/living/carbon/human/interactive))
botPool_l |= toInsert
/datum/controller/process/npcpool/proc/removeBot(toRemove)
botPool_l -= toRemove
/datum/controller/process/npcpool/statProcess()
..()
stat(null, "T [botPool_l.len + botPool_l_non.len] | D [needsDelegate.len] | A [needsAssistant.len + needsHelp_non.len] | U [canBeUsed.len + canBeUsed_non.len]")
+22 -10
View File
@@ -66,8 +66,8 @@ SUBSYSTEM_DEF(air)
/datum/controller/subsystem/air/Initialize(timeofday)
setup_overlays() // Assign icons and such for gas-turf-overlays
setup_allturfs()
setup_atmos_machinery()
setup_pipenets()
setup_atmos_machinery(machines)
setup_pipenets(machines)
..()
@@ -316,11 +316,17 @@ SUBSYSTEM_DEF(air)
ET.excited = 1
. += ET
/datum/controller/subsystem/air/proc/setup_atmos_machinery()
/datum/controller/subsystem/air/proc/setup_atmos_machinery(var/list/machines_to_init)
var/watch = start_watch()
var/count = 0
log_startup_progress("Initializing atmospherics machinery...")
for(var/obj/machinery/atmospherics/A in machines)
var/count = _setup_atmos_machinery(machines_to_init)
log_startup_progress(" Initialized [count] atmospherics machines in [stop_watch(watch)]s.")
// this underscored variant is so that we can have a means of late initing
// atmos machinery without a loud announcement to the world
/datum/controller/subsystem/air/proc/_setup_atmos_machinery(var/list/machines_to_init)
var/count = 0
for(var/obj/machinery/atmospherics/A in machines_to_init)
A.atmos_init()
count++
if(istype(A, /obj/machinery/atmospherics/unary/vent_pump))
@@ -329,19 +335,25 @@ SUBSYSTEM_DEF(air)
else if(istype(A, /obj/machinery/atmospherics/unary/vent_scrubber))
var/obj/machinery/atmospherics/unary/vent_scrubber/T = A
T.broadcast_status()
log_startup_progress(" Initialized [count] atmospherics machines in [stop_watch(watch)]s.")
return count
//this can't be done with setup_atmos_machinery() because
// all atmos machinery has to initalize before the first
// pipenet can be built.
/datum/controller/subsystem/air/proc/setup_pipenets()
/datum/controller/subsystem/air/proc/setup_pipenets(var/list/pipes)
var/watch = start_watch()
var/count = 0
log_startup_progress("Initializing pipe networks...")
for(var/obj/machinery/atmospherics/machine in machines)
var/count = _setup_pipenets(pipes)
log_startup_progress(" Initialized [count] pipenets in [stop_watch(watch)]s.")
// An underscored wrapper that exists for the same reason
// the machine init wrapper does
/datum/controller/subsystem/air/proc/_setup_pipenets(var/list/pipes)
var/count = 0
for(var/obj/machinery/atmospherics/machine in pipes)
machine.build_network()
count++
log_startup_progress(" Initialized [count] pipenets in [stop_watch(watch)]s.")
return count
/datum/controller/subsystem/air/proc/setup_overlays()
plmaster = new /obj/effect/overlay()
+18 -6
View File
@@ -23,7 +23,7 @@ SUBSYSTEM_DEF(atoms)
/datum/controller/subsystem/atoms/proc/InitializeAtoms(list/atoms)
/datum/controller/subsystem/atoms/proc/InitializeAtoms(list/atoms, noisy = TRUE)
if(initialized == INITIALIZATION_INSSATOMS)
return
@@ -32,7 +32,10 @@ SUBSYSTEM_DEF(atoms)
LAZYINITLIST(late_loaders)
var/watch = start_watch()
log_startup_progress("Initializing atoms...")
if(noisy)
log_startup_progress("Initializing atoms...")
else
log_debug("Initializing atoms...")
var/count
var/list/mapload_arg = list(TRUE)
if(atoms)
@@ -52,18 +55,27 @@ SUBSYSTEM_DEF(atoms)
++count
CHECK_TICK
log_startup_progress(" Initialized [count] atoms in [stop_watch(watch)]s")
if(noisy)
log_startup_progress(" Initialized [count] atoms in [stop_watch(watch)]s")
else
log_debug(" Initialized [count] atoms in [stop_watch(watch)]s")
pass(count)
initialized = INITIALIZATION_INNEW_REGULAR
if(late_loaders.len)
watch = start_watch()
log_startup_progress("Late-initializing atoms...")
if(noisy)
log_startup_progress("Late-initializing atoms...")
else
log_debug("Late-initializing atoms...")
for(var/I in late_loaders)
var/atom/A = I
A.LateInitialize()
log_startup_progress(" Late initialized [late_loaders.len] atoms in [stop_watch(watch)]s")
if(noisy)
log_startup_progress(" Late initialized [late_loaders.len] atoms in [stop_watch(watch)]s")
else
log_debug(" Late initialized [late_loaders.len] atoms in [stop_watch(watch)]s")
late_loaders.Cut()
if(atoms)
@@ -117,4 +129,4 @@ SUBSYSTEM_DEF(atoms)
if(initialized == INITIALIZATION_INNEW_MAPLOAD)
InitializeAtoms()
old_initialized = SSatoms.old_initialized
BadInitializeCalls = SSatoms.BadInitializeCalls
BadInitializeCalls = SSatoms.BadInitializeCalls
+2 -2
View File
@@ -58,10 +58,10 @@
if(ST_bot_left == null || ST_top_right == null)
log_runtime(EXCEPTION("One of the smoothing corners is bust"), src)
space_manager.remove_dirt(placement.z)
late_setup_level(
block(bot_left, top_right),
block(ST_bot_left, ST_top_right))
space_manager.remove_dirt(placement.z)
log_game("[name] loaded at [min_x],[min_y],[placement.z]")
return 1
@@ -175,4 +175,4 @@
var/datum/map_template/vr/V = new vr_type()
vr_templates[V.id] = V
map_templates[V.id] = V
map_templates[V.id] = V
+5 -6
View File
@@ -29,11 +29,10 @@
areaMaster = get_area_master(src)
/atom/movable/attempt_init()
if(ticker && ticker.current_state >= GAME_STATE_SETTING_UP)
var/turf/T = get_turf(src)
if(T && space_manager.is_zlevel_dirty(T.z))
space_manager.postpone_init(T.z, src)
return
var/turf/T = get_turf(src)
if(T && SSatoms.initialized != INITIALIZATION_INSSATOMS && space_manager.is_zlevel_dirty(T.z))
space_manager.postpone_init(T.z, src)
return
. = ..()
@@ -429,4 +428,4 @@
flick_overlay(I, viewing, 5) // 5 ticks/half a second
// And animate the attack!
animate(I, alpha = 175, pixel_x = 0, pixel_y = 0, pixel_z = 0, time = 3)
animate(I, alpha = 175, pixel_x = 0, pixel_y = 0, pixel_z = 0, time = 3)
@@ -11,7 +11,7 @@
// This needs to come before the initialization wave because
// the thing it creates might need to be initialized too
/obj/effect/spawner/random_barrier/New()
/obj/effect/spawner/random_barrier/Initialize()
. = ..()
var/turf/T = get_turf(src)
if(!T)
@@ -12,7 +12,7 @@
// This needs to come before the initialization wave because
// the thing it creates might need to be initialized too
/obj/effect/spawner/random_spawners/New()
/obj/effect/spawner/random_spawners/Initialize()
. = ..()
var/turf/T = get_turf(src)
if(!T)
@@ -8,33 +8,34 @@
anchored = 1 // No sliding out while you prime
/obj/effect/spawner/window/Initialize()
..()
spawn(0)
var/turf/T = get_turf(src)
for(var/obj/structure/grille/G in get_turf(src))
// Complain noisily
log_runtime(EXCEPTION("Extra grille on turf: ([T.x],[T.y],[T.z])"), src)
qdel(G) //just in case mappers don't know what they are doing
. = ..()
var/turf/T = get_turf(src)
for(var/obj/structure/grille/G in get_turf(src))
// Complain noisily
log_runtime(EXCEPTION("Extra grille on turf: ([T.x],[T.y],[T.z])"), src)
qdel(G) //just in case mappers don't know what they are doing
if(!useFull)
for(var/cdir in cardinal)
for(var/obj/effect/spawner/window/WS in get_step(src,cdir))
cdir = null
break
if(!cdir) continue
var/obj/structure/window/WI = new windowtospawn(get_turf(src))
WI.dir = cdir
else
var/obj/structure/window/W = new windowtospawn(get_turf(src))
W.dir = SOUTHWEST
if(!useFull)
for(var/cdir in cardinal)
for(var/obj/effect/spawner/window/WS in get_step(src,cdir))
cdir = null
break
if(!cdir) continue
var/obj/structure/window/WI = new windowtospawn(get_turf(src))
WI.dir = cdir
else
var/obj/structure/window/W = new windowtospawn(get_turf(src))
W.dir = SOUTHWEST
if(useGrille)
new /obj/structure/grille(get_turf(src))
if(useGrille)
new /obj/structure/grille(get_turf(src))
src.air_update_turf(1) //atmos can pass otherwise
spawn(10)
qdel(src)
src.air_update_turf(1) //atmos can pass otherwise
// Give some time for nearby window spawners to initialize
spawn(10)
qdel(src)
// why is this line a no-op
// QDEL_IN(src, 10)
/obj/effect/spawner/window/reinforced
+1 -1
View File
@@ -86,7 +86,7 @@
icon_state = "id"
item_state = "card-id"
var/mining_points = 0 //For redeeming at mining equipment lockers
var/access = list()
var/list/access = list()
var/registered_name = "Unknown" // The name registered_name on the card
slot_flags = SLOT_ID
var/untrackable // Can not be tracked by AI's
+1 -3
View File
@@ -21,14 +21,13 @@ var/global/list/map_transition_config = MAP_TRANSITION_CONFIG
src.update_status()
space_manager.initialize() //Before the MC starts up
. = ..()
// Create robolimbs for chargen.
populate_robolimb_list()
space_manager.initialize() //Before the MC starts up
Master.Initialize(10, FALSE)
processScheduler = new
@@ -494,4 +493,3 @@ proc/establish_db_connection()
return 1
#undef FAILED_DB_CONNECTION_CUTOFF
+1 -1
View File
@@ -20,7 +20,7 @@
template = map_templates[template_name]
/obj/effect/landmark/map_loader/Initialize()
..()
. = ..()
if(template)
load(template)
@@ -57,8 +57,6 @@ var/global/dmm_suite/preloader/_preloader = new
var/list/grid_models = list()
var/key_len = 0
var/dmm_suite/loaded_map/LM = new
// This try-catch is used as a budget "Finally" clause, as the dirt count
// needs to be reset
@@ -128,7 +126,6 @@ var/global/dmm_suite/preloader/_preloader = new
bounds[MAP_MAXY] = max(bounds[MAP_MAXY], min(ycrd, world.maxy))
var/maxx = xcrdStart
log_debug("[xcrdStart]")
if(measureOnly)
for(var/line in gridLines)
maxx = max(maxx, xcrdStart + length(line) / key_len - 1)
@@ -4,7 +4,7 @@
chattyness = SNPC_CHANCE_TALK / 4
/mob/living/carbon/human/interactive/away/hotel/Initialize(mapload)
..(loc, /datum/species/skrell)
. = ..(mapload, /datum/species/skrell)
/mob/living/carbon/human/interactive/away/hotel/doSetup()
..()
@@ -24,12 +24,6 @@
for(var/obj/item/I in get_all_slots())
I.flags |= NODROP
// FIXME(crazylemon) a hack to prevent guards from running around with an
// extra security jumpsuit like a goof
for(var/obj/item/clothing/under/U in get_all_slots())
if(w_uniform != U)
qdel(U)
/mob/living/carbon/human/interactive/away/hotel/guard/KnockOut()
// you'll never take me alive (this triggers the implant)
emote("deathgasp")
+8 -4
View File
@@ -5,14 +5,18 @@
var/home_z
/mob/living/carbon/human/interactive/away/Initialize(mapload)
..()
. = ..()
TRAITS |= TRAIT_ROBUST
faction += "away"
/mob/living/carbon/human/interactive/away/random()
if(ispath(override_under, /obj/item/clothing/under))
equip_to_slot(new override_under(src), slot_w_uniform)
..()
// a little hacky but it should prevent doubled uniforms
if(ispath(override_under, /obj/item/clothing/under))
var/old_under = w_uniform
w_uniform = null
equip_to_slot(new override_under(src), slot_w_uniform)
qdel(old_under)
/mob/living/carbon/human/interactive/away/doSetup()
..()
@@ -78,4 +82,4 @@
if(living < squad_size && !length(viewers(src, world.view)))
var/mob/living/carbon/human/interactive/away/A = new squad_type(loc)
squad += A
A.squad_member = 1
A.squad_member = 1
+1 -1
View File
@@ -523,7 +523,7 @@
icon_state = "fan_tiny"
buildstackamount = 2
/obj/structure/fans/New(loc)
/obj/structure/fans/Initialize(loc)
..()
air_update_turf(1)
@@ -245,7 +245,7 @@
MYID.age = age
MYID.registered_name = real_name
MYID.photo = get_id_photo(src)
MYID.access = Path_ID.access // Automatons have strange powers... strange indeed
MYID.access = Path_ID.access.Copy() // Automatons have strange powers... strange indeed
RPID = new(src)
RPID.name = "[real_name]'s ID Card ([alt_title])"
@@ -257,7 +257,10 @@
RPID.photo = get_id_photo(src)
RPID.access = myjob.get_access()
equip_to_slot_or_del(MYID, slot_wear_id)
if(wear_id)
qdel(wear_id)
if(!equip_to_slot_or_del(MYID, slot_wear_id))
create_attack_log("<font color='blue'>Deleted ID due to slot contention</font>")
if(wear_pda)
MYPDA = wear_pda
else
@@ -403,8 +406,12 @@
if(!hud_used)
hud_used = new /datum/hud/human(src)
/mob/living/carbon/human/interactive/Initialize(mapload)
/mob/living/carbon/human/interactive/Initialize()
..()
return INITIALIZE_HINT_LATELOAD
/mob/living/carbon/human/interactive/LateInitialize()
. = ..()
snpc_list += src
create_mob_hud()
@@ -427,6 +434,7 @@
/mob/living/carbon/human/interactive/Destroy()
hear_radio_list -= src
snpc_list -= src
npc_master.removeBot(src)
return ..()
/mob/living/carbon/human/interactive/proc/retalTarget(mob/living/target)
+1 -1
View File
@@ -1,4 +1,4 @@
/mob/living/New()
/mob/living/Initialize()
. = ..()
var/datum/atom_hud/data/human/medical/advanced/medhud = huds[DATA_HUD_MEDICAL_ADVANCED]
medhud.add_to_hud(src)
@@ -79,7 +79,7 @@
var/death_sound = null //The sound played on death
/mob/living/simple_animal/New()
/mob/living/simple_animal/Initialize()
..()
simple_animal_list += src
verbs -= /mob/verb/observe
+1 -1
View File
@@ -24,7 +24,7 @@
..()
return QDEL_HINT_HARDDEL
/mob/New()
/mob/Initialize()
mob_list += src
if(stat == DEAD)
dead_mob_list += src
@@ -38,4 +38,4 @@
if(get_step(T,direction) in mother.map)
continue
return 1
return 0
return 0
+21 -26
View File
@@ -133,6 +133,10 @@
if(SELFLOOPING)
link_to_self() // `link_to_self` is defined in space_transitions.dm
var/list/atmos_machine_typecache = typecacheof(/obj/machinery/atmospherics)
var/list/cable_typecache = typecacheof(/obj/structure/cable)
var/list/maploader_typecache = typecacheof(/obj/effect/landmark/map_loader)
/datum/space_level/proc/resume_init()
if(dirt_count > 0)
throw EXCEPTION("Init told to resume when z-level still dirty. Z level: '[zpos]'")
@@ -140,23 +144,15 @@
log_debug("Beginning initialization!")
var/list/our_atoms = init_list // OURS NOW!!! (Keeping this list to ourselves will prevent hijack)
init_list = list()
var/list/late_maps = list()
var/list/pipes = list()
var/list/cables = list()
var/watch = start_watch()
for(var/schmoo in our_atoms)
var/atom/movable/AM = schmoo
if(AM) // to catch stuff like the nuke disk that no longer exists
// This can mess with our state - we leave these for last
if(istype(AM, /obj/effect/landmark/map_loader))
late_maps.Add(AM)
continue
AM.Initialize(TRUE)
if(istype(AM, /obj/machinery/atmospherics))
pipes.Add(AM)
else if(istype(AM, /obj/structure/cable))
cables.Add(AM)
listclearnulls(our_atoms)
var/list/late_maps = typecache_filter_list(our_atoms, maploader_typecache)
var/list/pipes = typecache_filter_list(our_atoms, atmos_machine_typecache)
var/list/cables = typecache_filter_list(our_atoms, cable_typecache)
// If we don't carefully add dirt around the map templates, bad stuff happens
// so we separate them out here
our_atoms -= late_maps
SSatoms.InitializeAtoms(our_atoms, FALSE)
log_debug("Primary initialization finished in [stop_watch(watch)]s.")
our_atoms.Cut()
if(pipes.len)
@@ -168,13 +164,14 @@
/datum/space_level/proc/do_pipes(list/pipes)
var/watch = start_watch()
log_debug("Building pipenets on z-level '[zpos]'!")
for(var/schmoo in pipes)
var/obj/machinery/atmospherics/machine = schmoo
if(machine)
machine.build_network()
log_debug("Initializing atmos machines on z-level '[zpos]'!")
var/init_count = SSair._setup_atmos_machinery(pipes)
log_debug("Initialized [init_count] machines, took [stop_watch(watch)]s")
watch = start_watch()
log_debug("Initializing pipe networks on z-level '[zpos]'!")
init_count = SSair._setup_pipenets(pipes)
log_debug("Initialized pipenets for [init_count] machines, took [stop_watch(watch)]s")
pipes.Cut()
log_debug("Took [stop_watch(watch)]s")
/datum/space_level/proc/do_cables(list/cables)
var/watch = start_watch()
@@ -187,10 +184,8 @@
var/watch = start_watch()
log_debug("Loading map templates on z-level '[zpos]'!")
space_manager.add_dirt(zpos) // Let's not repeatedly resume init for each template
for(var/schmoo in late_maps)
var/obj/effect/landmark/map_loader/ML = schmoo
if(ML)
ML.Initialize()
for(var/atom/movable/AM in late_maps)
AM.Initialize()
late_maps.Cut()
space_manager.remove_dirt(zpos)
log_debug("Took [stop_watch(watch)]s")
@@ -136,9 +136,9 @@
if(owner.gloves)
owner.unEquip(owner.gloves)
if(owner.l_hand)
owner.unEquip(owner.l_hand,1)
owner.unEquip(owner.l_hand)
if(owner.r_hand)
owner.unEquip(owner.r_hand,1)
owner.unEquip(owner.r_hand)
. = ..()