diff --git a/code/__DEFINES/vote.dm b/code/__DEFINES/vote.dm index b83ea7b8f6..12e802383e 100644 --- a/code/__DEFINES/vote.dm +++ b/code/__DEFINES/vote.dm @@ -6,3 +6,12 @@ #define INSTANT_RUNOFF_VOTING 5 GLOBAL_LIST_INIT(vote_score_options,list("Bad","Poor","Acceptable","Good","Great")) + +GLOBAL_LIST_INIT(vote_type_names,list(\ +"Plurality (default)" = PLURALITY_VOTING,\ +"Approval" = APPROVAL_VOTING,\ +"IRV (single winner ranked choice)" = INSTANT_RUNOFF_VOTING,\ +"Schulze (ranked choice, higher result=better)" = SCHULZE_VOTING,\ +"Raw Score (returns results from 0 to 1, winner is 1)" = SCORE_VOTING,\ +"Majority Judgement (single-winner score voting)" = MAJORITY_JUDGEMENT_VOTING,\ +)) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index c3ae90cc1b..2e5b8a1852 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -267,6 +267,9 @@ /datum/config_entry/flag/tgstyle_maprotation +/datum/config_entry/string/map_vote_type + config_entry_value = "SCORE" + /datum/config_entry/number/maprotatechancedelta config_entry_value = 0.75 min_val = 0 diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 95daaf5d70..971a9f837b 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -477,7 +477,18 @@ SUBSYSTEM_DEF(ticker) if(CONFIG_GET(flag/tgstyle_maprotation)) INVOKE_ASYNC(SSmapping, /datum/controller/subsystem/mapping/.proc/maprotate) else - SSvote.initiate_vote("map","server",TRUE) + var/vote_type = CONFIG_GET(string/map_vote_type) + switch(vote_type) + if("PLURALITY") + SSvote.initiate_vote("map","server",hideresults=TRUE) + if("APPROVAL") + SSvote.initiate_vote("map","server",hideresults=TRUE,votesystem = APPROVAL_VOTING) + if("IRV") + SSvote.initiate_vote("map","server",hideresults=TRUE,votesystem = INSTANT_RUNOFF_VOTING) + if("SCORE") + SSvote.initiate_vote("map","server",hideresults=TRUE,votesystem = MAJORITY_JUDGEMENT_VOTING) + // fallback + SSvote.initiate_vote("map","server",hideresults=TRUE,votesystem = MAJORITY_JUDGEMENT_VOTING) /datum/controller/subsystem/ticker/proc/HasRoundStarted() return current_state >= GAME_STATE_PLAYING diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index 2a7c4401f3..086167fc48 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -201,7 +201,10 @@ SUBSYSTEM_DEF(vote) max_score=max(max_score,scores[score_name]) min_score=min(min_score,scores[score_name]) for(var/score_name in scores) - scores[score_name] = (scores[score_name]-min_score)/(max_score-min_score) + if(max_score == min_score) + scores[score_name] = 1 + else + scores[score_name] = (scores[score_name]-min_score)/(max_score-min_score) SSblackbox.record_feedback("nested tally","voting",scores[score_name],list(blackbox_text,"Total scores",score_name)) /datum/controller/subsystem/vote/proc/get_runoff_results(var/blackbox_text) @@ -252,14 +255,13 @@ SUBSYSTEM_DEF(vote) text += "\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!" if(vote_system == MAJORITY_JUDGEMENT_VOTING) text += "\nIt should be noted that this is not a raw tally of votes but the number of runoffs done by majority judgement!" - else - for(var/i=1,i<=choices.len,i++) - var/votes = choices[choices[i]] - if(!votes) - votes = 0 - if(was_roundtype_vote) - stored_gamemode_votes[choices[i]] = votes - text += "\n[choices[i]]: [obfuscated ? "???" : votes]" //CIT CHANGE - adds obfuscated votes + for(var/i=1,i<=choices.len,i++) + var/votes = choices[choices[i]] + if(!votes) + votes = 0 + if(was_roundtype_vote) + stored_gamemode_votes[choices[i]] = votes + text += "\n[choices[i]]: [obfuscated ? "???" : votes]" //CIT CHANGE - adds obfuscated votes if(mode != "custom") if(winners.len > 1 && !obfuscated) //CIT CHANGE - adds obfuscated votes text = "\nVote Tied Between:" @@ -484,6 +486,8 @@ SUBSYSTEM_DEF(vote) question = stripped_input(usr,"What is the vote for?") if(!question) return 0 + var/system_string = input(usr,"Which voting type?",GLOB.vote_type_names[1]) in GLOB.vote_type_names + vote_system = GLOB.vote_type_names[system_string] for(var/i=1,i<=10,i++) var/option = capitalize(stripped_input(usr,"Please enter an option or hit cancel to finish")) if(!option || mode || !usr.client) diff --git a/config/config.txt b/config/config.txt index 6d302a5512..4d8dcfb00c 100644 --- a/config/config.txt +++ b/config/config.txt @@ -384,6 +384,15 @@ MAPROTATION ## When it's set to zero, the map will be randomly picked each round ALLOW_MAP_VOTING 1 +## Map voting type +## Determines what kind of vote the map vote is +## Options are: +## PLURALITY (default, only vote for one option) +## APPROVAL (can vote for as many as you want), I +## IRV (vote by ranked choice, winner determined by instant runoff algorithm) +## SCORE (give individual rankings of each choice, winner determined by majority judgement algorithm) +MAP_VOTE_TYPE SCORE + ## Map rotate chance delta ## This is the chance of map rotation factored to the round length. ## A value of 1 would mean the map rotation chance is the round length in minutes (hour long round == 60% rotation chance)