//=============================================================================
// 
//=============================================================================
class MMRPGCreditsProjectileTen extends DeusExProjectile;
	   
var Pawn PawnOwner;
var bool bOnWall;
var bool bHighlight;
var bool bOnceYe;
var bool bInUse;

simulated function BeginPlay()
{
	Super.BeginPlay();

	bStuck = True;
	bOnceYe = False;
}

simulated function Tick(float deltaTime)
{
	If(bOnWall)
	{
		bStuck = True;
	}
	Super.Tick(deltatime);
}

auto simulated state Flying
{
	simulated function ProcessTouch (Actor Other, Vector HitLocation)
	{
	local MMRPGCreditCard Inv2;
	local DeusExPlayer player2;

	if(bOnceYe)
	{
		return;
	}

	if(!bOnceYe)
	{

	bOnceYe = True;

	player2=DeusExPlayer(Other);

//		if (!bStuck)
//		{
		if (!bOnWall)
		{
			foreach AllActors(class'MMRPGCreditCard', Inv2)
			{
				if (Inv2.Owner == Player2)
				{
					if (Inv2.IsA('MMRPGCreditCard'))
					{
						foreach AllActors(class'MMRPGCreditCard', Inv2)
						{
							if (Inv2.Owner == player2)
							{
									Inv2.CreditAmount+=10;
									PawnOwner.ClientMessage("|p3Gave 10 credits to "$player2.PlayerReplicationInfo.PlayerName);
									bOnceYe = True;
									player2.ClientMessage("|p3Received 10 credits from "$PawnOwner.PlayerReplicationInfo.PlayerName);
								Destroy();
							}
						}
					}
				}
			}
		}
		}
	}

	simulated function HitWall(vector HitNormal, actor Wall)
	{
		if (bStickToWall)
		{
			Velocity = vect(0,0,0);
			Acceleration = vect(0,0,0);
			SetPhysics(PHYS_None);
//			bStuck = True;
			bOnWall = True;
		}
//		Super.HitWall(HitNormal, Wall);
	}
}

simulated function Timer()
{

}

function Frob(Actor Frobber, Inventory frobWith)
	{
	local DeusExPlayer player;
	local MMRPGCreditCard Inv;
	local Inventory SpawnObject;

	if(bInUse)
	{
		return;
	}

	if(!bInUse)
	{

	bInUse = True;

	player=DeusExPlayer(Frobber);

	if(player==None)
		return;

		Player.ClientMessage("10 credits added to your account");
		foreach AllActors(class'MMRPGCreditCard', Inv)
		{
			if (Inv.Owner == Player)
			{
				if (Inv.IsA('MMRPGCreditCard'))
				{
					foreach AllActors(class'MMRPGCreditCard', Inv)
					{
						if (Inv.Owner == player)
						{
							Inv.CreditAmount+=10;
						}
					}
				}
			}
		}




if (Level.NetMode != NM_Standalone)
	Destroy();
else			
	Destroy();
}}


defaultproperties
{
     bHighlight=True
     DamageType=None
     ItemName="10 Credits"
     bStickToWall=True
     ItemArticle="a"
     bIgnoresNanoDefense=True
     speed=650.000000
     MaxSpeed=650.000000
     maxRange=150
     AccurateRange=75
     Damage=0.000000
     MomentumTransfer=50000
//     Physics=PHYS_Falling
     ImpactSound=None
     ExplosionDecal=None
     LifeSpan=15.000000
     Mesh=LodMesh'DeusExItems.Credits'
     Skin=Texture'ContenderStuff.Skins.Cred3Tex'
     MultiSkins(0)=Texture'ContenderStuff.Skins.Cred3Tex'
     CollisionRadius=6.500000
     CollisionHeight=6.500000
}
