class NuclearMiniShockI expands Effects;

#exec TEXTURE IMPORT NAME=ShockAirBlast FILE=CORONAS\ShockAirBlast.bmp GROUP=Skins FLAGS=2 LODSET=2


simulated function PostBeginPlay()
{
	SetTimer(0.1, True);
}


simulated function Timer()
{
local PlayerPawn PP;
local Actor A;
local vector dir;
local float ShockInterval;

	ShockInterval = Default.SpriteProjForward / Default.LifeSpan / 10;

	ForEach AllActors(Class'PlayerPawn', PP)
	{
		if (SpriteProjForward - VSize(Location - PP.Location) < ShockInterval && PP.ViewTarget == None && VSize(Location - PP.Location) < SpriteProjForward)
		{
			PP.ShakeView( 0.5, 800.0, 80.0);

			if (SpriteProjForward > 18000)
				Spawn(Class'ShockHitExtended',,, PP.Location);
			else
				Spawn(Class'ShockHit',,, PP.Location);
		}
		else if (PP.ViewTarget != None)
		{
			if (SpriteProjForward - VSize(Location - PP.ViewTarget.Location) < ShockInterval && VSize(Location - PP.ViewTarget.Location) < SpriteProjForward)
			{
				PP.ShakeView( 0.5, 800.0, 80.0);
	
				if (SpriteProjForward > 18000)
					Spawn(Class'ShockHitExtended',,, PP.ViewTarget.Location);
				else
					Spawn(Class'ShockHit',,, PP.ViewTarget.Location);
			}
		}
	}

	if (SpriteProjForward < Default.SpriteProjForward / 2)
	{
	ForEach VisibleCollidingActors(Class'Actor', A, SpriteProjForward)
	{
		if (SpriteProjForward - VSize(Location - A.Location) < ShockInterval && Role == ROLE_Authority)
		{
			dir = Normal(A.Location - Location);
			A.TakeDamage(Max((Default.SpriteProjForward / 2 - SpriteProjForward) * 10, 0),  Instigator, A.Location - 0.5 * (A.CollisionHeight + A.CollisionRadius) * dir, dir * 600000 * (ScaleGlow/Default.ScaleGlow), 'UnrealIIINuke');
		}
	}
	}
}


simulated function Tick( float DeltaTime)
{
	DrawScale = (Default.LifeSpan - LifeSpan) * Default.DrawScale / Default.LifeSpan;
	ScaleGlow = LifeSpan * Default.ScaleGlow / Default.LifeSpan;
	SpriteProjForward = (Default.LifeSpan - LifeSpan) * Default.SpriteProjForward / Default.LifeSpan;
}

defaultproperties
{
	DrawType=DT_Sprite
	Texture=ShockAirBlast
	LifeSpan=1.500000
	DrawScale=70.000000
	bNetTemporary=True
	RemoteRole=ROLE_SimulatedProxy
	ScaleGlow=1.000000
	Style=STY_Translucent
	bUnlit=True
	SpriteProjForward=9000.000000
}
