class Freezer expands NaliWeapons;

//1st person
#exec MESH IMPORT MESH=Freezer ANIVFILE=MODELS\Freezer_a.3d DATAFILE=MODELS\Freezer_d.3d X=0 Y=0 Z=0
#exec MESH LODPARAMS MESH=Freezer STRENGTH=0
#exec MESH ORIGIN MESH=Freezer X=0 Y=0 Z=0 YAW=128

//1st person right handed
#exec MESH IMPORT MESH=FreezerR ANIVFILE=MODELS\Freezer_a.3d DATAFILE=MODELS\Freezer_d.3d X=0 Y=0 Z=0 UNMIRROR=1
#exec MESH LODPARAMS MESH=FreezerR STRENGTH=0
#exec MESH ORIGIN MESH=FreezerR X=0 Y=0 Z=0

//Pickup
#exec MESH IMPORT MESH=FreezerPick ANIVFILE=MODELS\Freezer_a.3d DATAFILE=MODELS\Freezer_d.3d X=0 Y=0 Z=0
//#exec MESH LODPARAMS MESH=FreezerPick STRENGTH=0
#exec MESH ORIGIN MESH=FreezerPick X=0 Y=0 Z=0 YAW=128

//3rd person
#exec MESH IMPORT MESH=FreezerM ANIVFILE=MODELS\Freezer_a.3d DATAFILE=MODELS\Freezer_d.3d X=0 Y=0 Z=0
#exec MESH LODPARAMS MESH=FreezerM STRENGTH=0
#exec MESH ORIGIN MESH=FreezerM X=720 Y=0 Z=-90 YAW=128

//-----------------------------------------------------------------------------------

//Animations
#exec MESH SEQUENCE MESH=Freezer SEQ=All STARTFRAME=0 NUMFRAMES=27
#exec MESH SEQUENCE MESH=Freezer SEQ=Still STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=Freezer SEQ=Fire STARTFRAME=0 NUMFRAMES=10 RATE=20.0
#exec MESH SEQUENCE MESH=Freezer SEQ=AltFire STARTFRAME=8 NUMFRAMES=2 RATE=8.0
#exec MESH SEQUENCE MESH=Freezer SEQ=Select STARTFRAME=10 NUMFRAMES=9 RATE=14.0 GROUP=Select
#exec MESH SEQUENCE MESH=Freezer SEQ=Down STARTFRAME=18 NUMFRAMES=9 RATE=28.0

#exec MESH SEQUENCE MESH=FreezerR SEQ=All STARTFRAME=0 NUMFRAMES=27
#exec MESH SEQUENCE MESH=FreezerR SEQ=Still STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=FreezerR SEQ=Fire STARTFRAME=0 NUMFRAMES=10 RATE=20.0
#exec MESH SEQUENCE MESH=FreezerR SEQ=AltFire STARTFRAME=8 NUMFRAMES=2 RATE=8.0
#exec MESH SEQUENCE MESH=FreezerR SEQ=Select STARTFRAME=10 NUMFRAMES=9 RATE=14.0 GROUP=Select
#exec MESH SEQUENCE MESH=FreezerR SEQ=Down STARTFRAME=18 NUMFRAMES=9 RATE=28.0

#exec MESH SEQUENCE MESH=FreezerPick SEQ=Still STARTFRAME=0 NUMFRAMES=1

#exec MESH SEQUENCE MESH=FreezerM SEQ=Still STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=FreezerM SEQ=Fire STARTFRAME=0 NUMFRAMES=10 RATE=20.0
#exec MESH SEQUENCE MESH=FreezerM SEQ=AltFire STARTFRAME=8 NUMFRAMES=2 RATE=8.0


//-----------------------------------------------------------------------------------

//Scale
#exec MESHMAP NEW MESHMAP=Freezer MESH=Freezer
#exec MESHMAP SCALE MESHMAP=Freezer X=0.039 Y=0.039 Z=0.078

#exec MESHMAP NEW MESHMAP=FreezerR MESH=FreezerR
#exec MESHMAP SCALE MESHMAP=FreezerR X=0.039 Y=0.039 Z=0.078

#exec MESHMAP NEW MESHMAP=FreezerPick MESH=FreezerPick
#exec MESHMAP SCALE MESHMAP=FreezerPick X=0.039 Y=0.039 Z=0.078

#exec MESHMAP NEW MESHMAP=FreezerM MESH=FreezerM
#exec MESHMAP SCALE MESHMAP=FreezerM X=0.039 Y=0.039 Z=0.078

//-----------------------------------------------------------------------------------

//Skins
#exec TEXTURE IMPORT NAME=Sk_Freezer_01 FILE=SKINS\Sk_Freezer_01.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=Freezer NUM=1 TEXTURE=Sk_Freezer_01
#exec MESHMAP SETTEXTURE MESHMAP=FreezerR NUM=1 TEXTURE=Sk_Freezer_01
#exec MESHMAP SETTEXTURE MESHMAP=FreezerPick NUM=1 TEXTURE=Sk_Freezer_01
#exec MESHMAP SETTEXTURE MESHMAP=FreezerM NUM=1 TEXTURE=Sk_Freezer_01

