Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
vote.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void Nagger_Init ()
void ReadyCount ()
void ReadyRestart_force (bool is_fake_round_start)
void reset_map (bool is_fake_round_start)
 STATIC_INIT (g_saved_team)
string ValidateMap (string validated_map, entity caller)
 void (entity this) reset
void VoteCommand (int request, entity caller, int argc, string vote_command)
void VoteCount (float first_count)
void VoteReset (bool verbose)
void VoteThink ()

Variables

bool autocvar_sv_vote_call
bool autocvar_sv_vote_change
string autocvar_sv_vote_commands
bool autocvar_sv_vote_debug
bool autocvar_sv_vote_gamestart
int autocvar_sv_vote_limit
float autocvar_sv_vote_majority_factor
float autocvar_sv_vote_majority_factor_of_voted
bool autocvar_sv_vote_master
bool autocvar_sv_vote_master_callable
string autocvar_sv_vote_master_commands
string autocvar_sv_vote_master_ids
string autocvar_sv_vote_master_password
int autocvar_sv_vote_master_playerlimit
bool autocvar_sv_vote_no_stops_vote
int autocvar_sv_vote_nospectators
bool autocvar_sv_vote_override_mostrecent
bool autocvar_sv_vote_singlecount
float autocvar_sv_vote_stop
float autocvar_sv_vote_timeout
float autocvar_sv_vote_wait
IntrusiveList g_saved_team
entity nagger
bool ready
int readycount
const float RESTART_COUNTDOWN = 10
int team_saved
const float VC_ASGNMNT_BOTH = 1
const float VC_ASGNMNT_CLIENTONLY = 2
const float VC_ASGNMNT_SERVERONLY = 3
int vote_abstain_count
int vote_accept_count
int vote_called
string vote_called_command
string vote_called_display
entity vote_caller
string vote_caller_name
float vote_endtime
const float VOTE_MASTER = 2
bool vote_master
int vote_needed_overall
const float VOTE_NORMAL = 1
const float VOTE_NULL = 0
string vote_parsed_command
string vote_parsed_display
int vote_reject_count
const float VOTE_SELECT_ABSTAIN = -2
const float VOTE_SELECT_ACCEPT = 1
const float VOTE_SELECT_NULL = 0
const float VOTE_SELECT_REJECT = -1
int vote_selection
float vote_waittime

Function Documentation

◆ Nagger_Init()

void Nagger_Init ( )

Definition at line 97 of file vote.qc.

98{
100}
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:123
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67
bool Nagger_SendEntity(entity this, entity to, float sendflags)
Definition vote.qc:37
entity nagger
Definition vote.qh:67

References nagger, Nagger_SendEntity(), Net_LinkEntity(), and new_pure.

Referenced by spawnfunc().

◆ ReadyCount()

void ReadyCount ( )

Definition at line 553 of file vote.qc.

