//=============================================================================
// LAM.
//=============================================================================
class Lamm0r extends ThrownProjectile;

var float	mpBlastRadius;
var float	mpProxRadius;
var float	mpLAMDamage;
var float	mpFuselength;
var int FuseSeconds;

simulated function SpawnEffects(Vector HitLocation, Vector HitNormal, Actor Other)
{
	local SmokeTrail puff;
	local ParticleGenerator gen;
	local vector loc;
	local rotator rot;
	local DeusExDecal mark;
	local AnimatedSprite expeffect;

	rot.Pitch = 16384 + FRand() * 16384 - 8192;
	rot.Yaw = FRand() * 65536;
	rot.Roll = 0;

	if ((damageType == 'Exploded') && bStuck)
	{
		gen = spawn(class'ParticleGenerator',,, HitLocation, rot);
		if (gen != None)
		{
         //DEUS_EX AMSD Don't send this to clients unless really spawned server side.
         if (bDamaged)
            gen.RemoteRole = ROLE_SimulatedProxy;
         else
   			gen.RemoteRole = ROLE_None;
			gen.LifeSpan = FRand() * 10 + 10;
			gen.CheckTime = 0.25;
			gen.particleDrawScale = 0.4;
			gen.RiseRate = 20.0;
			gen.bRandomEject = True;
			gen.particleTexture = Texture'Effects.Smoke.SmokePuff1';
		}
	}

	// don't draw damage art on destroyed movers
	if (DeusExMover(Other) != None)
		if (DeusExMover(Other).bDestroyed)
			ExplosionDecal = None;

	if (ExplosionDecal != None)
	{
		mark = DeusExDecal(Spawn(ExplosionDecal, Self,, HitLocation, Rotator(HitNormal)));
		if (mark != None)
		{
			mark.DrawScale = FClamp(damage/30, 0.1, 3.0);
			mark.ReattachDecal();
         if (!bDamaged)
            mark.RemoteRole = ROLE_None;


			loc = Location;
			loc.X += FRand() * blastRadius - blastRadius * 0.5;
			loc.Y += FRand() * blastRadius - blastRadius * 0.5;

			if (damageType == 'Exploded')
			{
				puff = spawn(class'SmokeTrail',,, loc);
				if (puff != None)
				{
					if (!bDamaged)
						puff.RemoteRole = ROLE_None;
					else					
						puff.RemoteRole = ROLE_SimulatedProxy;
					puff.RiseRate = FRand() + 1;
					puff.DrawScale = FRand() + 3.0;
					puff.OrigScale = puff.DrawScale;
					puff.LifeSpan = FRand() * 10 + 10;
					puff.OrigLifeSpan = puff.LifeSpan;
				}

			}
		}
	}
}

simulated function DrawExplosionEffects(vector HitLocation, vector HitNormal)
{
}

function GrabProjectile(DeusExPlayer player)
{
}

simulated function Tick(float deltaTime)
{
	//Super.Tick(deltaTime);

	FuseSeconds += 1;

if(fuseSeconds < 62)
{
	if(fuseSeconds == 1)
	{
		MultiSkins[0] = Texture'ContenderStuff.Weapons.LED_5';
	}
	if(fuseSeconds == 20)
	{
		MultiSkins[0] = Texture'ContenderStuff.Weapons.LED_4';
	}
	if(fuseSeconds == 40)
	{
		MultiSkins[0] = Texture'ContenderStuff.Weapons.LED_3';
	}
	if(fuseSeconds == 60)
	{
		MultiSkins[0] = Texture'ContenderStuff.Weapons.LED_2';
	}
	if(fuseSeconds >= 80)
	{
		MultiSkins[0] = Texture'ContenderStuff.Weapons.LED_1';
	}
}
}

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

	if ( Level.NetMode != NM_Standalone )
	{
		blastRadius=mpBlastRadius;
		proxRadius=mpProxRadius;
		Damage=mpLAMDamage;
		fuseLength=mpFuselength;
		bIgnoresNanoDefense=True;
	}
}

defaultproperties
{
     DamageType=Shot
     fuseLength=6
     mpBlastRadius=512.000000
     mpProxRadius=128.000000
     mpLAMDamage=500.000000
     mpFuselength=6
     fuseLength=3.000000
     proxRadius=128.000000
     blastRadius=384.000000
     spawnWeaponClass=None
     ItemName="Timed Bomb"
     speed=10.000000
     MaxSpeed=10.000000
     Damage=500.000000
     MomentumTransfer=50000
     ImpactSound=Sound'DeusExSounds.Weapons.LAMExplode'
     ExplosionDecal=Class'DeusEx.ScorchMark'
     LifeSpan=0.000000
     Mesh=LodMesh'ContenderStuff.C4_3rd'
     CollisionRadius=4.300000
     CollisionHeight=3.800000
     Mass=5.000000
     Buoyancy=2.000000
}
