mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] JSON Logging Refactor (#11623)
Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
272afa33c8
commit
5a62077f2c
@@ -72,7 +72,7 @@
|
||||
for(var/i in 1 to 10)
|
||||
var/area/A = pick(grand_list_of_areas)
|
||||
if(is_area_occupied(A))
|
||||
log_debug("atmos_leak event: Rejected [A] because it is occupied.")
|
||||
log_game("atmos_leak event: Rejected [A] because it is occupied.")
|
||||
continue
|
||||
// A good area, great! Lets try and pick a turf
|
||||
var/list/turfs = list()
|
||||
@@ -80,14 +80,14 @@
|
||||
if(turf_clear(F))
|
||||
turfs += F
|
||||
if(turfs.len == 0)
|
||||
log_debug("atmos_leak event: Rejected [A] because it has no clear turfs.")
|
||||
log_game("atmos_leak event: Rejected [A] because it has no clear turfs.")
|
||||
continue
|
||||
target_area = A
|
||||
target_turf = pick(turfs)
|
||||
|
||||
// If we can't find a good target, give up
|
||||
if(!target_area)
|
||||
log_debug("atmos_leak event: Giving up after too many failures to pick target area")
|
||||
log_game("atmos_leak event: Giving up after too many failures to pick target area")
|
||||
kill()
|
||||
return
|
||||
|
||||
|
||||
@@ -13,18 +13,18 @@
|
||||
for(var/i in 1 to 10)
|
||||
var/obj/machinery/portable_atmospherics/canister/C = pick(all_canisters)
|
||||
if(severity <= EVENT_LEVEL_MUNDANE && area_is_occupied(get_area(C)))
|
||||
log_debug("canister_leak event: Rejecting canister [C] ([C.x],[C.y],[C.z]) because area is occupied")
|
||||
log_game("canister_leak event: Rejecting canister [C] ([C.x],[C.y],[C.z]) because area is occupied")
|
||||
continue
|
||||
// Okay lets break it
|
||||
break_canister(C)
|
||||
return
|
||||
|
||||
// If we got to here we failed to find it
|
||||
log_debug("canister_leak event: Giving up after too many failures to pick target canister")
|
||||
log_game("canister_leak event: Giving up after too many failures to pick target canister")
|
||||
kill()
|
||||
return
|
||||
|
||||
/datum/event/canister_leak/proc/break_canister(var/obj/machinery/portable_atmospherics/canister/C)
|
||||
log_debug("canister_leak event: Canister [C] ([C.x],[C.y],[C.z]) destroyed.")
|
||||
log_game("canister_leak event: Canister [C] ([C.x],[C.y],[C.z]) destroyed.")
|
||||
C.health = 0
|
||||
C.healthcheck()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
/datum/event/carp_migration/setup()
|
||||
if(prob(50))
|
||||
log_debug("Carp migration failed successfully.")
|
||||
log_game("carp migration: event setup prob() failed, killing")
|
||||
kill()
|
||||
return
|
||||
announceWhen = rand(30, 60) // 1 to 2 minutes
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
if(shield_gen.deal_shield_damage(30 * severity, SHIELD_DAMTYPE_EM) <= SHIELD_BREACHED_MINOR)
|
||||
return
|
||||
if(!valid_apcs.len)
|
||||
// log_debug("No valid APCs found for electrical storm event ship=[victim]!") // Let's not spam poor people with debug logs on (me)
|
||||
// log_game("No valid APCs found for electrical storm event ship=[victim]!") // Let's not spam poor people with debug logs on (me)
|
||||
return
|
||||
var/list/picked_apcs = list()
|
||||
for(var/i=0, i< severity * 2, i++) // up to 2/4/6 APCs per tick depending on severity
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
new next_event.event_type(next_event) // Events are added and removed from the processing queue in their New/kill procs
|
||||
|
||||
log_debug("Starting event '[next_event.name]' of severity [GLOB.severity_to_string[severity]].")
|
||||
log_game("Starting event '[next_event.name]' of severity [GLOB.severity_to_string[severity]].")
|
||||
next_event = null // When set to null, a random event will be selected next time
|
||||
else
|
||||
// If not, wait for one minute, instead of one tick, before checking again.
|
||||
@@ -114,7 +114,7 @@
|
||||
var/event_delay = rand(CONFIG_GET(number_list/event_delay_lower)[severity] MINUTES, CONFIG_GET(number_list/event_delay_upper)[severity] MINUTES) * playercount_modifier
|
||||
next_event_time = world.time + event_delay
|
||||
|
||||
log_debug("Next event of severity [GLOB.severity_to_string[severity]] in [(next_event_time - world.time)/600] minutes.")
|
||||
log_game("Next event of severity [GLOB.severity_to_string[severity]] in [(next_event_time - world.time)/600] minutes.")
|
||||
|
||||
/datum/event_container/proc/SelectEvent()
|
||||
var/datum/event_meta/EM = tgui_input_list(usr, "Select an event to queue up.", "Event Selection", available_events)
|
||||
|
||||
@@ -102,7 +102,7 @@ GLOBAL_LIST_EMPTY(event_last_fired)
|
||||
for(var/V in possibleEvents)
|
||||
debug_message += "[V]:[possibleEvents[V]]"
|
||||
debug_message += "|||Picked:[picked_event]"
|
||||
log_debug(debug_message)
|
||||
// to_chat(world, debug_message)
|
||||
|
||||
if(!picked_event)
|
||||
return
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
to_chat(A, span_danger("Malicious program detected in the [english_list(areaName)] lighting and airlock control systems by [my_department]."))
|
||||
|
||||
else
|
||||
to_world_log("ERROR: Could not initate grey-tide. Unable to find suitable containment area.")
|
||||
log_world("ERROR: Could not initate grey-tide. Unable to find suitable containment area.")
|
||||
kill()
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/datum/event/spacefish_migration/setup()
|
||||
//CHOMP Add start
|
||||
if(prob(15) || fired == TRUE)
|
||||
log_debug("Random spacefish migration failed successfully.")
|
||||
log_game("random spacefish migration: event setup prob() failed, killing")
|
||||
kill()
|
||||
return
|
||||
fired = TRUE
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
src.type_path = type_path
|
||||
src.name = initial(type_path.name)
|
||||
if(!name)
|
||||
log_debug("supply_demand event: Order for thing [type_path] has no name.")
|
||||
log_game("supply_demand event: Order for thing [type_path] has no name.")
|
||||
|
||||
/datum/supply_demand_order/thing/match_item(var/atom/I)
|
||||
if(istype(I, type_path))
|
||||
@@ -207,7 +207,7 @@
|
||||
qty_need = CEILING((qty_need - amount_to_take), 1)
|
||||
return 1
|
||||
else
|
||||
log_debug("supply_demand event: not taking reagent '[reagent_id]': [amount_to_take]")
|
||||
log_game("supply_demand event: not taking reagent '[reagent_id]': [amount_to_take]")
|
||||
return
|
||||
|
||||
//
|
||||
@@ -233,14 +233,14 @@
|
||||
if(!canmix || canmix.total_moles <= 0)
|
||||
return
|
||||
if(canmix.return_pressure() < mixture.return_pressure())
|
||||
log_debug("supply_demand event: canister fails to match [canmix.return_pressure()] kPa < [mixture.return_pressure()] kPa")
|
||||
log_game("supply_demand event: canister fails to match [canmix.return_pressure()] kPa < [mixture.return_pressure()] kPa")
|
||||
return
|
||||
// Make sure ratios are equal
|
||||
for(var/gas in mixture.gas)
|
||||
var/targetPercent = round((mixture.gas[gas] / mixture.total_moles) * 100)
|
||||
var/canPercent = round((canmix.gas[gas] / canmix.total_moles) * 100)
|
||||
if(abs(targetPercent-canPercent) > 1)
|
||||
log_debug("supply_demand event: canister fails to match because '[gas]': [canPercent] != [targetPercent]")
|
||||
log_game("supply_demand event: canister fails to match because '[gas]': [canPercent] != [targetPercent]")
|
||||
return // Fail!
|
||||
// Huh, it actually matches!
|
||||
qty_need -= 1
|
||||
|
||||
Reference in New Issue
Block a user