]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_shotgun.qc
Use a new function for movement
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_shotgun.qc
index 6c6658d931dc7431ca06380e0cd936feedd2a464..b5d5357e5f2a71de13d705325a36a0b6a5129047 100644 (file)
@@ -61,7 +61,7 @@ void W_Shotgun_Attack (void)
 void shotgun_meleethink (void)
 {
        // declarations
-       float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
+       float i, f, swing, swing_factor, swing_damage, meleetime, is_player, is_monster;
        entity target_victim;
        vector targpos;
 
@@ -102,15 +102,16 @@ void shotgun_meleethink (void)
                //te_customflash(targpos, 40,  2, '1 1 1');
                
                is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body");
+               is_monster = (trace_ent.flags & FL_MONSTER);
 
                if((trace_fraction < 1) // if trace is good, apply the damage and remove self
                        && (trace_ent.takedamage == DAMAGE_AIM)  
                        && (trace_ent != self.swing_alreadyhit)
-                       && (is_player || autocvar_g_balance_shotgun_secondary_melee_nonplayerdamage))
+                       && ((is_player || is_monster) || autocvar_g_balance_shotgun_secondary_melee_nonplayerdamage))
                {
                        target_victim = trace_ent; // so it persists through other calls
                        
-                       if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught.
+                       if(is_player || is_monster) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught.
                                swing_damage = (autocvar_g_balance_shotgun_secondary_damage * min(1, swing_factor + 1));
                        else
                                swing_damage = (autocvar_g_balance_shotgun_secondary_melee_nonplayerdamage * min(1, swing_factor + 1));
@@ -156,7 +157,7 @@ void shotgun_meleethink (void)
 
 void W_Shotgun_Attack2 (void)
 {
-       sound (self, CH_WEAPON_A, "weapons/shotgun_melee.wav", VOL_BASE, ATTN_NORM);
+       sound (self, CH_WEAPON_A, "weapons/shotgun_melee.wav", VOL_BASE, ATTEN_NORM);
        weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_shotgun_secondary_animtime, w_ready);
 
        entity meleetemp;
@@ -274,11 +275,11 @@ float w_shotgun(float req)
                if(!w_issilent && time - self.prevric > 0.25)
                {
                        if(w_random < 0.0165)
-                               sound(self, CH_SHOTS, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_SHOTS, "weapons/ric1.wav", VOL_BASE, ATTEN_NORM);
                        else if(w_random < 0.033)
-                               sound(self, CH_SHOTS, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_SHOTS, "weapons/ric2.wav", VOL_BASE, ATTEN_NORM);
                        else if(w_random < 0.05)
-                               sound(self, CH_SHOTS, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_SHOTS, "weapons/ric3.wav", VOL_BASE, ATTEN_NORM);
                        self.prevric = time;
                }
        }