better way to do it tbh

This commit is contained in:
Putnam
2020-01-07 00:39:14 -08:00
parent da830d3449
commit 70a1a0a9c1
5 changed files with 32 additions and 10 deletions

View File

@@ -341,7 +341,7 @@
if(probabilities[M.config_tag]<=0)
qdel(M)
continue
if(M.config_tag in SSvote.stored_gamemode_votes && SSvote.stored_gamemode_votes[M.config_tag] < Get(/datum/config_entry/number/dropped_modes))
if(M.config_tag in SSvote.stored_modetier_results && SSvote.stored_modetier_results[M.config_tag] < Get(/datum/config_entry/number/dropped_modes))
qdel(M)
continue
if(min_pop[M.config_tag])

View File

@@ -393,5 +393,8 @@
/datum/config_entry/flag/allow_clockwork_marauder_on_station
config_entry_value = TRUE
/datum/config_entry/flag/modetier_voting
config_entry_value = TRUE
/datum/config_entry/number/dropped_modes
config_entry_value = 3

View File

@@ -221,6 +221,12 @@ SUBSYSTEM_DEF(ticker)
var/init_start = world.timeofday
//Create and announce mode
var/list/datum/game_mode/runnable_modes
if(SSvote.mode && (SSvote.mode == "roundtype" || SSvote.mode == "dynamic" || SSvote.mode == "modetiers"))
SSvote.result()
SSpersistence.SaveSavedVotes()
for(var/client/C in SSvote.voting)
C << browse(null, "window=vote;can_close=0")
SSvote.reset()
if(GLOB.master_mode == "random" || GLOB.master_mode == "secret")
runnable_modes = config.get_runnable_modes()
@@ -484,9 +490,10 @@ SUBSYSTEM_DEF(ticker)
SSticker.modevoted = TRUE
var/dynamic = CONFIG_GET(flag/dynamic_voting)
if(dynamic)
SSvote.initiate_vote("dynamic","server",hideresults=TRUE,votesystem=SCORE_VOTING,forced=TRUE,vote_time = 2 MINUTES)
SSvote.initiate_vote("dynamic","server",hideresults=TRUE,votesystem=SCORE_VOTING,forced=TRUE,vote_time = 20 MINUTES)
else
SSvote.initiate_vote("roundtype","server",hideresults=TRUE,votesystem=RANKED_CHOICE_VOTING,forced=TRUE, vote_time = 2 MINUTES)
SSvote.initiate_vote("roundtype","server",hideresults=TRUE,votesystem=PLURALITY_VOTING,forced=TRUE, \
vote_time = (CONFIG_GET(flag/modetier_voting) ? 1 MINUTES : 20 MINUTES))
/datum/controller/subsystem/ticker/Recover()
current_state = SSticker.current_state

View File

@@ -27,6 +27,8 @@ SUBSYSTEM_DEF(vote)
var/list/stored_gamemode_votes = list() //Basically the last voted gamemode is stored here for end-of-round use.
var/list/stored_modetier_results = list() // The aggregated tier list of the modes available in secret.
/datum/controller/subsystem/vote/fire() //called by master_controller
if(mode)
if(end_time < world.time)
@@ -34,7 +36,8 @@ SUBSYSTEM_DEF(vote)
SSpersistence.SaveSavedVotes()
for(var/client/C in voting)
C << browse(null, "window=vote;can_close=0")
reset()
if(end_time < world.time) // result() can change this
reset()
else if(next_pop < world.time)
var/datum/browser/client_popup
for(var/client/C in voting)
@@ -209,7 +212,6 @@ SUBSYSTEM_DEF(vote)
calculate_condorcet_votes(vote_title_text)
if(vote_system == SCORE_VOTING)
calculate_majority_judgement_vote(vote_title_text)
calculate_scores(vote_title_text)
var/list/winners = get_result()
var/was_roundtype_vote = mode == "roundtype" || mode == "dynamic"
if(winners.len > 0)
@@ -251,6 +253,8 @@ SUBSYSTEM_DEF(vote)
var/admintext = "Obfuscated results"
if(vote_system == RANKED_CHOICE_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 == SCORE_VOTING)
admintext += "\nIt should be noted that this is not a raw tally of votes but the number of runoffs done by majority judgement!"
for(var/i=1,i<=choices.len,i++)
var/votes = choices[choices[i]]
admintext += "\n<b>[choices[i]]:</b> [votes]"
@@ -265,14 +269,16 @@ SUBSYSTEM_DEF(vote)
if("roundtype") //CIT CHANGE - adds the roundstart extended/secret vote
if(SSticker.current_state > GAME_STATE_PREGAME)//Don't change the mode if the round already started.
return message_admins("A vote has tried to change the gamemode, but the game has already started. Aborting.")
if(choices["secret"] > choices["extended"])
. = "secret"
else
. = "extended"
GLOB.master_mode = .
SSticker.save_mode(.)
message_admins("The gamemode has been voted for, and has been changed to: [GLOB.master_mode]")
log_admin("Gamemode has been voted for and switched to: [GLOB.master_mode].")
if(CONFIG_GET(flag/modetier_voting))
reset()
started_time = 0
initiate_vote("mode tiers","server",hideresults=FALSE,votesystem=RANKED_CHOICE_VOTING,forced=TRUE, vote_time = 30 MINUTES)
to_chat(world,"<b>The vote will end right as the round starts.</b>")
return .
if("restart")
if(. == "Restart Round")
restart = 1
@@ -283,6 +289,8 @@ SUBSYSTEM_DEF(vote)
restart = 1
else
GLOB.master_mode = .
if("mode tiers")
stored_modetier_results = choices.Copy()
if("dynamic")
if(SSticker.current_state > GAME_STATE_PREGAME)//Don't change the mode if the round already started.
return message_admins("A vote has tried to change the gamemode, but the game has already started. Aborting.")
@@ -403,6 +411,7 @@ SUBSYSTEM_DEF(vote)
choices |= M
if("roundtype") //CIT CHANGE - adds the roundstart secret/extended vote
choices.Add("secret", "extended")
if("mode tiers")
var/list/modes_to_add = config.votable_modes
var/list/probabilities = CONFIG_GET(keyed_list/probability)
for(var/tag in modes_to_add)

View File

@@ -580,5 +580,8 @@ BOX_RANDOM_ENGINE Engine SM
BOX_RANDOM_ENGINE Engine Tesla
BOX_RANDOM_ENGINE Engine Singulo
## Number of modes dropped by the secret vote during mode selection, after vote.
## Whether or not there's a mode tier list vote after the secret/extended vote.
MODETIER_VOTING
## Number of modes dropped by the modetier vote during mode selection, after vote.
DROPPED_MODES 3