//=============================================================================
// Lockpick.
//=============================================================================
class ThiefsLockpick expands Lockpick;

var int animcnt;

Function Tick(Float DT)
{
	if(animcnt != 0)
	{
		animcnt += 1;

		if(animcnt > 10)
		{
			PlayAnim('Idle1');
			animcnt = 0;
		}
	}
	Super.Tick(DT);
}

simulated function bool TestMPBeltSpot(int BeltSpot)
{
   return ( (BeltSpot >= 1) && (BeltSpot <=9) );
}

function UseOnce()
{
}

Function LPAttack()
{
	if((!Owner.Region.Zone.IsA('ArenaZoneSafe')) && (!Owner.Region.Zone.IsA('MMRPGRoomArea')) && (!Owner.Region.Zone.IsA('MMRPGSafeArea')))
	{
		ProcessFireLine();
	}
}

function SpawnBlood(Vector HitLocation, Vector HitNormal)
{
   if ((DeusExMPGame(Level.Game) != None) && (!DeusExMPGame(Level.Game).bSpawnEffects))
      return;

   spawn(class'BloodSpurt',,,HitLocation+HitNormal);
	spawn(class'BloodDrop',,,HitLocation+HitNormal);
	if (FRand() < 0.5)
		spawn(class'BloodDrop',,,HitLocation+HitNormal);
}


simulated function ProcessFireLine()
{
	local vector StartTrace, EndTrace, HitLocation, HitNormal;
	local Actor HitActor;
	local Human H;

	H = Human(Owner);

	StartTrace = H.Location;
	EndTrace = H.Location + (64 * Vector(H.ViewRotation));
	StartTrace.Z += H.BaseEyeHeight;

	HitActor = H.Trace(HitLocation, HitNormal, EndTrace, StartTrace);
      
	HitActor = Pawn(Owner).TraceShot(HitLocation,HitNormal,EndTrace,StartTrace);

	if( (HitActor.IsA('Pawn')) && (!HitActor.IsA('HumanCivilian')) )
	{
		PlayJab();
		SpawnBlood(HitLocation, HitNormal);

		if ( Role == ROLE_Authority )
		{
			HitActor.TakeDamage(3, Pawn(Owner), HitLocation, HitNormal, 'Shot');
		}
	}
}

simulated function PlayJab()
{
	PlayAnim('UseBegin',, 0.1);
	animcnt = 1;
}
defaultproperties
{
	maxcopies=1
	Icon=Texture'ContenderStuff.Icons.BeltPick1'
}
