]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a cvar to make it easy to debug votes
authorterencehill <piuntn@gmail.com>
Sat, 27 May 2023 22:33:41 +0000 (00:33 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 27 May 2023 22:33:41 +0000 (00:33 +0200)
commands.cfg
qcsrc/server/command/vote.qc
qcsrc/server/command/vote.qh

index d5b03ee3e4dc89d5b120f75c9e211088240ae850..5d4a7271ee0e9ff3902e1dbac5cb292fb4352c62 100644 (file)
@@ -369,6 +369,7 @@ set sv_vote_stop 15 "a player can not call a vote again for this many seconds wh
 set sv_vote_majority_factor 0.5        "What percentage of the PLAYERS constitute a majority? (Must be at least 0.5, recommended: 0.5)"
 set sv_vote_majority_factor_of_voted 0.5 "What percentage of the VOTERS constitute a majority too? (Must be at least 0.5, recommended: 0.5)"
 set sv_vote_gamestart 0 "Allow voting during map change"
+set sv_vote_debug 0 "count votes by bots too for debugging purposes (to get a bot to vote exec this command: bot_cmd 1 cc vote yes)
 // when disabled, don't allow game type changes "note: set these two equal to JUST support simple majorities"
 set sv_vote_override_mostrecent 0
 
index 5ee0ebfb3b0c6fb71760334292e367f2eaab18f9..02cb8e1cec9c730f967833becf5b93b14ea8308d 100644 (file)
@@ -215,7 +215,6 @@ void VoteSpam(float notvoters, float mincount, string result)
 
 void VoteCount(float first_count)
 {
-       // declarations
        vote_accept_count = vote_reject_count = vote_abstain_count = 0;
 
        float vote_player_count = 0, notvoters = 0;
@@ -227,7 +226,7 @@ void VoteCount(float first_count)
        Nagger_VoteCountChanged();
 
        // add up all the votes from each connected client
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), {
+       FOREACH_CLIENT(IS_REAL_CLIENT(it) || autocvar_sv_vote_debug, {
                ++vote_player_count;
                if (IS_PLAYER(it) || INGAME(it)) ++vote_real_player_count;
                switch (it.vote_selection)
@@ -978,6 +977,8 @@ void VoteCommand_call(int request, entity caller, int argc, string vote_command)
                                FOREACH_CLIENT(IS_REAL_CLIENT(it), { ++tmp_playercount; });
 
                                bprint("\{1}^2* ^3", OriginalCallerName(), "^2 calls a vote for ", vote_called_display, "\n");
+                               if (autocvar_sv_vote_debug)
+                                       bprint("\{1}^2* ^3", "^6DEBUG MODE ACTIVE: bots can vote too\n"); // so servers don't forget it on
                                if (autocvar_sv_eventlog)
                                        GameLogEcho(strcat(":vote:vcall:", ftos(vote_caller.playerid), ":", vote_called_display));
                                Nagger_VoteChanged();
index 3f555ed8d8a89086b3d5182d4f9a0386e8fb645a..509d4d233ab559f2b590ca54b9fda25a93d2c7e3 100644 (file)
@@ -3,6 +3,8 @@
 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;
@@ -19,7 +21,6 @@ bool autocvar_sv_vote_singlecount;
 float autocvar_sv_vote_stop;
 float autocvar_sv_vote_timeout;
 float autocvar_sv_vote_wait;
-bool autocvar_sv_vote_gamestart;
 
 // definitions for command selection between progs
 const float VC_ASGNMNT_BOTH = 1;