]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
make bullets go through 2x the distance when inside a player, and 10x when inside...
authorRudolf Polzer <divverent@alientrap.org>
Fri, 21 May 2010 12:25:14 +0000 (14:25 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 21 May 2010 12:25:14 +0000 (14:25 +0200)
defaultXonotic.cfg
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/defs.qh
qcsrc/server/w_common.qc

index 764782ed75d81cd6f50e505f4f75f6c5076c28cd..8766479bf64c46c3c1aebd5fb7c30cc2bbebe7e8 100644 (file)
@@ -1572,6 +1572,8 @@ alias rankings "cmd rankings"
 
 set g_ballistics_materialconstant 1414213562
 set g_ballistics_mindistance 16
+set g_ballistics_density_player 0.50 // players are 2x as easy to pass as walls
+set g_ballistics_density_corpse 0.10 // corpses are 10x as easy to pass as walls
 // unit: qJ / qu^3 (energy needed per volume unit of solid to push/burn away
 // parameter: bullet constant: mass / area in g/qu^2
 // = mass / (pi/4 * caliber^2)
index e9d9900ac28b5041326d7406f5e3cf4dba61e129..73c9169e5e6929341cca72c4f50377ec92c32125 100644 (file)
@@ -939,6 +939,7 @@ void PutClientInServer (void)
                self.nextthink = 0;
                self.hook_time = 0;
                self.dmg_team = 0;
+               self.ballistics_density = cvar("g_ballistics_density_player");
 
                self.metertime = 0;
 
index 7e73ea345bda2ef874b5baaaf88b752250d743cc..07c6b058b2475eead69dad1103e3d7d92fb40817 100644 (file)
@@ -621,6 +621,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                self.movetype = MOVETYPE_TOSS;
                // shootable corpse
                self.solid = SOLID_CORPSE;
+               self.ballistics_density = cvar("g_ballistics_density_corpse");
                // don't stick to the floor
                self.flags &~= FL_ONGROUND;
                // dying animation
index b487e3de77aa81cf455c54a68248f393cdc0aea1..41ca098b7796de764f4eb2c9ae3f8eb100201d2a 100644 (file)
@@ -641,3 +641,5 @@ string deathmessage;
 
 .float cvar_cl_weaponimpulsemode;
 .float selectweapon; // last selected weapon of the player
+
+.float ballistics_density; // wall piercing factor, larger = bullet can pass through more
index ec307528a0984f4bfdf64ab47d7c05c3532407d3..36552e930469f5361372bdc07b5505e99172acfb 100644 (file)
@@ -301,14 +301,20 @@ float W_BallisticBullet_LeaveSolid(entity e, vector vel, float constant)
 
 void W_BallisticBullet_Touch (void)
 {
+       float density;
+
        if(self.think == W_BallisticBullet_LeaveSolid_think) // skip this!
                return;
 
        PROJECTILE_TOUCH;
        W_BallisticBullet_Hit ();
 
+       density = other.ballistics_density;
+       if(density == 0)
+               density = 1;
+
        // go through solid!
-       if(!W_BallisticBullet_LeaveSolid(self, self.velocity, self.dmg_radius))
+       if(!W_BallisticBullet_LeaveSolid(self, self.velocity, self.dmg_radius * density))
        {
                remove(self);
                return;
@@ -332,7 +338,7 @@ void fireBallisticBullet_trace_callback(vector start, vector hit, vector end)
 
 void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float headshotbonus, float force, float dtype, float tracereffects, float gravityfactor, float bulletconstant)
 {
-       float lag, dt, savetime;
+       float lag, dt, savetime, density;
        entity pl, oldself;
 
        entity proj;
@@ -438,8 +444,12 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f
                                W_BallisticBullet_Hit();
                        }
 
+                       density = other.ballistics_density;
+                       if(density == 0)
+                               density = 1;
+
                        // go through solid!
-                       if(!W_BallisticBullet_LeaveSolid(self, self.velocity, self.dmg_radius))
+                       if(!W_BallisticBullet_LeaveSolid(self, self.velocity, self.dmg_radius * density))
                                break;
 
                        W_BallisticBullet_LeaveSolid_think();