]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Delete casings that spawn in a solid to avoid glitchy behaviour
authorbones_was_here <bones_was_here@xonotic.au>
Sat, 24 Dec 2022 11:42:35 +0000 (21:42 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 24 Dec 2022 11:43:21 +0000 (21:43 +1000)
This is cheaper on CPU time than doing it on the server since the client
performs the trace anyway

qcsrc/common/effects/qc/casings.qc

index 28789ff29e464328407c3b679e539b5bf099abe9..3de21aeda4e9f239a65fb3c229307eaad81a5ba7 100644 (file)
@@ -82,9 +82,19 @@ void Casing_Draw(entity this)
         return;
     }
 
+    trace_startsolid = 0; // due to cl_casings_ticrate, traces are not always performed
     Movetype_Physics_MatchTicrate(this, autocvar_cl_casings_ticrate, autocvar_cl_casings_sloppy);
     //if (wasfreed(this))
     //    return; // deleted by touch function
+
+    // prevent glitchy casings when the gun model is poking into a wall
+    // doing this here is cheaper than doing it on the server as the client performs the trace anyway
+    if (trace_startsolid)
+    {
+        delete(this);
+        this.drawmask = 0;
+        return;
+    }
 }
 
 SOUND(BRASS1, W_Sound("brass1"));