//MH Pickups (modifiers) for the weapons
class MHPickups expands Pickup
abstract;

#exec AUDIO IMPORT NAME="MH_Pickup" FILE=SOUNDS\MH_Pickup.wav GROUP="Pickups"
#exec AUDIO IMPORT NAME="MHPickups_Amb" FILE=SOUNDS\MHPickups_Amb.wav GROUP="Pickups"

var() class<Overlay> Bloom[2];
var Overlay BloomOv[2];
var SacredRing sr;

var float Count;
var bool bCalled;

simulated function PostBeginPlay()
{
	Super.PostBeginPlay();
	BloomOv[0] = Spawn(Bloom[0], Self);
	BloomOv[1] = Spawn(Bloom[1], Self);

	if (Role == ROLE_Authority)
	{
		if (!Class'NWMutator'.default.bPickupsDynLight)
			LightType = LT_None;
	}

	SpawnSacredRing();
	LODBias = Class'NWMutator'.default.PickupsDistDetail * 8/255;
	SetTimer(0.1, False);
}


function SpawnSacredRing()
{
	sr = Spawn(Class'SacredRing', Self);
}

simulated function Tick( float DeltaTime)
{
	if (Count < 0.1)
		Count += DeltaTime;
	else if (!bCalled)
	{
		bCalled = True;
		SpawnCharger();
	}
}

function SpawnCharger()
{
local vector HitNormal, HitLocation;
local NeoXChargerA nca;
local ChargerLightConeA clc;

	if (Class'NWMutator'.default.bMHChargers && Level.Game.ShouldRespawn(self))
	{
		Trace (HitLocation, HitNormal, Location + vect(0,0,-2000), Location, False);

		nca = Spawn(Class'NeoXChargerA',,, HitLocation, rotator(HitNormal));
		clc = Spawn(Class'ChargerLightConeA',,, HitLocation, rotator(HitNormal));

		if (Self.IsA('DamageN'))
		{
			nca.Texture = Texture'Damage_EnvMap';
			nca.MultiSkins[6] = Texture'PurpleN_Over';
			clc.MultiSkins[1] = Texture'DamageLightCone';
		}
		else if (Self.IsA('HealthN'))
		{
			nca.Texture = Texture'Health_EnvMap';
			nca.MultiSkins[6] = Texture'UnrealShare.Belt_fx.BlueShield';
			clc.MultiSkins[1] = Texture'HealthLightCone';
		}
		else if (Self.IsA('Kick'))
		{
			nca.Texture = Texture'Kick_EnvMap';
			nca.MultiSkins[6] = Texture'UnrealShare.Belt_fx.GreenShield';
			clc.MultiSkins[1] = Texture'KickLightCone';
		}
		else if (Self.IsA('Splasher'))
		{
			nca.Texture = Texture'Splasher_EnvMap';
			nca.MultiSkins[6] = Texture'UnrealShare.Belt_fx.N_Shield';
			clc.MultiSkins[1] = Texture'SplasherLightCone';
		}
		else if (Self.IsA('Fast'))
		{
			nca.Texture = Texture'Fast_EnvMap';
			nca.MultiSkins[6] = Texture'UnrealShare.Belt_fx.RedShield';
			clc.MultiSkins[1] = Texture'FastLightCone';
		}

		SetLocation(HitLocation + 40 * HitNormal);
	}
}


function PlayPickupMessage(Pawn Other)
{
    Other.ReceiveLocalizedMessage( class'PickupMessagePlus', 0, None, None, Self.Class );
}

simulated function Destroyed()
{
local byte i;

	For (i=0; i<2; i++)
	{
		if (BloomOv[i] != None)
			BloomOv[i].Destroy();
	}

	if (sr != None)
		sr.Destroy();
}

defaultproperties
{
	PickupSound=MH_Pickup
	bCollideActors=True
	bMeshEnviroMap=True
	bUnlit=True
	bRotatingPickup=True;
	MaxDesireability=0.750000
	RespawnTime=30.000000
	RemoteRole=ROLE_DumbProxy
	CollisionRadius=16.000000
	CollisionHeight=24.000000
	SoundVolume=120
	SoundRadius=40
	AmbientSound=MHPickups_Amb
}
