/*-----------------------------------------------------------------------------
	AtomicHealth
	Author: Futuretime23 (no but really Brandon, yer awesome man)
	
	Atomico, se dice atomico.
-----------------------------------------------------------------------------*/
class AtomicHealth extends Inventory;

#exec OBJ LOAD FILE=..\Sounds\dnsMaterials.dfx
#exec OBJ LOAD FILE=..\Sounds\a_dukevoice.dfx
#exec OBJ LOAD FILE=..\Meshes\modpack.dmx
#exec AUDIO IMPORT FILE="..\Sounds\AtomicHealth\AtomicPickup.wav" NAME="AtomicPickup" 

var() int HealingAmount;

function PreBeginPlay()
{
	PlayAnim('centered');
	Super.PreBeginPlay();
}

function PostBeginPlay()
{
	PlayAnim('centered');
	Super.PostBeginPlay();
}

function AnimEnd()
{
	LoopAnim('centered');
}
function DoPickup( Actor Other )
{
	local Pawn P;

	P = Pawn(Other);

	// Add the item's distinctiveness to our own.
	P.AddEgo(HealingAmount, false);

	// Display a pickup message.
	DisplayPickupEvent( Self, Other );

	// Eat it.
	if ( Other.IsA('DukePlayer') )
	{
		PlaySound(sound'dnGame.AtomicHealth.AtomicPickup', SLOT_Talk, 15.0);
	}

	// Get rid of...SPIDER
	SetRespawn();
}
auto state Pickup
{	
    function bool ValidTouch( actor Other, optional bool bCheckWall )
    {
        return ( Super.ValidTouch(Other,bCheckWall) && Other.bIsRenderActor && (RenderActor(Other).Health < 200) );
    }

	function Touch( actor Other )
	{			
		if ( bDontPickupOnTouch )
			return;

		if ( ValidTouch(Other,true) ) 
			DoPickup(Other);
	}

	function Used( Actor Other, Pawn EventInstigator )
	{
		if ( ValidTouch(Other) )
			DoPickup(Other);
	}
}

defaultproperties
{
 	 PickupIcon=None
     HealingAmount=50
     LodMode=LOD_Disabled
	 ItemName="Atomic Health"
	 ItemLandSound=sound'dnsMaterials.LthrMtlDamp18'
     RespawnTime=30.000000
	 Mesh=DukeMesh'modpack.Items.AtomicHealth'
	 PickupViewMesh=DukeMesh'modpack.Items.AtomicHealth'
	 SpawnOnHitClassString="dnParticles.dnBulletFX_FabricSpawner"
}