554{
555 // cannot reset the game while a timeout is active or pending
556 if (timeout_status) return;
557
558 int total_players = 0, human_players = 0, humans_ready = 0;
559 readycount = 0;
560
563 if (it.ready) ++readycount;
564 if (IS_REAL_CLIENT(it))
565 {
566 ++human_players;
567 if (it.ready) ++humans_ready;
568 }
569 });
570
572
573 // can't read warmup_stage here as it could have been set to 0 by ReadyRestart()
574 // and we need to use this when checking if we should abort the countdown
575 // map_minplayers can only be > 0 if g_warmup was -1 at worldspawn
576 int minplayers = autocvar_g_warmup > 1 ? autocvar_g_warmup : map_minplayers;
577
578 // This allows warmup to end with zero players to prevent complaints
579 // of server never changing map with legacy config (sv_autopause 0).
580 bool badteams = (teamplay && total_players && autocvar_sv_teamnagger)
582 : false;
583
584 if (total_players < minplayers || badteams)
585 {
586 if (game_starttime > time) // someone bailed during countdown, back to warmup
587 {
588 warmup_stage = autocvar_g_warmup; // CAN change it AFTER calling Nagger_ReadyCounted() this frame
590 if (total_players < minplayers)
591 Send_Notification(NOTIF_ALL, NULL, MSG_MULTI, COUNTDOWN_STOP_MINPLAYERS, minplayers);
592 else
593 Send_Notification(NOTIF_ALL, NULL, MSG_MULTI, COUNTDOWN_STOP_BADTEAMS);
594 if (!sv_ready_restart_after_countdown) // if we ran reset_map() at start of countdown
596 }
597 warmup_limit = -1;
598 return; // don't ReadyRestart if players are ready but too few or teams are bad
599 }
600 else if (warmup_limit <= 0
601 && game_starttime <= time) // No countdown in progress, check prevents early countdown end if only player leaves
602 {
603 // there's enough players now and teams are ok
604 // but we're still in infinite warmup and may need to switch to timed warmup
605 warmup_limit = cvar("g_warmup_limit");
606 if (warmup_limit == 0)
608 if (warmup_limit > 0)
610 // implicit else: g_warmup -1 && g_warmup_limit -1 means
611 // warmup continues until enough players AND enough RUPs (no time limit)
612 }
613
614 if (humans_ready && humans_ready >= rint(human_players * bound(0.5, cvar("g_warmup_majority_factor"), 1)))
615 ReadyRestart(true);
616}
bool warmup_stage
Definition main.qh:120
#define IS_PLAYER(s)
Definition player.qh:243
float warmup_limit
Definition stats.qh:375
int timeout_status
Definition stats.qh:87
#define autocvar_timelimit
Definition stats.qh:92
float game_starttime
Definition stats.qh:82
float time
int map_minplayers
Definition mapinfo.qh:190
float bound(float min, float value, float max)
float cvar(string name)
float rint(float f)
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1573
#define NULL
Definition post.qh:14
void GiveWarmupResources(entity this)
Definition client.qc:568
bool autocvar_sv_teamnagger
Definition client.qh:58
void ReadyRestart(bool forceWarmupEnd)
Definition vote.qc:526
void Nagger_ReadyCounted()
Definition vote.qc:112
int readycount
Definition vote.qh:68
#define INGAME_JOINED(it)
Definition sv_rules.qh:25
int total_players
Definition sv_rules.qh:12
int TeamBalance_SizeDifference(entity ignore)
Returns the size difference between the largest and smallest team (bots included).
Definition teamplay.qc:633
bool teamplay
Definition teams.qh:59
#define IS_REAL_CLIENT(v)
Definition utils.qh:17
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50
int autocvar_g_warmup
Definition world.qh:9
bool sv_ready_restart_after_countdown
Definition world.qh:116

References autocvar_g_warmup, autocvar_sv_teamnagger, autocvar_timelimit, bound(), cvar(), FOREACH_CLIENT, game_starttime, GiveWarmupResources(), INGAME_JOINED, IS_PLAYER, IS_REAL_CLIENT, map_minplayers, Nagger_ReadyCounted(), NULL, readycount, ReadyRestart(), rint(), Send_Notification(), sv_ready_restart_after_countdown, TeamBalance_SizeDifference(), teamplay, time, timeout_status, total_players, warmup_limit, and warmup_stage.

Referenced by bot_think(), ClientCommand_ready(), ClientDisconnect(), PutObserverInServer(), PutPlayerInServer(), SetPlayerTeam(), and timeout_handler_reset().

◆ ReadyRestart_force()

void ReadyRestart_force ( bool is_fake_round_start)

Definition at line 441 of file vote.qc.

