class TheMiner expands NaliWeapons;

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

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

//Pickup
#exec MESH IMPORT MESH=TheMinerPick ANIVFILE=MODELS\TheMiner_a.3d DATAFILE=MODELS\TheMiner_d.3d X=0 Y=0 Z=0
//#exec MESH LODPARAMS MESH=TheMinerPick STRENGTH=0
#exec MESH ORIGIN MESH=TheMinerPick X=-320 Y=0 Z=0 YAW=128

//3rd person
#exec MESH IMPORT MESH=TheMinerM ANIVFILE=MODELS\TheMiner_a.3d DATAFILE=MODELS\TheMiner_d.3d X=0 Y=0 Z=0
#exec MESH LODPARAMS MESH=TheMinerM STRENGTH=0
#exec MESH ORIGIN MESH=TheMinerM X=0 Y=0 Z=0 YAW=128

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

//Animations
#exec MESH SEQUENCE MESH=TheMiner SEQ=All STARTFRAME=0 NUMFRAMES=25
#exec MESH SEQUENCE MESH=TheMiner SEQ=Still STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=TheMiner SEQ=Fire STARTFRAME=0 NUMFRAMES=6 RATE=12.0
#exec MESH SEQUENCE MESH=TheMiner SEQ=AltFire STARTFRAME=5 NUMFRAMES=7 RATE=7.0
#exec MESH SEQUENCE MESH=TheMiner SEQ=Select STARTFRAME=15 NUMFRAMES=4 RATE=7.0 GROUP=Select
#exec MESH SEQUENCE MESH=TheMiner SEQ=Down STARTFRAME=18 NUMFRAMES=4 RATE=14.0

#exec MESH SEQUENCE MESH=TheMinerR SEQ=All STARTFRAME=0 NUMFRAMES=25
#exec MESH SEQUENCE MESH=TheMinerR SEQ=Still STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=TheMinerR SEQ=Fire STARTFRAME=0 NUMFRAMES=6 RATE=12.0
#exec MESH SEQUENCE MESH=TheMinerR SEQ=AltFire STARTFRAME=5 NUMFRAMES=7 RATE=7.0
#exec MESH SEQUENCE MESH=TheMinerR SEQ=Select STARTFRAME=15 NUMFRAMES=4 RATE=7.0 GROUP=Select
#exec MESH SEQUENCE MESH=TheMinerR SEQ=Down STARTFRAME=18 NUMFRAMES=4 RATE=14.0

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

#exec MESH SEQUENCE MESH=TheMinerM SEQ=Still STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=TheMinerM SEQ=AltFire STARTFRAME=5 NUMFRAMES=7 RATE=7.0

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

//Scale
#exec MESHMAP NEW MESHMAP=TheMiner MESH=TheMiner
#exec MESHMAP SCALE MESHMAP=TheMiner X=0.05 Y=0.05 Z=0.1

#exec MESHMAP NEW MESHMAP=TheMinerR MESH=TheMinerR
#exec MESHMAP SCALE MESHMAP=TheMinerR X=0.05 Y=0.05 Z=0.1

#exec MESHMAP NEW MESHMAP=TheMinerPick MESH=TheMinerPick
#exec MESHMAP SCALE MESHMAP=TheMinerPick X=0.05 Y=0.05 Z=0.1

#exec MESHMAP NEW MESHMAP=TheMinerM MESH=TheMinerM
#exec MESHMAP SCALE MESHMAP=TheMinerM X=0.05 Y=0.05 Z=0.1

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

//Skins
#exec TEXTURE IMPORT NAME=Sk_TheMiner_01 FILE=SKINS\Sk_TheMiner_01.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=TheMiner NUM=1 TEXTURE=Sk_TheMiner_01
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerR NUM=1 TEXTURE=Sk_TheMiner_01
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerPick NUM=1 TEXTURE=Sk_TheMiner_01
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerM NUM=1 TEXTURE=Sk_TheMiner_01

#exec TEXTURE IMPORT NAME=Sk_TheMiner_02 FILE=SKINS\Sk_TheMiner_02.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=TheMiner NUM=2 TEXTURE=Sk_TheMiner_02
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerR NUM=2 TEXTURE=Sk_TheMiner_02
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerPick NUM=2 TEXTURE=Sk_TheMiner_02
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerM NUM=2 TEXTURE=Sk_TheMiner_02

