From 7d1125a36e0a538ca3682c8abb1bab2a98692a1f Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Fri, 21 May 2010 14:25:14 +0200 Subject: [PATCH] make bullets go through 2x the distance when inside a player, and 10x when inside a corpse (please test) --- defaultXonotic.cfg | 2 ++ qcsrc/server/cl_client.qc | 1 + qcsrc/server/cl_player.qc | 1 + qcsrc/server/defs.qh | 2 ++ qcsrc/server/w_common.qc | 16 +++++++++++++--- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 764782ed75..8766479bf6 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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) diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index e9d9900ac2..73c9169e5e 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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; diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 7e73ea345b..07c6b058b2 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -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 diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index b487e3de77..41ca098b77 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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 diff --git a/qcsrc/server/w_common.qc b/qcsrc/server/w_common.qc index ec307528a0..36552e9304 100644 --- a/qcsrc/server/w_common.qc +++ b/qcsrc/server/w_common.qc @@ -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(); -- 2.39.5