442{
444 return;
445 if (!is_fake_round_start && !autocvar_g_campaign)
446 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_COUNTDOWN_RESTART);
447
448 VoteReset(true);
449
450 // clear overtime, we have to decrease timelimit to its original value again.
454
455 if(warmup_stage)
456 game_starttime = time; // Warmup: No countdown in warmup
457 else if (autocvar_g_campaign)
458 game_starttime = time + 3;
459 else
460 game_starttime = time + RESTART_COUNTDOWN; // Go into match mode
461
462 // clear player attributes
464 it.alivetime_start = 0;
465 CS(it).killcount = 0;
466 });
467
468 // if we're ending the warmup stage call the corresponding hook
469 if(!is_fake_round_start && !warmup_stage)
470 localcmd("\nsv_hook_warmupend\n");
471
472 // reset the .ready status of all clients (including spectators and bots)
473 FOREACH_CLIENT(true, { it.ready = false; });
474 readycount = 0;
475 Nagger_ReadyCounted(); // NOTE: this causes a resend of that entity, and will also turn off warmup state on the client
476
477 // lock teams with lockonrestart
480
481 // initiate the restart-countdown-announcer entity
482 if (!is_fake_round_start && sv_ready_restart_after_countdown && !warmup_stage)
483 {
484 entity restart_timer = new_pure(restart_timer);
485 setthink(restart_timer, ReadyRestart_think);
486 restart_timer.nextthink = game_starttime;
487 }
488
489 // If we're returning to warmup join/switch all queued players for consistency:
490 // there's no queueing in warmup and imbalances are handled by sv_teamnagger blocking end of warmup.
491 if (warmup_stage)
492 {
493 // First pass: join player(s) queued for specific team(s)
494 FOREACH_CLIENT(it.wants_join > 0, Join(it, false));
495 // Second pass: join player(s) queued for team autoselection
496 FOREACH_CLIENT(it.wants_join < 0, Join(it, false));
497 }
498
499 // after a restart every players number of allowed timeouts gets reset, too
501 {
502 FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { CS(it).allowed_timeouts = autocvar_sv_timeout_number; });
503 }
504
506 {
508 {
509 if (it.vote_master)
510 ClientData_Touch(it.enemy, true);
511 else
512 {
513 Send_Notification(NOTIF_ONE_ONLY, it, MSG_MULTI, SPECTATE_SPEC_NOTALLOWED);
514 TRANSMUTE(Observer, it);
516 }
517 });
518 }
519
521 reset_map(is_fake_round_start);
522
523 if (autocvar_sv_eventlog) GameLogEcho(":restart");
524}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float game_stopped
Definition stats.qh:81
int overtimes
Definition stats.qh:86
void GameLogEcho(string s)
Definition gamelog.qc:15
bool autocvar_sv_eventlog
Definition gamelog.qh:3
#define PutClientInServer
Definition _all.inc:246
bool autocvar_g_campaign
Definition menu.qc:747
void localcmd(string command,...)
void cvar_set(string name, string value)
string ftos(float f)
#define TRANSMUTE(cname, this,...)
Definition oo.qh:136
#define setthink(e, f)
void Join(entity this, bool queued_join)
it's assumed this isn't called for bots (campaign_bots_may_start, centreprints)
Definition client.qc:2068
void ClientData_Touch(entity e, bool to_spectators_too)
Definition client.qc:185
bool autocvar_sv_spectate
Definition client.qh:57
bool autocvar_sv_timeout
Definition common.qh:5
int autocvar_sv_timeout_number
Definition common.qh:8
void reset_map(bool is_fake_round_start)
Definition vote.qc:351
void VoteReset(bool verbose)
Definition vote.qc:129
void ReadyRestart_think(entity this)
Definition vote.qc:433
const float RESTART_COUNTDOWN
Definition vote.qh:66
int g_race_qualifying
Definition race.qh:13
ClientState CS(Client this)
Definition state.qh:47
bool autocvar_teamplay_lockonrestart
Definition teamplay.qh:5
bool lockteams
Definition teamplay.qh:15
#define IS_SPEC(v)
Definition utils.qh:10
float checkrules_suddendeathwarning
Definition world.qh:36
int checkrules_overtimesadded
Definition world.qh:38
float checkrules_suddendeathend
Definition world.qh:37
float autocvar_timelimit_overtime
Definition world.qh:28

References autocvar_g_campaign, autocvar_sv_eventlog, autocvar_sv_spectate, autocvar_sv_timeout, autocvar_sv_timeout_number, autocvar_teamplay_lockonrestart, autocvar_timelimit, autocvar_timelimit_overtime, checkrules_overtimesadded, checkrules_suddendeathend, checkrules_suddendeathwarning, ClientData_Touch(), CS(), cvar_set(), entity(), FOREACH_CLIENT, ftos(), g_race_qualifying, game_starttime, game_stopped, GameLogEcho(), IS_PLAYER, IS_REAL_CLIENT, IS_SPEC, Join(), localcmd(), lockteams, Nagger_ReadyCounted(), new_pure, NULL, overtimes, PutClientInServer, readycount, ReadyRestart_think(), reset_map(), RESTART_COUNTDOWN, Send_Notification(), setthink, sv_ready_restart_after_countdown, teamplay, time, TRANSMUTE, VoteReset(), and warmup_stage.

Referenced by assault_new_round(), and ReadyRestart().

◆ reset_map()

void reset_map ( bool is_fake_round_start)

Definition at line 351 of file vote.qc.

