//=============================================================================
// Rips_FlamethWeapon.
// 
// 
// 
//=============================================================================

class Rips_FlamethWeapon extends CatableWeapon;

var class<damageType> MyDamageType;

var Rips_Flama FlamaB;

simulated function PostNetBeginPlay()
{
    local PlayerController PC;
	local Pawn P;

    Super.PostNetBeginPlay();

    P  = Pawn(Owner);
	PC = PlayerController(P.Controller);

   	if (P.IsLocallyControlled() && PC!=None && (!PC.bBehindView) )
	{
        FlamaB = Spawn(Class'RipsModV1.Rips_Flama');
        AttachToBone(FlamaB, 'Rips_Flama');
    }
   	else
	{
        if(Instigator != None)
	   {
		 if(Instigator.Mesh != None)

             FlamaB.Destroyed();
             FlamaB = None;
	   }
	}

}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
function DropFrom(vector StartLocation)
{

   Super.DropFrom(StartLocation);


     FlamaB.Destroyed();

}

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

  if( FlamaB != None )
  {
    DetachFromBone(FlamaB);
    FlamaB.Destroy();
    FlamaB = None;
  }
}
///////////////////////////////////////////////////////////////////////////////
// Vars, structs, consts
///////////////////////////////////////////////////////////////////////////////
//var travel byte ShootScissors;		// Cheat that makes you shoot bouncing scissors instead
				// How accurate we are in single player games.


///////////////////////////////////////////////////////////////////////////////
// Tell ammo to make this scissors type
///////////////////////////////////////////////////////////////////////////////
/*function SpawnScissors(bool bMakeSpinner)
{
	local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z;
	local actor Other;
	local ScissorsProjectile sic;
	local P2Player p2p;

	GetAxes(Instigator.GetViewRotation(),X,Y,Z);
	StartTrace = GetFireStart(X,Y,Z);
	AdjustedAim = Instigator.AdjustAim(AmmoType, StartTrace, 2*AimError);
	sic = spawn(class'ScissorsAltProjectile',Instigator,,StartTrace, AdjustedAim);
}*/

///////////////////////////////////////////////////////////////////////////////
simulated function PlayFiring()
{
        //SetupMuzzleFlash();
	Super.PlayFiring();
        //IncrementFlashCount();
        // Play MP sounds on everyone's computers
	if(Level.Game == None
		|| !FPSGameInfo(Level.Game).bIsSinglePlayer)
		PlayOwnedSound(FireSound,SLOT_Interact,1.0,,,WeaponFirePitchStart + (FRand()*WeaponFirePitchRand),false);
	else // just on yours in SP games
		Instigator.PlaySound(FireSound, SLOT_None, 1.0, true, , WeaponFirePitchStart + (FRand()*WeaponFirePitchRand));
	PlayAnim('Shoot1', WeaponSpeedShoot1 + (WeaponSpeedShoot1Rand*FRand()), 0.05);
}

///////////////////////////////////////////////////////////////////////////////
// Make sure the muzzle flash renders, and move it around some
///////////////////////////////////////////////////////////////////////////////
/*simulated function SetupMuzzleFlash()
{
	bMuzzleFlash = True;
	bSetFlashTime = false;
	// Gets turned off in weapon, in RenderOverlays
	// Slightly change colors each time
	if(IsFirstPersonView()
		&& bDrawMuzzleFlash)
	{
		PickLightValues();
		bDynamicLight=bAllowDynamicLights;
	}
}*/

///////////////////////////////////////////////////////////////////////////////
// See what we hit
///////////////////////////////////////////////////////////////////////////////
function TraceFire( float Accuracy, float YOffset, float ZOffset )
{
	local int i;

	// Reduce the ammo only by 1 here, for the shotgun, but shoot
	// ShotCountMaxForNotify number of pellets each time.
	P2AmmoInv(AmmoType).UseAmmoForShot();

	// Reduce the cat ammo if we're using one
	if(CatOnGun == 1)
		CatAmmoLeft--;

	/*if(ShootScissors==1)
		SpawnScissors(true);*/
	else
		Super.TraceFire(Accuracy, YOffset, ZOffset);
}

///////////////////////////////////////////////////////////////////////////////
// Default properties
///////////////////////////////////////////////////////////////////////////////

defaultproperties
{
     MyDamageType=Class'RipsModV1.Rips_FlamethDamage'
     
     ViolenceRank=8
     RecognitionDist=400.000000
     ShotCountMaxForNotify=20
     AI_BurstCountExtra=10
     AI_BurstCountMin=6
     AI_BurstTime=0.150000
     holdstyle=WEAPONHOLDSTYLE_Both
     switchstyle=WEAPONHOLDSTYLE_Both
     firingstyle=WEAPONHOLDSTYLE_Both
     bNoHudReticle=True
     MinRange=250.000000
     PlayerMeleeDist=225.000000
     NPCMeleeDist=215.000000
     CombatRating=2.000000
     FirstPersonMeshSuffix="Rips_Flama"
     WeaponsPackageStr="RipsModAnimsV1."
     WeaponSpeedLoad=1.250000
     WeaponSpeedHolster=1.250000
     WeaponSpeedShoot1=40.000000
     WeaponFirePitchStart=1.000000
     WeaponFirePitchRand=0.000000
     WeaponSpeedIdle=0.750000
     AmmoName=Class'RipsModV1.Rips_FlamethBulletAmmoInv'
     AutoSwitchPriority=4
     ShakeRotMag=(X=0.000000,Y=0.000000,Z=0.000000)
     ShakeOffsetMag=(X=10.000000)
     ShakeOffsetRate=(X=50.000000)
     TraceAccuracy=0.025000
     bMeleeWeapon=True
     aimerror=0.020000
     AIRating=1.200000
     MaxRange=800.000000
     SelectSound=None
     InventoryGroup=4
     GroupOffset=24
     PickupClass=Class'RipsModV1.Rips_FlamethPickup'
     PlayerViewOffset=(X=1.500000,Y=-0.400000,Z=1.000000)
     BobDamping=0.975000
     AttachmentClass=Class'RipsModV1.Rips_FlamethAttachment'
     ItemName="Flamethrower"
     Mesh=SkeletalMesh'RipsModAnimsV1.MP_LS_Flama'
     DrawScale=0.250000
     Skins(0)=Shader'RipsModTexV1.Dart.fake'
     Skins(1)=Texture'MP_FPArms.LS_arms.LS_hands_dude'
     SoundRadius=255.000000
}
