]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Freezetag: limit hit force considered at once to reduce autorevive time, e.g. when...
authorterencehill <piuntn@gmail.com>
Thu, 4 Feb 2021 11:44:12 +0000 (12:44 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 4 Feb 2021 11:44:12 +0000 (12:44 +0100)
gamemodes-server.cfg
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh

index c0889f3ae09cd3cc95293bd34dea517858a3d5e9..8e0978181620505864470a712f24aae1bd380459 100644 (file)
@@ -377,6 +377,7 @@ set g_freezetag_revive_auto 1 "automatically revive frozen players after some ti
 set g_freezetag_revive_auto_progress 1 "start the automatic reviving progress as soon as the player gets frozen"
 set g_freezetag_revive_auto_reducible 1 "reduce auto-revival time when frozen players are hit by enemies; set to -1 to reduce it even when they are hit by teammates"
 set g_freezetag_revive_auto_reducible_forcefactor 0.025 "hit force to time reduction conversion factor"
+set g_freezetag_revive_auto_reducible_maxforce 400 "max force considered at once"
 set g_freezetag_revive_spawnshield 1 "apply spawnshield for this time in seconds after the player has been revived"
 set g_freezetag_frozen_maxtime 60 "frozen players will be automatically unfrozen after this time in seconds"
 set g_freezetag_teams_override 0
index a8f37678a9105cf8e31b8f8fc010f8073f2edd52..9bba0b3e5414e891c48b9b05c8d9dd867da742a6 100644 (file)
@@ -493,7 +493,20 @@ MUTATOR_HOOKFUNCTION(ft, Damage_Calculate)
                        && frag_target.freezetag_frozen_timeout > time)
                {
                        if (fabs(autocvar_g_freezetag_revive_auto_reducible) == 1)
-                               t = vlen(frag_force) * autocvar_g_freezetag_revive_auto_reducible_forcefactor;
+                       {
+                               float maxforce = autocvar_g_freezetag_revive_auto_reducible_maxforce;
+                               t = vlen(frag_force);
+                               // limit hit force considered at once, e.g when you have the Strength
+                               // powerup but also with weapons that fire multiple projectiles at once (crylink)
+                               if (frag_target.freezetag_frozen_force + t > maxforce)
+                               {
+                                       t = max(0, maxforce - frag_target.freezetag_frozen_force);
+                                       frag_target.freezetag_frozen_force = maxforce;
+                               }
+                               else
+                                       frag_target.freezetag_frozen_force += t;
+                               t *= autocvar_g_freezetag_revive_auto_reducible_forcefactor;
+                       }
                        frag_target.freezetag_frozen_timeout -= t;
                        if (frag_target.freezetag_frozen_timeout < time)
                                frag_target.freezetag_frozen_timeout = time;
@@ -524,6 +537,8 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
        //if(player.freezetag_frozen_timeout > 0 && time < player.freezetag_frozen_timeout)
                //player.iceblock.alpha = ICE_MIN_ALPHA + (ICE_MAX_ALPHA - ICE_MIN_ALPHA) * (player.freezetag_frozen_timeout - time) / (player.freezetag_frozen_timeout - player.freezetag_frozen_time);
 
+       player.freezetag_frozen_force = 0;
+
        if (!(frametime && IS_PLAYER(player)))
                return true;
 
index 067d2d64050d4b358fd76a14057a87b07eec6a5d..9296767cd7a5a2c136296b6258cca8870b4fbe6c 100644 (file)
@@ -30,6 +30,7 @@ REGISTER_MUTATOR(ft, false)
 .float freezetag_revive_time;
 .float freezetag_frozen_time;
 .float freezetag_frozen_timeout;
+.float freezetag_frozen_force;
 const float ICE_MAX_ALPHA = 1;
 const float ICE_MIN_ALPHA = 0.1;
 float freezetag_teams;
@@ -38,6 +39,7 @@ bool autocvar_g_freezetag_revive_auto = 1;
 int autocvar_g_freezetag_revive_auto_progress = 1;
 int autocvar_g_freezetag_revive_auto_reducible;
 float autocvar_g_freezetag_revive_auto_reducible_forcefactor;
+float autocvar_g_freezetag_revive_auto_reducible_maxforce;
 float autocvar_g_freezetag_revive_extra_size;
 float autocvar_g_freezetag_revive_speed;
 float autocvar_g_freezetag_revive_time_to_score = 1.5;