352{
353 if (time <= game_starttime)
354 {
355 if (game_stopped)
356 return;
357
358 if (!is_fake_round_start)
359 {
362 }
363
366 }
367
369 {
370 shuffleteams();
372 }
373
374 FOREACH_CLIENT(true, {
375 if (time <= game_starttime)
376 accuracy_reset(it); // for spectators too because weapon accuracy is persistent
377 if (!IS_PLAYER(it))
378 continue;
380 entity store = PS(it);
381 if (store)
382 {
383 Inventory_clear(store.inventory);
384 Inventory_update(store);
385 }
386 });
387
388 MUTATOR_CALLHOOK(reset_map_global);
389
391 {
392 if(IS_CLIENT(it))
393 continue;
394 if (it.reset)
395 {
396 it.reset(it);
397 continue;
398 }
399 if (it.team_saved) it.team = it.team_saved;
400 if (it.flags & FL_PROJECTILE) delete(it); // remove any projectiles left
401 });
402
403 // Waypoints and assault start come LAST
405 if (it.reset2) it.reset2(it);
406 });
407
408 // Moving the player reset code here since the player-reset depends
409 // on spawnpoint entities which have to be reset first --blub
410 if (!MUTATOR_CALLHOOK(reset_map_players))
411 {
413 {
414 // PlayerScore_Clear(it);
415 CS(it).killcount = 0;
416 // stop the player from moving so that they stand still once they get respawned
417 it.velocity = '0 0 0';
418 it.avelocity = '0 0 0';
419 CS(it).movement = '0 0 0';
421
422 if(IS_BOT_CLIENT(it))
423 {
424 .entity weaponentity = weaponentities[0];
425 if(it.(weaponentity).m_weapon == WEP_Null)
426 W_NextWeapon(it, 0, weaponentity);
427 }
428 });
429 }
430}
void accuracy_reset(entity e)
Definition accuracy.qc:63
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
#define IS_NOT_A_CLIENT(s)
Definition player.qh:244
#define IS_CLIENT(s)
Definition player.qh:242
const int FL_PROJECTILE
Definition constants.qh:85
void Inventory_update(entity e)
Definition inventory.qh:159
void Inventory_clear(entity store)
Definition inventory.qh:169
#define FOREACH_ENTITY_ORDERED(cond, body)
Definition iter.qh:138
#define FOREACH_ENTITY_FLOAT_ORDERED(fld, match, body)
Definition iter.qh:175
bool pure_data
Definition oo.qh:9
void PlayerStats_GameReport_Reset_All()
void round_handler_Reset(float next_think)
#define round_handler_IsActive()
void Score_ClearAll()
Clear ALL scores (for ready-restart).
Definition scores.qc:306
void W_NextWeapon(entity this, int list,.entity weaponentity)
Definition selection.qc:322
void player_powerups_remove_all(entity this, bool allow_poweroff_sound)
Definition client.qc:1535
#define PS(this)
Definition state.qh:18
void shuffleteams()
Definition sv_cmd.qc:1339
bool shuffleteams_on_reset_map
Definition sv_cmd.qh:7
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
Definition utils.qh:15
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17

References accuracy_reset(), CS(), entity(), FL_PROJECTILE, FOREACH_CLIENT, FOREACH_ENTITY_FLOAT_ORDERED, FOREACH_ENTITY_ORDERED, game_starttime, game_stopped, Inventory_clear(), Inventory_update(), IS_BOT_CLIENT, IS_CLIENT, IS_NOT_A_CLIENT, IS_PLAYER, MUTATOR_CALLHOOK, player_powerups_remove_all(), PlayerStats_GameReport_Reset_All(), PS, pure_data, PutClientInServer, round_handler_IsActive, round_handler_Reset(), Score_ClearAll(), shuffleteams(), shuffleteams_on_reset_map, time, W_NextWeapon(), and weaponentities.

Referenced by ReadyRestart_force(), ReadyRestart_think(), and round_handler_Think().

◆ STATIC_INIT()

STATIC_INIT ( g_saved_team )

Definition at line 80 of file vote.qh.

80{ g_saved_team = IL_NEW(); }
#define IL_NEW()
IntrusiveList g_saved_team
Definition vote.qh:79

References g_saved_team, and IL_NEW.

◆ ValidateMap()

string ValidateMap ( string validated_map,
entity caller )

Definition at line 672 of file vote.qc.

673{
674 validated_map = MapInfo_FixName(validated_map);
675
676 if (!validated_map)
677 {
678 print_to(caller, "This map is not available on this server.");
679 return string_null;
680 }
681
683 {
684 if (Map_IsRecent(validated_map))
685 {
686 print_to(caller, "This server does not allow for recent maps to be played again. Please be patient for some rounds.");
687 return string_null;
688 }
689 }
690
691 if (!MapInfo_CheckMap(validated_map))
692 {
693 print_to(caller, strcat("^1Invalid mapname, \"^3", validated_map, "^1\" does not support the current gametype."));
694 return string_null;
695 }
696
697 return validated_map;
698}
bool Map_IsRecent(string m)
float MapInfo_CheckMap(string s)
Definition mapinfo.qc:1510
string MapInfo_FixName(string s)
Definition mapinfo.qc:1474
string string_null
Definition nil.qh:9
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void print_to(entity to, string input)
Definition common.qc:171
bool autocvar_sv_vote_override_mostrecent
Definition vote.qh:20

