From: Mario Date: Sun, 23 Aug 2015 00:11:01 +0000 (+1000) Subject: Add a hook to allow hit sounds from custom entities X-Git-Tag: xonotic-v0.8.2~2057 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=adb2d69f779ab14c316ca8337894c29adcbeb272;p=xonotic%2Fxonotic-data.pk3dir.git Add a hook to allow hit sounds from custom entities --- 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) \