#ifdef REGISTER_WEAPON
REGISTER_WEAPON(GRENADE_LAUNCHER, w_glauncher, IT_ROCKETS, 4, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "gl", "grenadelauncher", "Mortar");
#else
+#ifdef SVQC
void W_Grenade_Explode (void)
{
if(other.takedamage == DAMAGE_AIM)
remove (self);
}
+void W_Grenade_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+{
+ if (self.health <= 0)
+ return;
+ self.health = self.health - damage;
+ if (self.health <= 0)
+ {
+ W_PrepareExplosionByDamage(attacker, self.think);
+ }
+}
+
void W_Grenade_Touch1 (void)
{
PROJECTILE_TOUCH;
- W_Grenade_Explode ();
+ if(cvar("g_balance_grenadelauncher_primary_sticky") && other.takedamage != DAMAGE_AIM)
+ {
+ spamsound (self, CHAN_PROJECTILE, "weapons/grenade_stick.wav", VOL_BASE, ATTN_NORM);
+
+ // let it stick whereever it is
+ self.velocity = '0 0 0';
+ self.movetype = MOVETYPE_NONE; // also disables gravity
+ self.gravity = 0; // nope, it does NOT! maybe a bug in CSQC code? TODO
+ UpdateCSQCProjectile(self);
+
+ // do not respond to any more touches
+ self.solid = SOLID_NOT;
+
+ self.nextthink = min(self.nextthink, time + cvar("g_balance_grenadelauncher_primary_lifetime2"));
+ }
+ else
+ W_Grenade_Explode ();
}
void W_Grenade_Touch2 (void)
}
}
-void W_Grenade_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
-{
- if (self.health <= 0)
- return;
- self.health = self.health - damage;
- if (self.health <= 0)
- {
- W_PrepareExplosionByDamage(attacker, self.think);
- }
-}
-
void W_Grenade_Attack (void)
{
local entity gren;
setsize(gren, '0 0 -3', '0 0 -3');
gren.nextthink = time + cvar("g_balance_grenadelauncher_primary_lifetime");
- gren.think = adaptor_think2use;
+ gren.think = adaptor_think2use_hittype_splash;
gren.use = W_Grenade_Explode;
gren.touch = W_Grenade_Touch1;
+
+ gren.takedamage = DAMAGE_YES;
+ gren.health = cvar("g_balance_grenadelauncher_primary_health");
+ gren.event_damage = W_Grenade_Damage;
W_SETUPPROJECTILEVELOCITY_UP(gren, g_balance_grenadelauncher_primary);
gren.angles = vectoangles (gren.velocity);
gren.bouncestop = cvar("g_balance_grenadelauncher_secondary_bouncestop");
PROJECTILE_MAKETRIGGER(gren);
gren.projectiledeathtype = WEP_GRENADE_LAUNCHER | HITTYPE_SECONDARY;
- setsize(gren, '0 0 -3', '0 0 -3');
setorigin(gren, w_shotorg);
+ setsize(gren, '0 0 -3', '0 0 -3');
gren.nextthink = time + cvar("g_balance_grenadelauncher_secondary_lifetime");
- gren.think = adaptor_think2use;
+ gren.think = adaptor_think2use_hittype_splash;
gren.use = W_Grenade_Explode2;
gren.touch = W_Grenade_Touch2;
+
gren.takedamage = DAMAGE_YES;
gren.health = cvar("g_balance_grenadelauncher_secondary_health");
gren.damageforcescale = cvar("g_balance_grenadelauncher_secondary_damageforcescale");
{
precache_model ("models/weapons/g_gl.md3");
precache_model ("models/weapons/v_gl.md3");
- precache_model ("models/weapons/h_gl.dpm");
+ precache_model ("models/weapons/h_gl.iqm");
precache_sound ("weapons/grenade_bounce1.wav");
precache_sound ("weapons/grenade_bounce2.wav");
precache_sound ("weapons/grenade_bounce3.wav");
precache_sound ("weapons/grenade_bounce4.wav");
precache_sound ("weapons/grenade_bounce5.wav");
precache_sound ("weapons/grenade_bounce6.wav");
+ precache_sound ("weapons/grenade_stick.wav");
precache_sound ("weapons/grenade_fire.wav");
}
else if (req == WR_SETUP)
return self.ammo_rockets >= cvar("g_balance_grenadelauncher_primary_ammo");
else if (req == WR_CHECKAMMO2)
return self.ammo_rockets >= cvar("g_balance_grenadelauncher_secondary_ammo");
+ return TRUE;
+};
+#endif
+#ifdef CSQC
+float w_glauncher(float req)
+{
+ if(req == WR_IMPACTEFFECT)
+ {
+ vector org2;
+ org2 = w_org + w_backoff * 12;
+ pointparticles(particleeffectnum("grenade_explode"), org2, '0 0 0', 1);
+ if(!w_issilent)
+ sound(self, CHAN_PROJECTILE, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
+ }
+ else if(req == WR_PRECACHE)
+ {
+ precache_sound("weapons/grenade_impact.wav");
+ }
else if (req == WR_SUICIDEMESSAGE)
{
if(w_deathtype & HITTYPE_SECONDARY)
w_deathtypestring = "ate #'s grenade";
}
return TRUE;
-};
+}
+#endif
#endif