From efb674f0d316cdfe9e078d7206f3f1df7b6271e4 Mon Sep 17 00:00:00 2001 From: Freddy Date: Wed, 13 Jul 2016 17:38:25 +0200 Subject: [PATCH] add possibility to modify respawn delay with a factor in overtime (increases with every overtime) --- defaultXonotic.cfg | 1 + gamemodes.cfg | 17 ++++++++++++++++- qcsrc/server/autocvars.qh | 1 + qcsrc/server/cl_player.qc | 9 +++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 15aa706fd..9027b340c 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -476,6 +476,7 @@ set g_respawn_delay_large 2 "large game number of seconds you have to wait befor 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 5 "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_delay_overtimefactor 1 "factor to modify the respawn delay in overtime. effect increases with every played overtime" set g_respawn_waves 0 "respawn in waves (every n seconds), intended to decrease overwhelming base attacks" // overtime diff --git a/gamemodes.cfg b/gamemodes.cfg index 4cf77d52e..a542ddf67 100644 --- a/gamemodes.cfg +++ b/gamemodes.cfg @@ -18,7 +18,7 @@ alias asay_drop "say_team (%l) dropped %w ; impulse 17" // ================= // gamestart hooks // ================= -seta cl_matchcount 0 // incremented by cl_hook_gameend and used by playerstats to know when to +seta cl_matchcount 0 // incremented by cl_hook_gameend and used by playerstats to know when to alias _cl_hook_gamestart "set _cl_hook_gametype $1; _cl_hook_gamestart_stage2" alias _cl_hook_gamestart_stage2 "cl_hook_gamestart_all; cl_hook_gamestart_${_cl_hook_gametype}" alias cl_hook_gamestart_all @@ -127,6 +127,7 @@ set g_ctf_respawn_delay_small_count 1 set g_ctf_respawn_delay_large 5 set g_ctf_respawn_delay_large_count 5 set g_ctf_respawn_delay_max 0 +set g_ctf_respawn_delay_overtimefactor 1.25 set g_ctf_respawn_waves 0 set g_ctf_weapon_stay 0 set g_dm_respawn_delay_small 0 @@ -134,6 +135,7 @@ set g_dm_respawn_delay_small_count 0 set g_dm_respawn_delay_large 0 set g_dm_respawn_delay_large_count 0 set g_dm_respawn_delay_max 0 +set g_dm_respawn_delay_overtimefactor 0 set g_dm_respawn_waves 0 set g_dm_weapon_stay 0 set g_dom_respawn_delay_small 0 @@ -141,6 +143,7 @@ set g_dom_respawn_delay_small_count 0 set g_dom_respawn_delay_large 0 set g_dom_respawn_delay_large_count 0 set g_dom_respawn_delay_max 0 +set g_dom_respawn_delay_overtimefactor 0 set g_dom_respawn_waves 0 set g_dom_weapon_stay 0 set g_lms_respawn_delay_small 0 @@ -148,6 +151,7 @@ set g_lms_respawn_delay_small_count 0 set g_lms_respawn_delay_large 0 set g_lms_respawn_delay_large_count 0 set g_lms_respawn_delay_max 0 +set g_lms_respawn_delay_overtimefactor 0 set g_lms_respawn_waves 0 set g_lms_weapon_stay 0 set g_tdm_respawn_delay_small 0 @@ -155,6 +159,7 @@ set g_tdm_respawn_delay_small_count 0 set g_tdm_respawn_delay_large 0 set g_tdm_respawn_delay_large_count 0 set g_tdm_respawn_delay_max 0 +set g_tdm_respawn_delay_overtimefactor 0 set g_tdm_respawn_waves 0 set g_tdm_weapon_stay 0 set g_ka_respawn_delay_small 0 @@ -162,6 +167,7 @@ set g_ka_respawn_delay_small_count 0 set g_ka_respawn_delay_large 0 set g_ka_respawn_delay_large_count 0 set g_ka_respawn_delay_max 0 +set g_ka_respawn_delay_overtimefactor 0 set g_ka_respawn_waves 0 set g_ka_weapon_stay 0 set g_kh_respawn_delay_small 0 @@ -169,6 +175,7 @@ set g_kh_respawn_delay_small_count 0 set g_kh_respawn_delay_large 0 set g_kh_respawn_delay_large_count 0 set g_kh_respawn_delay_max 0 +set g_kh_respawn_delay_overtimefactor 0 set g_kh_respawn_waves 0 set g_kh_weapon_stay 0 set g_ca_respawn_delay_small 0 @@ -176,6 +183,7 @@ set g_ca_respawn_delay_small_count 0 set g_ca_respawn_delay_large 0 set g_ca_respawn_delay_large_count 0 set g_ca_respawn_delay_max 0 +set g_ca_respawn_delay_overtimefactor 0 set g_ca_respawn_waves 0 set g_ca_weapon_stay 0 set g_nb_respawn_delay_small 0 @@ -183,6 +191,7 @@ set g_nb_respawn_delay_small_count 0 set g_nb_respawn_delay_large 0 set g_nb_respawn_delay_large_count 0 set g_nb_respawn_delay_max 0 +set g_nb_respawn_delay_overtimefactor 0 set g_nb_respawn_waves 0 set g_nb_weapon_stay 0 set g_as_respawn_delay_small 0 @@ -190,6 +199,7 @@ set g_as_respawn_delay_small_count 0 set g_as_respawn_delay_large 0 set g_as_respawn_delay_large_count 0 set g_as_respawn_delay_max 0 +set g_as_respawn_delay_overtimefactor 1.25 set g_as_respawn_waves 0 set g_as_weapon_stay 0 set g_ons_respawn_delay_small 0 @@ -197,6 +207,7 @@ set g_ons_respawn_delay_small_count 0 set g_ons_respawn_delay_large 0 set g_ons_respawn_delay_large_count 0 set g_ons_respawn_delay_max 0 +set g_ons_respawn_delay_overtimefactor 0 set g_ons_respawn_waves 0 set g_ons_weapon_stay 0 set g_rc_respawn_delay_small 0 @@ -204,6 +215,7 @@ set g_rc_respawn_delay_small_count 0 set g_rc_respawn_delay_large 0 set g_rc_respawn_delay_large_count 0 set g_rc_respawn_delay_max 0 +set g_rc_respawn_delay_overtimefactor 0 set g_rc_respawn_waves 0 set g_rc_weapon_stay 0 set g_cts_respawn_delay_small -1 // CTS shall have instant respawn. @@ -211,6 +223,7 @@ set g_cts_respawn_delay_small_count 0 set g_cts_respawn_delay_large -1 // CTS shall have instant respawn. set g_cts_respawn_delay_large_count 0 set g_cts_respawn_delay_max 0 +set g_cts_respawn_delay_overtimefactor 0 set g_cts_respawn_waves 0 set g_cts_weapon_stay 2 set g_ft_respawn_delay_small 0 @@ -218,6 +231,7 @@ set g_ft_respawn_delay_small_count 0 set g_ft_respawn_delay_large 0 set g_ft_respawn_delay_large_count 0 set g_ft_respawn_delay_max 0 +set g_ft_respawn_delay_overtimefactor 0 set g_ft_respawn_waves 0 set g_ft_weapon_stay 0 set g_inv_respawn_delay_small 0 @@ -225,6 +239,7 @@ set g_inv_respawn_delay_small_count 0 set g_inv_respawn_delay_large 0 set g_inv_respawn_delay_large_count 0 set g_inv_respawn_delay_max 0 +set g_inv_respawn_delay_overtimefactor 0 set g_inv_respawn_waves 0 set g_inv_weapon_stay 0 diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 314858780..7bc761805 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -253,6 +253,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; +float autocvar_g_respawn_delay_overtimefactor; bool autocvar_g_respawn_delay_forced; bool autocvar_g_respawn_ghosts; float autocvar_g_respawn_ghosts_maxtime; diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index fa5ac0f3e..91ba9cc28 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -224,6 +224,15 @@ void calculate_player_respawn_time(entity this) float sdelay_large_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large_count); float waves = GAMETYPE_DEFAULTED_SETTING(respawn_waves); + // increase spawn delay in overtime + if (checkrules_overtimesadded) + { + float delay_overtimefactor = pow(GAMETYPE_DEFAULTED_SETTING(respawn_delay_overtimefactor), checkrules_overtimesadded); + sdelay_small *= delay_overtimefactor; + sdelay_large *= delay_overtimefactor; + sdelay_max *= delay_overtimefactor; + } + float pcount = 1; // Include myself whether or not team is already set right and I'm a "player". if (teamplay) { -- 2.39.2