Skip to content

Commit

Permalink
ZAS Debug improvements (#1169)
Browse files Browse the repository at this point in the history
* fixes & improvements

* minor formatting
  • Loading branch information
Kapu1178 authored Dec 27, 2024
1 parent abfad67 commit 3e79c82
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 98 deletions.
26 changes: 13 additions & 13 deletions _maps/map_files/generic/CentCom.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2505,7 +2505,7 @@
pixel_y = 17
},
/obj/structure/fluff/tram_rail,
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"hm" = (
/obj/structure/flora/ausbushes/lavendergrass,
Expand Down Expand Up @@ -6054,7 +6054,7 @@
dir = 1
},
/obj/structure/railing,
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"ri" = (
/obj/effect/turf_decal/stripes/full,
Expand Down Expand Up @@ -7234,7 +7234,7 @@
/obj/structure/railing{
dir = 10
},
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"uX" = (
/obj/machinery/shower{
Expand Down Expand Up @@ -8979,7 +8979,7 @@
/obj/structure/railing{
dir = 9
},
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"zZ" = (
/obj/effect/turf_decal/tile/brown{
Expand Down Expand Up @@ -10571,7 +10571,7 @@
/obj/structure/railing{
dir = 1
},
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"Es" = (
/obj/effect/light_emitter{
Expand Down Expand Up @@ -10733,7 +10733,7 @@
/obj/structure/railing{
dir = 8
},
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"ES" = (
/obj/structure/sign/poster/contraband/lamarr{
Expand Down Expand Up @@ -10941,7 +10941,7 @@
/obj/structure/railing{
dir = 9
},
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"Fy" = (
/obj/structure/chair/stool/directional/south,
Expand Down Expand Up @@ -12178,7 +12178,7 @@
/obj/structure/railing{
dir = 10
},
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"Jo" = (
/obj/machinery/door/airlock/centcom{
Expand Down Expand Up @@ -12443,7 +12443,7 @@
/turf/open/misc/asteroid/snow/airless,
/area/centcom/syndicate_mothership)
"Ki" = (
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"Kk" = (
/obj/docking_port/stationary{
Expand Down Expand Up @@ -13400,7 +13400,7 @@
/obj/structure/railing{
dir = 6
},
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"Np" = (
/obj/structure/bookcase/random,
Expand Down Expand Up @@ -13428,7 +13428,7 @@
/obj/structure/railing{
dir = 6
},
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"Nt" = (
/obj/structure/filingcabinet/medical,
Expand Down Expand Up @@ -15268,7 +15268,7 @@
/obj/structure/railing{
dir = 9
},
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"SL" = (
/obj/structure/rack,
Expand Down Expand Up @@ -15734,7 +15734,7 @@
/obj/structure/railing{
dir = 10
},
/turf/open/lava/plasma,
/turf/open/lava/plasma/snow_air,
/area/centcom/syndicate_mothership/control)
"TO" = (
/obj/machinery/keycard_auth/directional/south,
Expand Down
10 changes: 10 additions & 0 deletions code/controllers/subsystem/zas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,11 @@ SUBSYSTEM_DEF(zas)
active_edges -= E
E.excited = FALSE

#ifdef ZASDBG
for(var/turf/T as anything in E.connecting_turfs)
T.vis_contents -= zasdbgovl_edge
#endif

///Wakes an edge, adding it to the active process list.
/datum/controller/subsystem/zas/proc/excite_edge(connection_edge/E)
#ifdef ZASDBG
Expand All @@ -524,6 +529,11 @@ SUBSYSTEM_DEF(zas)
active_edges += E
E.excited = TRUE

#ifdef ZASDBG
for(var/turf/T as anything in E.connecting_turfs)
T.vis_contents += zasdbgovl_edge
#endif

///Returns the edge between zones A and B. If one doesn't exist, it creates one. See header for more information
/datum/controller/subsystem/zas/proc/get_edge(zone/A, zone/B) //Note: B can also be a turf.
var/connection_edge/edge
Expand Down
18 changes: 18 additions & 0 deletions code/modules/atmospherics/ZAS/ConnectionGroup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ Class Procs:
#ifdef ZASDBG
if(verbose)
zas_log("[type] Erased.")

for(var/turf/T in connecting_turfs)
T.vis_contents -= zasdbgovl_edge
#endif

///Called every air tick on edges in the processing list. Equalizes gas.
Expand Down Expand Up @@ -184,9 +187,16 @@ Class Procs:
/connection_edge/zone/add_connection(connection/c)
. = ..()
connecting_turfs += c.A
#ifdef ZASDBG
if(excited)
c.A.vis_contents += zasdbgovl_edge
#endif

/connection_edge/zone/remove_connection(connection/c)
connecting_turfs -= c.A
#ifdef ZASDBG
c.A.vis_contents -= zasdbgovl_edge
#endif
return ..()

/connection_edge/zone/contains_zone(zone/Z)
Expand Down Expand Up @@ -239,6 +249,7 @@ Class Procs:

flow(attracted, abs(differential), 0)
flow(repelled, abs(differential), 1)

/connection_edge/unsimulated
var/turf/B
var/datum/gas_mixture/air
Expand All @@ -261,10 +272,17 @@ Class Procs:
. = ..()
connecting_turfs += c.B
air.group_multiplier = coefficient
#ifdef ZASDBG
if(excited)
c.B.vis_contents += zasdbgovl_edge
#endif

/connection_edge/unsimulated/remove_connection(connection/c)
connecting_turfs -= c.B
air.group_multiplier = coefficient
#ifdef ZASDBG
c.B.vis_contents -= zasdbgovl_edge
#endif
return ..()

/connection_edge/unsimulated/erase()
Expand Down
4 changes: 4 additions & 0 deletions code/modules/atmospherics/ZAS/Debug.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ GLOBAL_REAL_VAR(obj/effect/zasdbg/merged/zasdbgovl_merged) = new
GLOBAL_REAL_VAR(obj/effect/zasdbg/invalid_zone/zasdbgovl_invalid_zone) = new
GLOBAL_REAL_VAR(obj/effect/zasdbg/blocked/zasdbgovl_blocked) = new
GLOBAL_REAL_VAR(obj/effect/zasdbg/mark/zasdbgovl_mark) = new
GLOBAL_REAL_VAR(obj/effect/zasdbg/edge/zasdbgovl_edge) = new

GLOBAL_REAL_VAR(list/zasdbgovl_dirblock) = list(
"north" = new /obj/effect/zasdbg/air_blocked/north,
Expand All @@ -31,6 +32,7 @@ GLOBAL_REAL_VAR(list/zasdbgovl_dirzoneblock) = list(
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
layer = FLY_LAYER
vis_flags = NONE
appearance_flags = RESET_COLOR | RESET_TRANSFORM | KEEP_APART

/obj/effect/zasdbg/assigned
icon_state = "assigned"
Expand All @@ -44,6 +46,8 @@ GLOBAL_REAL_VAR(list/zasdbgovl_dirzoneblock) = list(
icon_state = "fullblock"
/obj/effect/zasdbg/mark
icon_state = "mark"
/obj/effect/zasdbg/edge
icon_state = "edge"

/obj/effect/zasdbg/zone_blocked
icon_state = "zoneblock"
Expand Down
33 changes: 17 additions & 16 deletions code/modules/atmospherics/ZAS/Diagnostic.dm
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
/client/proc/Zone_Info(turf/T as null|turf)
set category = "Debug"
if(T)
if(T.simulated && T.zone)
T.zone.dbg_data(src)
if(length(T.zone.contents) < ZONE_MIN_SIZE)
to_chat(mob, span_notice("This turf's zone is below the minimum size, and will merge over zone blockers."))
var/list/out = list()
if(!T)
return

if(T.simulated && T.zone)
out += T.zone.dbg_data(src)

else
to_chat(mob, span_admin("ZASDBG: No zone here."))
var/datum/gas_mixture/mix = T.unsafe_return_air()
to_chat(mob,span_admin( "ZASDBG_MAIN: [mix.returnPressure()] kPa [mix.temperature] k"))
for(var/g in mix.gas)
to_chat(mob, span_admin("ZASDBG_GAS: [g]: [mix.gas[g]]\n"))
else
if(zone_debug_images)
for(var/zone in zone_debug_images)
images -= zone_debug_images[zone]
zone_debug_images = null
var/datum/gas_mixture/air = T.unsafe_return_air()
out += span_info("Unsimulated Turf ([T.type])")
out += span_info("<br>Moles: [air.total_moles]")
out += span_info("Pressure: [air.returnPressure()] kPa")
out += span_info("Temperature: [air.temperature]°K ([air.temperature - T0C]°C)")
out += span_info("Volume: [air.volume]L")

out += span_info("Mixture:")
for(var/g in air.gas)
out += span_info("[FOURSPACES]- [xgm_gas_data.name[g]]: [air.gas[g]] ([round((air.gas[g] / air.total_moles) * 100, ATMOS_PRECISION)]%) ")

/client/var/list/zone_debug_images
to_chat(src, examine_block("ZAS Debug: [COORD(T)]<hr>"+ jointext(out, "<br>")))

/client/proc/Test_ZAS_Connection(turf/T as turf)
set category = "Debug"
Expand Down
38 changes: 28 additions & 10 deletions code/modules/atmospherics/ZAS/Zone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -233,25 +233,43 @@ Class Procs:

///Prints debug information to the given mob. Used by the "Zone Info" verb. Does not require ZASDBG compile define.
/zone/proc/dbg_data(mob/M)
to_chat(M, name)
. = list()
. += span_info("[name][invalid ? " ([span_alert("Invalid")])" : ""]")
if(length(contents) < ZONE_MIN_SIZE)
. += span_alert("This turf's zone is below the minimum size, and will merge over zone blockers.")
. += span_info("<br>Moles: [air.total_moles]")
. += span_info("Pressure: [air.returnPressure()] kPa")
. += span_info("Temperature: [air.temperature]°K ([air.temperature - T0C]°C)")
. += span_info("Volume: [air.volume]L")
. += span_info("Mixture:")
for(var/g in air.gas)
to_chat(M, "[xgm_gas_data.name[g]]: [air.gas[g]]")
to_chat(M, "P: [air.returnPressure()] kPa V: [air.volume]L T: [air.temperature]°K ([air.temperature - T0C]°C)")
to_chat(M, "O2 per N2: [(air.gas[GAS_NITROGEN] ? air.gas[GAS_OXYGEN]/air.gas[GAS_NITROGEN] : "N/A")] Moles: [air.total_moles]")
to_chat(M, "Simulated: [contents.len] ([air.group_multiplier])")
to_chat(M, "Edges: [edges.len]")
if(invalid) to_chat(M, "Invalid!")
. += span_info("[FOURSPACES]- [xgm_gas_data.name[g]]: [air.gas[g]] ([round((air.gas[g] / air.total_moles) * 100, ATMOS_PRECISION)]%)")

. += span_info("<br>Turfs: [contents.len] (Mult: [air.group_multiplier])")
. += span_info("All Edges: [edges.len]")

var/zone_edges = 0
var/space_edges = 0
var/space_coefficient = 0
var/list/unsim_pressures = list()
var/list/zone_pressures = list()

for(var/edge_source in edges)
var/connection_edge/E = edges[edge_source]
var/turf/jump_target = E.connecting_turfs[1]

if(E.type == /connection_edge/zone)
zone_edges++
var/zone/enemy_zone = edge_source
zone_pressures += span_info("[FOURSPACES]- [enemy_zone.air.returnPressure()] kPa ([E.excited ? span_alert("Excited") : span_good("Sleeping")]) [ADMIN_JMP(jump_target)]")

else
space_edges++
space_coefficient += E.coefficient
to_chat(M, " - [E:air:returnPressure()]kPa")
var/connection_edge/unsimulated/unsim_edge = E
unsim_pressures += span_info("[FOURSPACES]- [unsim_edge.air.returnPressure()] kPa ([unsim_edge.excited ? span_alert("Excited") : span_good("Sleeping")]) [ADMIN_JMP(jump_target)]")

to_chat(M, "Zone Edges: [zone_edges]")
to_chat(M, "Unsimulated Edges: [space_edges] ([space_coefficient] connections)\n")
. += span_info("Zone Edges: [zone_edges]")
. += zone_pressures
. += span_info("Unsimulated Edges: [space_edges] ([space_coefficient] connections)")
. += unsim_pressures
5 changes: 5 additions & 0 deletions code/modules/awaymissions/mission_code/snowdin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@
baseturfs = /turf/open/lava/plasma/mafia
slowdown = 0

//matches /turf/open/misc/asteroid/snow
/turf/open/lava/plasma/snow_air
initial_gas = OPENTURF_LOW_PRESSURE
temperature = 180

/////////// papers


Expand Down
Loading

0 comments on commit 3e79c82

Please sign in to comment.