From 381039401880dc847230f3752b738745a6aeb8e7 Mon Sep 17 00:00:00 2001 From: div0 Date: Sun, 10 Aug 2008 15:13:20 +0000 Subject: [PATCH] new command "allready" (for vcall/vdo); fix shootable buttons in independent players mode git-svn-id: svn://svn.icculus.org/nexuiz/trunk@4093 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/defaultNexuiz.cfg | 4 +- data/qcsrc/server/arena.qc | 2 + data/qcsrc/server/clientcommands.qc | 74 +++++++++++++++-------------- data/qcsrc/server/g_damage.qc | 2 +- data/qcsrc/server/gamecommand.qc | 4 ++ 5 files changed, 49 insertions(+), 37 deletions(-) diff --git a/data/defaultNexuiz.cfg b/data/defaultNexuiz.cfg index 39a017492..e697cd6dc 100644 --- a/data/defaultNexuiz.cfg +++ b/data/defaultNexuiz.cfg @@ -688,7 +688,7 @@ bind kp_plus "+userbind 14" bind kp_minus "+userbind 15" // these commands can be voted -set sv_vote_commands "restart timelimit fraglimit chmap gotomap g_grappling_hook sv_defaultplayer_fbskin_green sv_defaultplayer_fbskin_red sv_defaultplayer_fbskin_orange sv_defaultplayer_fbskin_off endmatch reducematchtime extendmatchtime" +set sv_vote_commands "restart timelimit fraglimit chmap gotomap g_grappling_hook sv_defaultplayer_fbskin_green sv_defaultplayer_fbskin_red sv_defaultplayer_fbskin_orange sv_defaultplayer_fbskin_off endmatch reducematchtime extendmatchtime allready" // users can call a vote for the above commands set sv_vote_call 1 // users can call a vote to become master @@ -1076,3 +1076,5 @@ prvm_leaktest_ignore_classnames "ctf_team dom_team tdm_team" sv_allowdownloads_inarchive 1 // for csprogs.dat set g_jump_grunt 0 // Do you make a grunting noise every time you jump? Is it the same grunting noise every time? + +alias allready "sv_cmd allready" diff --git a/data/qcsrc/server/arena.qc b/data/qcsrc/server/arena.qc index b72602a6e..587fcbecd 100644 --- a/data/qcsrc/server/arena.qc +++ b/data/qcsrc/server/arena.qc @@ -150,6 +150,8 @@ void reset_map() if(g_arena) if(champion) UpdateFrags(champion, +1); + + Score_ClearAll(); } void Spawnqueue_Insert(entity e) diff --git a/data/qcsrc/server/clientcommands.qc b/data/qcsrc/server/clientcommands.qc index b69719dca..95bdf78b5 100644 --- a/data/qcsrc/server/clientcommands.qc +++ b/data/qcsrc/server/clientcommands.qc @@ -378,39 +378,9 @@ void SV_ParseClientCommand(string s) { } } -/** - * Counts how many players are ready. If not enough players are ready, the function - * does nothing. If all players are ready, the timelimit will be extended and the - * restart_countdown variable is set to allow other functions like PlayerPostThink - * to detect that the countdown is now active. If the cvar sv_ready_restart_after_countdown - * is not set the map will be resetted. - * - * Function is called after the server receives a 'ready' sign from a player. - */ -void ReadyCount() +void ReadyRestart() { local entity e; - local float r, p; - - FOR_EACH_REALPLAYER(e) - { - p += 1; - if(e.ready) - r += 1; - } - - if(cvar("sv_ready_restart_nag")) { - if(!readyNagActive) { - readyNagger = spawn(); - readyNagger.think = readyNagger_Think; - readyNagger.cnt = cvar("sv_ready_restart_nag_duration"); - readyNagger.nextthink = time; - readyNagActive = 1; - } - } - - if(!p || r < p) - return; bprint("^1Server is restarting...\n"); @@ -435,7 +405,6 @@ void ReadyCount() start_health = cvar("g_balance_health_start"); start_armorvalue = cvar("g_balance_armor_start"); } - restart_countdown = time + RESTART_COUNTDOWN; restart_mapalreadyrestarted = 0; //reset this var, needed when cvar sv_ready_restart_repeatable is in use //reset the .ready status of all players (also spectators) @@ -452,6 +421,7 @@ void ReadyCount() if(timelimit_orig) cvar_set("timelimit", ftos(timelimit_orig + ceil(restart_countdown)/60)); } + if(cvar("teamplay_lockonrestart") && teams_matter) { lockteams = 1; bprint("^1The teams are now locked.\n"); @@ -477,15 +447,49 @@ void ReadyCount() //reset map immediately if this cvar is not set if (!cvar("sv_ready_restart_after_countdown")) - { reset_map(); - Score_ClearAll(); - } if(cvar("sv_eventlog")) GameLogEcho(":restart", FALSE); } +/** + * Counts how many players are ready. If not enough players are ready, the function + * does nothing. If all players are ready, the timelimit will be extended and the + * restart_countdown variable is set to allow other functions like PlayerPostThink + * to detect that the countdown is now active. If the cvar sv_ready_restart_after_countdown + * is not set the map will be resetted. + * + * Function is called after the server receives a 'ready' sign from a player. + */ +void ReadyCount() +{ + local entity e; + local float r, p; + + FOR_EACH_REALPLAYER(e) + { + p += 1; + if(e.ready) + r += 1; + } + + if(cvar("sv_ready_restart_nag")) { + if(!readyNagActive) { + readyNagger = spawn(); + readyNagger.think = readyNagger_Think; + readyNagger.cnt = cvar("sv_ready_restart_nag_duration"); + readyNagger.nextthink = time; + readyNagActive = 1; + } + } + + if(!p || r < p) + return; + + ReadyRestart(); +} + /** * Centerprints the information to all players who didn't ready up yet to do so. */ diff --git a/data/qcsrc/server/g_damage.qc b/data/qcsrc/server/g_damage.qc index 198e92802..6227dd8b9 100644 --- a/data/qcsrc/server/g_damage.qc +++ b/data/qcsrc/server/g_damage.qc @@ -515,7 +515,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if(deathtype != DEATH_TELEFRAG) if(attacker.classname == "player") { - if(independent_players && targ != attacker) + if(independent_players && targ != attacker && targ.classname == "player") { damage = 0; force = '0 0 0'; diff --git a/data/qcsrc/server/gamecommand.qc b/data/qcsrc/server/gamecommand.qc index 6d26c1263..29496af7a 100644 --- a/data/qcsrc/server/gamecommand.qc +++ b/data/qcsrc/server/gamecommand.qc @@ -206,6 +206,10 @@ void GameCommand(string command) { Score_DebugPrint(); } + if (argv(0) == "allready") + { + ReadyRestart(); + } print("Invalid command. For a list of supported commands, try sv_cmd help.\n"); } -- 2.39.2