167 lines
4.5 KiB
Ucode
167 lines
4.5 KiB
Ucode
//=============================================================================
|
|
// KSGFire
|
|
//=============================================================================
|
|
// KSG shotgun primary fire class
|
|
//=============================================================================
|
|
// Killing Floor Source
|
|
// Copyright (C) 2012 Tripwire Interactive LLC
|
|
// - John "Ramm-Jaeger" Gibson and IJC
|
|
//=============================================================================
|
|
class KSGFire extends KFShotgunFire;
|
|
|
|
var() class<Emitter> ShellEjectClass; // class of the shell eject emitter
|
|
var() Emitter ShellEjectEmitter; // The shell eject emitter
|
|
var() name ShellEjectBoneName; // name of the shell eject bone
|
|
|
|
event ModeDoFire()
|
|
{
|
|
local float Rec;
|
|
|
|
if (!AllowFire())
|
|
return;
|
|
|
|
Spread = Default.Spread;
|
|
|
|
Rec = GetFireSpeed();
|
|
FireRate = default.FireRate/Rec;
|
|
FireAnimRate = default.FireAnimRate*Rec;
|
|
Rec = 1;
|
|
|
|
if ( KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo) != none && KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo).ClientVeteranSkill != none )
|
|
{
|
|
Spread *= KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo).ClientVeteranSkill.Static.ModifyRecoilSpread(KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo), self, Rec);
|
|
}
|
|
|
|
// if wide spread is on give us some additional spread
|
|
if( KSGShotgun(Weapon) != none && KSGShotgun(Weapon).bWideSpread )
|
|
{
|
|
Spread *= 2.05;
|
|
}
|
|
|
|
if( !bFiringDoesntAffectMovement )
|
|
{
|
|
if (FireRate > 0.25)
|
|
{
|
|
Instigator.Velocity.x *= 0.1;
|
|
Instigator.Velocity.y *= 0.1;
|
|
}
|
|
else
|
|
{
|
|
Instigator.Velocity.x *= 0.5;
|
|
Instigator.Velocity.y *= 0.5;
|
|
}
|
|
}
|
|
|
|
super(BaseProjectileFire).ModeDoFire();
|
|
|
|
// client
|
|
if (Instigator.IsLocallyControlled())
|
|
{
|
|
HandleRecoil(Rec);
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
//log("Spread = "$Spread);
|
|
|
|
return super(WeaponFire).AllowFire();
|
|
}
|
|
|
|
simulated function InitEffects()
|
|
{
|
|
super.InitEffects();
|
|
|
|
// don't even spawn on server
|
|
if ( (Level.NetMode == NM_DedicatedServer) || (AIController(Instigator.Controller) != None) )
|
|
return;
|
|
if ( (ShellEjectClass != None) && ((ShellEjectEmitter == None) || ShellEjectEmitter.bDeleteMe) )
|
|
{
|
|
ShellEjectEmitter = Weapon.Spawn(ShellEjectClass);
|
|
Weapon.AttachToBone(ShellEjectEmitter, ShellEjectBoneName);
|
|
}
|
|
}
|
|
|
|
function DrawMuzzleFlash(Canvas Canvas)
|
|
{
|
|
super.DrawMuzzleFlash(Canvas);
|
|
// Draw shell ejects
|
|
if (ShellEjectEmitter != None )
|
|
{
|
|
Canvas.DrawActor( ShellEjectEmitter, false, false, Weapon.DisplayFOV );
|
|
}
|
|
}
|
|
|
|
function FlashMuzzleFlash()
|
|
{
|
|
super.FlashMuzzleFlash();
|
|
|
|
if (ShellEjectEmitter != None)
|
|
{
|
|
ShellEjectEmitter.Trigger(Weapon, Instigator);
|
|
}
|
|
}
|
|
|
|
simulated function DestroyEffects()
|
|
{
|
|
super.DestroyEffects();
|
|
|
|
if (ShellEjectEmitter != None)
|
|
ShellEjectEmitter.Destroy();
|
|
}
|
|
|
|
defaultproperties
|
|
{
|
|
KickMomentum=(X=-85.000000,Z=15.000000)
|
|
ProjPerFire=12
|
|
bAttachSmokeEmitter=True
|
|
TransientSoundVolume=2.0
|
|
TransientSoundRadius=500.000000
|
|
FireSoundRef="KF_KSGSnd.KSG_Fire_M"
|
|
StereoFireSoundRef="KF_KSGSnd.KSG_Fire_S"
|
|
NoAmmoSoundRef="KF_AA12Snd.AA12_DryFire"
|
|
FireRate=0.82
|
|
FireAnimRate=1.0
|
|
AmmoClass=Class'KFMod.KSGAmmo'
|
|
ProjectileClass=Class'KFMod.KSGBullet'
|
|
BotRefireRate=0.250000
|
|
FlashEmitterClass=Class'ROEffects.MuzzleFlash1stKar'
|
|
aimerror=1.000000
|
|
Spread=1000.0
|
|
maxVerticalRecoilAngle=1000
|
|
maxHorizontalRecoilAngle=500
|
|
FireAimedAnim=Fire_Iron
|
|
|
|
//** View shake **//
|
|
ShakeOffsetMag=(X=6.0,Y=2.0,Z=10.0)
|
|
ShakeOffsetRate=(X=1000.0,Y=1000.0,Z=1000.0)
|
|
ShakeOffsetTime=3.0
|
|
ShakeRotMag=(X=50.0,Y=50.0,Z=400.0)
|
|
ShakeRotRate=(X=12500.0,Y=12500.0,Z=12500.0)
|
|
ShakeRotTime=5.0
|
|
bWaitForRelease=false
|
|
|
|
ShellEjectClass=class'KFMod.KSGShellEject'
|
|
ShellEjectBoneName=Shell_eject
|
|
bRandomPitchFireSound=false
|
|
}
|