mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Makes vote weight and preferred map actually work (#17880)
This commit is contained in:
@@ -42,12 +42,7 @@ SUBSYSTEM_DEF(vote)
|
||||
/datum/controller/subsystem/vote/proc/get_result()
|
||||
//get the highest number of votes
|
||||
var/greatest_votes = 0
|
||||
var/total_votes = 0
|
||||
for(var/option in choices)
|
||||
var/votes = choices[option]
|
||||
total_votes += votes
|
||||
if(votes > greatest_votes)
|
||||
greatest_votes = votes
|
||||
|
||||
//default-vote for everyone who didn't vote
|
||||
if(!CONFIG_GET(flag/default_no_vote) && choices.len)
|
||||
var/list/non_voters = GLOB.directory.Copy()
|
||||
@@ -70,19 +65,21 @@ SUBSYSTEM_DEF(vote)
|
||||
for (var/non_voter_ckey in non_voters)
|
||||
var/client/C = non_voters[non_voter_ckey]
|
||||
var/preferred_map = C.prefs.read_preference(/datum/preference/choiced/preferred_map)
|
||||
if(isnull(global.config.defaultmap))
|
||||
continue
|
||||
if(!preferred_map)
|
||||
if(global.config.defaultmap.map_name)
|
||||
preferred_map = global.config.defaultmap.map_name
|
||||
if(preferred_map)
|
||||
choices[preferred_map] += 1
|
||||
greatest_votes = max(greatest_votes, choices[preferred_map])
|
||||
|
||||
. = list()
|
||||
if(greatest_votes)
|
||||
for(var/option in choices)
|
||||
if(choices[option] == greatest_votes)
|
||||
. += option
|
||||
for(var/option in choices)
|
||||
var/weight = 1
|
||||
if(mode == "map")
|
||||
var/datum/map_config/VM = config.maplist[option]
|
||||
weight = VM.voteweight
|
||||
var/votes = choices[option] * weight
|
||||
if(votes == greatest_votes)
|
||||
. += option
|
||||
if(votes > greatest_votes)
|
||||
. = list(option)
|
||||
greatest_votes = votes
|
||||
return .
|
||||
|
||||
/datum/controller/subsystem/vote/proc/announce_result()
|
||||
|
||||
Reference in New Issue
Block a user