References autocvar_sv_vote_override_mostrecent, entity(), Map_IsRecent(), MapInfo_CheckMap(), MapInfo_FixName(), print_to(), strcat(), and string_null.

Referenced by GameCommand_nextmap(), and VoteCommand_parse().

◆ void()

void ( entity this)

References entity().

◆ VoteCommand()

void VoteCommand ( int request,
entity caller,
int argc,
string vote_command )

Definition at line 1431 of file vote.qc.

1432{
1433 // Guide for working with argc arguments by example:
1434 // argc: 1 - 2 - 3 - 4
1435 // argv: 0 - 1 - 2 - 3
1436 // cmd vote - master - login - password
1437
1438 switch (request)
1439 {
1441 {
1442 if (VoteCommand_macro_command(caller, argc, vote_command)) return;
1443 }
1444
1445 default:
1446 print_to(caller, strcat(((argv(1) != "") ? strcat("Unknown vote command \"", argv(1), "\"") : "No command provided"), ". For a list of supported commands, try ", GetCommandPrefix(caller), " vote help.\n"));
1447 case CMD_REQUEST_USAGE:
1448 {
1449 VoteCommand_macro_help(caller, argc);
1450 return;
1451 }
1452 }
1453}
const int CMD_REQUEST_COMMAND
Definition command.qh:3
const int CMD_REQUEST_USAGE
Definition command.qh:4
string argv(float n)
string GetCommandPrefix(entity caller)
Definition common.qc:26
float VoteCommand_macro_command(entity caller, int argc, string vote_command)
Definition vote.qc:1415
void VoteCommand_macro_help(entity caller, int argc)
Definition vote.qc:1382

References argv(), CMD_REQUEST_COMMAND, CMD_REQUEST_USAGE, entity(), GetCommandPrefix(), print_to(), strcat(), VoteCommand_macro_command(), and VoteCommand_macro_help().

Referenced by COMMON_COMMAND().

◆ VoteCount()

void VoteCount ( float first_count)

Definition at line 220 of file vote.qc.

