]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add g_spawnshield_blockdamage cvar: "how much spawn shield protects you from damage... 275/head
authorterencehill <piuntn@gmail.com>
Thu, 21 Jan 2016 23:49:46 +0000 (00:49 +0100)
committerGitLab <gitlab@gitlab.com>
Sat, 30 Jan 2016 00:16:37 +0000 (00:16 +0000)
defaultXonotic.cfg
qcsrc/server/autocvars.qh
qcsrc/server/cl_player.qc

index b5d1bbfc02da2c2e08db3dffb1e3088305c74f4d..7bc9466eb45bdec8b53dd4d28bd559d8927d8e51 100644 (file)
@@ -408,6 +408,7 @@ alias g_waypointeditor_unreachable "impulse 107"
 locs_enable 0
 pausable 0
 set g_spawnshieldtime 1 "number of seconds you are invincible after you spawned, this shield is lost after you fire"
+set g_spawnshield_blockdamage 1 "how much spawn shield protects you from damage (1 = full protection)"
 set g_antilag 2        "AntiLag (0 = no AntiLag, 1 = verified client side hit scan, 2 = server side hit scan in the past, 3 = unverified client side hit scan)"
 set g_antilag_nudge 0 "don't touch"
 set g_shootfromeye 0 "shots are fired from your eye/crosshair; visual gun position can still be influenced by cl_gunalign 1 and 2"
index d252a1895827070e61cb51b2a266c6e742619cca..3c4e4c43fbc442e0d502e3d065a5fe8cd1714b8d 100644 (file)
@@ -265,6 +265,7 @@ float autocvar_g_spawn_furthest;
 bool autocvar_g_spawn_useallspawns;
 bool autocvar_g_spawnpoints_auto_move_out_of_solid;
 #define autocvar_g_spawnshieldtime cvar("g_spawnshieldtime")
+float autocvar_g_spawnshield_blockdamage;
 float autocvar_g_teamdamage_resetspeed;
 float autocvar_g_teamdamage_threshold;
 bool autocvar_g_telefrags;
index f5f5ad905ddc59b68769ff8c37d03a8bbe7b1e8c..fe0951e8713f18e7d3c17096fd45a8c310c0c678 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))
                {