Code: Select all
//=============================================================================
// TaryGun.
//=============================================================================
class TaryGun expands Stinger;
var bool bAlreadyFiring;
var() int hitdamage;
function float RateSelf( out int bUseAltMode )
{
local float EnemyDist;
if ( AmmoType.AmmoAmount EnemyDist - 140 );
return AIRating;
}
function PlayFiring()
{
if ( bAlreadyFiring )
{
AmbientSound = sound'StingerTwoFire';
SoundVolume = Pawn(Owner).SoundDampening*255;
LoopAnim( 'FireOne', 0.7);
}
else
{
Owner.PlaySound(FireSound, SLOT_Misc,2.0*Pawn(Owner).SoundDampening);
PlayAnim( 'FireOne', 0.7 );
}
bAlreadyFiring = true;
bWarnTarget = (FRand() < 0.2);
}
function PlayAltFiring()
{
Owner.PlaySound(AltFireSound, SLOT_Misc,2.0*Pawn(Owner).SoundDampening);
PlayAnim( 'FireOne', 0.6 );
}
///////////////////////////////////////////////////////
state NormalFire
{
function Tick( float DeltaTime )
{
if (Owner==None) AmbientSound=None;
else
SetLocation(Owner.Location);
}
function EndState()
{
if (AmbientSound!=None && Owner!=None) Owner.PlaySound(Misc1Sound, SLOT_Misc,2.0*Pawn(Owner).SoundDampening);
AmbientSound = None;
bAlreadyFiring = false;
Super.EndState();
}
Begin:
Sleep(0.2);
SetLocation(Owner.Location);
Finish();
}
///////////////////////////////////////////////////////////////
state AltFiring
{
function MeleeTargetting()
{
local vector HitLoc, HitNorm, End, X, Y, Z, Start;
local actor Other;
GetAxes(Pawn(Owner).ViewRotation, X, Y, Z);
Start = Owner.Location + CalcDrawOffset() + FireOffset.X * X
+ FireOffset.Y * Y + FireOffset.Z * Z;
AdjustedAim = Pawn(Owner).AdjustAim(1000000, Start, AimError, False, False);
End = Owner.Location + (100 * vector(AdjustedAim));
Other = Pawn(Owner).TraceShot(HitLoc, HitNorm, End, Start);
if (Other == Level)
Spawn(class'WallHitEffect',,, HitLoc+HitNorm*9, Rotator(HitNorm));
else if ((Other != self) && (Other != Owner) && (Other != None) )
{
if ( FRand() < 0.2 )
X *= 5;
Other.TakeDamage(HitDamage, Pawn(Owner), HitLoc, 3000.0*X, 'shot');
if ( !Other.IsA('Pawn') && !Other.IsA('Carcass') )
spawn(class'SpriteSmokePuff',,,HitLoc+HitNorm*9);
if ( Other.IsA('Brush') )
Spawn(class'WallHitEffect',,, HitLoc+HitNorm*9, Rotator(HitNorm));
}
}
Begin:
FinishAnim();
PlayAnim('Still');
Sleep(1.0);
Finish();
}
///////////////////////////////////////////////////////////
function PlayIdleAnim()
{
PlayAnim('Still');
}
