141 lines
4.3 KiB
Ucode
141 lines
4.3 KiB
Ucode
//=============================================================================
|
|
// SPShotgunFire
|
|
//=============================================================================
|
|
// Steampunk Shotgun Primary fire class
|
|
//=============================================================================
|
|
// Killing Floor Source
|
|
// Copyright (C) 2013 Tripwire Interactive LLC
|
|
// - John "Ramm-Jaeger" Gibson
|
|
//=============================================================================
|
|
class SPShotgunFire extends KFShotgunFire;
|
|
|
|
simulated function bool AllowFire()
|
|
{
|
|
if(KFWeapon(Weapon).bIsReloading)
|
|
return false;
|
|
if(KFPawn(Instigator).SecondaryItem!=none)
|
|
return false;
|
|
if(KFPawn(Instigator).bThrowingNade)
|
|
return false;
|
|
|
|
if(KFWeapon(Weapon).MagAmmoRemaining < 1)
|
|
{
|
|
if( Level.TimeSeconds - LastClickTime>FireRate )
|
|
{
|
|
LastClickTime = Level.TimeSeconds;
|
|
}
|
|
|
|
if( AIController(Instigator.Controller)!=None )
|
|
KFWeapon(Weapon).ReloadMeNow();
|
|
return false;
|
|
}
|
|
|
|
return super(WeaponFire).AllowFire();
|
|
}
|
|
|
|
function DoFireEffect()
|
|
{
|
|
local Vector StartProj, StartTrace, X,Y,Z;
|
|
local Rotator R, Aim;
|
|
local Vector HitLocation, HitNormal;
|
|
local Actor Other;
|
|
local int p;
|
|
local int SpawnCount;
|
|
local float theta;
|
|
|
|
Instigator.MakeNoise(1.0);
|
|
Weapon.GetViewAxes(X,Y,Z);
|
|
|
|
StartTrace = Instigator.Location + Instigator.EyePosition();// + X*Instigator.CollisionRadius;
|
|
StartProj = StartTrace + X*ProjSpawnOffset.X;
|
|
if ( !Weapon.WeaponCentered() && !KFWeap.bAimingRifle )
|
|
StartProj = StartProj + Weapon.Hand * Y*ProjSpawnOffset.Y + Z*ProjSpawnOffset.Z;
|
|
|
|
// check if projectile would spawn through a wall and adjust start location accordingly
|
|
Other = Weapon.Trace(HitLocation, HitNormal, StartProj, StartTrace, false);
|
|
|
|
// Collision attachment debugging
|
|
/* if( Other.IsA('ROCollisionAttachment'))
|
|
{
|
|
log(self$"'s trace hit "$Other.Base$" Collision attachment");
|
|
}*/
|
|
|
|
if (Other != None)
|
|
{
|
|
StartProj = HitLocation;
|
|
}
|
|
|
|
Aim = AdjustAim(StartProj, AimError);
|
|
|
|
SpawnCount = Max(1, ProjPerFire * int(Load));
|
|
|
|
switch (SpreadStyle)
|
|
{
|
|
case SS_Random:
|
|
X = Vector(Aim);
|
|
for (p = 0; p < SpawnCount; p++)
|
|
{
|
|
R.Yaw = Spread * (FRand()-0.5);
|
|
R.Pitch = Spread * (FRand()-0.5);
|
|
R.Roll = Spread * (FRand()-0.5);
|
|
SpawnProjectile(StartProj, Rotator(X >> R));
|
|
}
|
|
break;
|
|
case SS_Line:
|
|
for (p = 0; p < SpawnCount; p++)
|
|
{
|
|
theta = Spread*PI/32768*(p - float(SpawnCount-1)/2.0);
|
|
X.X = Cos(theta);
|
|
X.Y = Sin(theta);
|
|
X.Z = 0.0;
|
|
SpawnProjectile(StartProj, Rotator(X >> Aim));
|
|
}
|
|
break;
|
|
default:
|
|
SpawnProjectile(StartProj, Aim);
|
|
}
|
|
|
|
if (Instigator != none )
|
|
{
|
|
// Really boost the momentum for low grav. Weapon only gets momentum on low grav
|
|
if( Instigator.Physics == PHYS_Falling
|
|
&& Instigator.PhysicsVolume.Gravity.Z > class'PhysicsVolume'.default.Gravity.Z)
|
|
{
|
|
Instigator.AddVelocity((KickMomentum * 10.0) >> Instigator.GetViewRotation());
|
|
}
|
|
}
|
|
}
|
|
|
|
defaultproperties
|
|
{
|
|
KickMomentum=(X=-35.000000,Z=5.000000)
|
|
ProjPerFire=7
|
|
bAttachSmokeEmitter=True
|
|
TransientSoundVolume=2.0
|
|
TransientSoundRadius=500.000000
|
|
FireSoundRef="KF_SP_ZEDThrowerSnd.KFO_Shotgun_Primary_Fire_M"
|
|
StereoFireSoundRef="KF_SP_ZEDThrowerSnd.KFO_Shotgun_Primary_Fire_S"
|
|
NoAmmoSoundRef="KF_AA12Snd.AA12_DryFire"
|
|
FireRate=0.35
|
|
FireAnimRate=1.0
|
|
AmmoClass=Class'KFMod.SPShotgunAmmo'
|
|
ProjectileClass=Class'KFMod.SPShotgunBullet'
|
|
BotRefireRate=0.250000
|
|
FlashEmitterClass=Class'ROEffects.MuzzleFlash1stSPShotgun'
|
|
aimerror=1.000000
|
|
Spread=1500.0//1125.0//1500.000000
|
|
maxVerticalRecoilAngle=1000
|
|
maxHorizontalRecoilAngle=500
|
|
FireAimedAnim=Fire_Iron
|
|
|
|
//** View shake **//
|
|
ShakeOffsetMag=(X=6.0,Y=2.0,Z=6.0)
|
|
ShakeOffsetRate=(X=1000.0,Y=1000.0,Z=1000.0)
|
|
ShakeOffsetTime=1.25
|
|
ShakeRotMag=(X=50.0,Y=50.0,Z=250.0)
|
|
ShakeRotRate=(X=12500.0,Y=12500.0,Z=12500.0)
|
|
ShakeRotTime=3.0
|
|
bWaitForRelease=false
|
|
bRandomPitchFireSound=false
|
|
}
|