From: terencehill Date: Wed, 24 May 2023 17:44:56 +0000 (+0200) Subject: If a frozen player falls into space don't increase their armor and ammo; it partially... X-Git-Tag: xonotic-v0.8.6~62^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=215de4a98d362abc7b16cec8e10d1bc20b8fcabc;p=xonotic%2Fxonotic-data.pk3dir.git If a frozen player falls into space don't increase their armor and ammo; it partially fixes #2837 --- diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc index 444268a2d..08d4935ae 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc @@ -179,6 +179,8 @@ 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; @@ -366,13 +368,22 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies) } else { - float t = frag_target.freezetag_frozen_timeout; - float t2 = frag_target.freezetag_frozen_time; - Unfreeze(frag_target, false); // remove ice - // keep timeout value so it can be restored when player will be refrozen on respawn - // NOTE this can't be exactly -2 since game starts from time 2 - frag_target.freezetag_frozen_timeout = -t; - frag_target.freezetag_frozen_time = t2; + // 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'; } return true; } @@ -406,14 +417,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerSpawn) if(player.freezetag_frozen_timeout <= -2) // player was dead { - float t = player.freezetag_frozen_timeout; - float t2 = player.freezetag_frozen_time; freezetag_Freeze(player, NULL); - if (t < -2) - { - player.freezetag_frozen_timeout = -t; - player.freezetag_frozen_time = t2; - } return true; } diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh index 6fdd693cc..049f03714 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qh @@ -31,6 +31,7 @@ REGISTER_MUTATOR(ft, false) .float freezetag_frozen_time; .float freezetag_frozen_timeout; .float freezetag_frozen_force; +.float freezetag_frozen_armor; const float ICE_MAX_ALPHA = 1; const float ICE_MIN_ALPHA = 0.1; float freezetag_teams;