]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/tracing.qc
Roughly notify for vaporizer headshots
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / tracing.qc
index 508f91be7821c808a90625da29c821de83a63043..9fd07eb2e4920b4e5bd79542b7ebb07bd51ec5fb 100644 (file)
@@ -222,7 +222,7 @@ bool Headshot(entity targ, entity ent, vector start, vector end)
        return trace_hits_box(start, end, headmins, headmaxs);
 }
 
-void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector end, float bdamage, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, int deathtype)
+void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector end, float bdamage, bool headshot_notify, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, int deathtype)
 {
        vector dir = normalize(end - start);
        vector force = dir * bforce;
@@ -231,6 +231,7 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector
        end = end + dir;
 
        float totaldmg = 0;
+       bool headshot = false; // indicates that one of the targets hit was a headshot
 
        // trace multiple times until we hit a wall, each obstacle will be made
        // non-solid so we can hit the next, while doing this we spawn effects and
@@ -255,6 +256,9 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector
                if (trace_ent == NULL || trace_fraction == 1)
                        break;
 
+               if(headshot_notify && !headshot && Headshot(trace_ent, this, start, end))
+                       headshot = true;
+
                // make the entity non-solid so we can hit the next one
                IL_PUSH(g_railgunhit, trace_ent);
                trace_ent.railgunhit = true;
@@ -324,6 +328,9 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector
 
        IL_CLEAR(g_railgunhit);
 
+       if(headshot)
+               Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_HEADSHOT);
+
        // calculate hits and fired shots for hitscan
        if(this.(weaponentity))
                accuracy_add(this, this.(weaponentity).m_weapon, 0, min(bdamage, totaldmg));