Xonotic
vote.qh
Go to the documentation of this file.
1 #pragma once
2 
16 //string autocvar_sv_vote_only_commands;
23 
24 // definitions for command selection between progs
25 const float VC_ASGNMNT_BOTH = 1;
26 const float VC_ASGNMNT_CLIENTONLY = 2;
27 const float VC_ASGNMNT_SERVERONLY = 3;
28 
29 // vote selection definitions
30 const float VOTE_SELECT_ABSTAIN = -2;
31 const float VOTE_SELECT_REJECT = -1;
32 const float VOTE_SELECT_NULL = 0;
33 const float VOTE_SELECT_ACCEPT = 1;
34 
35 // different statuses of the current vote
36 const float VOTE_NULL = 0;
37 const float VOTE_NORMAL = 1;
38 const float VOTE_MASTER = 2;
39 
40 // global vote information declarations
41 entity vote_caller; // original caller of the current vote
42 string vote_caller_name; // name of the vote caller
43 float vote_called; // stores status of current vote (See VOTE_*)
44 float vote_endtime; // time when the vote is finished
45 float vote_accept_count; // total amount of players who accept the vote (counted by VoteCount() function)
46 float vote_reject_count; // same as above, but rejected
47 float vote_abstain_count; // same as above, but abstained
48 float vote_needed_overall; // total amount of players NEEDED for a vote to pass (based on sv_vote_majority_factor)
49 .float vote_master; // flag for if the player has vote master privelages
50 .float vote_waittime; // flag for how long the player must wait before they can vote again
51 .float vote_selection; // flag for which vote selection the player has made (See VOTE_SELECT_*)
52 string vote_called_command; // command sent by client
53 string vote_called_display; // visual string of command sent by client
54 string vote_parsed_command; // command which is fixed after being parsed
55 string vote_parsed_display; // visual string which is fixed after being parsed
56 
57 // allow functions to be used in other code like world.qc and teamplay.qc
58 void VoteThink();
59 void VoteReset();
60 void VoteCommand(int request, entity caller, int argc, string vote_command);
61 
62 // warmup and nagger stuff
63 const float RESTART_COUNTDOWN = 10;
65 float readycount; // amount of players who are ready
66 .float ready; // flag for if a player is ready
67 .float last_ready; // last ready time for anti-spam
68 .int team_saved; // team number to restore upon map reset
69 .void(entity this) reset; // if set, an entity is reset using this
70 .void(entity this) reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
71 void reset_map(float dorespawn, bool is_fake_round_start);
72 void ReadyCount();
73 void ReadyRestart_force(bool is_fake_round_start);
74 void VoteCount(float first_count);
75 void Nagger_Init();
76 
78 STATIC_INIT(g_saved_team) { g_saved_team = IL_NEW(); }
float autocvar_sv_vote_majority_factor_of_voted
Definition: vote.qh:8
bool autocvar_sv_vote_no_stops_vote
Definition: vote.qh:14
void VoteReset()
Definition: vote.qc:128
const float VC_ASGNMNT_CLIENTONLY
Definition: vote.qh:26
bool autocvar_sv_vote_change
Definition: vote.qh:4
void VoteCount(float first_count)
Definition: vote.qc:207
float ready
Definition: vote.qh:66
int autocvar_sv_vote_limit
Definition: vote.qh:6
void reset_map(float dorespawn, bool is_fake_round_start)
int team_saved
Definition: vote.qh:68
#define IL_NEW()
int autocvar_sv_vote_master_playerlimit
Definition: vote.qh:13
float autocvar_sv_vote_majority_factor
Definition: vote.qh:7
bool autocvar_sv_vote_master_callable
Definition: vote.qh:10
float autocvar_sv_vote_stop
Definition: vote.qh:19
entity() spawn
const float VOTE_MASTER
Definition: vote.qh:38
float readycount
Definition: vote.qh:65
void VoteCommand(int request, entity caller, int argc, string vote_command)
Definition: vote.qc:1264
bool autocvar_sv_vote_call
Definition: vote.qh:3
float vote_selection
Definition: vote.qh:51
float vote_called
Definition: vote.qh:43
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
const float VOTE_SELECT_NULL
Definition: vote.qh:32
string autocvar_sv_vote_commands
Definition: vote.qh:5
bool autocvar_sv_vote_master
Definition: vote.qh:9
bool autocvar_sv_vote_singlecount
Definition: vote.qh:18
float last_ready
Definition: vote.qh:67
const float VOTE_NULL
Definition: vote.qh:36
float vote_endtime
Definition: vote.qh:44
string autocvar_sv_vote_master_commands
Definition: vote.qh:11
float vote_accept_count
Definition: vote.qh:45
void ReadyRestart_force(bool is_fake_round_start)
Definition: vote.qc:426
string vote_parsed_display
Definition: vote.qh:55
const float VOTE_SELECT_REJECT
Definition: vote.qh:31
const float VOTE_NORMAL
Definition: vote.qh:37
float vote_needed_overall
Definition: vote.qh:48
string autocvar_sv_vote_master_password
Definition: vote.qh:12
int autocvar_sv_vote_nospectators
Definition: vote.qh:15
string vote_parsed_command
Definition: vote.qh:54
void ReadyCount()
Definition: vote.qc:498
string vote_called_display
Definition: vote.qh:53
bool autocvar_sv_vote_gamestart
Definition: vote.qh:22
entity nagger
Definition: vote.qh:64
float vote_waittime
Definition: vote.qh:50
float vote_reject_count
Definition: vote.qh:46
string vote_caller_name
Definition: vote.qh:42
bool autocvar_sv_vote_override_mostrecent
Definition: vote.qh:17
entity vote_caller
Definition: vote.qh:41
const float VOTE_SELECT_ACCEPT
Definition: vote.qh:33
void VoteThink()
Definition: vote.qc:324
float vote_abstain_count
Definition: vote.qh:47
IntrusiveList g_saved_team
Definition: vote.qh:77
const float VOTE_SELECT_ABSTAIN
Definition: vote.qh:30
STATIC_INIT(g_saved_team)
Definition: vote.qh:78
float autocvar_sv_vote_wait
Definition: vote.qh:21
string vote_called_command
Definition: vote.qh:52
float vote_master
Definition: vote.qh:49
const float RESTART_COUNTDOWN
Definition: vote.qh:63
const float VC_ASGNMNT_SERVERONLY
Definition: vote.qh:27
void Nagger_Init()
Definition: vote.qc:97
const float VC_ASGNMNT_BOTH
Definition: vote.qh:25
float autocvar_sv_vote_timeout
Definition: vote.qh:20