]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a hook to allow hit sounds from custom entities
authorMario <zacjardine@y7mail.com>
Sun, 23 Aug 2015 00:11:01 +0000 (10:11 +1000)
committerMario <zacjardine@y7mail.com>
Sun, 23 Aug 2015 00:11:01 +0000 (10:11 +1000)
qcsrc/server/g_damage.qc
qcsrc/server/mutators/events.qh

index 42a45b50722d9289621ca13ed9763eeba2518675..1f10217a16a5836bd885cd9cbd368787e10c5e08 100644 (file)
@@ -845,7 +845,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                        else
                                victim = targ;
 
-                       if(IS_PLAYER(victim) || IS_TURRET(victim) || IS_MONSTER(victim))
+                       if(IS_PLAYER(victim) || IS_TURRET(victim) || IS_MONSTER(victim) || MUTATOR_CALLHOOK(PlayHitsound, victim))
                        {
                                if(DIFF_TEAM(victim, attacker) && !victim.frozen)
                                {
index ab652d1b4f661df4e69acec055a40a2be7296fab..88c58f3094db0b925e93e1c0b10c6217fb5d47f3 100644 (file)
@@ -56,6 +56,13 @@ entity frag_target;
 int frag_deathtype;
 MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
 
+/** called when a player dies to e.g. remove stuff he was carrying. */
+#define EV_PlayHitsound(i, o) \
+    /**/ i(entity, frag_victim) \
+    /**/
+entity frag_victim;
+MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
+
 /** called when a player presses the jump key */
 #define EV_PlayerJump(i, o) \
     /**/ i(float, player_multijump) \