From d3a5cd5787ab4e25ef5e45a8375289237e0d3785 Mon Sep 17 00:00:00 2001 From: Jacquerel Date: Mon, 7 Jul 2025 16:27:43 +0100 Subject: [PATCH] Increases logging for candidate polls (#91590) ## About The Pull Request The game will now log when someone signs up or removes their candidacy for ghost polls for roles. This also fixes a runtime I experienced while testing it and running pirates with no candidates signed up, IDK if it had any effect but it's possible the runtime was causing the ship not to spawn. ## Why It's Good For The Game Mostly just that I saw admins requesting this on several recent occasions. It's already possible to dig up some of this information through the existing logs but it's a bit of a pain. ## Changelog :cl: admin: Additional logging for when people sign up for ghost roles. /:cl: --- code/__DEFINES/logging.dm | 1 + code/__HELPERS/logging/game.dm | 2 ++ code/controllers/configuration/entries/general.dm | 4 ++++ code/controllers/subsystem/polling.dm | 15 +++++++++++++-- code/datums/candidate_poll.dm | 14 ++++++++++++++ .../logging/categories/log_category_game.dm | 5 +++++ config/logging.txt | 3 +++ 7 files changed, 42 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/logging.dm b/code/__DEFINES/logging.dm index e3d71a2d9e1..823475fda22 100644 --- a/code/__DEFINES/logging.dm +++ b/code/__DEFINES/logging.dm @@ -152,6 +152,7 @@ #define LOG_CATEGORY_GAME_TRAITOR "game-traitor" #define LOG_CATEGORY_GAME_VOTE "game-vote" #define LOG_CATEGORY_GAME_WHISPER "game-whisper" +#define LOG_CATEGORY_GAME_GHOST_POLLS "game-ghost-polls" // HREF categories #define LOG_CATEGORY_HREF "href" diff --git a/code/__HELPERS/logging/game.dm b/code/__HELPERS/logging/game.dm index 0d872abeb1e..254414fa44b 100644 --- a/code/__HELPERS/logging/game.dm +++ b/code/__HELPERS/logging/game.dm @@ -30,3 +30,5 @@ /proc/log_vote(text, list/data) logger.Log(LOG_CATEGORY_GAME_VOTE, text, data) +/proc/log_ghost_poll(text, list/data) + logger.Log(LOG_CATEGORY_GAME_GHOST_POLLS, text, data) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index bb2714b6123..26c837c515b 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -124,6 +124,10 @@ /// log emotes /datum/config_entry/flag/log_emote +/// log ghost polling +/datum/config_entry/flag/log_ghost_poll + default = TRUE + /// log economy actions /datum/config_entry/flag/log_econ diff --git a/code/controllers/subsystem/polling.dm b/code/controllers/subsystem/polling.dm index dccb826a12f..65b981e3fe7 100644 --- a/code/controllers/subsystem/polling.dm +++ b/code/controllers/subsystem/polling.dm @@ -63,7 +63,11 @@ SUBSYSTEM_DEF(polling) question = "Do you want to play as [span_notice(role_name_text)]?" if(!question) question = "Do you want to play as a special role?" - log_game("Polling candidates [role_name_text ? "for [role_name_text]" : "\"[question]\""] for [DisplayTimeText(poll_time)] seconds") + log_ghost_poll("Candidate poll started.", data = list( + "role name" = role_name_text, + "poll question" = question, + "poll duration" = DisplayTimeText(poll_time), + )) // Start firing total_polls++ @@ -308,7 +312,14 @@ SUBSYSTEM_DEF(polling) // Trim players who aren't eligible anymore var/length_pre_trim = length(finishing_poll.signed_up) finishing_poll.trim_candidates() - log_game("Candidate poll [finishing_poll.role ? "for [finishing_poll.role]" : "\"[finishing_poll.question]\""] finished. [length_pre_trim] players signed up, [length(finishing_poll.signed_up)] after trimming") + + log_ghost_poll("Candidate poll completed.", data = list( + "role name" = finishing_poll.role, + "poll question" = finishing_poll.question, + "signed up count" = length_pre_trim, + "trimmed candidate count" = length(finishing_poll.signed_up) + )) + finishing_poll.finished = TRUE // Take care of updating the remaining screen alerts if a similar poll is found, or deleting them. diff --git a/code/datums/candidate_poll.dm b/code/datums/candidate_poll.dm index 9afec6f371b..439f21878ed 100644 --- a/code/datums/candidate_poll.dm +++ b/code/datums/candidate_poll.dm @@ -78,6 +78,13 @@ return FALSE signed_up += candidate + + log_ghost_poll("Player [candidate.key] signed candidate poll", data = list( + "player key" = candidate.key, + "role name" = role, + "poll question" = question, + )) + if(!silent) to_chat(candidate, span_notice(response_messages[POLL_RESPONSE_SIGNUP])) // Sign them up for any other polls with the same mob type @@ -102,6 +109,13 @@ return FALSE signed_up -= candidate + + log_ghost_poll("Player [candidate.key] removed from poll candidacy", data = list( + "player key" = candidate.key, + "role name" = role, + "poll question" = question, + )) + if(!silent) to_chat(candidate, span_danger(response_messages[POLL_RESPONSE_UNREGISTERED])) diff --git a/code/modules/logging/categories/log_category_game.dm b/code/modules/logging/categories/log_category_game.dm index 1d29f288984..f337d5f821c 100644 --- a/code/modules/logging/categories/log_category_game.dm +++ b/code/modules/logging/categories/log_category_game.dm @@ -12,6 +12,11 @@ config_flag = /datum/config_entry/flag/log_emote master_category = /datum/log_category/game +/datum/log_category/game_ghost_polls + category = LOG_CATEGORY_GAME_GHOST_POLLS + config_flag = /datum/config_entry/flag/log_ghost_poll + master_category = /datum/log_category/game + /datum/log_category/game_internet_request category = LOG_CATEGORY_GAME_INTERNET_REQUEST config_flag = /datum/config_entry/flag/log_internet_request diff --git a/config/logging.txt b/config/logging.txt index 0bc5f025ef0..4b51dfc4d8a 100644 --- a/config/logging.txt +++ b/config/logging.txt @@ -29,6 +29,9 @@ LOG_ECON ## log emotes LOG_EMOTE +## log ghost polling +LOG_GHOST_POLL + ## log game actions (start of round, results, etc.) LOG_GAME