221{
223
224 float vote_player_count = 0, notvoters = 0;
225 float vote_real_player_count = 0, vote_real_accept_count = 0;
226 float vote_real_reject_count = 0, vote_real_abstain_count = 0;
227 float vote_needed_of_voted, final_needed_votes;
228 float vote_factor_overall, vote_factor_of_voted;
229
231
232 // add up all the votes from each connected client
234 ++vote_player_count;
235 if (IS_PLAYER(it) || INGAME(it)) ++vote_real_player_count;
236 switch (it.vote_selection)
237 {
240 if (IS_PLAYER(it) || INGAME(it)) ++vote_real_reject_count;
241 break;
244 if (IS_PLAYER(it) || INGAME(it)) ++vote_real_accept_count;
245 break;
248 if (IS_PLAYER(it) || INGAME(it)) ++vote_real_abstain_count;
249 break;
250 default: break;
251 }
252 });
253
254 // Check to see if there are enough players on the server to allow master voting... otherwise, vote master could be used for evil.
255 if ((vote_called == VOTE_MASTER) && autocvar_sv_vote_master_playerlimit > vote_player_count)
256 {
257 if (vote_caller) vote_caller.vote_waittime = 0;
258 print_to(vote_caller, "^1There are not enough players on this server to allow you to become vote master.");
259 VoteReset(false);
260 return;
261 }
262
263 // if spectators aren't allowed to vote and there are players in a match, then only count the players in the vote and ignore spectators.
264 if (!spectators_allowed && (vote_real_player_count > 0))
265 {
266 vote_accept_count = vote_real_accept_count;
267 vote_reject_count = vote_real_reject_count;
268 vote_abstain_count = vote_real_abstain_count;
269 vote_player_count = vote_real_player_count;
270 }
271
272 // people who have no opinion in any way :D
273 notvoters = (vote_player_count - vote_accept_count - vote_reject_count - vote_abstain_count);
274
275 // determine the goal for the vote to be passed or rejected normally
276 vote_factor_overall = bound(0.5, autocvar_sv_vote_majority_factor, 0.999);
277 vote_needed_overall = floor((vote_player_count - vote_abstain_count) * vote_factor_overall) + 1;
278
279 // if the vote times out, determine the amount of votes needed of the people who actually already voted
280 vote_factor_of_voted = bound(0.5, autocvar_sv_vote_majority_factor_of_voted, 0.999);
281 vote_needed_of_voted = floor((vote_accept_count + vote_reject_count) * vote_factor_of_voted) + 1;
282
283 // are there any players at all on the server? it could be an admin vote
284 if (vote_player_count == 0 && first_count)
285 {
286 VoteSpam(0, -1, "yes"); // no players at all, just accept it
287 VoteAccept();
288 return;
289 }
290
291 // since there ARE players, finally calculate the result of the vote
293 {
294 VoteSpam(notvoters, -1, "yes"); // there is enough acceptions to pass the vote
295 VoteAccept();
296 return;
297 }
298
299 if (vote_reject_count > vote_player_count - vote_abstain_count - vote_needed_overall)
300 {
301 VoteSpam(notvoters, -1, "no"); // there is enough rejections to deny the vote
302 VoteReject();
303 return;
304 }
305
306 // there is not enough votes in either direction, now lets just calculate what the voters have said
307 if (time > vote_endtime)
308 {
309 final_needed_votes = vote_needed_overall;
310
312 {
313 if (vote_accept_count >= vote_needed_of_voted)
314 {
315 VoteSpam(notvoters, min(vote_needed_overall, vote_needed_of_voted), "yes");
316 VoteAccept();
317 return;
318 }
319
321 {
322 VoteSpam(notvoters, min(vote_needed_overall, vote_needed_of_voted), "no");
323 VoteReject();
324 return;
325 }
326
327 final_needed_votes = min(vote_needed_overall, vote_needed_of_voted);
328 }
329
330 // it didn't pass or fail, so not enough votes to even make a decision.
331 VoteSpam(notvoters, final_needed_votes, "timeout");
332 VoteTimeout();
333 }
334}
float min(float f,...)
float floor(float f)
#define spectators_allowed
Definition vote.qc:218
void VoteReject()
Definition vote.qc:184
void Nagger_VoteCountChanged()
Definition vote.qc:107
void VoteTimeout()
Definition vote.qc:191
void VoteSpam(float notvoters, float mincount, string result)
Definition vote.qc:198
void VoteAccept()
Definition vote.qc:171
int vote_needed_overall
Definition vote.qh:50
float vote_endtime
Definition vote.qh:46
const float VOTE_MASTER
Definition vote.qh:40
const float VOTE_SELECT_REJECT
Definition vote.qh:33
int vote_accept_count
Definition vote.qh:47
float autocvar_sv_vote_majority_factor_of_voted
Definition vote.qh:10
bool autocvar_sv_vote_debug
Definition vote.qh:6
entity vote_caller
Definition vote.qh:43
const float VOTE_SELECT_ACCEPT
Definition vote.qh:35
int autocvar_sv_vote_master_playerlimit
Definition vote.qh:16
const float VOTE_SELECT_ABSTAIN
Definition vote.qh:32
int vote_called
Definition vote.qh:45
int vote_reject_count
Definition vote.qh:48
int vote_abstain_count
Definition vote.qh:49
float autocvar_sv_vote_majority_factor
Definition vote.qh:9
#define INGAME(it)
Definition sv_rules.qh:24

References autocvar_sv_vote_debug, autocvar_sv_vote_majority_factor, autocvar_sv_vote_majority_factor_of_voted, autocvar_sv_vote_master_playerlimit, bound(), floor(), FOREACH_CLIENT, INGAME, IS_PLAYER, IS_REAL_CLIENT, min(), Nagger_VoteCountChanged(), print_to(), spectators_allowed, time, vote_abstain_count, vote_accept_count, vote_called, vote_caller, vote_endtime, VOTE_MASTER, vote_needed_overall, vote_reject_count, VOTE_SELECT_ABSTAIN, VOTE_SELECT_ACCEPT, VOTE_SELECT_REJECT, VoteAccept(), VoteReject(), VoteReset(), VoteSpam(), and VoteTimeout().

Referenced by ClientDisconnect(), PutObserverInServer(), VoteCommand_abstain(), VoteCommand_call(), VoteCommand_master(), VoteCommand_no(), VoteCommand_yes(), and VoteThink().

◆ VoteReset()

void VoteReset ( bool verbose)

Definition at line 129 of file vote.qc.

130{
131 if (verbose && vote_called)
132 {
133 VoteStop(NULL, true);
134 return;
135 }
136
137 FOREACH_CLIENT(true, { it.vote_selection = 0; });
138
139 if (vote_called)
140 {
144 }
145
148 vote_endtime = 0;
149
152
154}
void Nagger_VoteChanged()
Definition vote.qc:102
void VoteStop(entity stopper, bool show_name)
Definition vote.qc:156
string vote_caller_name
Definition vote.qh:44
string vote_called_command
Definition vote.qh:54
string vote_parsed_display
Definition vote.qh:57
const float VOTE_NULL
Definition vote.qh:38
string vote_parsed_command
Definition vote.qh:56
string vote_called_display
Definition vote.qh:55
#define strfree(this)
Definition string.qh:59

