]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Port ballistics_density to PlayerState
authorMario <mario@smbclan.net>
Tue, 18 Jul 2017 13:58:47 +0000 (23:58 +1000)
committerMario <mario@smbclan.net>
Tue, 18 Jul 2017 13:58:47 +0000 (23:58 +1000)
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/player.qc
qcsrc/server/weapons/tracing.qc

index 8f28e294d8e581eddec41179313e8c08b6a20308..804868fa0031ac041b3e24cf65ae737fb0bed114 100644 (file)
@@ -578,7 +578,7 @@ void PutPlayerInServer(entity this)
        setthink(this, func_null); // players have no think function
        this.nextthink = 0;
        this.dmg_team = 0;
-       this.ballistics_density = autocvar_g_ballistics_density_player;
+       PS(this).ballistics_density = autocvar_g_ballistics_density_player;
 
        this.deadflag = DEAD_NO;
 
index af4d3d693a0bec4ba65d531bef22879c897cdfa6..3218b44496255c267847d7af9d6a91757c496684 100644 (file)
@@ -153,6 +153,7 @@ CLASS(Player, Client)
 
     ATTRIB(Player, dual_weapons, vector, this.dual_weapons); // TODO: actually WepSet!
     ATTRIB(Player, itemkeys, int, this.itemkeys);
+    ATTRIB(Player, ballistics_density, float, this.ballistics_density);
 
     INIT(Player) {
         this.classname = STR_PLAYER;
index c40f87de3a0c45b60d3623a97750206700d95241..4e8663d24af0a5aaf8b6b3f574fdd9acd9dab8d8 100644 (file)
@@ -97,7 +97,6 @@ void CopyBody(entity this, float keepvelocity)
        clone.move_qcphysics = false; // don't run gamecode logic on clones, too many
        set_movetype(clone, this.move_movetype);
        clone.solid = this.solid;
-       clone.ballistics_density = this.ballistics_density;
        clone.takedamage = this.takedamage;
        setcefc(clone, getcefc(this));
        clone.uncustomizeentityforclient = this.uncustomizeentityforclient;
@@ -610,7 +609,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                set_movetype(this, MOVETYPE_TOSS);
                // shootable corpse
                this.solid = SOLID_CORPSE;
-               this.ballistics_density = autocvar_g_ballistics_density_corpse;
+               PS(this).ballistics_density = autocvar_g_ballistics_density_corpse;
                // don't stick to the floor
                UNSET_ONGROUND(this);
                // dying animation
index 4c6304a1b1b50439070afa5c43a78a71d26d5846..475eb3d265c086e769242548ab018ed6a00e1bb3 100644 (file)
@@ -438,16 +438,17 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
                        break;
 
                float maxdist;
+               entity hitstore = IS_PLAYER(hit) ? PS(hit) : hit;
                if(max_solid_penetration < 0)
                        break;
-               else if(hit.ballistics_density < -1)
+               else if(hitstore.ballistics_density < -1)
                        break; // -2: no solid penetration, ever
-               else if(hit.ballistics_density < 0)
+               else if(hitstore.ballistics_density < 0)
                        maxdist = vlen(hit.maxs - hit.mins) + 1; // -1: infinite travel distance
-               else if(hit.ballistics_density == 0)
+               else if(hitstore.ballistics_density == 0)
                        maxdist = max_solid_penetration * solid_penetration_left;
                else
-                       maxdist = max_solid_penetration * solid_penetration_left * hit.ballistics_density;
+                       maxdist = max_solid_penetration * solid_penetration_left * hitstore.ballistics_density;
 
                if(maxdist <= autocvar_g_ballistics_mindistance)
                        break;