]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a few more mutator hooks to handle custom projectiles
authorMario <zacjardine@y7mail.com>
Mon, 24 Aug 2015 02:26:11 +0000 (12:26 +1000)
committerMario <zacjardine@y7mail.com>
Mon, 24 Aug 2015 02:26:11 +0000 (12:26 +1000)
qcsrc/client/mutators/events.qh
qcsrc/client/weapons/projectile.qc
qcsrc/common/constants.qh

index 8f317c8e8a6f042476a887fbeb1869bc2b7841a7..893765a7e1f85e322e768c73055183079b68d102 100644 (file)
@@ -49,4 +49,19 @@ MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS);
     /**/
 MUTATOR_HOOKABLE(CSQC_Parse_TempEntity, EV_CSQC_Parse_TempEntity);
 
+/** Called when a projectile is linked with CSQC */
+#define EV_Ent_Projectile(i, o) \
+    /** entity id */ i(entity, self) \
+    /**/
+MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile);
+
+/** Called when a projectile's properties are being modified */
+#define EV_EditProjectile(i, o) \
+    /** entity id */ i(entity, self) \
+    /**/
+MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
+
+/* Called when projectiles are precached */
+MUTATOR_HOOKABLE(PrecacheProjectiles, EV_NO_ARGS);
+
 #endif
index 4e1544be84513d97837464ae7419aa497271836d..1d0083e28e2ce7a40ac2b04981a390331943c25e 100644 (file)
@@ -318,6 +318,9 @@ void Ent_Projectile()
                        case PROJECTILE_RPC: setmodel(self, "models/weapons/ok_rocket.md3");self.traileffect = particleeffectnum("TR_ROCKET"); break;
 
                        default:
+                               if(MUTATOR_CALLHOOK(Ent_Projectile, self))
+                                       break;
+
                                if (Nade_FromProjectile(self.cnt) != NADE_TYPE_NULL)
                                {
                                        setmodel(self, "models/weapons/v_ok_grenade.md3");
@@ -470,6 +473,8 @@ void Ent_Projectile()
                                self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
                }
 
+               MUTATOR_CALLHOOK(EditProjectile, self);
+
                setsize(self, self.mins, self.maxs);
        }
 
@@ -520,4 +525,5 @@ void Projectile_Precache()
        precache_sound("weapons/fireball_fly2.wav");
        precache_sound("weapons/tag_rocket_fly.wav");
 
+       MUTATOR_CALLHOOK(PrecacheProjectiles);
 }
index 231046d6dd32aa3ff09cad16deb121984e69085b..1e77197f6f62cd731fd6438924c1c91ed3d3dcfa 100644 (file)
@@ -296,6 +296,8 @@ const int PROJECTILE_BUMBLE_BEAM = 31;
 const int PROJECTILE_MAGE_SPIKE = 32;
 const int PROJECTILE_SHAMBLER_LIGHTNING = 33;
 
+// projectile IDs 40-50 reserved
+
 const int PROJECTILE_RPC = 60;
 
 const int SPECIES_HUMAN = 0;