From: Mario Date: Sun, 30 Aug 2015 10:42:43 +0000 (+1000) Subject: Add an option to override the gamemode specific respawn delays, also add a hook to... X-Git-Tag: xonotic-v0.8.2~1969 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7faadb66e8849f64136b58a545928f96bafd4209;p=xonotic%2Fxonotic-data.pk3dir.git Add an option to override the gamemode specific respawn delays, also add a hook to server commands --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index c87ffa276..6a81e3507 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -477,6 +477,7 @@ set g_respawn_delay_small_count 0 "Player count per team for g_respawn_delay_sma set g_respawn_delay_large 2 "large game number of seconds you have to wait before you can respawn again" set g_respawn_delay_large_count 8 "Player count per team for g_respawn_delay_large. <=0 values mean the minimum amount of players to have gameplay (typically 2 in FFA, 1 in teamplay)." set g_respawn_delay_max 0 "number of seconds you can wait before you're forced to respawn (only effective with g_forced_respawn 1)" +set g_respawn_delay_forced 0 "enforce regular respawn delay (prevent gamemode specific respawn delays)" set g_respawn_waves 0 "respawn in waves (every n seconds), intended to decrease overwhelming base attacks" // overtime diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 45de5e3e8..3f4a11a7c 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -462,6 +462,7 @@ int autocvar_g_respawn_delay_small_count; float autocvar_g_respawn_delay_large; int autocvar_g_respawn_delay_large_count; float autocvar_g_respawn_delay_max; +bool autocvar_g_respawn_delay_forced; bool autocvar_g_respawn_ghosts; float autocvar_g_respawn_ghosts_maxtime; float autocvar_g_respawn_ghosts_speed; diff --git a/qcsrc/server/cl_player.qh b/qcsrc/server/cl_player.qh index cd1ec2e15..27d1bd0dd 100644 --- a/qcsrc/server/cl_player.qh +++ b/qcsrc/server/cl_player.qh @@ -26,7 +26,7 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, int de #define GAMETYPE_DEFAULTED_SETTING(str) \ ((gametype_setting_tmp = cvar(strcat("g_", GetGametype(), "_" #str))), \ (gametype_setting_tmp < 0) ? 0 : \ - (gametype_setting_tmp == 0) ? max(0, autocvar_g_##str) : \ + (gametype_setting_tmp == 0 || autocvar_g_respawn_delay_forced) ? max(0, autocvar_g_##str) : \ gametype_setting_tmp) diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index de36b3754..fdf82e368 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1905,6 +1905,10 @@ void GameCommand(string command) return; } } + else if(MUTATOR_CALLHOOK(SV_ParseServerCommand, strtolower(argv(0)), argc, command)) + { + return; // handled by a mutator + } else if(BanCommand(command)) { return; // handled by server/command/ipban.qc diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 234f56beb..1dd82a88f 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -399,6 +399,17 @@ int cmd_argc; string cmd_string; MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand); +/** please read EV_SV_ParseClientCommand description before using */ +#define EV_SV_ParseServerCommand(i, o) \ + /** command name */ i(string, cmd_name) \ + /** also, argv() can be used */ i(int, cmd_argc) \ + /** whole command, use only if you really have to */ i(string, cmd_string) \ + /**/ +//string cmd_name; +//int cmd_argc; +//string cmd_string; +MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand); + /** * called when a spawnpoint is being evaluated * return 1 to make the spawnpoint unusable