#exec TEXTURE IMPORT NAME=Sk_TheMiner_03 FILE=SKINS\Sk_TheMiner_03.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=TheMiner NUM=3 TEXTURE=Sk_TheMiner_03
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerR NUM=3 TEXTURE=Sk_TheMiner_03
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerPick NUM=3 TEXTURE=Sk_TheMiner_03
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerM NUM=3 TEXTURE=Sk_TheMiner_03

#exec TEXTURE IMPORT NAME=Sk_TheMiner_04 FILE=SKINS\Sk_TheMiner_04.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=TheMiner NUM=4 TEXTURE=Sk_TheMiner_04
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerR NUM=4 TEXTURE=Sk_TheMiner_04
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerPick NUM=4 TEXTURE=Sk_TheMiner_04
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerM NUM=4 TEXTURE=Sk_TheMiner_04

#exec TEXTURE IMPORT NAME=Sk_TheMiner_05 FILE=SKINS\Sk_TheMiner_05.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=TheMiner NUM=5 TEXTURE=Sk_TheMiner_05
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerR NUM=5 TEXTURE=Sk_TheMiner_05
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerPick NUM=5 TEXTURE=Sk_TheMiner_05
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerM NUM=5 TEXTURE=Sk_TheMiner_05

#exec TEXTURE IMPORT NAME=Sk_TheMiner_06 FILE=SKINS\Sk_TheMiner_06.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=TheMiner NUM=6 TEXTURE=Sk_TheMiner_06
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerR NUM=6 TEXTURE=Sk_TheMiner_06
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerPick NUM=6 TEXTURE=Sk_TheMiner_06
#exec MESHMAP SETTEXTURE MESHMAP=TheMinerM NUM=6 TEXTURE=Sk_TheMiner_06

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

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

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

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

//Sounds
#exec AUDIO IMPORT NAME="TheMiner_Fire" FILE=SOUNDS\TheMiner_Fire.wav GROUP="TheMiner"
#exec AUDIO IMPORT NAME="TheMiner_AltFire" FILE=SOUNDS\TheMiner_AltFire.wav GROUP="TheMiner"
#exec AUDIO IMPORT NAME="TheMiner_Pick" FILE=SOUNDS\TheMiner_Pick.wav GROUP="TheMiner"
#exec AUDIO IMPORT NAME="TheMiner_Select" FILE=SOUNDS\TheMiner_Select.wav GROUP="TheMiner"

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

//Other skins
#exec TEXTURE IMPORT NAME=Sk_LandMine_Blue FILE=SKINS\Sk_LandMine_Blue.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Sk_LandMine_Green FILE=SKINS\Sk_LandMine_Green.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Sk_LandMine_Red FILE=SKINS\Sk_LandMine_Red.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Sk_LandMine_Yellow FILE=SKINS\Sk_LandMine_Yellow.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Sk_StickyMine_Blue FILE=SKINS\Sk_StickyMine_Blue.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Sk_StickyMine_Green FILE=SKINS\Sk_StickyMine_Green.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Sk_StickyMine_Red FILE=SKINS\Sk_StickyMine_Red.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Sk_StickyMine_Yellow FILE=SKINS\Sk_StickyMine_Yellow.bmp GROUP=Skins FLAGS=2 LODSET=2


var() texture TeamLand[4];
var() texture TeamSticky[4];


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_TheMiner;
	}
}

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



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('StickyMine'))
	{
		StickyMine(pj).Kickback = Kickback;
		StickyMine(pj).MoreDamage = MoreDamage;
		StickyMine(pj).HealthGiver = HealthGiver;
		StickyMine(pj).Splasher = Splasher;

		if (Class'NWMutator'.default.bMineID_InTeamGames && Level.Game.IsA('TeamGamePlus') && !Level.Game.IsA('MonsterHunt'))
		{
			StickyMine(pj).MultiSkins[1] = TeamSticky[Pawn(Owner).PlayerReplicationInfo.Team];
		}
	}
		
    }	
    else if (AmmoType.UseAmmo(1))
    {
        GotoState('NormalFire');
        bPointing=True;
        bCanClientFire = true;
        ClientFire(Value);

	pj = ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget);

        if (pj.IsA('StickyMine'))
	{
		StickyMine(pj).Kickback = Kickback;
		StickyMine(pj).MoreDamage = MoreDamage;
		StickyMine(pj).HealthGiver = HealthGiver;
		StickyMine(pj).Splasher = Splasher;

		if (Class'NWMutator'.default.bMineID_InTeamGames && Level.Game.IsA('TeamGamePlus') && !Level.Game.IsA('MonsterHunt'))
		{
			StickyMine(pj).MultiSkins[1] = TeamSticky[Pawn(Owner).PlayerReplicationInfo.Team];
		}
	}
    }
}



