Files
Bubberstation/code/datums/votes/custom_vote.dm
SkyratBot 03854f9abe [MIRROR] Vote System: Approval Voting [MDB IGNORE] (#19666)
* Vote System: Approval Voting (#73749)

## About The Pull Request

Approval Voting is a system in which voters can select as many maps as
they want, instead of selecting only one. Final tallies show how many
votes each map received, and the winner is the map with the most
support.

## Changes since https://github.com/tgstation/tgstation/pull/73413
- Custom votes can now be started using either system
- Icon during AV votes indicating your selections
- Map population filter counts active players and participating ghosts

https://user-images.githubusercontent.com/83487515/222580901-61506cc3-dc42-4435-9775-1e6291a3f734.mp4

## Why It's Good For The Game

First-past-the-post (our current voting system) has flaws such as
creating a bunch of wasted votes, in that a large number of selections
ultimately have no impact and for example, a map can win a 3 way race
11/10/10, even though 2/3 of the votes were not for that map. This leads
to people having to vote strategically, and perhaps not what their true
choice is.

Approval Voting solves this by instead allowing the player to select all
the maps they would like to play, so they can vote for their true
preferred choice, as well as alternates.

For example, a player that wants Metastation, is okay with Icebox, and
doesn't want Delta may feel pressured to vote Icebox if it's in a 2 way
race with Delta.

AV lets them vote for Meta, and Icebox or as many others as they want as
their alternates and creates a more fair outcome of a map vote.

Map population filter removing AFK/lobby screen dwellers gives a better
number of active players so as to not trip the map filter's population
cap earlier than it should.

tl;dr: Less of this

![image](https://user-images.githubusercontent.com/83487515/222860681-210f2d7e-2368-4d42-84d5-6de838995e50.png)

## Changelog

🆑 LT3
rscadd: Added new multi-vote system
balance: Map votes are now calculated using multi-vote instead of the
old single-vote system
admin: Admins can now use either multi-vote or single-vote for custom
votes
code: Map choice filtering uses active player count, not all connected
clients
/🆑

* Vote System: Approval Voting

---------

Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
2023-03-04 17:49:21 -08:00

60 lines
1.7 KiB
Plaintext

/// The max amount of options someone can have in a custom vote.
#define MAX_CUSTOM_VOTE_OPTIONS 10
/datum/vote/custom_vote/single
name = "Custom Standard"
message = "Click here to start a custom vote (one selection per voter)"
/datum/vote/custom_vote/multi
name = "Custom Multi"
message = "Click here to start a custom multi vote (multiple selections per voter)"
count_method = VOTE_COUNT_METHOD_MULTI
// Custom votes ares always accessible.
/datum/vote/custom_vote/is_accessible_vote()
return TRUE
/datum/vote/custom_vote/reset()
default_choices = null
override_question = null
return ..()
/datum/vote/custom_vote/can_be_initiated(mob/by_who, forced = FALSE)
. = ..()
if(!.)
return FALSE
// Custom votes can only be created if they're forced to be made.
// (Either an admin makes it, or otherwise.)
return forced
/datum/vote/custom_vote/create_vote(mob/vote_creator)
override_question = tgui_input_text(vote_creator, "What is the vote for?", "Custom Vote")
if(!override_question)
return FALSE
default_choices = list()
for(var/i in 1 to MAX_CUSTOM_VOTE_OPTIONS)
var/option = tgui_input_text(vote_creator, "Please enter an option, or hit cancel to finish. [MAX_CUSTOM_VOTE_OPTIONS] max.", "Options", max_length = MAX_NAME_LEN)
if(!vote_creator?.client)
return FALSE
if(!option)
break
default_choices += capitalize(option)
if(!length(default_choices))
return FALSE
return ..()
/datum/vote/custom_vote/initiate_vote(initiator, duration)
. = ..()
. += "\n[override_question]"
// There are no winners or losers for custom votes
/datum/vote/custom_vote/get_winner_text(list/all_winners, real_winner, list/non_voters)
return "[span_bold("Did not vote:")] [length(non_voters)]"
#undef MAX_CUSTOM_VOTE_OPTIONS