Skip to content

Commit

Permalink
[MIRROR] Reduces chat/audio spam when multiple ghost polls are being …
Browse files Browse the repository at this point in the history
…called (#1981)

* Reduces chat/audio spam when multiple ghost polls are being called (#81441)

## About The Pull Request

This slightly modifies the polling subsystem. The sound/chat popup for a
new role is now only given on the first "stack" of a role signup.

Let's say 3 loneops roll at once (ty admins), you'll still get the toast
popup for 3x loneop rolls, but you'll only get one text highlight in the
chat, and only one audio stinger.

Even if the first 2 loneops don't have anyone sign up for it, using the
text or toast signup options will still sign you up for the last roll as
it completes. This shouldn't make signing up any harder, just quieter.
## Why It's Good For The Game

Less spam in chat. Less headset-blasting audio bleeps. Cool!

Closes #80998.
## Changelog
:cl: Rhials
fix: Ghost role polls should spam you less when multiple of the same
roll occur in succession.
/:cl:

* Reduces chat/audio spam when multiple ghost polls are being called

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: Rhials <[email protected]>
  • Loading branch information
3 people authored Feb 15, 2024
1 parent 8eb1a18 commit 7f34764
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions code/controllers/subsystem/polling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ SUBSYSTEM_DEF(polling)
if(role && !is_eligible(candidate_mob, role, check_jobban, ignore_category))
continue

SEND_SOUND(candidate_mob, 'sound/misc/notice2.ogg')
if(flash_window)
window_flash(candidate_mob.client)

Expand Down Expand Up @@ -116,7 +115,10 @@ SUBSYSTEM_DEF(polling)
var/act_never = ""
if(ignore_category)
act_never = "<a href='?src=[REF(poll_alert_button)];never=1'>\[Never For This Round]</a>"
to_chat(candidate_mob, span_boldnotice(examine_block("Now looking for candidates [role_name_text ? "to play as \an [role_name_text]." : "\"[question]\""] [act_jump] [act_signup] [act_never]")))

if(!duplicate_message_check(alert_poll)) //Only notify people once. They'll notice if there are multiple and we don't want to spam people.
SEND_SOUND(candidate_mob, 'sound/misc/notice2.ogg')
to_chat(candidate_mob, span_boldnotice(examine_block("Now looking for candidates [role_name_text ? "to play as \an [role_name_text]." : "\"[question]\""] [act_jump] [act_signup] [act_never]")))

// Start processing it so it updates visually the timer
START_PROCESSING(SSprocessing, poll_alert_button)
Expand Down Expand Up @@ -197,13 +199,8 @@ SUBSYSTEM_DEF(polling)

// Take care of updating the remaining screen alerts if a similar poll is found, or deleting them.
if(length(finishing_poll.alert_buttons))
var/polls_of_same_type_left = FALSE
for(var/datum/candidate_poll/running_poll as anything in currently_polling)
if(running_poll.poll_key == finishing_poll.poll_key && running_poll.time_left() > 0)
polls_of_same_type_left = TRUE
break
for(var/atom/movable/screen/alert/poll_alert/alert as anything in finishing_poll.alert_buttons)
if(polls_of_same_type_left)
if(duplicate_message_check(finishing_poll))
alert.update_stacks_overlay()
else
alert.owner.clear_alert("[finishing_poll.poll_key]_poll_alert")
Expand All @@ -218,6 +215,13 @@ SUBSYSTEM_DEF(polling)
msg += " | Next: [DisplayTimeText(soonest_to_complete.time_left())] ([length(soonest_to_complete.signed_up)] candidates)"
return ..()

///Is there a multiple of the given event type running right now?
/datum/controller/subsystem/polling/proc/duplicate_message_check(datum/candidate_poll/poll_to_check)
for(var/datum/candidate_poll/running_poll as anything in currently_polling)
if((running_poll.poll_key == poll_to_check.poll_key && running_poll != poll_to_check) && running_poll.time_left() > 0)
return TRUE
return FALSE

/datum/controller/subsystem/polling/proc/get_next_poll_to_finish()
var/lowest_time_left = INFINITY
var/next_poll_to_finish
Expand Down

0 comments on commit 7f34764

Please sign in to comment.