From: Mario Date: Fri, 27 Sep 2019 15:29:07 +0000 (+1000) Subject: Restrict the timelimit vote to values between timelimit_min and timelimit_max X-Git-Tag: xonotic-v0.8.5~1263 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=48b9d3f25bbf7b3557903448db03e4e307c70888;p=xonotic%2Fxonotic-data.pk3dir.git Restrict the timelimit vote to values between timelimit_min and timelimit_max --- diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index a5cc73834..069c0784d 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -711,7 +711,9 @@ int VoteCommand_parse(entity caller, string vote_command, string vote_list, floa break; } - case "nextmap": // TODO: replicate the old behaviour of being able to vote for maps from different modes on multimode servers (possibly support it in gotomap too), maybe fallback instead of aborting if map name is invalid? + // TODO: replicate the old behaviour of being able to vote for maps from different modes on multimode servers (possibly support it in gotomap too) + // maybe fallback instead of aborting if map name is invalid? + case "nextmap": { vote_command = ValidateMap(argv(startpos + 1), caller); if (!vote_command) return -1; @@ -721,6 +723,21 @@ int VoteCommand_parse(entity caller, string vote_command, string vote_list, floa break; } + case "timelimit": // include restrictions on the maximum votable time limit + { + float timelimit_vote = stof(argv(startpos + 1)); + if(timelimit_vote <= 0 || timelimit_vote > autocvar_timelimit_max || timelimit_vote < autocvar_timelimit_min) + { + print_to(caller, strcat("Invalid timelimit vote, accepted values are between ", ftos(autocvar_timelimit_min), " and ", ftos(autocvar_timelimit_max), ".")); + return -1; + } + timelimit_vote = bound(autocvar_timelimit_min, timelimit_vote, autocvar_timelimit_max); + vote_parsed_command = strcat("timelimit ", ftos(timelimit_vote)); + vote_parsed_display = strzone(strcat("^1", vote_parsed_command)); + + break; + } + case "restart": { // add a delay so that vote result can be seen and announcer can be heard diff --git a/xonotic-server.cfg b/xonotic-server.cfg index 594e2943e..f1f2898ee 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -384,8 +384,8 @@ set g_banned_list_idmode "1" "when set, the IP banning system always uses the ID // useful vote aliases set timelimit_increment 5 "number of minutes added to the timer when voting for extendmatchtime" set timelimit_decrement 5 "number of minutes removed from the timer when voting for reducematchtime" -set timelimit_min 5 "shortest match time achieveable with reducematchtime votes" -set timelimit_max 60 "maximum match time achieveable with extendmatchtime votes" +set timelimit_min 5 "shortest match time achieveable with reducematchtime and timelimit votes" +set timelimit_max 60 "maximum match time achieveable with extendmatchtime and timelimit votes" sv_gameplayfix_delayprojectiles 0 sv_gameplayfix_q2airaccelerate 1