]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Shotgun accuracy stats: also count damage dealt by projectiles hitting the enemy...
authorterencehill <piuntn@gmail.com>
Thu, 13 Jul 2017 17:20:05 +0000 (19:20 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 14 Jul 2017 11:22:54 +0000 (13:22 +0200)
qcsrc/server/client.qc
qcsrc/server/player.qc
qcsrc/server/weapons/accuracy.qc
qcsrc/server/weapons/tracing.qc

index 381373ad2bcb713d93ccc4046efa6ac2341c14ed..da256e8f406faeb95173f2dbd62d31cd26434dce 100644 (file)
@@ -2708,6 +2708,11 @@ void PlayerPostThink (entity this)
        }
 
        if (IS_PLAYER(this)) {
+               if(this.death_time == time && IS_DEAD(this))
+               {
+                       this.maxs.z = 5;
+                       setsize(this, this.mins, this.maxs);
+               }
                DrownPlayer(this);
                CheckRules_Player(this);
                UpdateChatBubble(this);
index 0ca9cb8491d3084d309b3a5d92be39303c8448f8..ac312dc590f1a686a5d70e998ad2d8b6228456cb 100644 (file)
@@ -173,9 +173,6 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da
        vector v;
        Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
-       // damage resistance (ignore most of the damage from a bullet or similar)
-       damage = max(damage - 5, 1);
-
        v = healtharmor_applydamage(this.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
        take = v.x;
        save = v.y;
@@ -625,11 +622,16 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                        animdecide_setstate(this, this.anim_state | ANIMSTATE_DEAD1, true);
                else
                        animdecide_setstate(this, this.anim_state | ANIMSTATE_DEAD2, true);
+
+               /* // postpone resize until frame end so that dead player can still
+               // properly get hit by all the projectiles fired in this frame (shotgun)
                if (this.maxs.z > 5)
                {
                        this.maxs_z = 5;
                        setsize(this, this.mins, this.maxs);
                }
+               */
+
                // set damage function to corpse damage
                this.event_damage = PlayerCorpseDamage;
                // call the corpse damage function just in case it wants to gib
@@ -648,7 +650,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                if(autocvar_sv_gentle > 0 || autocvar_ekg || this.classname == "body") {
                        // remove corpse
                        // clones don't run any animation code any more, so we must gib them when they die :(
-                       PlayerCorpseDamage(this, inflictor, attacker, autocvar_sv_gibhealth+1.0, deathtype, hitloc, force);
+                       this.event_damage(this, inflictor, attacker, autocvar_sv_gibhealth + 1, deathtype, hitloc, force);
                }
 
                // reset fields the weapons may use just in case
index 7cc06da3e6dc05b32595b85556ff43d4ecb11225..6e4c67595895c4c3121f11cfe4c08ef329447dbd 100644 (file)
@@ -93,7 +93,7 @@ bool accuracy_isgooddamage(entity attacker, entity targ)
        int mutator_check = MUTATOR_CALLHOOK(AccuracyTargetValid, attacker, targ);
 
        if (warmup_stage) return false;
-       if (IS_DEAD(targ)) return false;
+       if (IS_DEAD(targ) && time > targ.death_time) return false;
        if (STAT(FROZEN, targ)) return false;
        if (SAME_TEAM(attacker, targ)) return false;
 
index 8e4f88b8cd3d8c4fcf957b1a154e815a4d5158a8..6b07d8a0f59c4f3d1c89d2f4d83a5a2fec2631bb 100644 (file)
@@ -422,10 +422,10 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
                        yoda = 0;
                        MUTATOR_CALLHOOK(FireBullet_Hit, this, hit, start, end, damage, this.(weaponentity));
                        damage = M_ARGV(4, float);
-                       float g = accuracy_isgooddamage(this, hit);
+                       bool gooddamage = accuracy_isgooddamage(this, hit);
                        Damage(hit, this, this, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
                        // calculate hits for ballistic weapons
-                       if(g)
+                       if(gooddamage)
                        {
                                // do not exceed 100%
                                float added_damage = min(damage - total_damage, damage * solid_penetration_left);