Add a mutator hook for CopyBody
authorMario <mario@smbclan.net>
Sun, 21 Aug 2016 01:31:19 +0000 (11:31 +1000)
committerMario <mario@smbclan.net>
Sun, 21 Aug 2016 01:31:19 +0000 (11:31 +1000)
qcsrc/server/cl_player.qc
qcsrc/server/mutators/events.qh

index 1ae97c99e5c23020ea6d79fcbd567ce21f721d4f..b6c258b046e49fb04d0f76f0272720cc246d1f74 100644 (file)
@@ -125,6 +125,8 @@ void CopyBody(entity this, float keepvelocity)
        // "bake" the current animation frame for clones (they don't get clientside animation)
        animdecide_load_if_needed(clone);
        animdecide_setframes(clone, false, frame, frame1time, frame2, frame2time);
+
+       MUTATOR_CALLHOOK(CopyBody, this, clone, keepvelocity);
 }
 
 void player_setupanimsformodel(entity this)
index 29b1b7abd4094c7e3e2b269717008e12e2c7936b..1c0985723000b0a5580f54a090df46f0b2c17e85 100644 (file)
@@ -854,3 +854,11 @@ MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
     /**/
 MUTATOR_HOOKABLE(ForbidWeaponUse, EV_ForbidWeaponUse);
+
+/** called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here) */
+#define EV_CopyBody(i, o) \
+    /** player */               i(entity, MUTATOR_ARGV_0_entity) \
+    /** newly created clone */  i(entity, MUTATOR_ARGV_1_entity) \
+    /** keepvelocity? */        i(bool, MUTATOR_ARGV_2_bool) \
+    /**/
+MUTATOR_HOOKABLE(CopyBody, EV_CopyBody);