Skip to content

Commit

Permalink
Makes transfer votes way less annoying (#4091)
Browse files Browse the repository at this point in the history
* done

* failsafe

* Update monkestation/code/datums/votes/transfer_vote.dm

Co-authored-by: Lucy <lucy@absolucy.moe>

* Update monkestation/code/datums/votes/_vote_datum.dm

Co-authored-by: Lucy <lucy@absolucy.moe>

---------

Co-authored-by: Lucy <lucy@absolucy.moe>
  • Loading branch information
RikuTheKiller and Absolucy authored Nov 6, 2024
1 parent 93b7b81 commit 2a37a04
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion code/controllers/subsystem/vote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ SUBSYSTEM_DEF(vote)
generated_actions += voting_action

if(current_vote.vote_sound && (new_voter.prefs.read_preference(/datum/preference/toggle/sound_announcements)))
SEND_SOUND(new_voter, sound(current_vote.vote_sound))
SEND_SOUND(new_voter, sound(current_vote.vote_sound, volume = current_vote.vote_sound_volume)) // monkestation edit

return TRUE

Expand Down
4 changes: 4 additions & 0 deletions monkestation/code/datums/votes/_vote_datum.dm
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/datum/vote
/// The volume of the vote sound, from 0 to 100 or above.
var/vote_sound_volume = 100

/datum/vote/proc/can_vote(mob/voter)
return TRUE
19 changes: 19 additions & 0 deletions monkestation/code/datums/votes/transfer_vote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
CHOICE_CONTINUE,
)
player_startable = FALSE
vote_sound_volume = 150 // Make it loud so people don't miss it.

/datum/vote/shuttle_call/reset()
. = ..()
Expand All @@ -29,6 +30,12 @@
/datum/vote/shuttle_call/initiate_vote(initiator, duration)
. = ..()
SSautotransfer.doing_transfer_vote = TRUE
priority_announce(
text = "The shift has eclipsed its standard duration. If the crew wish to leave, a scheduled shuttle will be sent to the station from Central Command.",
title = "Crew Transfer Vote",
has_important_message = TRUE,
color_override = "green",
)

/datum/vote/shuttle_call/finalize_vote(winning_option)
switch(winning_option)
Expand All @@ -46,5 +53,17 @@
if(isobserver(voter) || voter.stat == DEAD || !(voter.ckey in GLOB.joined_player_list)) // only living crew gets to vote
return FALSE

/datum/vote/shuttle_call/tiebreaker(list/winners)
return CHOICE_CONTINUE // Generally, this is less likely to make people mad. It still can, don't get me wrong, but it's safer.

/datum/vote/shuttle_call/get_vote_result(list/non_voters)
for(var/ckey in non_voters)
var/client/client = non_voters[ckey]
if(client?.mob && can_vote(client.mob))
choices[CHOICE_CONTINUE]++ // Everyone defaults to continue, since they may be in the middle of something when the vote starts.
if(choices[CHOICE_CALL] + choices[CHOICE_CONTINUE] <= 0) // No-one is alive. Call it.
return CHOICE_CALL
return ..()

#undef CHOICE_CONTINUE
#undef CHOICE_CALL

0 comments on commit 2a37a04

Please # to comment.