From 9d2f950e8e0cbc904f59868bad7f3870a8e709a0 Mon Sep 17 00:00:00 2001 From: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> Date: Sat, 23 Sep 2023 21:25:13 +0200 Subject: [PATCH] Fixed ZASDBG, Added ZAS logging subsystem, Removed FIREDBG and consolidated it under ZASDBG (#17386) * Atomization * asfsa * sdaf * sdfas --------- Co-authored-by: FluffyGhost --- aurorastation.dme | 1 + code/ZAS/Fire.dm | 31 +++++++------ code/ZAS/Turf.dm | 18 ++++---- code/_helpers/logging/subsystems/ZAS.dm | 17 ++++++++ code/controllers/configuration.dm | 4 ++ code/controllers/subsystems/air.dm | 4 ++ .../game/objects/items/weapons/tanks/tanks.dm | 8 ++-- config/example/logging.json | 4 +- config/example/logging_files.json | 4 +- .../FluffyGhost-zas_logging_debug.yml | 43 +++++++++++++++++++ 10 files changed, 104 insertions(+), 30 deletions(-) create mode 100644 code/_helpers/logging/subsystems/ZAS.dm create mode 100644 html/changelogs/FluffyGhost-zas_logging_debug.yml diff --git a/aurorastation.dme b/aurorastation.dme index fdce36e0e2a..c21cda40389 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -184,6 +184,7 @@ #include "code\_helpers\logging\subsystems\ghostroles.dm" #include "code\_helpers\logging\subsystems\law.dm" #include "code\_helpers\logging\subsystems\mapfinalization.dm" +#include "code\_helpers\logging\subsystems\ZAS.dm" #include "code\_helpers\sorting\__main.dm" #include "code\_helpers\sorting\cmp.dm" #include "code\_helpers\sorting\TimSort.dm" diff --git a/code/ZAS/Fire.dm b/code/ZAS/Fire.dm index bd8dec04d2e..29cd46029c1 100644 --- a/code/ZAS/Fire.dm +++ b/code/ZAS/Fire.dm @@ -6,7 +6,6 @@ The more pressure, the more boom. If it gains pressure too slowly, it may leak or just rupture instead of exploding. */ -//#define FIREDBG #define FIRE_LIGHT_1 2 //These defines are the power of the light given off by fire at various stages #define FIRE_LIGHT_2 4 #define FIRE_LIGHT_3 5 @@ -244,9 +243,9 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin . = 0 if((temperature > PHORON_MINIMUM_BURN_TEMPERATURE || force_burn) && (no_check ||check_recombustability(zone? zone.fuel_objs : null))) - #ifdef FIREDBG - LOG_DEBUG("***************** FIREDBG *****************") - LOG_DEBUG("Burning [zone? zone.name : "zoneless gas_mixture"]!") + #ifdef ZASDBG + log_subsystem_zas_debug("***************** FIREDBG *****************") + log_subsystem_zas_debug("Burning [zone? zone.name : "zoneless gas_mixture"]!") #endif var/gas_fuel = 0 @@ -298,14 +297,14 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin var/used_fuel = min(total_reaction_progress, reaction_limit) var/used_oxidizers = used_fuel*(FIRE_REACTION_OXIDIZER_AMOUNT/FIRE_REACTION_FUEL_AMOUNT) - #ifdef FIREDBG - LOG_DEBUG("gas_fuel = [gas_fuel], liquid_fuel = [liquid_fuel], total_oxidizers = [total_oxidizers]") - LOG_DEBUG("fuel_area = [fuel_area], total_fuel = [total_fuel], reaction_limit = [reaction_limit]") - LOG_DEBUG("firelevel -> [firelevel] (gas: [gas_firelevel], liquid: [liquid_firelevel])") - LOG_DEBUG("liquid_reaction_progress = [liquid_reaction_progress]") - LOG_DEBUG("gas_reaction_progress = [gas_reaction_progress]") - LOG_DEBUG("total_reaction_progress = [total_reaction_progress]") - LOG_DEBUG("used_fuel = [used_fuel], used_oxidizers = [used_oxidizers]; ") + #ifdef ZASDBG + log_subsystem_zas_debug("gas_fuel = [gas_fuel], liquid_fuel = [liquid_fuel], total_oxidizers = [total_oxidizers]") + log_subsystem_zas_debug("fuel_area = [fuel_area], total_fuel = [total_fuel], reaction_limit = [reaction_limit]") + log_subsystem_zas_debug("firelevel -> [firelevel] (gas: [gas_firelevel], liquid: [liquid_firelevel])") + log_subsystem_zas_debug("liquid_reaction_progress = [liquid_reaction_progress]") + log_subsystem_zas_debug("gas_reaction_progress = [gas_reaction_progress]") + log_subsystem_zas_debug("total_reaction_progress = [total_reaction_progress]") + log_subsystem_zas_debug("used_fuel = [used_fuel], used_oxidizers = [used_oxidizers]; ") #endif //if the reaction is progressing too slow then it isn't self-sustaining anymore and burns out @@ -332,9 +331,9 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin temperature = (starting_energy + vsc.fire_fuel_energy_release * (used_gas_fuel + used_liquid_fuel)) / heat_capacity() update_values() - #ifdef FIREDBG - LOG_DEBUG("used_gas_fuel = [used_gas_fuel]; used_liquid_fuel = [used_liquid_fuel]; total = [used_fuel]") - LOG_DEBUG("new temperature = [temperature]; new pressure = [return_pressure()]") + #ifdef ZASDBG + log_subsystem_zas_debug("used_gas_fuel = [used_gas_fuel]; used_liquid_fuel = [used_liquid_fuel]; total = [used_fuel]") + log_subsystem_zas_debug("new temperature = [temperature]; new pressure = [return_pressure()]") #endif return firelevel @@ -404,7 +403,7 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin //fires burn better when there is more oxidizer -- too much fuel will choke the fire out a bit, reducing firelevel. var/mix_multiplier = 1 / (1 + (5 * ((total_fuel / total_combustables) ** 2))) - #ifdef FIREDBG + #ifdef ZASDBG ASSERT(damping_multiplier <= 1) ASSERT(mix_multiplier <= 1) #endif diff --git a/code/ZAS/Turf.dm b/code/ZAS/Turf.dm index 2fa3b17b3f6..d0fead8c36d 100644 --- a/code/ZAS/Turf.dm +++ b/code/ZAS/Turf.dm @@ -111,7 +111,7 @@ ATMOS_CANPASS_TURF(s_block, src, src) if(s_block & AIR_BLOCKED) #ifdef ZASDBG - if(verbose) LOG_DEBUG("Self-blocked.") + log_subsystem_zas_debug("Self-blocked.") //dbg(blocked) #endif if(zone) @@ -145,7 +145,7 @@ if(block & AIR_BLOCKED) #ifdef ZASDBG - if(verbose) LOG_DEBUG("[d] is blocked.") + log_subsystem_zas_debug("[d] is blocked.") //unsim.dbg(air_blocked, turn(180,d)) #endif @@ -156,7 +156,7 @@ if(r_block & AIR_BLOCKED) #ifdef ZASDBG - if(verbose) LOG_DEBUG("[d] is blocked.") + log_subsystem_zas_debug("[d] is blocked.") //dbg(air_blocked, d) #endif @@ -190,7 +190,7 @@ // we are blocking them and not blocking ourselves - this prevents tiny zones from forming on doorways. if(((block & ZONE_BLOCKED) && !(r_block & ZONE_BLOCKED)) || ((r_block & ZONE_BLOCKED) && !(s_block & ZONE_BLOCKED))) #ifdef ZASDBG - if(verbose) LOG_DEBUG("[d] is zone blocked.") + log_subsystem_zas_debug("[d] is zone blocked.") //dbg(zone_blocked, d) #endif @@ -202,21 +202,23 @@ #ifdef ZASDBG dbg(assigned) - if(verbose) LOG_DEBUG("Added to [zone]") + log_subsystem_zas_debug("Added to [zone]") #endif else if(sim.zone != zone) #ifdef ZASDBG - if(verbose) LOG_DEBUG("Connecting to [sim.zone]") + log_subsystem_zas_debug("Connecting to [sim.zone]") #endif SSair.connect(src, sim) #ifdef ZASDBG - else if(verbose) LOG_DEBUG("[d] has same zone.") + else + log_subsystem_zas("[d] has same zone.") - else if(verbose) LOG_DEBUG("[d] has invalid zone.") + else + log_subsystem_zas("[d] has invalid zone.") #endif else //Postponing connections to tiles until a zone is assured. diff --git a/code/_helpers/logging/subsystems/ZAS.dm b/code/_helpers/logging/subsystems/ZAS.dm new file mode 100644 index 00000000000..6e17da57508 --- /dev/null +++ b/code/_helpers/logging/subsystems/ZAS.dm @@ -0,0 +1,17 @@ +/proc/log_subsystem_zas(text) +// SUppress this in case of unit tests, it's essentially useless +#if defined(UNIT_TEST) + LOG_GITHUB_DEBUG("ZAS: [text]") +#else + if (config.logsettings["log_subsystems_zas"]) + WRITE_LOG(config.logfiles["log_subsystems_zas"], "ZAS: [text]") +#endif + +/proc/log_subsystem_zas_debug(text) +// SUppress this in case of unit tests, it's essentially useless +#if defined(UNIT_TEST) + LOG_GITHUB_DEBUG("ZAS-Debug: [text]") +#else + if (config.logsettings["log_subsystems_zas_debug"]) + WRITE_LOG(config.logfiles["log_subsystems_zas_debug"], "ZAS-Debug: [text]") +#endif diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 8593dde18d1..03dceb45498 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -62,6 +62,8 @@ var/list/gamemode_cache = list() "log_subsystems_fail2topic" = TRUE, // Fail2Topic "log_subsystems_mapfinalization" = TRUE, // Map Finalization "log_subsystems_tgui" = TRUE, // TGUI + "log_subsystems_zas" = FALSE, // ZAS + "log_subsystems_zas_debug" = FALSE, // ZAS debug //// MODULES //// @@ -114,6 +116,8 @@ var/list/gamemode_cache = list() "world_subsystems_fail2topic_log" = "subsystems/fail2topic.log", "world_subsystems_mapfinalization_log" = "subsystems/mapfinalization.log", "world_subsystems_tgui" = "subsystems/tgui.log", + "world_subsystems_zas" = "subsystems/zas.log", + "world_subsystems_zas_debug" = "subsystems/zas.log", //// MODULES //// diff --git a/code/controllers/subsystems/air.dm b/code/controllers/subsystems/air.dm index deeac685c52..e18848c7571 100644 --- a/code/controllers/subsystems/air.dm +++ b/code/controllers/subsystems/air.dm @@ -90,6 +90,10 @@ Class Procs: var/active_zones = 0 var/next_id = 1 + #ifdef ZASDBG + var/updated = 0 + #endif + /datum/controller/subsystem/air/proc/reboot() set waitfor = FALSE diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm index c106e70245a..d67c6814cf7 100644 --- a/code/game/objects/items/weapons/tanks/tanks.dm +++ b/code/game/objects/items/weapons/tanks/tanks.dm @@ -266,8 +266,8 @@ qdel(src) else if(pressure > TANK_RUPTURE_PRESSURE) - #ifdef FIREDBG - LOG_DEBUG("[x],[y] tank is rupturing: [pressure] kPa, integrity [integrity]") + #ifdef ZASDBG + log_subsystem_zas("[x],[y] tank is rupturing: [pressure] kPa, integrity [integrity]") #endif if(integrity <= 0) @@ -281,8 +281,8 @@ integrity-- else if(pressure > TANK_LEAK_PRESSURE) - #ifdef FIREDBG - LOG_DEBUG("[x],[y] tank is leaking: [pressure] kPa, integrity [integrity]") + #ifdef ZASDBG + log_subsystem_zas("[x],[y] tank is leaking: [pressure] kPa, integrity [integrity]") #endif if(integrity <= 0) diff --git a/config/example/logging.json b/config/example/logging.json index 854285c07ad..aa147bfb9a4 100644 --- a/config/example/logging.json +++ b/config/example/logging.json @@ -40,5 +40,7 @@ "log_modules_sectors":1, "world_modules_ruins_log":1, "log_gelf_enabled":0, - "log_gelf_addr":"127.0.0.1:12345" + "log_gelf_addr":"127.0.0.1:12345", + "log_subsystems_zas":0, + "log_subsystems_zas_debug":0 } diff --git a/config/example/logging_files.json b/config/example/logging_files.json index a26e1cfe817..10819a1cb9f 100644 --- a/config/example/logging_files.json +++ b/config/example/logging_files.json @@ -39,5 +39,7 @@ "world_modules_customitems_log":"modules/customitems.log", "world_modules_exoplanets_log":"modules/exoplanets.log", "world_modules_sectors_log":"modules/sectors.log", - "world_modules_ruins_log":"modules/ruins.log" + "world_modules_ruins_log":"modules/ruins.log", + "world_subsystems_zas":"subsystems/zas.log", + "world_subsystems_zas_debug":"subsystems/zas.log" } diff --git a/html/changelogs/FluffyGhost-zas_logging_debug.yml b/html/changelogs/FluffyGhost-zas_logging_debug.yml new file mode 100644 index 00000000000..622110a1faa --- /dev/null +++ b/html/changelogs/FluffyGhost-zas_logging_debug.yml @@ -0,0 +1,43 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixed ZASDBG, that was not working due to missing pieces." + - rscadd: "Added ZAS logging subsystem and replaced the relative previous log calls with them within ZAS." + - refactor: "Removed FIREDBG and consolidated it under ZASDBG."