mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-25 13:09:11 +01:00
JSON Logging Refactor (#18252)
* First pass * fixes * more fixes * num2hex length changes * pass 2 * fixed warning * looc log fix * . * update tgui * . * . * . * . * perttier * cleanup * . * . * fix token * no * . * . * . * , * modsay eventsay * . --------- Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
@@ -57,5 +57,5 @@
|
||||
R = safepick(GLOB.data_core.medical)
|
||||
|
||||
if(R)
|
||||
log_debug("Manifest malfunction event is now deleting [R.fields["name"]]'s [record_class_to_delete] record.")
|
||||
log_game("Manifest malfunction event is now deleting [R.fields["name"]]'s [record_class_to_delete] record.")
|
||||
qdel(R)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
targeted_account = pick(GLOB.all_money_accounts)
|
||||
|
||||
if(!targeted_account)
|
||||
log_debug("Money hacker event could not find an account to hack. Aborting.")
|
||||
log_game("Money hacker event could not find an account to hack. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
@@ -47,11 +47,11 @@
|
||||
if(targeted_account && !targeted_account.suspended) // Hacker wins.
|
||||
message = "The hack attempt has succeeded."
|
||||
hack_account(targeted_account)
|
||||
log_debug("Money hacker event managed to hack the targeted account.")
|
||||
log_game("Money hacker event managed to hack the targeted account.")
|
||||
|
||||
else // Crew wins.
|
||||
message = "The attack has ceased, the affected accounts can now be brought online."
|
||||
log_debug("Money hacker event failed to hack the targeted account due to intervention by the crew.")
|
||||
log_game("Money hacker event failed to hack the targeted account due to intervention by the crew.")
|
||||
|
||||
var/my_department = "[location_name()] Firewall Subroutines"
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@
|
||||
// taking out loads of money before the event, then depositing it back in after the event fires, feel free to make this check for
|
||||
// roundstart money instead.
|
||||
money_at_start = count_money()
|
||||
log_debug("Funding Drive event logged a sum of [money_at_start] thalers in all station accounts at the start of the event.")
|
||||
log_game("Funding Drive event logged a sum of [money_at_start] thalers in all station accounts at the start of the event.")
|
||||
|
||||
/datum/event2/event/raise_funds/end()
|
||||
var/money_at_end = count_money()
|
||||
log_debug("Funding Drive event logged a sum of [money_at_end] thalers in all station accounts at the end of the event, compared \
|
||||
log_game("Funding Drive event logged a sum of [money_at_end] thalers in all station accounts at the end of the event, compared \
|
||||
to [money_at_start] thalers. A difference of [money_at_end / money_at_start] was calculated.")
|
||||
|
||||
// A number above 1 indicates money was made, while below 1 does the opposite.
|
||||
@@ -50,20 +50,20 @@
|
||||
discussion regarding your future employment prospects will occur.<br><br>\
|
||||
Your facility's current balance of requisition tokens has been revoked."
|
||||
SSsupply.points = 0
|
||||
log_debug("Funding Drive event ended with an abyssmal response, and the loss of all cargo points.")
|
||||
log_game("Funding Drive event ended with an abyssmal response, and the loss of all cargo points.")
|
||||
|
||||
if(0.02 to 0.98) // Bad response.
|
||||
message = "We're very disappointed that \the [location_name()] has ran a deficit since our request. \
|
||||
As such, we will be taking away some requisition tokens to cover the cost of operating your facility."
|
||||
var/points_lost = round(SSsupply.points * rand(0.5, 0.8))
|
||||
SSsupply.points -= points_lost
|
||||
log_debug("Funding Drive event ended with a bad response, and [points_lost] cargo points was taken away.")
|
||||
log_game("Funding Drive event ended with a bad response, and [points_lost] cargo points was taken away.")
|
||||
|
||||
if(0.98 to 1.02) // Neutral response.
|
||||
message = "It is unfortunate that \the [location_name()]'s finances remain at a standstill, however \
|
||||
that is still preferred over having a decicit. We hope that in the future, your facility will be able to be \
|
||||
more profitable."
|
||||
log_debug("Funding Drive event ended with a neutral response.")
|
||||
log_game("Funding Drive event ended with a neutral response.")
|
||||
|
||||
if(1.02 to INFINITY) // Good response.
|
||||
message = "We appreciate the efforts made by \the [location_name()] to run at a surplus. \
|
||||
@@ -75,7 +75,7 @@
|
||||
// Otherwise it would be weird for centcom to go 'thanks for not spending money, your reward is money to spend'.
|
||||
var/point_reward = rand(100, 200)
|
||||
SSsupply.points += point_reward
|
||||
log_debug("Funding Drive event ended with a good response and a bonus of [point_reward] cargo points.")
|
||||
log_game("Funding Drive event ended with a good response and a bonus of [point_reward] cargo points.")
|
||||
|
||||
send_command_report("Budget Followup", message)
|
||||
|
||||
@@ -92,5 +92,5 @@
|
||||
|
||||
/datum/event2/event/raise_funds/proc/send_command_report(title, message)
|
||||
post_comm_message(title, message)
|
||||
to_world(span_danger("New [using_map.company_name] Update available at all communication consoles."))
|
||||
to_chat(world, span_danger("New [using_map.company_name] Update available at all communication consoles."))
|
||||
SEND_SOUND(world, 'sound/AI/commandreport.ogg')
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
/datum/event2/event/airlock_failure/start()
|
||||
var/list/areas = find_random_areas()
|
||||
if(!LAZYLEN(areas))
|
||||
log_debug("Airlock Failure event could not find any areas. Aborting.")
|
||||
log_game("Airlock Failure event could not find any areas. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
addtimer(CALLBACK(src, PROC_REF(break_door), door), 1) // Emagging proc is actually a blocking proc and that's bad for the ticker.
|
||||
door.visible_message(span_danger("\The [door]'s panel sparks!"))
|
||||
playsound(door, "sparks", 50, 1)
|
||||
log_debug("Airlock Failure event has broken \the [door] airlock in [area].")
|
||||
log_game("Airlock Failure event has broken \the [door] airlock in [area].")
|
||||
affected_areas |= area
|
||||
doors_to_break--
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
open_turfs = find_random_turfs(5 + number_of_blobs)
|
||||
|
||||
if(!open_turfs.len)
|
||||
log_debug("Blob infestation event: Giving up after failure to find blob spots.")
|
||||
log_game("Blob infestation event: Giving up after failure to find blob spots.")
|
||||
abort()
|
||||
|
||||
/datum/event2/event/blob/start()
|
||||
@@ -108,7 +108,7 @@
|
||||
var/obj/structure/blob/core/new_blob = new spawn_blob_type(T)
|
||||
blobs += WEAKREF(new_blob)
|
||||
open_turfs -= T // So we can't put two cores on the same tile if doing multiblob.
|
||||
log_debug("Spawned [new_blob.overmind.blob_type.name] blob at [get_area(new_blob)].")
|
||||
log_game("Spawned [new_blob.overmind.blob_type.name] blob at [get_area(new_blob)].")
|
||||
|
||||
/datum/event2/event/blob/should_end()
|
||||
for(var/datum/weakref/weakref as anything in blobs)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
vending_machines += V
|
||||
|
||||
if(!vending_machines.len)
|
||||
log_debug("Could not find any vending machines on station Z levels. Aborting.")
|
||||
log_game("Brand intelligence event: Could not find any vending machines on station Z levels. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
if(!C.destroyed && (C.z in using_map.station_levels) && C.air_contents.total_moles >= MOLES_CELLSTANDARD)
|
||||
all_canisters += C
|
||||
var/obj/machinery/portable_atmospherics/canister/C = pick(all_canisters)
|
||||
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()
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
var/list/turfs = find_random_turfs()
|
||||
if(!turfs.len)
|
||||
log_debug("Gas Leak event failed to find any available turfs to leak into. Aborting.")
|
||||
log_game("Gas Leak event failed to find any available turfs to leak into. Aborting.")
|
||||
abort()
|
||||
return
|
||||
chosen_turf = pick(turfs)
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
var/turf/candidate = locate(rand(1, world.maxx), rand(1, world.maxy), pick(get_location_z_levels()) )
|
||||
if(istype(candidate, /turf/simulated/wall))
|
||||
origin = candidate
|
||||
log_debug("Wall-rot event has chosen \the [origin] ([origin.loc]) as the origin for the wallrot infestation.")
|
||||
log_game("Wall-rot event has chosen \the [origin] ([origin.loc]) as the origin for the wallrot infestation.")
|
||||
return
|
||||
|
||||
log_debug("Wall-rot event failed to find a valid wall after one hundred tries. Aborting.")
|
||||
log_game("Wall-rot event failed to find a valid wall after one hundred tries. Aborting.")
|
||||
abort()
|
||||
|
||||
/datum/event2/event/wallrot/announce()
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/datum/event2/event/window_break/set_up()
|
||||
var/list/areas = find_random_areas()
|
||||
if(!LAZYLEN(areas))
|
||||
log_debug("Window Break event could not find any areas. Aborting.")
|
||||
log_game("Window Break event could not find any areas. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
@@ -43,11 +43,11 @@
|
||||
break // Break out of the inner loop.
|
||||
|
||||
if(chosen_turf_with_windows)
|
||||
log_debug("Window Break event has chosen turf '[chosen_turf_with_windows.name]' in [chosen_turf_with_windows.loc].")
|
||||
log_game("Window Break event has chosen turf '[chosen_turf_with_windows.name]' in [chosen_turf_with_windows.loc].")
|
||||
break // Then the outer loop.
|
||||
|
||||
if(!chosen_turf_with_windows)
|
||||
log_debug("Window Break event could not find a turf with valid windows to break. Aborting.")
|
||||
log_game("Window Break event could not find a turf with valid windows to break. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
/datum/event2/event/window_break/end()
|
||||
// If someone fixed the window, then everything is fine.
|
||||
if(chosen_window && chosen_window.anchored && chosen_window.health == chosen_window.maxhealth)
|
||||
log_debug("Window Break event ended with window repaired.")
|
||||
log_game("Window Break event ended with window repaired.")
|
||||
return
|
||||
|
||||
// Otherwise a bunch of windows shatter.
|
||||
@@ -102,7 +102,7 @@
|
||||
var/obj/structure/window/W = collateral_windows[i]
|
||||
W?.shatter()
|
||||
|
||||
log_debug("Window Break event ended with [windows_to_shatter] shattered windows and a breach.")
|
||||
log_game("Window Break event ended with [windows_to_shatter] shattered windows and a breach.")
|
||||
|
||||
// Checks if a window is adjacent to a space tile, and also that the opposite direction is open.
|
||||
// This is done to avoid getting caught in corner parts of windows.
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
/datum/event2/event/comms_blackout/start()
|
||||
if(prob(50))
|
||||
// One in two chance for the radios to turn i%t# t&_)#%, which can be more alarming than radio silence.
|
||||
log_debug("Doing partial outage of telecomms.")
|
||||
log_game("Doing partial outage of telecomms.")
|
||||
for(var/obj/machinery/telecomms/processor/P in telecomms_list)
|
||||
P.emp_act(1)
|
||||
else
|
||||
// Otherwise just shut everything down, madagascar style.
|
||||
log_debug("Doing complete outage of telecomms.")
|
||||
log_game("Doing complete outage of telecomms.")
|
||||
for(var/obj/machinery/telecomms/T in telecomms_list)
|
||||
T.emp_act(1)
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
/datum/event2/event/electrical_fault/event_tick()
|
||||
if(!valid_apcs.len)
|
||||
log_debug("ELECTRICAL EVENT: No valid APCs found for electrical fault event. Aborting.")
|
||||
log_game("ELECTRICAL EVENT: No valid APCs found for electrical fault event. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
/datum/event2/event/electrical_fault/end()
|
||||
command_announcement.Announce("The irregular electrical conditions inside \the [location_name()] power grid has ceased.", "[location_name()] Power Grid Monitoring")
|
||||
log_debug("Electrical Fault event caused [apcs_disabled] APC\s to shut off, \
|
||||
log_game("Electrical Fault event caused [apcs_disabled] APC\s to shut off, \
|
||||
[apcs_overloaded] APC\s to overload lighting, and [apcs_emagged] APC\s to be emagged.")
|
||||
|
||||
/datum/event2/event/electrical_fault/proc/affect_apc(obj/machinery/power/apc/A)
|
||||
@@ -77,7 +77,7 @@
|
||||
// This will actually protect it from further damage.
|
||||
if(prob(25))
|
||||
A.energy_fail(rand(60, 120))
|
||||
// log_debug("ELECTRICAL EVENT: Disabled \the [A]'s power for a temporary amount of time.")
|
||||
// log_game("ELECTRICAL EVENT: Disabled \the [A]'s power for a temporary amount of time.")
|
||||
playsound(A, 'sound/machines/defib_success.ogg', 50, 1)
|
||||
apcs_disabled++
|
||||
return
|
||||
@@ -85,7 +85,7 @@
|
||||
// Decent chance to overload lighting circuit.
|
||||
if(prob(30))
|
||||
A.overload_lighting()
|
||||
// log_debug("ELECTRICAL EVENT: Overloaded \the [A]'s lighting.")
|
||||
// log_game("ELECTRICAL EVENT: Overloaded \the [A]'s lighting.")
|
||||
playsound(A, 'sound/effects/lightningshock.ogg', 50, 1)
|
||||
apcs_overloaded++
|
||||
|
||||
@@ -93,6 +93,6 @@
|
||||
if(prob(5))
|
||||
A.emagged = TRUE
|
||||
A.update_icon()
|
||||
// log_debug("ELECTRICAL EVENT: Emagged \the [A].")
|
||||
// log_game("ELECTRICAL EVENT: Emagged \the [A].")
|
||||
playsound(A, 'sound/machines/chime.ogg', 50, 1)
|
||||
apcs_emagged++
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
/datum/event2/event/infestation/set_up()
|
||||
turfs = find_random_turfs(max_vermin)
|
||||
if(!turfs.len)
|
||||
log_debug("Infestation event failed to find any valid turfs. Aborting.")
|
||||
log_game("Infestation event failed to find any valid turfs. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/datum/event2/event/pda_spam
|
||||
length_lower_bound = 30 MINUTES
|
||||
length_upper_bound = 1 HOUR
|
||||
var/spam_debug = FALSE // If true, notices of the event sending spam go to `log_debug()`.
|
||||
var/spam_debug = FALSE // If true, notices of the event sending spam go to `log_game()`.
|
||||
var/last_spam_time = null // world.time of most recent spam.
|
||||
var/next_spam_attempt_time = 0 // world.time of next attempt to try to spam.
|
||||
var/give_up_after = 5 MINUTES
|
||||
@@ -60,7 +60,7 @@
|
||||
if(!.)
|
||||
// Give up if nobody was reachable for five minutes.
|
||||
if(last_spam_time + give_up_after < world.time)
|
||||
log_debug("PDA Spam event giving up after not being able to spam for awhile.")
|
||||
log_game("PDA Spam event giving up after not being able to spam for awhile.")
|
||||
return TRUE
|
||||
|
||||
/datum/event2/event/pda_spam/proc/can_spam()
|
||||
@@ -134,7 +134,7 @@
|
||||
var/datum/data/pda/app/messenger/PM = P.find_program(/datum/data/pda/app/messenger)
|
||||
PM.notify(span_bold("Message from [sender] (Unknown / spam?), ") + "\"[message]\" (Unable to Reply)", 0)
|
||||
if(spam_debug)
|
||||
log_debug("PDA Spam event sent spam to \the [P].")
|
||||
log_game("PDA Spam event sent spam to \the [P].")
|
||||
|
||||
|
||||
/datum/event2/event/pda_spam/proc/pick_message_server()
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
/datum/event2/event/sudden_weather_shift/set_up()
|
||||
if(!LAZYLEN(SSplanets.planets))
|
||||
log_debug("Weather shift event was ran when no planets exist. Aborting.")
|
||||
log_game("Weather shift event was ran when no planets exist. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
@@ -41,5 +41,5 @@
|
||||
|
||||
// Now choose a new weather.
|
||||
var/new_weather = pickweight(new_weather_weights)
|
||||
log_debug("Sudden weather shift event is now changing [chosen_planet.name]'s weather to [new_weather].")
|
||||
log_game("Sudden weather shift event is now changing [chosen_planet.name]'s weather to [new_weather].")
|
||||
chosen_planet.weather_holder.change_weather(new_weather)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
free_turfs = find_random_turfs(5, desired_turf_areas)
|
||||
|
||||
if(!free_turfs.len)
|
||||
log_debug("Ghost Pod Spawning event failed to find a place to spawn. Aborting.")
|
||||
log_game("Ghost Pod Spawning event failed to find a place to spawn. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
|
||||
@@ -31,6 +31,6 @@
|
||||
continue
|
||||
|
||||
if(H.appendicitis())
|
||||
log_debug("Appendicitis event gave appendicitis to \the [H].")
|
||||
log_game("Appendicitis event gave appendicitis to \the [H].")
|
||||
return
|
||||
log_debug("Appendicitis event could not find a valid victim.")
|
||||
log_game("Appendicitis event could not find a valid victim.")
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
areas_to_break += A
|
||||
|
||||
if(!areas_to_break.len)
|
||||
log_debug("Prison Break event failed to find any areas to break. Aborting.")
|
||||
log_game("Prison Break event failed to find any areas to break. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
end_weights -= victim_chosen
|
||||
|
||||
if(!victim)
|
||||
log_debug("Security Screening event failed to find anyone to screen. Aborting.")
|
||||
log_game("Security Screening event failed to find anyone to screen. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
|
||||
@@ -44,6 +44,6 @@
|
||||
while((spiders_to_spawn >= 1) && vents.len)
|
||||
var/obj/vent = pick(vents)
|
||||
new spiderling_to_spawn(vent.loc)
|
||||
log_debug("Spider infestation event spawned a spiderling at [get_area(vent)].")
|
||||
log_game("Spider infestation event spawned a spiderling at [get_area(vent)].")
|
||||
vents -= vent
|
||||
spiders_to_spawn--
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
|
||||
/datum/event2/event/surprise_carp/start()
|
||||
if(!victim)
|
||||
log_debug("Failed to find a target for surprise carp attack. Aborting.")
|
||||
log_game("Failed to find a target for surprise carp attack. Aborting.")
|
||||
abort()
|
||||
return
|
||||
|
||||
var/number_of_carp = rand(1, 2)
|
||||
log_debug("Sending [number_of_carp] carp\s after \the [victim].")
|
||||
log_game("Sending [number_of_carp] carp\s after \the [victim].")
|
||||
// Getting off screen tiles is kind of tricky due to potential edge cases that could arise.
|
||||
// The method we're gonna do is make a big square around the victim, then
|
||||
// subtract a smaller square in the middle for the default vision range.
|
||||
@@ -54,7 +54,7 @@
|
||||
// Ask carp to swim onto the victim's screen. The AI will then switch to hostile and try to eat them.
|
||||
C.ai_holder?.give_destination(get_turf(victim))
|
||||
else
|
||||
log_debug("Surprise carp attack failed to find any space turfs offscreen to the victim.")
|
||||
log_game("Surprise carp attack failed to find any space turfs offscreen to the victim.")
|
||||
|
||||
// Gets suitable spots for carp to spawn, without risk of going off the edge of the map.
|
||||
// If there is demand for this proc, then it can easily be made independant and moved into one of the helper files.
|
||||
|
||||
Reference in New Issue
Block a user