From 205ba804089a9548c93fcefe144df3e00281ac21 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 3 Jun 2020 21:03:03 +1000 Subject: [PATCH] Add an announcement for the headshot --- notifications.cfg | 1 + qcsrc/common/notifications/all.inc | 2 ++ qcsrc/server/weapons/tracing.qc | 6 +++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/notifications.cfg b/notifications.cfg index 41f0706ea..10f2f8b03 100644 --- a/notifications.cfg +++ b/notifications.cfg @@ -20,6 +20,7 @@ seta notification_ANNCE_ACHIEVEMENT_ELECTROBITCH "2" "0 = disabled, 1 = enabled seta notification_ANNCE_ACHIEVEMENT_IMPRESSIVE "1" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled" seta notification_ANNCE_ACHIEVEMENT_YODA "1" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled" seta notification_ANNCE_BEGIN "2" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled" +seta notification_ANNCE_HEADSHOT "2" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled" seta notification_ANNCE_INSTAGIB_LASTSECOND "1" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled" seta notification_ANNCE_INSTAGIB_NARROWLY "1" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled" seta notification_ANNCE_INSTAGIB_TERMINATED "1" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled" diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index a9a2ee655..2c6a16d88 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -111,6 +111,8 @@ MSG_ANNCE_NOTIF(BEGIN, N__ALWAYS, "begin", CH_INFO, VOL_BASEVOICE, ATTEN_NONE) + MSG_ANNCE_NOTIF(HEADSHOT, N__ALWAYS, "headshot", CH_INFO, VOL_BASEVOICE, ATTEN_NONE) + MSG_ANNCE_NOTIF(KILLSTREAK_03, N_GNTLOFF, "03kills", CH_INFO, VOL_BASEVOICE, ATTEN_NONE) MSG_ANNCE_NOTIF(KILLSTREAK_05, N_GNTLOFF, "05kills", CH_INFO, VOL_BASEVOICE, ATTEN_NONE) MSG_ANNCE_NOTIF(KILLSTREAK_10, N_GNTLOFF, "10kills", CH_INFO, VOL_BASEVOICE, ATTEN_NONE) diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index b1dbd5d59..508f91be7 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -364,6 +364,7 @@ void fireBullet_antilag(entity this, .entity weaponentity, vector start, vector WarpZone_trace_forent = this; + bool headshot = false; // indicates that one of the hit targets was a headshot for (;;) { WarpZone_TraceBox_ThroughZone(start, '0 0 0', '0 0 0', end, false, WarpZone_trace_forent, NULL, fireBullet_trace_callback); @@ -414,7 +415,7 @@ void fireBullet_antilag(entity this, .entity weaponentity, vector start, vector if(headshot_multiplier && Headshot(hit, this, start, end)) { damage *= headshot_multiplier; - // TODO: sound/announcement + headshot = true; } bool gooddamage = accuracy_isgooddamage(this, hit); Damage(hit, this, this, damage * damage_fraction, dtype, weaponentity, start, force * dir * damage_fraction); @@ -475,6 +476,9 @@ void fireBullet_antilag(entity this, .entity weaponentity, vector start, vector Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -damage_fraction, dtype, 0, this); } + if(headshot) + Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_HEADSHOT); + if(lag) antilag_restore_all(this); -- 2.39.2