]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Roughly notify for vaporizer headshots
authorMario <mario.mario@y7mail.com>
Wed, 3 Jun 2020 11:40:05 +0000 (21:40 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 3 Jun 2020 11:40:05 +0000 (21:40 +1000)
qcsrc/common/mutators/mutator/overkill/oknex.qc
qcsrc/common/turrets/turret/plasma.qc
qcsrc/common/turrets/turret/plasma_dual.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/tracing.qh

index ca44a070a0cf99c2db176642d49cd07efaa34bfc..55afbe45c1112e4f2fdf04632f62dd71becdbbb5 100644 (file)
@@ -95,7 +95,7 @@ void W_OverkillNex_Attack(Weapon thiswep, entity actor, .entity weaponentity, fl
 
        yoda = 0;
        damage_goodhits = 0;
-       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, thiswep.m_id);
+       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, mydmg, true, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, thiswep.m_id);
 
        if(yoda && flying)
                Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
index 89ddfbd4f1ca6a28df7f9d45339b016d01923144..98426c9c33ef7b3bf43850099bc29a98101513dd 100644 (file)
@@ -9,7 +9,7 @@ METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this, entity it))
     if(MUTATOR_IS_ENABLED(mutator_instagib))
     {
         .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-        FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000,
+        FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000, false,
                            800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id);
 
         Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, it.tur_shotorg, it.tur_shotdir_updated * 1000, 1);
index 9fa10eefff01e8a2c7cf0a9cbd305014f7be13e4..1aee6f5c4a501e53cdc9eebf331678568a9a3a37 100644 (file)
@@ -8,7 +8,7 @@ METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret thistur, entity it))
 {
     if (MUTATOR_IS_ENABLED(mutator_instagib)) {
         .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-        FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000,
+        FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000, false,
                            800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id);
 
 
index e71ed7478a327227a021e91491aaf352bec50784..ce4d1f67acf11610df61be6e90f9c68374c1f6eb 100644 (file)
@@ -124,7 +124,7 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 
        yoda = 0;
        damage_goodhits = 0;
-       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, WEP_CVAR_PRI(vaporizer, force), 0, 0, 0, 0, thiswep.m_id);
+       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, true, WEP_CVAR_PRI(vaporizer, force), 0, 0, 0, 0, thiswep.m_id);
 
        // do this now, as goodhits is disabled below
        SendCSQCVaporizerBeamParticle(actor, damage_goodhits);
index 46fd4d8c0887639b8b8c32e8b116c0f60ff4538e..a6207ea06532b1a002e73c45e3c1b1f6c4d22eb6 100644 (file)
@@ -139,7 +139,7 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, .entity weaponentity, float i
 
        yoda = 0;
        damage_goodhits = 0;
-       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, dtype);
+       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, mydmg, false, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, dtype);
 
        if(yoda && flying)
                Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
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));
index b622b25d95932b3c515c81d8bff1d3c266accdb6..e2f43fb7c13dfb9c2c521432318fd2a2c6210fc6 100644 (file)
@@ -64,7 +64,7 @@ void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float p
 
 .float railgundistance;
 .vector railgunforce;
-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);
 
 entity fireBullet_trace_callback_eff;
 entity fireBullet_last_hit;