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

🆑
admin: Additional logging for when people sign up for ghost roles.
/🆑
This commit is contained in:
Jacquerel
2025-07-07 16:27:43 +01:00
committed by GitHub
parent a70e462e64
commit d0e2bfe85c
7 changed files with 42 additions and 2 deletions

View File

@@ -150,6 +150,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"

View File

@@ -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)

View File

@@ -121,6 +121,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

View File

@@ -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++
@@ -302,7 +306,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.

View File

@@ -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]))

View File

@@ -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

View File

@@ -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