mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 15:17:01 +01:00
Ranked Choice Voting (#4166)
## About The Pull Request Implements ranked choice voting for storyteller and map vote ## Why It's Good For The Game I can close the secret storyteller PR ## Changelog 🆑 LT3 qol: Ranked choice voting is now available for storyteller and map votes /🆑
This commit is contained in:
@@ -133,6 +133,10 @@
|
||||
return get_simple_winner()
|
||||
if(VOTE_WINNER_METHOD_WEIGHTED_RANDOM)
|
||||
return get_random_winner()
|
||||
// BUBBER EDIT ADDITION BEGIN - RANKED CHOICE VOTING
|
||||
if(VOTE_WINNER_METHOD_RANKED)
|
||||
return get_ranked_winner()
|
||||
// BUBBER EDIT ADDITION END
|
||||
|
||||
stack_trace("invalid select winner method: [winner_method]. Defaulting to simple.")
|
||||
return get_simple_winner()
|
||||
@@ -183,6 +187,10 @@
|
||||
returned_text += "None"
|
||||
if(VOTE_WINNER_METHOD_WEIGHTED_RANDOM)
|
||||
returned_text += "Weighted Random"
|
||||
// BUBBER EDIT ADDITION BEGIN - RANKED CHOICE VOTING
|
||||
if(VOTE_WINNER_METHOD_RANKED)
|
||||
returned_text += "Ranked"
|
||||
// BUBBER EDIT ADDITION END
|
||||
else
|
||||
returned_text += "Simple"
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
/datum/vote/custom_vote/create_vote(mob/vote_creator)
|
||||
var/custom_count_method = tgui_input_list(
|
||||
user = vote_creator,
|
||||
message = "Single or multiple choice?",
|
||||
message = "Single, multiple, or ranked choice?", // BUBBER EDIT CHANGE - Ranked Choice Voting - Original: "Single or multiple choice?"
|
||||
title = "Choice Method",
|
||||
items = list("Single", "Multiple"),
|
||||
items = list("Single", "Multiple", "Ranked"), // BUBBER EDIT CHANGE - Ranked Choice Voting - Original: ("Single", "Multiple")
|
||||
default = "Single",
|
||||
)
|
||||
switch(custom_count_method)
|
||||
@@ -39,6 +39,22 @@
|
||||
count_method = VOTE_COUNT_METHOD_SINGLE
|
||||
if("Multiple")
|
||||
count_method = VOTE_COUNT_METHOD_MULTI
|
||||
// BUBBER EDIT ADDITION BEGIN - Ranked Choice Voting
|
||||
if("Ranked")
|
||||
count_method = VOTE_COUNT_METHOD_RANKED
|
||||
// Ask for the threshold if it's ranked voting
|
||||
var/threshold = tgui_input_number(
|
||||
user = vote_creator,
|
||||
message = "Set the victory threshold percentage (1-100)",
|
||||
title = "Ranked Choice Threshold",
|
||||
default = 50,
|
||||
min_value = 1,
|
||||
max_value = 100
|
||||
)
|
||||
if(isnull(threshold))
|
||||
return FALSE
|
||||
ranked_winner_threshold = threshold
|
||||
// BUBBER EDIT ADDITION END
|
||||
if(null)
|
||||
return FALSE
|
||||
else
|
||||
@@ -50,7 +66,7 @@
|
||||
user = vote_creator,
|
||||
message = "How should the vote winner be determined?",
|
||||
title = "Winner Method",
|
||||
items = list("Simple", "Weighted Random", "No Winner"),
|
||||
items = list("Simple", "Weighted Random", "Ranked", "No Winner"), // BUBBER EDIT CHANGE - Ranked Choice Voting - Original: ("Simple", "Weighted Random", "No Winner")
|
||||
default = "Simple",
|
||||
)
|
||||
switch(custom_win_method)
|
||||
@@ -58,6 +74,10 @@
|
||||
winner_method = VOTE_WINNER_METHOD_SIMPLE
|
||||
if("Weighted Random")
|
||||
winner_method = VOTE_WINNER_METHOD_WEIGHTED_RANDOM
|
||||
// BUBBER EDIT ADDITION BEGIN - Ranked Choice Voting
|
||||
if("Ranked")
|
||||
winner_method = VOTE_WINNER_METHOD_RANKED
|
||||
// BUBBER EDIT ADDITION END
|
||||
if("No Winner")
|
||||
winner_method = VOTE_WINNER_METHOD_NONE
|
||||
if(null)
|
||||
|
||||
Reference in New Issue
Block a user