From: Rudolf Polzer Date: Fri, 21 May 2010 12:25:14 +0000 (+0200) Subject: make bullets go through 2x the distance when inside a player, and 10x when inside... X-Git-Tag: xonotic-v0.1.0preview~588 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7d1125a36e0a538ca3682c8abb1bab2a98692a1f;p=xonotic%2Fxonotic-data.pk3dir.git make bullets go through 2x the distance when inside a player, and 10x when inside a corpse (please test) --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 764782ed7..8766479bf 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 e9d9900ac..73c9169e5 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 7e73ea345..07c6b058b 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 b487e3de7..41ca098b7 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 ec307528a..36552e930 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();