From: terencehill Date: Thu, 21 Jan 2016 23:49:46 +0000 (+0100) Subject: Add g_spawnshield_blockdamage cvar: "how much spawn shield protects you from damage... X-Git-Tag: xonotic-v0.8.2~1209^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=17fda31b950847aaf5aa267dfa7c0a1e7456c401;p=xonotic%2Fxonotic-data.pk3dir.git Add g_spawnshield_blockdamage cvar: "how much spawn shield protects you from damage (1 = full protection)" --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index b5d1bbfc0..7bc9466eb 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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" diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index d252a1895..3c4e4c43f 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -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; diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index f5f5ad905..fe0951e87 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -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)) {