Code: Select all
version "3.2.5"
class SimpleStrifeGrenadeLauncherBase : StrifeWeapon
{
action void A_CustomGrenade (class<Actor> grenadetype, double angleofs, statelabel flash, bool useammo = true)
{
if (player == null)
{
return;
}
Weapon weapon = player.ReadyWeapon;
if (weapon != null)
{
if (!weapon.DepleteAmmo (weapon.bAltFire))
return;
player.SetPsprite (PSP_FLASH, weapon.FindState(flash), true);
}
if (grenadetype != null)
{
AddZ(32);
Actor grenade = SpawnSubMissile (grenadetype, self);
AddZ(-32);
if (grenade == null)
return;
if (grenade.SeeSound != 0)
{
grenade.A_PlaySound (grenade.SeeSound, CHAN_VOICE);
}
grenade.Vel.Z = (-clamp(tan(Pitch), -5, 5)) * grenade.Speed + 8;
Vector2 offset = AngleToVector(angle, radius + grenade.radius);
double an = Angle + angleofs;
offset += AngleToVector(an, 15);
grenade.SetOrigin(grenade.Vec3Offset(offset.X, offset.Y, 0.), false);
}
}
}