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;
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;
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;
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
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;