]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a nasty hook to customise impact effects
authorMario <mario@smbclan.net>
Thu, 12 Nov 2015 06:20:46 +0000 (16:20 +1000)
committerMario <mario@smbclan.net>
Thu, 12 Nov 2015 06:20:46 +0000 (16:20 +1000)
qcsrc/client/mutators/events.qh
qcsrc/common/effects/qc/damageeffects.qc

index 34f75b0ea1d5d331d0c801ff79177a75d8fcc1c5..baaba14aef2a0f6d5607f688f1d79192486f4d0c 100644 (file)
@@ -130,4 +130,11 @@ vector vbeam_shotorg;
 vector vbeam_endpos;
 MUTATOR_HOOKABLE(Particles_VortexBeam, EV_Particles_VortexBeam);
 
+/** Return true to not draw any impact effect */
+#define EV_Weapon_ImpactEffect(i, o) \
+       /**/ i(entity, w_hitwep) \
+       /**/
+entity w_hitwep;
+MUTATOR_HOOKABLE(Weapon_ImpactEffect, EV_Weapon_ImpactEffect);
+
 #endif
index 6cf7c1992d82d41f6f382e15f852d0d2bda43773..e77f63f69c8c19a8261f40075da5b2599d3e9d63 100644 (file)
@@ -4,6 +4,7 @@
 #ifdef CSQC
 #include "../../deathtypes/all.qh"
 #include "../../movetypes/movetypes.qh"
+#include "../../../client/mutators/events.qh"
 #include "../../vehicles/all.qh"
 #include "../../weapons/all.qh"
 #endif
@@ -423,8 +424,10 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                        w_backoff = -1 * normalize(force);
                setorigin(self, w_org + w_backoff * 2); // for sound() calls
 
-               if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) {
-                       hitwep.wr_impacteffect(hitwep);
+               if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
+               {
+                       if(!MUTATOR_CALLHOOK(Weapon_ImpactEffect, hitwep))
+                               hitwep.wr_impacteffect(hitwep);
                }
        }
 }