From 9b4c3a5be3f26e2131d65f183b0f9c17e82c91a9 Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Thu, 10 Mar 2022 21:35:08 -0800 Subject: [PATCH] Adds a minimum greater vote count to extend rounds --- code/__DEFINES/vote.dm | 3 +++ code/controllers/subsystem/vote.dm | 21 ++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/vote.dm b/code/__DEFINES/vote.dm index 88e70b884e..bbe6ddf2b7 100644 --- a/code/__DEFINES/vote.dm +++ b/code/__DEFINES/vote.dm @@ -5,6 +5,9 @@ #define HIGHEST_MEDIAN_VOTING "HIGHEST_MEDIAN" #define INSTANT_RUNOFF_VOTING "IRV" +#define VOTE_TRANSFER "Initiate Crew Transfer" +#define VOTE_CONTINUE "Continue Playing" + #define SHOW_RESULTS (1<<0) #define SHOW_VOTES (1<<1) #define SHOW_WINNER (1<<2) diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index 868351a833..9196c5f4a1 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -32,6 +32,8 @@ SUBSYSTEM_DEF(vote) var/list/stored_modetier_results = list() // The aggregated tier list of the modes available in secret. + var/transfer_votes_done = 0 + /datum/controller/subsystem/vote/fire() //called by master_controller if(mode) if(end_time < world.time) @@ -248,8 +250,17 @@ SUBSYSTEM_DEF(vote) if(vote_system == SCORE_VOTING) calculate_scores(vote_title_text) if(vote_system == HIGHEST_MEDIAN_VOTING) - calculate_highest_median(vote_title_text) // nothing uses this at the moment - var/list/winners = vote_system == INSTANT_RUNOFF_VOTING ? get_runoff_results() : get_result() + calculate_highest_median(vote_title_text) + var/list/winners = list() + if(mode == "transfer") + var/greater_amount_required = 2 + transfer_votes_done + text += "\nExtending requires [greater_amount_required] more votes to win." + if(choices[VOTE_TRANSFER] + greater_amount_required >= choices[VOTE_CONTINUE]) + winners = list(VOTE_TRANSFER) + else + winners = list(VOTE_CONTINUE) + else + winners = vote_system == INSTANT_RUNOFF_VOTING ? get_runoff_results() : get_result() var/was_roundtype_vote = mode == "roundtype" || mode == "dynamic" if(winners.len > 0) if(was_roundtype_vote) @@ -305,7 +316,7 @@ SUBSYSTEM_DEF(vote) if(vote_system == SCHULZE_VOTING) admintext += "\nIt should be noted that this is not a raw tally of votes (impossible in ranked choice) but the score determined by the schulze method of voting, so the numbers will look weird!" else if(vote_system == HIGHEST_MEDIAN_VOTING) - admintext += "\nIt should be noted that this is not a raw tally of votes but the number of runoffs done by majority judgement!" + admintext += "\nIt should be noted that this is not a raw tally of votes but rather the median score plus a tiebreaker!" for(var/i=1,i<=choices.len,i++) var/votes = choices[choices[i]] admintext += "\n[choices[i]]: [votes]" @@ -339,7 +350,7 @@ SUBSYSTEM_DEF(vote) if(SSmapping.changemap(config.maplist[.])) to_chat(world, "The map vote has chosen [VM.map_name] for next round!") if("transfer") // austation begin -- Crew autotransfer vote - if(. == "Initiate Crew Transfer") + if(. == VOTE_TRANSFER) SSshuttle.autoEnd() var/obj/machinery/computer/communications/C = locate() in GLOB.machines if(C) @@ -446,7 +457,7 @@ SUBSYSTEM_DEF(vote) continue choices |= M if("transfer") // austation begin -- Crew autotranfer vote - choices.Add("Initiate Crew Transfer","Continue Playing") // austation end + choices.Add(VOTE_TRANSFER,VOTE_CONTINUE) // austation end if("roundtype") //CIT CHANGE - adds the roundstart secret/extended vote choices.Add("dynamic", "extended") if("custom")