]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/w_vortex.qc
Merge branch 'master' into Melanosuchus/minigames
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / w_vortex.qc
index b7cdc85a283219abf355f32f7562340e895dd78e..3c0d21354de46d73af552d758ab95f81bd293f10 100644 (file)
@@ -53,6 +53,8 @@ REGISTER_WEAPON(
 
 #ifdef SVQC
 VORTEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
+
+.float vortex_lasthit;
 #endif
 #else
 #ifdef SVQC
@@ -76,7 +78,7 @@ void SendCSQCVortexBeamParticle(float charge) {
 void W_Vortex_Attack(float issecondary)
 {
        float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge;
-       
+
        mydmg = WEP_CVAR_BOTH(vortex, !issecondary, damage);
        myforce = WEP_CVAR_BOTH(vortex, !issecondary, force);
        mymindist = WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_mindist);
@@ -107,10 +109,18 @@ void W_Vortex_Attack(float issecondary)
        }
 
        yoda = 0;
+       damage_goodhits = 0;
        FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX);
 
        if(yoda && flying)
-               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); 
+               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
+       if(damage_goodhits && self.vortex_lasthit)
+       {
+               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
+               damage_goodhits = 0; // only every second time
+       }
+
+       self.vortex_lasthit = damage_goodhits;
 
        //beam and muzzle flash done on client
        SendCSQCVortexBeamParticle(charge);
@@ -121,7 +131,7 @@ void W_Vortex_Attack(float issecondary)
 void spawnfunc_weapon_vortex(void); // defined in t_items.qc
 
 .float vortex_chargepool_pauseregen_finished;
-float W_Vortex(float req)
+bool W_Vortex(int req)
 {
        float dt;
        float ammo_amount;
@@ -142,7 +152,7 @@ float W_Vortex(float req)
                {
                        if(WEP_CVAR(vortex, charge) && self.vortex_charge < WEP_CVAR(vortex, charge_limit))
                                self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
-                               
+
                        if(WEP_CVAR_SEC(vortex, chargepool))
                                if(self.vortex_chargepool_ammo < 1)
                                {
@@ -237,7 +247,7 @@ float W_Vortex(float req)
                                        }
                                }
                        }
-                       
+
                        return true;
                }
                case WR_INIT:
@@ -251,7 +261,12 @@ float W_Vortex(float req)
                        precache_sound("weapons/nexwhoosh1.wav");
                        precache_sound("weapons/nexwhoosh2.wav");
                        precache_sound("weapons/nexwhoosh3.wav");
-                       VORTEX_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
+                       VORTEX_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
+               }
+               case WR_SETUP:
+               {
+                       self.vortex_lasthit = 0;
                        return true;
                }
                case WR_CHECKAMMO1:
@@ -276,7 +291,12 @@ float W_Vortex(float req)
                }
                case WR_CONFIG:
                {
-                       VORTEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
+                       VORTEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
+               }
+               case WR_RESETPLAYER:
+               {
+                       self.vortex_lasthit = 0;
                        return true;
                }
                case WR_RELOAD:
@@ -297,8 +317,8 @@ float W_Vortex(float req)
 }
 #endif
 #ifdef CSQC
-var float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO
-float W_Vortex(float req)
+float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO
+bool W_Vortex(int req)
 {
        switch(req)
        {
@@ -309,7 +329,7 @@ float W_Vortex(float req)
                        pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
                        if(!w_issilent)
                                sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
-                               
+
                        return true;
                }
                case WR_INIT: