]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_grenadelauncher.qc
Add a think function for the secondary grenade, this clears up the issue with func...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_grenadelauncher.qc
index 0e03c953c077eb427dd8bd54d5ec6a0763afedc6..077318055c03cbf3f9fc24918a788073df24b1f0 100644 (file)
@@ -70,6 +70,18 @@ void W_Grenade_Think1 (void)
                W_Grenade_Explode();
 }
 
+void W_Grenade_Think2 (void)
+{
+       self.nextthink = time;
+       if (time > self.cnt)
+       {
+               other = world;
+               self.projectiledeathtype |= HITTYPE_BOUNCE;
+               W_Grenade_Explode2 ();
+               return;
+       }
+}
+
 void W_Grenade_Touch1 (void)
 {
        PROJECTILE_TOUCH;
@@ -110,7 +122,7 @@ void W_Grenade_Touch1 (void)
                // do not respond to any more touches
                self.solid = SOLID_NOT;
 
-               self.nextthink = min(self.nextthink, time + autocvar_g_balance_grenadelauncher_primary_lifetime2);
+               self.nextthink = min(self.nextthink, time + autocvar_g_balance_grenadelauncher_primary_lifetime_stick);
        }
 }
 
@@ -139,6 +151,10 @@ void W_Grenade_Touch2 (void)
                        spamsound (self, CH_SHOTS, "weapons/grenade_bounce6.wav", VOL_BASE, ATTN_NORM);
                self.projectiledeathtype |= HITTYPE_BOUNCE;
                self.gl_bouncecnt += 1;
+               
+               if (autocvar_g_balance_grenadelauncher_secondary_lifetime_bounce && self.gl_bouncecnt == 1)
+                       self.cnt = time + autocvar_g_balance_grenadelauncher_secondary_lifetime_bounce;
+                       
        }
        else if(autocvar_g_balance_grenadelauncher_secondary_type == 2 && (!other || (other.takedamage != DAMAGE_AIM && other.movetype == MOVETYPE_NONE))) // stick
        {
@@ -154,7 +170,7 @@ void W_Grenade_Touch2 (void)
                // do not respond to any more touches
                self.solid = SOLID_NOT;
 
-               self.nextthink = min(self.nextthink, time + autocvar_g_balance_grenadelauncher_secondary_lifetime2);
+               self.nextthink = min(self.nextthink, time + autocvar_g_balance_grenadelauncher_secondary_lifetime_stick);
        }
 }
 
@@ -229,8 +245,9 @@ void W_Grenade_Attack2 (void)
        setorigin(gren, w_shotorg);
        setsize(gren, '-3 -3 -3', '3 3 3');
 
-       gren.nextthink = time + autocvar_g_balance_grenadelauncher_secondary_lifetime;
-       gren.think = adaptor_think2use_hittype_splash;
+       gren.cnt = time + autocvar_g_balance_grenadelauncher_secondary_lifetime;
+       gren.nextthink = time;
+       gren.think = W_Grenade_Think2;
        gren.use = W_Grenade_Explode2;
        gren.touch = W_Grenade_Touch2;
 
@@ -310,7 +327,7 @@ float w_glauncher(float req)
                                        }
                                }
                                if(nadefound)
-                                       asound (self, CH_WEAPON_B, "weapons/rocket_det.wav", VOL_BASE, ATTN_NORM);
+                                       sound (self, CH_WEAPON_B, "weapons/rocket_det.wav", VOL_BASE, ATTN_NORM);
                        }
                        else if (weapon_prepareattack(1, autocvar_g_balance_grenadelauncher_secondary_refire))
                        {
@@ -367,7 +384,7 @@ float w_glauncher(float req)
                org2 = w_org + w_backoff * 12;
                pointparticles(particleeffectnum("grenade_explode"), org2, '0 0 0', 1);
                if(!w_issilent)
-                       asound(self, CH_SHOTS, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
+                       sound(self, CH_SHOTS, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
        }
        else if(req == WR_PRECACHE)
        {