From: terencehill Date: Wed, 7 Oct 2020 15:56:22 +0000 (+0200) Subject: Give players reviving a frozen teammate 1 point every 1.5 seconds (cvar g_freezetag_r... X-Git-Tag: xonotic-v0.8.5~688^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a0fd208362840417b2e12a61a002983cbd2aea07;p=xonotic%2Fxonotic-data.pk3dir.git Give players reviving a frozen teammate 1 point every 1.5 seconds (cvar g_freezetag_revive_time_to_score). It also automatically disables revive progress clearing when out of range to prevent stacking points by entering and exiting the revival zone many times --- diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index 8dd0d5d48..c15baaf9d 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -371,6 +371,7 @@ set g_freezetag_revive_clearspeed 1.6 "Speed at which reviving progress gets los set g_freezetag_revive_extra_size 100 "Distance in qu that you can stand from a frozen teammate to keep reviving him" set g_freezetag_revive_nade 1 "Enable reviving from own nade explosion" set g_freezetag_revive_nade_health 40 "Amount of health player has if they revived from their own nade explosion" +set g_freezetag_revive_time_to_score 1.5 "every this amount of seconds give players reviving a frozen teammate 1 point" set g_freezetag_round_timelimit 360 "round time limit in seconds" set g_freezetag_revive_auto 1 "automatically revive frozen players after some time (g_freezetag_frozen_maxtime)" set g_freezetag_revive_auto_progress 1 "start the automatic reviving progress as soon as the player gets frozen" diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc index ba25fa716..ea00927ab 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc @@ -114,6 +114,7 @@ bool freezetag_CheckWinner() Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_OVER); FOREACH_CLIENT(IS_PLAYER(it), { it.freezetag_frozen_timeout = 0; + it.freezetag_revive_time = 0; nades_Clear(it); }); game_stopped = true; @@ -141,6 +142,7 @@ bool freezetag_CheckWinner() FOREACH_CLIENT(IS_PLAYER(it), { it.freezetag_frozen_timeout = 0; + it.freezetag_revive_time = 0; nades_Clear(it); }); @@ -179,7 +181,7 @@ void freezetag_Add_Score(entity targ, entity attacker) { if(attacker == targ) { - // you froze your own dumb targ + // you froze your own dumb self // counted as "suicide" already GameRules_scoring_add(targ, SCORE, -1); } @@ -438,6 +440,7 @@ MUTATOR_HOOKFUNCTION(ft, reset_map_players) { FOREACH_CLIENT(IS_PLAYER(it), { CS(it).killcount = 0; + it.freezetag_revive_time = 0; it.freezetag_frozen_timeout = -1; PutClientInServer(it); it.freezetag_frozen_timeout = 0; @@ -515,6 +518,15 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST) int n = 0; vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size; FOREACH_CLIENT(IS_PLAYER(it) && IS_REVIVING(player, it, revive_extra_size), { + if (autocvar_g_freezetag_revive_time_to_score > 0 && STAT(FROZEN, player) == FROZEN_NORMAL) + { + it.freezetag_revive_time += frametime / autocvar_g_freezetag_revive_time_to_score; + while (it.freezetag_revive_time > 1) + { + GameRules_scoring_add(it, SCORE, +1); + it.freezetag_revive_time -= 1; + } + } if (reviving_players_last) reviving_players_last.chain = it; reviving_players_last = it; @@ -540,8 +552,11 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST) if (!n) // no teammate nearby { + float clearspeed = autocvar_g_freezetag_revive_clearspeed; + if (autocvar_g_freezetag_revive_time_to_score > 0) + clearspeed = 0; // prevent stacking points by entering and exiting the revival zone many times if (STAT(FROZEN, player) == FROZEN_NORMAL) - STAT(REVIVE_PROGRESS, player) = bound(base_progress, STAT(REVIVE_PROGRESS, player) - frametime * autocvar_g_freezetag_revive_clearspeed * (1 - base_progress), 1); + STAT(REVIVE_PROGRESS, player) = bound(base_progress, STAT(REVIVE_PROGRESS, player) - frametime * clearspeed * (1 - base_progress), 1); else if (!STAT(FROZEN, player)) STAT(REVIVE_PROGRESS, player) = base_progress; // thawing nobody } diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh index 43ceede6e..4c88b20de 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh @@ -27,6 +27,7 @@ REGISTER_MUTATOR(ft, false) return 0; } +.float freezetag_revive_time; .float freezetag_frozen_time; .float freezetag_frozen_timeout; const float ICE_MAX_ALPHA = 1; @@ -39,5 +40,6 @@ int autocvar_g_freezetag_revive_auto_reducible; float autocvar_g_freezetag_revive_auto_reducible_forcefactor; float autocvar_g_freezetag_revive_extra_size; float autocvar_g_freezetag_revive_speed; +float autocvar_g_freezetag_revive_time_to_score = 1.5; bool autocvar_g_freezetag_revive_nade; float autocvar_g_freezetag_revive_nade_health;