//=============================================================================
// LightSwitch.
//=============================================================================
class RPGLightSwitch extends DeusExDecoration;

var bool bOn;
var FuseBox Box;
var Name LeetName;

function tick(float deltatime)
{
/*	if ( (bon) && (!box.binuse) )
	{
		Super.Frob(None, None);
		PlayAnim('Off');
		bOn = !bOn;
	}*/
	super.tick(deltatime);
}

function PostBeginPlay()
{/*
	local FuseBox fuse;

	LeetName = Tag;

	ForEach Allactors (class'FuseBox', fuse)
	{
		//if (Event == fuse.BoxName)
		if (fuse.BoxName == LeetName)
		{
			Box = Fuse;
		}
	}
	Box.bInUse = True;*/
	Super.PostBeginPlay();
}


function Frob(Actor Frobber, Inventory frobWith)
{
	Super.Frob(Frobber, frobWith);

	if (bOn)
	{
		PlaySound(sound'Switch4ClickOff');
		PlayAnim('Off');
	}
	else
	{
		PlaySound(sound'Switch4ClickOn');
		PlayAnim('On');
	}
	bOn = !bOn;
}

/*
{
	local float rnd;

	If (!Box.bInuse)
	{
		DeusExPlayer(Frobber).ClientMessage("The fusebox needs to be fixed!");
		return;
	}

	If (Box.bInuse)
	{
		rnd = FRand();

		if (rnd < 0.09)
		{
			DeusExPlayer(Frobber).ClientMessage("You have blown the fusebox!");
			Box.bInUse = False;
			return;
		}
		else if (rnd >= 0.09)
		{
			Super.Frob(Frobber, frobWith);


			if (bOn)
			{
				PlaySound(sound'Switch4ClickOff');
				PlayAnim('Off');
			}
			else
			{
				PlaySound(sound'Switch4ClickOn');
				PlayAnim('On');
			}

			bOn = !bOn;
		}
	}
}*/


defaultproperties
{
     bInvincible=True
     ItemName="Switch"
     bPushable=False
     Physics=PHYS_None
     Mesh=LodMesh'DeusExDeco.LightSwitch'
     CollisionRadius=3.750000
     CollisionHeight=6.250000
     Mass=30.000000
     Buoyancy=40.000000
}
