From 6d93d99dfa4fc8495c1e3ed6e219d0909b9e437e Mon Sep 17 00:00:00 2001 From: Samual Date: Sun, 14 Aug 2011 16:54:28 -0400 Subject: [PATCH] Add a think function for the secondary grenade, this clears up the issue with func walls where the grenade could pass through without actually bouncing off of it -- it would also make the grenade "miss" its think function for some reason. Quite a weird bug, but doing this properly fixed it. --- qcsrc/server/w_grenadelauncher.qc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/qcsrc/server/w_grenadelauncher.qc b/qcsrc/server/w_grenadelauncher.qc index 1d2ee93b9..077318055 100644 --- a/qcsrc/server/w_grenadelauncher.qc +++ b/qcsrc/server/w_grenadelauncher.qc @@ -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; @@ -141,7 +153,7 @@ void W_Grenade_Touch2 (void) self.gl_bouncecnt += 1; if (autocvar_g_balance_grenadelauncher_secondary_lifetime_bounce && self.gl_bouncecnt == 1) - self.nextthink = time + autocvar_g_balance_grenadelauncher_secondary_lifetime_bounce; + 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 @@ -233,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; -- 2.39.2