class NeoXUDamage expands UDamage;

#exec MESH IMPORT MESH=NeoXUDamage ANIVFILE=MODELS\NeoXUDamage_a.3d DATAFILE=MODELS\NeoXUDamage_d.3d X=0 Y=0 Z=0
#exec MESH LODPARAMS MESH=NeoXUDamage STRENGTH=0
#exec MESH ORIGIN MESH=NeoXUDamage X=0 Y=0 Z=0 YAW=64

#exec MESH SEQUENCE MESH=NeoXUDamage SEQ=All STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=NeoXUDamage SEQ=Still STARTFRAME=0 NUMFRAMES=1

#exec MESHMAP NEW MESHMAP=NeoXUDamage MESH=NeoXUDamage
#exec MESHMAP SCALE MESHMAP=NeoXUDamage X=0.04 Y=0.04 Z=0.08

#exec TEXTURE IMPORT NAME=ShineMetal FILE=SKINS\ShineMetal.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Bloom_Damage FILE=OVERLAYERS\Bloom_Damage.bmp GROUP=Icons FLAGS=2
#exec MESHMAP SETTEXTURE MESHMAP=NeoXUDamage NUM=1 TEXTURE=Bloom_Damage
#exec MESHMAP SETTEXTURE MESHMAP=NeoXUDamage NUM=2 TEXTURE=ShineMetal

#exec AUDIO IMPORT NAME="NeoXUDamPick" FILE=SOUNDS\NeoXUDamPick.wav GROUP="NeoXPickups"
#exec AUDIO IMPORT NAME="NeoXUDamFire1" FILE=SOUNDS\NeoXUDamFire1.wav GROUP="NeoXPickups"
#exec AUDIO IMPORT NAME="NeoXUDamFire2" FILE=SOUNDS\NeoXUDamFire2.wav GROUP="NeoXPickups"
#exec AUDIO IMPORT NAME="NeoXUDamOut" FILE=SOUNDS\NeoXUDamOut.wav GROUP="NeoXPickups"

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

	if (Role == ROLE_Authority)
	{
		if (!Class'NWMutator'.default.bPickupsDynLight)
			LightType = LT_None;
	}
	SpawnOv();
	LODBias = Class'NWMutator'.default.PickupsDistDetail * 8/255;
}

simulated function SpawnOv()
{
	Spawn(Class'NeoXUDamOver', Self);
}

singular function UsedUp()
{
    if (UDamageWeapon != None)
	{
		if (UDamageWeapon.IsA('NaliWeapons'))
		{
			NaliWeapons(UDamageWeapon).Affector = None;
			NaliWeapons(UDamageWeapon).CurrentPickFX = None;
		}
		else
		{
			// Make old weapon normal again.
      			UDamageWeapon.SetDefaultDisplayProperties();
        		if ( UDamageWeapon.IsA('TournamentWeapon') )
            			TournamentWeapon(UDamageWeapon).Affector = None;
    		}
	}

    if ( Owner != None )
    {
        if ( Owner.bIsPawn )
        {
            if ( !Pawn(Owner).bIsPlayer || (Pawn(Owner).PlayerReplicationInfo.HasFlag == None) )
            {
                Owner.AmbientGlow = Owner.Default.AmbientGlow;
                Owner.LightType = LT_None;
            }
            Pawn(Owner).DamageScaling = 1.0;
        }
        bActive = false;
        if ( Owner.Inventory != None )
        {
            Owner.Inventory.SetOwnerDisplay();
            Owner.Inventory.ChangedWeapon();
        }
        if (Level.Game.LocalLog != None)
            Level.Game.LocalLog.LogItemDeactivate(Self, Pawn(Owner));
        if (Level.Game.WorldLog != None)
            Level.Game.WorldLog.LogItemDeactivate(Self, Pawn(Owner));
    }
    Destroy();
}


function SetUDamageWeapon()
{
	if ( !bActive )
		return;

	    SetOwnerLighting();

	if (UDamageWeapon != None)
	{
		if (UDamageWeapon.IsA('NaliWeapons'))
		{
			NaliWeapons(UDamageWeapon).Affector = None;
			NaliWeapons(UDamageWeapon).CurrentPickFX = None;
		}
		else
		{
			// Make old weapon normal again.
      			UDamageWeapon.SetDefaultDisplayProperties();
        		if ( UDamageWeapon.IsA('TournamentWeapon') )
            			TournamentWeapon(UDamageWeapon).Affector = None;
    		}
	}

	UDamageWeapon = Pawn(Owner).Weapon;

	if (UDamageWeapon != None)
	{
		if (UDamageWeapon.IsA('NaliWeapons'))
		{
			NaliWeapons(UDamageWeapon).Affector = Self;
			NaliWeapons(UDamageWeapon).CurrentPickFX = Texture'IonOverlay';
			NaliWeapons(UDamageWeapon).SetTranslucentWeapon();
		}
		else
		{
			// Make new weapon cool.
			if ( UDamageWeapon.IsA('TournamentWeapon') )
				TournamentWeapon(UDamageWeapon).Affector = self;
			if ( Level.bHighDetailMode )
				UDamageWeapon.SetDisplayProperties(ERenderStyle.STY_Translucent, 
                                     FireTexture'UnrealShare.Belt_fx.UDamageFX', true, true);
			else
				UDamageWeapon.SetDisplayProperties(ERenderStyle.STY_Normal, 
				FireTexture'UnrealShare.Belt_fx.UDamageFX', true, true);
    		}
	}
}


defaultproperties
{
	DrawType=DT_Mesh
	Mesh=NeoXUDamage
	LightBrightness=100
	LightHue=191
	LightSaturation=13
	LightRadius=4
	LightType=LT_Steady
	Texture=ShineMetal
	Skin=None
	PickupViewMesh=NeoXUDamage
	PickupSound=NeoXUDamPick
	DeActivateSound=NeoXUDamOut
	EndFireSound=NeoXUDamFire2
	ExtraFireSound=NeoXUDamFire1
	PickupMessage="You got the NeoX Damage Amplifier!"

}