References FOREACH_CLIENT, Nagger_VoteChanged(), NULL, strfree, string_null, vote_called, vote_called_command, vote_called_display, vote_caller, vote_caller_name, vote_endtime, VOTE_NULL, vote_parsed_command, vote_parsed_display, and VoteStop().

Referenced by InitGameplayMode(), NextLevel(), ReadyRestart_force(), VoteAccept(), VoteCount(), VoteReject(), VoteStop(), and VoteTimeout().

◆ VoteThink()

void VoteThink ( )

Definition at line 336 of file vote.qc.

337{
338 if (vote_endtime > 0) // a vote was called
339 {
340 if (time > vote_endtime) // time is up
341 VoteCount(false);
342 }
343}
void VoteCount(float first_count)
Definition vote.qc:220

References time, vote_endtime, and VoteCount().

Referenced by CheckRules_World().

Variable Documentation

◆ autocvar_sv_vote_call

bool autocvar_sv_vote_call

Definition at line 3 of file vote.qh.

Referenced by VoteCommand_call().

◆ autocvar_sv_vote_change

bool autocvar_sv_vote_change

Definition at line 4 of file vote.qh.

Referenced by VoteCommand_abstain(), VoteCommand_no(), and VoteCommand_yes().

◆ autocvar_sv_vote_commands

string autocvar_sv_vote_commands

Definition at line 5 of file vote.qh.

Referenced by print_available_commands_to(), VoteCommand_call(), and VoteCommand_master().

◆ autocvar_sv_vote_debug

bool autocvar_sv_vote_debug

Definition at line 6 of file vote.qh.

Referenced by VoteCommand_call(), and VoteCount().

◆ autocvar_sv_vote_gamestart

bool autocvar_sv_vote_gamestart

Definition at line 7 of file vote.qh.

Referenced by VoteCommand_call().

◆ autocvar_sv_vote_limit

int autocvar_sv_vote_limit

Definition at line 8 of file vote.qh.

Referenced by VoteCommand_parse().

◆ autocvar_sv_vote_majority_factor

float autocvar_sv_vote_majority_factor

Definition at line 9 of file vote.qh.

Referenced by VoteCount().

◆ autocvar_sv_vote_majority_factor_of_voted

float autocvar_sv_vote_majority_factor_of_voted

Definition at line 10 of file vote.qh.

Referenced by VoteCount().

◆ autocvar_sv_vote_master

bool autocvar_sv_vote_master

Definition at line 11 of file vote.qh.

Referenced by VoteCommand_master().

◆ autocvar_sv_vote_master_callable

bool autocvar_sv_vote_master_callable

Definition at line 12 of file vote.qh.

Referenced by VoteCommand_master().

◆ autocvar_sv_vote_master_commands

string autocvar_sv_vote_master_commands

Definition at line 13 of file vote.qh.

Referenced by VoteCommand_master().

◆ autocvar_sv_vote_master_ids

string autocvar_sv_vote_master_ids

Definition at line 14 of file vote.qh.

Referenced by ClientConnect().

◆ autocvar_sv_vote_master_password

string autocvar_sv_vote_master_password

Definition at line 15 of file vote.qh.

Referenced by VoteCommand_master().

◆ autocvar_sv_vote_master_playerlimit

int autocvar_sv_vote_master_playerlimit

Definition at line 16 of file vote.qh.

Referenced by VoteCount().

◆ autocvar_sv_vote_no_stops_vote

bool autocvar_sv_vote_no_stops_vote

Definition at line 17 of file vote.qh.

Referenced by VoteCommand_no().

◆ autocvar_sv_vote_nospectators

int autocvar_sv_vote_nospectators

Definition at line 18 of file vote.qh.

◆ autocvar_sv_vote_override_mostrecent

bool autocvar_sv_vote_override_mostrecent

Definition at line 20 of file vote.qh.

Referenced by ValidateMap().

◆ autocvar_sv_vote_singlecount

bool autocvar_sv_vote_singlecount

Definition at line 21 of file vote.qh.

Referenced by VoteCommand_abstain(), VoteCommand_no(), and VoteCommand_yes().

◆ autocvar_sv_vote_stop

float autocvar_sv_vote_stop

Definition at line 22 of file vote.qh.

Referenced by VoteStop().

◆ autocvar_sv_vote_timeout

float autocvar_sv_vote_timeout

Definition at line 23 of file vote.qh.

Referenced by VoteCommand_call(), and VoteCommand_master().

◆ autocvar_sv_vote_wait

float autocvar_sv_vote_wait

Definition at line 24 of file vote.qh.

Referenced by VoteCommand_call(), and VoteCommand_master().