#exec TEXTURE IMPORT NAME=Sk_Freezer_02 FILE=SKINS\Sk_Freezer_02.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=Freezer NUM=2 TEXTURE=Sk_Freezer_02
#exec MESHMAP SETTEXTURE MESHMAP=FreezerR NUM=2 TEXTURE=Sk_Freezer_02
#exec MESHMAP SETTEXTURE MESHMAP=FreezerPick NUM=2 TEXTURE=Sk_Freezer_02
#exec MESHMAP SETTEXTURE MESHMAP=FreezerM NUM=2 TEXTURE=Sk_Freezer_02

#exec TEXTURE IMPORT NAME=Sk_Freezer_03 FILE=SKINS\Sk_Freezer_03.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=Freezer NUM=3 TEXTURE=Sk_Freezer_03
#exec MESHMAP SETTEXTURE MESHMAP=FreezerR NUM=3 TEXTURE=Sk_Freezer_03
#exec MESHMAP SETTEXTURE MESHMAP=FreezerPick NUM=3 TEXTURE=Sk_Freezer_03
#exec MESHMAP SETTEXTURE MESHMAP=FreezerM NUM=3 TEXTURE=Sk_Freezer_03

#exec TEXTURE IMPORT NAME=Glass FILE=SKINS\Glass.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=Freezer NUM=4 TEXTURE=Glass
#exec MESHMAP SETTEXTURE MESHMAP=FreezerR NUM=4 TEXTURE=Glass
#exec MESHMAP SETTEXTURE MESHMAP=FreezerPick NUM=4 TEXTURE=Glass
#exec MESHMAP SETTEXTURE MESHMAP=FreezerM NUM=4 TEXTURE=Glass

#exec MESHMAP SETTEXTURE MESHMAP=Freezer NUM=5 TEXTURE=UnrealShare.Belt_fx.Testing.Effect_1
#exec MESHMAP SETTEXTURE MESHMAP=FreezerR NUM=5 TEXTURE=UnrealShare.Belt_fx.Testing.Effect_1
#exec MESHMAP SETTEXTURE MESHMAP=FreezerPick NUM=5 TEXTURE=UnrealShare.Belt_fx.Testing.Effect_1
#exec MESHMAP SETTEXTURE MESHMAP=FreezerM NUM=5 TEXTURE=UnrealShare.Belt_fx.Testing.Effect_1

//--------------------------------------------------------------

//Icons
#exec TEXTURE IMPORT NAME=FreezerIcon FILE=ICONS\FreezerIcon.bmp GROUP=Icons MIPS=OFF

#exec OBJ LOAD FILE=Textures\NaliIcons.utx PACKAGE=NaliWeaponsII.Icons

//-----------------------------------------------------------------------------------

//Sounds
#exec AUDIO IMPORT NAME="Freezer_Pick" FILE=SOUNDS\Freezer_Pick.wav GROUP="Freezer"
#exec AUDIO IMPORT NAME="Freezer_Select" FILE=SOUNDS\Freezer_Select.wav GROUP="Freezer"
#exec AUDIO IMPORT NAME="Freezer_Fire" FILE=SOUNDS\Freezer_Fire.wav GROUP="Freezer"
#exec AUDIO IMPORT NAME="Freezer_AltFire" FILE=SOUNDS\Freezer_AltFire.wav GROUP="Freezer"



function PreBeginPlay()
{
	Super.PreBeginPlay();
	if ((Level.Game.IsA('MonsterHunt') && Class'NWMutator'.Default.EnableMonsterHuntMode && Class'NWMutator'.Default.MonsterHuntOnly) || (Class'NWMutator'.Default.EnableMonsterHuntMode && !Class'NWMutator'.Default.MonsterHuntOnly))
	{
		PickupAmmoCount *= Class'NWMutator'.default.ammo_Freezer;
	}

	if (Level.NetMode != NM_StandAlone)
		FireOffset.X = -50;
}


function setHand(float Hand)
{
	Super.SetHand(Hand);
	if ( Hand == 1 )
		Mesh = mesh'Freezer';
	else
		Mesh = mesh'FreezerR';
}


function Fire( float Value )
{
local Projectile pj;

    if ( (AmmoType == None) && (AmmoName != None) )
    {
        // ammocheck
        GiveAmmo(Pawn(Owner));
    }

    if (bInfinity)
    {
	GotoState('NormalFire');
        bPointing=True;
        bCanClientFire = true;
        ClientFire(Value);


        pj = ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget);
	
	if (pj.IsA('IceBeam'))
	{
		IceBeam(pj).Kickback = Kickback;
		IceBeam(pj).MoreDamage = MoreDamage;
		IceBeam(pj).HealthGiver = HealthGiver;
		IceBeam(pj).Splasher = Splasher;
	}
		
    }	
    else if (AmmoType.UseAmmo(5))
    {
        GotoState('NormalFire');
        bPointing=True;
        bCanClientFire = true;
        ClientFire(Value);

	pj = ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget);

        if (pj.IsA('IceBeam'))
	{
		IceBeam(pj).Kickback = Kickback;
		IceBeam(pj).MoreDamage = MoreDamage;
		IceBeam(pj).HealthGiver = HealthGiver;
		IceBeam(pj).Splasher = Splasher;
	}
    }
	else
		PlayFiring();
}



