From 17fda31b950847aaf5aa267dfa7c0a1e7456c401 Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 22 Jan 2016 00:49:46 +0100 Subject: [PATCH] Add g_spawnshield_blockdamage cvar: "how much spawn shield protects you from damage (1 = full protection)" --- defaultXonotic.cfg | 1 + qcsrc/server/autocvars.qh | 1 + qcsrc/server/cl_player.qc | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) 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)) { -- 2.39.2