◆ g_saved_team

◆ nagger

entity nagger

◆ ready

bool ready

Definition at line 69 of file vote.qh.

◆ readycount

int readycount

Definition at line 68 of file vote.qh.

Referenced by Nagger_SendEntity(), ReadyCount(), and ReadyRestart_force().

◆ RESTART_COUNTDOWN

const float RESTART_COUNTDOWN = 10

Definition at line 66 of file vote.qh.

Referenced by ReadyRestart_force().

◆ team_saved

◆ VC_ASGNMNT_BOTH

const float VC_ASGNMNT_BOTH = 1

Definition at line 27 of file vote.qh.

Referenced by Votecommand_check_assignment().

◆ VC_ASGNMNT_CLIENTONLY

const float VC_ASGNMNT_CLIENTONLY = 2

Definition at line 28 of file vote.qh.

Referenced by Votecommand_check_assignment().

◆ VC_ASGNMNT_SERVERONLY

const float VC_ASGNMNT_SERVERONLY = 3

Definition at line 29 of file vote.qh.

Referenced by Votecommand_check_assignment().

◆ vote_abstain_count

int vote_abstain_count

Definition at line 49 of file vote.qh.

Referenced by VoteCount(), and VoteSpam().

◆ vote_accept_count

int vote_accept_count

Definition at line 47 of file vote.qh.

Referenced by Nagger_SendEntity(), VoteCount(), and VoteSpam().

◆ vote_called

◆ vote_called_command

string vote_called_command

Definition at line 54 of file vote.qh.

Referenced by VoteAccept(), VoteCommand_call(), VoteCommand_master(), and VoteReset().

◆ vote_called_display

◆ vote_caller

◆ vote_caller_name

string vote_caller_name

Definition at line 44 of file vote.qh.

Referenced by OriginalCallerName(), VoteCommand_call(), VoteCommand_master(), and VoteReset().

◆ vote_endtime

float vote_endtime

Definition at line 46 of file vote.qh.

Referenced by VoteCommand_call(), VoteCommand_master(), VoteCount(), VoteReset(), and VoteThink().

◆ VOTE_MASTER

const float VOTE_MASTER = 2

Definition at line 40 of file vote.qh.

Referenced by VoteAccept(), VoteCommand_master(), and VoteCount().

◆ vote_master

bool vote_master

Definition at line 51 of file vote.qh.

Referenced by ClientConnect(), and ObserverOrSpectatorThink().

◆ vote_needed_overall

int vote_needed_overall

Definition at line 50 of file vote.qh.

Referenced by Nagger_SendEntity(), and VoteCount().

◆ VOTE_NORMAL

const float VOTE_NORMAL = 1

Definition at line 39 of file vote.qh.

Referenced by VoteCommand_call().

◆ VOTE_NULL

const float VOTE_NULL = 0

Definition at line 38 of file vote.qh.

Referenced by VoteCommand_call(), and VoteReset().

◆ vote_parsed_command

string vote_parsed_command

Definition at line 56 of file vote.qh.

Referenced by VoteCommand_call(), VoteCommand_master(), VoteCommand_parse(), and VoteReset().

◆ vote_parsed_display

string vote_parsed_display

Definition at line 57 of file vote.qh.

Referenced by VoteCommand_call(), VoteCommand_master(), VoteCommand_parse(), and VoteReset().

◆ vote_reject_count

int vote_reject_count

Definition at line 48 of file vote.qh.

Referenced by Nagger_SendEntity(), VoteCount(), and VoteSpam().

◆ VOTE_SELECT_ABSTAIN

const float VOTE_SELECT_ABSTAIN = -2

Definition at line 32 of file vote.qh.

Referenced by VoteCommand_abstain(), and VoteCount().

◆ VOTE_SELECT_ACCEPT

const float VOTE_SELECT_ACCEPT = 1

Definition at line 35 of file vote.qh.

Referenced by VoteCommand_call(), VoteCommand_master(), VoteCommand_yes(), and VoteCount().

◆ VOTE_SELECT_NULL

const float VOTE_SELECT_NULL = 0

Definition at line 34 of file vote.qh.

Referenced by VoteCommand_abstain(), VoteCommand_no(), and VoteCommand_yes().

◆ VOTE_SELECT_REJECT

const float VOTE_SELECT_REJECT = -1

Definition at line 33 of file vote.qh.

Referenced by VoteCommand_no(), and VoteCount().

◆ vote_selection

int vote_selection

Definition at line 53 of file vote.qh.

Referenced by LocalCommand_handlevote().

◆ vote_waittime

float vote_waittime

Definition at line 52 of file vote.qh.