simulated function PlayFiring()
{
	PlayAnim('Fire', 0.4 * FireRateChange, 0.0);
	PlayOwnedSound(FireSound, SLOT_None, Pawn(Owner).SoundDampening*8.0);
}


function AltFire( float Value )
{
local Projectile pj;

    if ( (AmmoType == None) && (AmmoName != None) )
    {
        // ammocheck
        GiveAmmo(Pawn(Owner));
    }

    if (bInfinity)
    {
	GotoState('AltFiring');
        bPointing=True;
        bCanClientFire = true;
        ClientAltFire(Value);

        if ( bRapidFire || (FiringSpeed > 0) )
            Pawn(Owner).PlayRecoil(FiringSpeed);

        pj = ProjectileFire(AltProjectileClass, AltProjectileSpeed, bAltWarnTarget);
	
	if (pj.IsA('IceSpike'))
	{
		IceSpike(pj).Kickback = Kickback;
		IceSpike(pj).MoreDamage = MoreDamage;
		IceSpike(pj).HealthGiver = HealthGiver;
	}
		
    }	
    else if (AmmoType.UseAmmo(1))
    {
        GotoState('AltFiring');
        bPointing=True;
        bCanClientFire = true;
        ClientAltFire(Value);

        if ( bRapidFire || (FiringSpeed > 0) )
            Pawn(Owner).PlayRecoil(FiringSpeed);

	pj = ProjectileFire(AltProjectileClass, AltProjectileSpeed, bAltWarnTarget);

        if (pj.IsA('IceSpike'))
	{
		IceSpike(pj).Kickback = Kickback;
		IceSpike(pj).MoreDamage = MoreDamage;
		IceSpike(pj).HealthGiver = HealthGiver;
	}
    }
}


simulated function PlayAltFiring()
{
	PlayAnim('AltFire', 1.0 * FireRateChange, 0.0);
	PlayOwnedSound(AltFireSound, SLOT_None, Pawn(Owner).SoundDampening*8.0);
}

function float RateSelf( out int bUseAltMode )
{
	local float EnemyDist, Rating;
	local bool bRetreating;
	local vector EnemyDir;
	local Pawn P;

	P = Pawn(Owner);

	//No enemy, ready to fire
	if ( P.Enemy == None )
        	return AIRating;

	//Don't recommend self if out of ammo
	if ( AmmoType.AmmoAmount <=0 )
        	return -2;

	EnemyDir = P.Enemy.Location - Owner.Location; 
	EnemyDist = VSize(EnemyDir);

	//Don't recommend first mode if it hasn't ammo for it
	if (AmmoType.AmmoAmount < 5 || EnemyDist >= 430)
		bUseAltMode = 1;
	else if (EnemyDist < 430 && P.Region.Zone.bWaterZone)
		bUseAltMode = 0;
	else
		bUseAltMode = int(FRand() + 0.5);

	return (AIRating + FRand() * 0.05);
}


defaultproperties
{
	DrawType=DT_Mesh
	Mesh=FreezerPick
	CollisionHeight=15.000000
	CollisionRadius=15.000000
	AutoSwitchPriority=6
	Icon=FreezerIcon
	InventoryGroup=6
	ItemArticle="a"
	ItemName="Freezer"
	MaxDesireability=0.500000
	PickupMessage="You got the Freezer."
	PickupSound=Freezer_Pick
	PickupViewMesh=FreezerPick
	PickupViewScale=1.000000
	PlayerViewMesh=FreezerR
	PlayerViewOffset=(X=34.000000,Y=-18.000000,Z=-14.000000)
	PlayerViewScale=1.000000
	RespawnTime=30.000000
	StatusIcon=FreezerIcon
	ThirdPersonMesh=FreezerM
	ThirdPersonScale=0.850000
	AltDamageType="Freezed"
	AltFireSound=Freezer_AltFire
	AltProjectileClass=Class'IceSpike'
	AmmoName=FreezerAmmo
	bRapidFire=True
	DeathMessage="%o was freezed to death by %k's %w."
	FireOffset=(X=5.000000,Y=6.000000,Z=5.000000)
	FireSound=Freezer_Fire
	FiringSpeed=1.000000
	MaxTargetRange=4096.000000
	MyDamageType="Freezed"
	NameColor=(R=255,G=255,B=255)
	PickupAmmoCount=30
	ProjectileClass=Class'IceBeam'
	SelectSound=Freezer_Select
	shakemag=200.000000
	shaketime=0.150000
	shakevert=5.000000
	AIRating=0.600000
	AltRefireRate=1.000000
	bAltWarnTarget=True
	bRecommendAltSplashDamage=False
	bRecommendSplashDamage=True
	bSplashDamage=True
	bWarnTarget=True
	RefireRate=1.200000
	Mass=50.000000
	bNoSmooth=False
	bOwnsCrossHair=True
	CustomCross=FreezerCross
	CrossHairSize=64
}
