Add g_spawnshield_blockdamage cvar: "how much spawn shield protects you from damage...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_player.qc
index f5f5ad9..fe0951e 100644 (file)
@@ -374,6 +374,13 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                this.istypefrag = 0;
        }
 
+       if (time < this.spawnshieldtime && autocvar_g_spawnshield_blockdamage < 1)
+       {
+               vector v = healtharmor_applydamage(this.armorvalue, max(0, autocvar_g_spawnshield_blockdamage), deathtype, damage);
+               take = v.x;
+               save = v.y;
+       }
+
        frag_damage = damage;
        MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, this, force, take, save);
        take = bound(0, damage_take, this.health);
@@ -395,7 +402,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        if (take > 100)
                Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker);
 
-       if (time >= this.spawnshieldtime)
+       if (time >= this.spawnshieldtime || autocvar_g_spawnshield_blockdamage < 1)
        {
                if (!(this.flags & FL_GODMODE))
                {