From: terencehill Date: Sat, 27 May 2023 22:33:41 +0000 (+0200) Subject: Add a cvar to make it easy to debug votes X-Git-Tag: xonotic-v0.8.6~59^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1b2301709e9985ad35f9a6dca6465a528980dde0;p=xonotic%2Fxonotic-data.pk3dir.git Add a cvar to make it easy to debug votes --- diff --git a/commands.cfg b/commands.cfg index d5b03ee3e..5d4a7271e 100644 --- a/commands.cfg +++ b/commands.cfg @@ -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 diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 5ee0ebfb3..02cb8e1ce 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -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(); diff --git a/qcsrc/server/command/vote.qh b/qcsrc/server/command/vote.qh index 3f555ed8d..509d4d233 100644 --- a/qcsrc/server/command/vote.qh +++ b/qcsrc/server/command/vote.qh @@ -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;