From: Mario Date: Fri, 28 Aug 2015 07:01:21 +0000 (+1000) Subject: Add a mutator hook to customize bullets X-Git-Tag: xonotic-v0.8.2~2007 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a915e2e4edce0f3e5f1df6a12b2a356f45f6b446;p=xonotic%2Fxonotic-data.pk3dir.git Add a mutator hook to customize bullets --- diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index fb3fbd107..2d10ee01c 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -547,4 +547,20 @@ MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS); /**/ string checkmodel_input, checkmodel_command; MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams); + +/** called when a bullet has hit a target */ +#define EV_FireBullet_Hit(i, o) \ + /**/ i(entity, self) \ + /**/ i(entity, bullet_hit) \ + /**/ i(vector, bullet_startpos) \ + /**/ i(vector, bullet_endpos) \ + /**/ i(float, frag_damage) \ + /**/ o(float, frag_damage) \ + /**/ +entity bullet_hit; +//vector bullet_hitloc; // the end pos matches the hit location, apparently +vector bullet_startpos; +vector bullet_endpos; +//float frag_damage; +MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit); #endif diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index 484ac35be..5065b4af1 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -422,6 +422,8 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat { fireBullet_last_hit = hit; yoda = 0; + MUTATOR_CALLHOOK(FireBullet_Hit, self, hit, start, end, damage); + damage = frag_damage; float g = accuracy_isgooddamage(self, hit); Damage(hit, self, self, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left); // calculate hits for ballistic weapons