]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Also don't increase armor and ammo of non-frozen players falling into space too;...
authorterencehill <piuntn@gmail.com>
Wed, 24 May 2023 22:52:41 +0000 (00:52 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 24 May 2023 22:56:57 +0000 (00:56 +0200)
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc

index 08d4935aeca8e1e4c6675e51b828fbd5262e6bbb..3bb78272fd0e01a5a2729e7b38423f6cff5c0b90 100644 (file)
@@ -179,8 +179,6 @@ void freezetag_Freeze(entity targ, entity attacker)
        if(STAT(FROZEN, targ))
                return;
 
-       targ.freezetag_frozen_armor = GetResource(targ, RES_ARMOR);
-
        targ.freezetag_frozen_time = time;
        if (autocvar_g_freezetag_revive_auto && autocvar_g_freezetag_frozen_maxtime > 0)
                targ.freezetag_frozen_timeout = time + autocvar_g_freezetag_frozen_maxtime;
@@ -353,41 +351,38 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies)
        frag_target.respawn_time = time + 1;
        frag_target.respawn_flags |= RESPAWN_FORCE;
 
-       // Cases DEATH_TEAMCHANGE and DEATH_AUTOTEAMCHANGE are needed to fix a bug whe
-       // you succeed changing team through the menu: you both really die (gibbing) and get frozen
-       if(ITEM_DAMAGE_NEEDKILL(frag_deathtype)
-               || frag_deathtype == DEATH_TEAMCHANGE.m_id || frag_deathtype == DEATH_AUTOTEAMCHANGE.m_id)
+       // let the player die, they will be automatically frozen when they respawn
+       // it fixes a bug where you both really die (gibbing) and get frozen
+       // if you succeed changing team through the menu
+       if (frag_deathtype == DEATH_TEAMCHANGE.m_id || frag_deathtype == DEATH_AUTOTEAMCHANGE.m_id)
        {
-               // let the player die, they will be automatically frozen when they respawn
-               if (STAT(FROZEN, frag_target) != FROZEN_NORMAL)
-               {
-                       freezetag_Add_Score(frag_target, frag_attacker);
-                       freezetag_count_alive_players();
-                       freezetag_LastPlayerForTeam_Notify(frag_target);
-                       frag_target.freezetag_frozen_timeout = -2; // freeze on respawn
-               }
-               else
-               {
-                       // soft-kill: setting health to something >= 1 after death, ammo won't be reset
-                       SetResourceExplicit(frag_target, RES_HEALTH, 1);
-                       // restore armor as it was removed in PlayerDamage
-                       SetResourceExplicit(frag_target, RES_ARMOR, frag_target.freezetag_frozen_armor);
-
-                       // relocate
-                       entity spot = SelectSpawnPoint(frag_target, true);
-                       setorigin(frag_target, spot.origin);
-                       frag_target.oldorigin = frag_target.origin;
-                       frag_target.fixangle = true; // turn this way immediately
-                       frag_target.angles = vec2(spot.angles);
-                       frag_target.velocity = '0 0 0';
-                       frag_target.oldvelocity = frag_target.velocity; // prevents fall damage, see CreatureFrame_FallDamage
-                       frag_target.avelocity = '0 0 0';
-                       frag_target.punchangle = '0 0 0';
-                       frag_target.punchvector = '0 0 0';
-               }
+               freezetag_Add_Score(frag_target, frag_attacker);
+               freezetag_count_alive_players();
+               freezetag_LastPlayerForTeam_Notify(frag_target);
+               frag_target.freezetag_frozen_timeout = -2; // freeze on respawn
                return true;
        }
 
+       if(ITEM_DAMAGE_NEEDKILL(frag_deathtype))
+       {
+               // soft-kill: setting health to something >= 1 after death, ammo won't be reset
+               SetResourceExplicit(frag_target, RES_HEALTH, 1);
+               // restore armor as it was removed in PlayerDamage
+               SetResourceExplicit(frag_target, RES_ARMOR, frag_target.freezetag_frozen_armor);
+
+               // relocate
+               entity spot = SelectSpawnPoint(frag_target, true);
+               setorigin(frag_target, spot.origin);
+               frag_target.oldorigin = frag_target.origin;
+               frag_target.fixangle = true; // turn this way immediately
+               frag_target.angles = vec2(spot.angles);
+               frag_target.velocity = '0 0 0';
+               frag_target.oldvelocity = frag_target.velocity; // prevents fall damage, see CreatureFrame_FallDamage
+               frag_target.avelocity = '0 0 0';
+               frag_target.punchangle = '0 0 0';
+               frag_target.punchvector = '0 0 0';
+       }
+
        if (STAT(FROZEN, frag_target) == FROZEN_NORMAL)
                return true;
 
@@ -467,6 +462,8 @@ MUTATOR_HOOKFUNCTION(ft, Damage_Calculate)
        //float frag_damage = M_ARGV(4, float);
        vector frag_force = M_ARGV(6, vector);
 
+       frag_target.freezetag_frozen_armor = GetResource(frag_target, RES_ARMOR);
+
        if (STAT(FROZEN, frag_target) == FROZEN_NORMAL && autocvar_g_freezetag_revive_auto_reducible
                && autocvar_g_freezetag_frozen_maxtime > 0 && autocvar_g_freezetag_revive_auto)
        {