//=============================================================================
// Introducing... Wildcards Rubber Suit
// Counters: Combo Whores
// 
// Because I really hate people who abuse the asmd shock rifle combo!
// It annoys the piss out of me when you cant even leave your base without being combo whored.
// People who only use the combo whore as offense really annoy the piss out of me!
// 
// Well time to change weapons! if you try to combo whore anyone whearing this handy Rubber Suit 
// it won't do any damage at all! XD The most you will do is move them. This suit also makes you 
// invulnerable to bio also so you don't acidentally kill your own dumbass when attacking the
// enemy base.
// 
// Also this can be combined with the metal suit for ultimate protection!
// Any problems or questions? email: wildcardisnotanoob@email.com
//=============================================================================
class WildcardsRubberSuit expands TournamentPickup;

function MakePlayerShiney(bool shiney)
{
	local Inventory OtherSuits;

	OtherSuits = Pawn(Owner).FindInventoryType(class'WildcardsMetalSuit');

	if (shiney == true)
		{
			if ( Pawn(Owner).Weapon != None )
				if ( OtherSuits == none )
					{
						Owner.SetDisplayProperties(ERenderStyle.STY_Normal,Texture,true,true);
						Pawn(Owner).Weapon.SetDisplayProperties
						(ERenderStyle.STY_Normal,Texture,true,true);
					}
				else
					{
						Owner.SetDisplayProperties(ERenderStyle.STY_Normal,Texture'RubberMetalSuitHybrid',true,true);
						Pawn(Owner).Weapon.SetDisplayProperties
						(ERenderStyle.STY_Normal,Texture'RubberMetalSuitHybrid',true,true);
					}
		}
	else
		{
			if ( OtherSuits == none )
				{
					Pawn(Owner).SetDefaultDisplayProperties();
					Pawn(Owner).Weapon.SetDefaultDisplayProperties();
				}
			else
				{
					Owner.SetDisplayProperties(ERenderStyle.STY_Normal,OtherSuits.Texture,true,true);
					Pawn(Owner).Weapon.SetDisplayProperties(ERenderStyle.STY_Normal,OtherSuits.Texture,true,true);
				}
		}
}

	function EndState()
	{
		MakePlayerShiney(false);
	}

	function BeginState()
	{
		local Inventory OtherSuits;

		// Well everyone bitched and whined enough so I will make it so you can no longer have both suits
		OtherSuits = Pawn(Owner).FindInventoryType(class'WildcardsMetalSuit');
		if ( OtherSuits != none )
		{
			OtherSuits.destroy();
			OtherSuits = None;
		}

		// Fine... no jetpacks either....
		OtherSuits = Pawn(Owner).FindInventoryType(class'Jetpack');
		if ( OtherSuits != none )
		{
			OtherSuits.destroy();
			OtherSuits = None;
		}

		MakePlayerShiney(true);
	}

	function ChangedWeapon()
	{
		if( Inventory != None )
			MakePlayerShiney(true);
	}

function bool HandlePickupQuery( inventory Item )
{
	local inventory S;

	if ( item.class == class ) 
	{
		S = Pawn(Owner).FindInventoryType(class'UT_Shieldbelt');	
		if (  S==None )
		{
			if ( Charge<Item.Charge )	
				Charge = Item.Charge;
		}
		else
			Charge = Clamp(S.Default.Charge - S.Charge, Charge, Item.Charge );
		if (Level.Game.LocalLog != None)
			Level.Game.LocalLog.LogPickup(Item, Pawn(Owner));
		if (Level.Game.WorldLog != None)
			Level.Game.WorldLog.LogPickup(Item, Pawn(Owner));
		if ( PickupMessageClass == None )
			Pawn(Owner).ClientMessage(PickupMessage, 'Pickup');
		else
			Pawn(Owner).ReceiveLocalizedMessage( PickupMessageClass, 0, None, None, Self.Class );
		Item.PlaySound (PickupSound,,2.0);
		Item.SetReSpawn();
		return true;				
	}
	if ( Inventory == None )
		return false;

	return Inventory.HandlePickupQuery(Item);
}

function inventory SpawnCopy( pawn Other )
{
	local inventory Copy, S;

	Copy = Super.SpawnCopy(Other);
	S = Other.FindInventoryType(class'UT_Shieldbelt');	
	if ( S != None )
	{
		Copy.Charge = Min(Copy.Charge, S.Default.Charge - S.Charge);
		if ( Copy.Charge <= 0 )
		{ 
			S.Charge -= 1;
			Copy.Charge = 1;
		}
	}
	return Copy;
}

defaultproperties
{
    PickupMessage="You found the Rubber Suit"
    RespawnTime=80.00
    PickupViewMesh=LodMesh'UnrealI.AsbSuit'
    ProtectionType1=jolted
    ProtectionType2=Corroded
    Charge=75
    ArmorAbsorption=65
    bIsAnArmor=True
    AbsorptionPriority=5
    MaxDesireability=1.15
    PickupSound=Sound'UnrealShare.Pickups.suitsnd'
    RespawnSound=Sound'SiegeUltimateRC7UB01Media.U.PickUpRespawn'
    Texture=Texture'SiegeUltimateRC7UB01Media.U.RubberSuitSkin'
    Mesh=LodMesh'UnrealI.AsbSuit'
    bUnlit=True
    bMeshEnviroMap=True
}