simulated function PlayFiring()
{
	PlayAnim('Fire', 0.5 * 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);

        pj = ProjectileFire(AltProjectileClass, AltProjectileSpeed, bAltWarnTarget);
	
	if (pj.IsA('LandMine'))
	{
		LandMine(pj).Kickback = Kickback;
		LandMine(pj).MoreDamage = MoreDamage;
		LandMine(pj).HealthGiver = HealthGiver;
		LandMine(pj).Splasher = Splasher;

		if (Class'NWMutator'.default.bMineID_InTeamGames && Level.Game.IsA('TeamGamePlus') && !Level.Game.IsA('MonsterHunt'))
		{
			LandMine(pj).MultiSkins[1] = TeamLand[Pawn(Owner).PlayerReplicationInfo.Team];
		}
	}
		
    }	
    else if (AmmoType.UseAmmo(5))
    {
        GotoState('AltFiring');
        bPointing=True;
        bCanClientFire = true;
        ClientAltFire(Value);

	pj = ProjectileFire(AltProjectileClass, AltProjectileSpeed, bAltWarnTarget);

        if (pj.IsA('LandMine'))
	{
		LandMine(pj).Kickback = Kickback;
		LandMine(pj).MoreDamage = MoreDamage;
		LandMine(pj).HealthGiver = HealthGiver;
		LandMine(pj).Splasher = Splasher;

		if (Class'NWMutator'.default.bMineID_InTeamGames && Level.Game.IsA('TeamGamePlus') && !Level.Game.IsA('MonsterHunt'))
		{
			LandMine(pj).MultiSkins[1] = TeamLand[Pawn(Owner).PlayerReplicationInfo.Team];
		}
	}
    }
	else
		PlayAltFiring();
}


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 second mode if it hasn't ammo for it
	if (AmmoType.AmmoAmount < 5 || EnemyDist < 512)
		bUseAltMode = 0;
	else
		bUseAltMode = int(FRand() + 0.5);

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


defaultproperties
{
	DrawType=DT_Mesh
	Mesh=TheMinerPick
	CollisionHeight=10.000000
	CollisionRadius=15.000000
	AutoSwitchPriority=8
	Icon=TheMinerIcon
	InventoryGroup=8
	ItemArticle="a"
	ItemName="The Miner"
	MaxDesireability=0.500000
	PickupMessage="You got The Miner."
	PickupSound=TheMiner_Pick
	PickupViewMesh=TheMinerPick
	PickupViewScale=1.000000
	PlayerViewMesh=TheMinerR
	PlayerViewOffset=(X=5.000000,Y=-15.000000,Z=-22.000000)
	PlayerViewScale=1.000000
	RespawnTime=30.000000
	StatusIcon=TheMinerIcon
	ThirdPersonMesh=TheMinerM
	ThirdPersonScale=0.750000
	AltDamageType=Exploded
	AltFireSound=TheMiner_AltFire
	AltProjectileClass=Class'LandMine'
	AmmoName=Class'TheMinerAmmo'
	bInstantHit=False
	bOwnsCrosshair=False
	bRapidFire=False
	DeathMessage="%o was blown apart by %k's %w."
	FireOffset=(X=-5.000000,Y=-10.000000,Z=-20.000000)
	FireSound=TheMiner_Fire
	FiringSpeed=1.000000
	MaxTargetRange=4096.000000
	MyDamageType=Exploded
	NameColor=(R=128,G=128,B=128)
	PickupAmmoCount=6
	ProjectileClass=Class'StickyMine'
	SelectSound=TheMiner_Select
	shakemag=900.000000
	shaketime=0.150000
	shakevert=15.000000
	AIRating=0.800000
	AltRefireRate=1.000000
	bAltWarnTarget=True
	bRecommendAltSplashDamage=True
	bRecommendSplashDamage=True
	bSplashDamage=True
	bWarnTarget=True
	RefireRate=0.600000
	Mass=50.000000
	bNoSmooth=False
	bOwnsCrossHair=True
	CustomCross=TheMinerCross
	CrossHairSize=64
	CrossHairScale=0.750000
	TeamLand(0)=Sk_LandMine_Red
	TeamLand(1)=Sk_LandMine_Blue
	TeamLand(2)=Sk_LandMine_Green
	TeamLand(3)=Sk_LandMine_Yellow
	TeamSticky(0)=Sk_StickyMine_Red
	TeamSticky(1)=Sk_StickyMine_Blue
	TeamSticky(2)=Sk_StickyMine_Green
	TeamSticky(3)=Sk_StickyMine_Yellow
}
