From adb2d69f779ab14c316ca8337894c29adcbeb272 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 23 Aug 2015 10:11:01 +1000 Subject: [PATCH] Add a hook to allow hit sounds from custom entities --- qcsrc/server/g_damage.qc | 2 +- qcsrc/server/mutators/events.qh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 42a45b507..1f10217a1 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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) { diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index ab652d1b4..88c58f309 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -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) \ -- 2.39.2