]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/tracing.qc
Merge branch 'martin-t/mg-solidpen' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / tracing.qc
index 09e9eab980e7ad51c1859542af51da1ccbc19f65..06bebeba2746f09b57e3cc37e6f0c4c95075f5c5 100644 (file)
@@ -330,7 +330,7 @@ void fireBullet_trace_callback(vector start, vector hit, vector end)
        fireBullet_last_hit = NULL;
 }
 
-void fireBullet(entity this, .entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, entity tracer_effect)
+void fireBullet_antilag(entity this, .entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, entity tracer_effect, bool do_antilag)
 {
        dir = normalize(dir + randomvec() * spread);
        vector end = start + dir * max_shot_distance;
@@ -342,12 +342,7 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
        float damage_fraction = 1;
        float total_damage = 0;
 
-       float lag = ((IS_REAL_CLIENT(this)) ? ANTILAG_LATENCY(this) : 0);
-       if(lag < 0.001)
-               lag = 0;
-       bool noantilag = ((IS_CLIENT(this)) ? CS(this).cvar_cl_noantilag : false);
-       if(autocvar_g_antilag == 0 || noantilag)
-               lag = 0; // only do hitscan, but no antilag
+       float lag = ((do_antilag) ? antilag_getlag(this) : 0);
        if(lag)
                antilag_takeback_all(this, lag);
 
@@ -471,3 +466,8 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
        if(this)
                this.dphitcontentsmask = oldsolid;
 }
+
+void fireBullet(entity this, .entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, entity tracer_effect)
+{
+       fireBullet_antilag(this, weaponentity, start, dir, spread, max_solid_penetration, damage, force, dtype, tracer_effect, true);
+}