From dca3f3bd8a5c71630b905b23c3c72811d21dc044 Mon Sep 17 00:00:00 2001 From: Cael_Aislinn Date: Thu, 9 Aug 2012 18:12:59 +1000 Subject: [PATCH] reworked/verbosified some zas debugging, added additional zas debugging, made kill_air available to game_admins as well as game_masters, increased runtime check sensitivity to aid in debugging Signed-off-by: Cael_Aislinn --- code/ZAS/FEA_system.dm | 14 ++++++------ code/ZAS/Processing.dm | 38 +++++++++++++++++++++++++++++++ code/game/master_controller.dm | 24 ++++--------------- code/modules/admin/admin_verbs.dm | 2 +- 4 files changed, 50 insertions(+), 28 deletions(-) diff --git a/code/ZAS/FEA_system.dm b/code/ZAS/FEA_system.dm index fba39e9219e..c1c380d8fd5 100644 --- a/code/ZAS/FEA_system.dm +++ b/code/ZAS/FEA_system.dm @@ -171,14 +171,14 @@ datum proc/tick() . = 1 //Set the default return value, for runtime detection. - tick_progress = 0 + tick_progress = "next_stat_check (atmos statistics)" if(current_cycle >= next_stat_check) var/zone/z = pick(zones) var/log_file = file("[time2text(world.timeofday, "statistics/DD-MM-YYYY-air.txt")]") log_file << "\"\The [get_area(pick(z.contents))]\",[z.air.oxygen],[z.air.nitrogen],[z.air.carbon_dioxide],[z.air.toxins],[z.air.temperature],[z.air.group_multiplier * z.air.volume]" next_stat_check = current_cycle + (rand(5,7)*60) - tick_progress = 1 + tick_progress = "update_air_properties" if(tiles_to_update.len) //If there are tiles to update, do so. for(var/turf/simulated/T in tiles_to_update) var/output = T.update_air_properties() @@ -187,19 +187,19 @@ datum log_admin("ZASALERT: Either a null turf in list/tiles_to_update, or unable run turf/simualted/update_air_properties()") tiles_to_update = list() - tick_progress = 2 + tick_progress = "connections_to_check" if(connections_to_check.len) for(var/connection/C in connections_to_check) C.CheckPassSanity() connections_to_check = list() - tick_progress = 3 + tick_progress = "tiles_to_reconsider_zones" if(tiles_to_reconsider_zones.len) for(var/turf/simulated/T in tiles_to_reconsider_zones) if(!T.zone) new /zone(T) - tick_progress = 4 + tick_progress = "zone/process()" for(var/zone/Z in zones) if(Z.last_update < current_cycle) var/output = Z.process() @@ -209,11 +209,11 @@ datum . = 0 log_admin("ZASALERT: Either a null zone in list/zones, or unable run zone/process()") - tick_progress = 5 + tick_progress = "active_hotspots (fire)" for(var/obj/fire/F in active_hotspots) var/output = F.process() if(. && F && !output) . = 0 log_admin("ZASALERT: Either a null fire in list/active_hotspots, or unable run obj/fire/process()") - tick_progress = 6 \ No newline at end of file + tick_progress = "success" \ No newline at end of file diff --git a/code/ZAS/Processing.dm b/code/ZAS/Processing.dm index 8f12a73cb33..f74ceb005e4 100644 --- a/code/ZAS/Processing.dm +++ b/code/ZAS/Processing.dm @@ -1,9 +1,18 @@ #define QUANTIZE(variable) (round(variable,0.0001)) + +zone/var/progress = "nothing" + zone/proc/process() . = 1 + + progress = "problem with: src.SoftDelete()" + //Deletes zone if empty. if(!contents.len) return SoftDelete() + + progress = "problem with: src.Rebuild()" + //Does rebuilding stuff. if(rebuild) rebuild = 0 @@ -12,12 +21,16 @@ zone/proc/process() if(!contents.len) //If we got soft deleted. return + progress = "problem with: src.air.adjust()" + //Sometimes explosions will cause the air to be deleted for some reason. if(!air) air = new() air.adjust(MOLES_O2STANDARD, 0, MOLES_N2STANDARD, 0, list()) world.log << "Air object lost in zone. Regenerating." + progress = "problem with: calculating total space tiles" + //Counting up space. var/total_space = 0 @@ -28,6 +41,8 @@ zone/proc/process() if(space_tiles) total_space = space_tiles.len + progress = "problem with: src.ShareSpace()" + //Add checks to ensure that we're not sucking air out of an empty room. if(total_space && air.total_moles > 0.1 && air.temperature > TCMB+0.5) //If there is space, air should flow out of the zone. @@ -35,11 +50,15 @@ zone/proc/process() AirflowSpace(src) ShareSpace(air,total_space*vsc.zone_share_percent/200) + progress = "problem with: src.air.react()" + //React the air here. air.react(null,0) //Check the graphic. + progress = "problem with: modifying turf graphics" + air.graphic = 0 if(air.toxins > MOLES_PLASMA_VISIBLE) air.graphic = 1 @@ -48,9 +67,13 @@ zone/proc/process() if(sleeping_agent && (sleeping_agent.moles > 1)) air.graphic = 2 + progress = "problem with an inbuilt byond function: some conditional checks" + //Only run through the individual turfs if there's reason to. if(air.graphic != air.graphic_archived || air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) + progress = "problem with: turf/simulated/update_visuals()" + for(var/turf/simulated/S in contents) //Update overlays. if(air.graphic != air.graphic_archived) @@ -59,20 +82,31 @@ zone/proc/process() else S.update_visuals(air) + progress = "problem with: item or turf temperature_expose()" + //Expose stuff to extreme heat. if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) for(var/atom/movable/item in S) item.temperature_expose(air, air.temperature, CELL_VOLUME) S.temperature_expose(air, air.temperature, CELL_VOLUME) + progress = "problem with: calculating air graphic" + //Archive graphic so we can know if it's different. air.graphic_archived = air.graphic + progress = "problem with: calculating air temp" + //Ensure temperature does not reach absolute zero. air.temperature = max(TCMB,air.temperature) + progress = "problem with an inbuilt byond function: length(connections)" + //Handle connections to other zones. if(length(connections)) + + progress = "problem with: src.ZMerge(), a couple of misc procs" + for(var/connection/C in connections) //Check if the connection is valid first. if(!C.Cleanup()) @@ -84,6 +118,8 @@ zone/proc/process() if(C.A.zone.air.compare(C.B.zone.air) || total_space) ZMerge(C.A.zone,C.B.zone) + progress = "problem with: src.ShareRatio(), src.Airflow(), a couple of misc procs" + //Share some for(var/zone/Z in connected_zones) if(air && Z.air) @@ -95,6 +131,8 @@ zone/proc/process() //Divided by 200 since each zone is processed. Each connection is considered twice //Space tiles force it to try and move twice as much air. + progress = "all components completed successfully, the problem is not here" + proc/ShareRatio(datum/gas_mixture/A, datum/gas_mixture/B, ratio) //Shares a specific ratio of gas between mixtures using simple weighted averages. var diff --git a/code/game/master_controller.dm b/code/game/master_controller.dm index f49a2ab8bda..0d049707a14 100644 --- a/code/game/master_controller.dm +++ b/code/game/master_controller.dm @@ -176,30 +176,14 @@ datum/controller/game_controller air_master.current_cycle++ var/success = air_master.tick() //Changed so that a runtime does not crash the ticker. if(!success) //Runtimed. - var/section = "unknown" - switch(air_master.tick_progress) - if(0) - section = "next_stat_check (atmos statistics)" - if(1) - section = "update_air_properties" - if(2) - section = "connections_to_check" - if(3) - section = "tiles_to_reconsider_zones" - if(4) - section = "zone/process" - if(5) - section = "active_hotspots (fire)" - if(6) - section = "success" - log_admin("ZASALERT: air_system/tick() failed with progress: [air_master.tick_progress] ([section])") + log_admin("ZASALERT: air_system/tick() failed: [air_master.tick_progress]") air_master.failed_ticks++ - if(air_master.failed_ticks > 20) + if(air_master.failed_ticks > 10) world << "RUNTIMES IN ATMOS TICKER. Killing air simulation!" kill_air = 1 air_master.failed_ticks = 0 - else if (air_master.failed_ticks > 10) - air_master.failed_ticks = 0 + /*else if (air_master.failed_ticks > 10) + air_master.failed_ticks = 0*/ air_master_ready = 1 src.set_debug_state("Tension Master") diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index f1c4b8356db..2f2bfaaa838 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -292,6 +292,7 @@ verbs += /client/proc/Force_Event_admin verbs += /client/proc/radioalert verbs += /client/proc/CarbonCopy + verbs += /client/proc/kill_air //formerly game masters only. this should help for zas debugging while we're having these issues //verbs += /client/proc/jump_to_dead_group else return @@ -311,7 +312,6 @@ verbs += /client/proc/startSinglo //Used to prevent the station from losing power while testing stuff out. verbs += /client/proc/toggle_log_hrefs verbs += /client/proc/enable_debug_verbs - verbs += /client/proc/kill_air verbs += /client/proc/callprocgen verbs += /client/proc/callprocobj verbs += /client/proc/rnd_check_designs