]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Give players reviving a frozen teammate 1 point every 1.5 seconds (cvar g_freezetag_r...
authorterencehill <piuntn@gmail.com>
Wed, 7 Oct 2020 15:56:22 +0000 (17:56 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 7 Oct 2020 16:15:08 +0000 (18:15 +0200)
gamemodes-server.cfg
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh

index 8dd0d5d4897223a09ae2daa1ce6f45231a88cb5f..c15baaf9d101150e0fba283fe39422860894168e 100644 (file)
@@ -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"
index ba25fa71617792de6e542092543f13ac5de86383..ea00927abd908ae3856092f51b8d81d4ab80301b 100644 (file)
@@ -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
        }
index 43ceede6ee8d384c2d16d897ffabf2ab5f4e7068..4c88b20de448ebafc0d8aa6195e4da21e0404c2a 100644 (file)
@@ -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;