Vote Singleton
A singleton datum that represents a type of vote for the voting subsystem.
Vars | |
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. |
default_message | What message do we show as the tooltip of this vote if the vote can be initiated? |
display_statistics | Should we show details about the number of votes submitted for each option? |
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. |
Procs | |
can_be_initiated | Checks if the passed mob can initiate this vote. |
create_vote | Called prior to the vote 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. |
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. |
get_winner_text | Gets the text that displays the winning options within the result text. |
initiate_vote | Called when this vote is actually initiated. |
is_accessible_vote | Used to determine if this vote is a possible vote type for the vote subsystem. |
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. |
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.
default_message
What message do we show as the tooltip of this vote if the vote can be initiated?
display_statistics
Should we show details about the number of votes submitted for each option?
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.
- forced - if being invoked by someone who is an admin
Return VOTE_AVAILABLE if the mob can initiate the vote. Return a string with the reason why the mob can't 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.