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;
}
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;
}
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;
}