/tg/ Station 13 - Modules - TypesVar Details - Proc Details

Vote Singleton

A singleton datum that represents a type of vote for the voting subsystem.

Vars

choicesAn assoc list of [all choices] to [number of votes in the current running vote].
choices_by_ckeyA assoc list of [ckey] to [what they voted for in the current running vote].
contains_vote_in_nameDoes the name of this vote contain the word "vote"?
count_methodThe counting method we use for votes.
default_choicesA list of default choices we have for this vote.
display_statisticsShould we show details about the number of votes submitted for each option?
messageWhat message do we want to pass to the player-side vote panel as a tooltip?
nameThe name of the vote.
override_questionIf supplied, an override question will be displayed instead of the name of the vote.
started_timeThe world time this vote was started.
time_remainingThe time remaining in this vote's run.
vote_soundThe sound effect played to everyone when this vote is initiated.
winner_methodThe method for selecting a winner.

Procs

can_be_initiatedChecks if the passed mob can initiate this vote.
create_voteCalled prior to the vote being initiated.
finalize_voteCalled when a vote is actually all said and done. Apply actual vote effects here.
get_random_winnerGets the winner of the vote, selecting a random choice from all choices based on their vote count.
get_result_textGets the resulting text displayed when the vote is completed.
get_simple_winnerGets the winner of the vote, selecting the choice with the most votes.
get_vote_resultGets the result of the vote.
get_winner_textGets the text that displays the winning options within the result text.
initiate_voteCalled when this vote is actually initiated.
is_accessible_voteUsed to determine if this vote is a possible vote type for the vote subsystem.
is_config_enabledIf this vote has a config associated, returns its value (True or False, usually). If it has no config, returns -1.
resetResets our vote to its default state.
tiebreakerHow this vote handles a tiebreaker between multiple winners.
toggle_votableIf this vote has a config associated, toggles it between enabled and disabled. Returns TRUE on a successful toggle, FALSE otherwise

Var Details

choices

An assoc list of [all choices] to [number of votes in the current running vote].

choices_by_ckey

A assoc list of [ckey] to [what they voted for in the current running vote].

contains_vote_in_name

Does the name of this vote contain the word "vote"?

count_method

The counting method we use for votes.

default_choices

A list of default choices we have for this vote.

display_statistics

Should we show details about the number of votes submitted for each option?

message

What message do we want to pass to the player-side vote panel as a tooltip?

name

The name of the vote.

override_question

If supplied, an override question will be displayed instead of the name of the vote.

started_time

The world time this vote was started.

time_remaining

The time remaining in this vote's run.

vote_sound

The sound effect played to everyone when this vote is initiated.

winner_method

The method for selecting a winner.

Proc Details

can_be_initiated

Checks if the passed mob can initiate this vote.

Return TRUE if the mob can begin the vote, allowing anyone to actually vote on it. Return FALSE if the mob cannot initiate the vote.

create_vote

Called prior to the vote being initiated.

Return FALSE to prevent the vote from being initiated.

finalize_vote

Called when a vote is actually all said and done. Apply actual vote effects here.

get_random_winner

Gets the winner of the vote, selecting a random choice from all choices based on their vote count.

get_result_text

Gets the resulting text displayed when the vote is completed.

all_winners - list of all options that won. Can be multiple, in the event of ties. real_winner - the option that actually won. non_voters - a list of all ckeys who didn't vote in the vote.

Return a formatted string of text to be displayed to everyone.

get_simple_winner

Gets the winner of the vote, selecting the choice with the most votes.

get_vote_result

Gets the result of the vote.

non_voters - a list of all ckeys who didn't vote in the vote.

Returns a list of all options that won. If there were no votes at all, the list will be length = 0, non-null. If only one option one, the list will be length = 1. If there was a tie, the list will be length > 1.

get_winner_text

Gets the text that displays the winning options within the result text.

all_winners - list of all options that won. Can be multiple, in the event of ties. real_winner - the option that actually won. non_voters - a list of all ckeys who didn't vote in the vote.

Return a formatted string of text to be displayed to everyone.

initiate_vote

Called when this vote is actually initiated.

Return a string - the text displayed to the world when the vote is initiated.

is_accessible_vote

Used to determine if this vote is a possible vote type for the vote subsystem.

If FALSE is returned, this vote singleton will not be created when the vote subsystem initializes, meaning no one will be able to hold this vote.

is_config_enabled

If this vote has a config associated, returns its value (True or False, usually). If it has no config, returns -1.

reset

Resets our vote to its default state.

tiebreaker

How this vote handles a tiebreaker between multiple winners.

toggle_votable

If this vote has a config associated, toggles it between enabled and disabled. Returns TRUE on a successful toggle, FALSE otherwise