self.W_BallisticBullet_LeaveSolid_origin = trace_endpos;
- dst = vlen(trace_endpos - self.origin);
+ dst = max(cvar("g_ballistics_mindistance"), vlen(trace_endpos - self.origin));
// E(s) = E0 - constant * s, constant = area of bullet circle * material constant / mass
Es_m = E0_m - constant * dst;
if(Es_m <= 0)
PROJECTILE_TOUCH;
W_BallisticBullet_Hit ();
+ // if we hit "weapclip", bail out
+ //
+ // rationale of this check:
+ //
+ // any shader that is solid, nodraw AND trans is meant to clip weapon
+ // shots and players, but has no other effect!
+ //
+ // if it is not trans, it is caulk and should not have this side effect
+ //
+ // matching shaders:
+ // common/weapclip (intended)
+ // common/noimpact (is supposed to eat projectiles, but is erased farther above)
+ if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
+ if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID)
+ if not(trace_dphitcontents & DPCONTENTS_OPAQUE)
+ {
+ remove(self);
+ return;
+ }
+
density = other.ballistics_density;
if(density == 0)
density = 1;
{
float lag, dt, savetime, density;
entity pl, oldself;
+ float antilagging;
+
+ antilagging = (cvar("g_antilag_bullets") && (pSpeed >= cvar("g_antilag_bullets")));
entity proj;
proj = spawn();
proj.movetype = MOVETYPE_FLY;
proj.think = SUB_Remove;
proj.nextthink = time + lifetime; // min(pLifetime, vlen(world.maxs - world.mins) / pSpeed);
- W_SetupProjectileVelocityEx(proj, dir, v_up, pSpeed, 0, 0, spread);
+ W_SetupProjectileVelocityEx(proj, dir, v_up, pSpeed, 0, 0, spread, antilagging);
proj.angles = vectoangles(proj.velocity);
proj.dmg_radius = cvar("g_ballistics_materialconstant") / bulletconstant;
// so: bulletconstant = bullet mass / area of bullet circle
proj.oldvelocity = proj.velocity;
- if(cvar("g_antilag_bullets"))
- if(pSpeed >= cvar("g_antilag_bullets"))
+ other = proj; MUTATOR_CALLHOOK(EditProjectile);
+
+ if(antilagging)
{
float eff;
self.takedamage = DAMAGE_NO;
self.event_damage = SUB_Null;
self.owner = attacker;
+ self.realowner = attacker;
// do not explode NOW but in the NEXT FRAME!
// because recursive calls to RadiusDamage are not allowed