## XIII
Class Beretta

source: C:\XIII\XIII\Classes\Beretta.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Inventory
             |
             +--Engine.Weapon
                |
                +--XIII.XIIIWeapon
                   |
                   +--XIII.Beretta

Direct Known Subclasses:BerettaPeace, BerettaPlus, BerettaMulti

class Beretta
extends XIII.XIIIWeapon

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

Variables
`class` | `DTSilencer`

Function Summary
`Name` | `GetBaseWeaponBone()`
    //_____________________________________________________________________________
`simulated` | `PlayFiring()`
    //_____________________________________________________________________________
`simulated` | `PlayIdleAnim()`
    //_____________________________________________________________________________
`simulated` | `PlaySelect()`
    //_____________________________________________________________________________
`float` | `RateSelf()`
    //_____________________________________________________________________________
    // FRD
`void` | `TraceFire(float Accuracy, float YOffset, float ZOffset)`
    //_____________________________________________________________________________
`simulated` | `TweenDown()`
    //_____________________________________________________________________________

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class Beretta extends XIIIWeapon;
    00005
    00006	var class<DamageType> DTSilencer;
    00007
    00008	//_____________________________________________________________________________
    00009	simulated function Name GetBaseWeaponBone()
    00010	{
    00011	    return 'Berretta';
    00012	}
    00013
    00014	//_____________________________________________________________________________
    00015	function TraceFire( float Accuracy, float YOffset, float ZOffset )
    00016	{
    00017	    if ( HasSilencer() )
    00018	      AmmoType.MyDamageType = DTSilencer;
    00019	    else
    00020	      AmmoType.MyDamageType = AmmoType.Default.MyDamageType;
    00021
    00022	    Super.TraceFire(Accuracy, YOffset, ZOffset);
    00023	}
    00024
    00025	//_____________________________________________________________________________
    00026	// FRD
    00027	function float RateSelf()
    00028	{
    00029	    local float distance;
    00030
    00031	     if ( !HasAmmo() )
    00032	         return -2;
    00033	     if (instigator.controller.enemy!=none)
    00034	     {
    00035	      distance=Vsize(instigator.controller.enemy.location-instigator.location);
    00036	      if (distance>1766)
    00037	        return 0.291;
    00038	     }
    00039	    return AIRating;
    00040	}
    00041
    00042	//_____________________________________________________________________________
    00043	simulated function PlayIdleAnim()
    00044	{
    00045	    if ( !bIsSlave && !bHaveSlave )
    00046	    {
    00047	      if ( ReloadCount == 0 )
    00048	      {
    00049	        if ( bHaveBoredSfx && Pawn(Owner).IsPlayerPawn() && (iBoredCount > BOREDSFXTHRESHOLD) )
    00050	        {
    00051	          iBoredCount = 0;
    00052	          if ( Instigator.IsLocallyControlled() || (Level.NetMode == NM_StandAlone) )
    00053	            Instigator.PlayRolloffSound(hActWaitSound, self, 0, int(Pawn(Owner).IsPlayerPawn()), 0 );
    00054	          PlayAnim('WaitActVide', 1.0, 0.3);
    00055	        }
    00056	        else
    00057	          PlayAnim('WaitVide', 1.0, 0.3);
    00058	      }
    00059	      else
    00060	      {
    00061	        if ( bHaveBoredSfx && Pawn(Owner).IsPlayerPawn() && (iBoredCount > BOREDSFXTHRESHOLD) )
    00062	        {
    00063	          iBoredCount = 0;
    00064	          if ( Instigator.IsLocallyControlled() || (Level.NetMode == NM_StandAlone) )
    00065	            Instigator.PlayRolloffSound(hActWaitSound, self, 0, int(Pawn(Owner).IsPlayerPawn()), 0 );
    00066	          PlayAnim('WaitAct', 1.0, 0.3);
    00067	        }
    00068	        else
    00069	          PlayAnim('Wait', 1.0, 0.3);
    00070	      }
    00071	    }
    00072	    else
    00073	    {
    00074	      if ( ReloadCount == 0 )
    00075	      {
    00076	        if ( bHaveBoredSfx && Pawn(Owner).IsPlayerPawn() && (iBoredCount > BOREDSFXTHRESHOLD) )
    00077	        {
    00078	          iBoredCount = 0;
    00079	          if ( Instigator.IsLocallyControlled() || (Level.NetMode == NM_StandAlone) )
    00080	            Instigator.PlayRolloffSound(hActWaitSound, self, 0, int(Pawn(Owner).IsPlayerPawn()), 0 );
    00081	          PlayAnim('WaitActVide', 0.80+fRand()*0.40, 0.3);
    00082	        }
    00083	        else
    00084	          PlayAnim('WaitVide', 0.80+fRand()*0.40, 0.3);
    00085	      }
    00086	      else
    00087	      {
    00088	        if ( bHaveBoredSfx && Pawn(Owner).IsPlayerPawn() && (iBoredCount > BOREDSFXTHRESHOLD) )
    00089	        {
    00090	          iBoredCount = 0;
    00091	          if ( Instigator.IsLocallyControlled() || (Level.NetMode == NM_StandAlone) )
    00092	            Instigator.PlayRolloffSound(hActWaitSound, self, 0, int(Pawn(Owner).IsPlayerPawn()), 0 );
    00093	          PlayAnim('WaitAct', 1.0, 0.3);
    00094	        }
    00095	        else
    00096	          PlayAnim('Wait', 1.0, 0.3);
    00097	      }
    00098	    }
    00099	}
    00100
    00101	//_____________________________________________________________________________
    00102	simulated function TweenDown()
    00103	{
    00104	//    log("#"@DBUGFrameCount@" TweenDown call for"@self);
    00105	    if ( ReloadCount == 0 )
    00106	      PlayAnim('DownVide', 1.0);
    00107	    else
    00108	      PlayAnim('Down', 1.0);
    00109	}
    00110
    00111	//_____________________________________________________________________________
    00112	simulated function PlayFiring()
    00113	{
    00114	//    Log("#"$DBUGFrameCount@" PlayFiring call for"@self@"w/FiringMode="$FiringMode);
    00115	    if ( HasAmmo() )
    00116	    {
    00117	      if ( ReloadCount >= 1 )
    00118	        PlayAnim('Fire', 1.0);
    00119	      else
    00120	        PlayAnim('FireLast', 1.0);
    00121	    }
    00122	    else
    00123	      PlayAnim('FireVide', 1.0);
    00124	    if ( Instigator.IsLocallyControlled() || (Level.NetMode == NM_StandAlone) )
    00125	      PlayFiringSound(HasSilencer());
    00126
    00127	    if ( !HasAmmo() )
    00128	      return;
    00129
    00130	    IncrementFlashCount();
    00131	    if ( bDrawMuzzleflash )
    00132	      SetUpMuzzleFlash();
    00133	}
    00134
    00135	//_____________________________________________________________________________
    00136	simulated function PlaySelect()
    00137	{
    00138	//    log("#"@DBUGFrameCount@" PlaySelect call for"@self@"w/ mesh="$Mesh);
    00139	    bForceFire = false;
    00140	    bForceAltFire = false;
    00141	    if ( !IsAnimating() || !AnimIsInGroup(0,'Select') )
    00142	    {
    00143	      if ( ReloadCount == 0 )
    00144	        PlayAnim('SelectVide',1.0);
    00145	      else
    00146	        PlayAnim('Select',1.0);
    00147	    }
    00148	    if ( Instigator.IsLocallyControlled() || (Level.NetMode == NM_StandAlone) )
    00149	      Instigator.PlayRolloffSound(hSelectWeaponSound, self, 0, int(Pawn(Owner).IsPlayerPawn()), 0 );
    00150	}
    00151
    00152	//    Mesh=SkeletalMesh'XIIIArmes.FpsBerrettaM'
    00153	//    PickupClass=Class'XIII.BerettaPick'
    00154	//    Icon=texture'XIIIMenu.BerettaIcon'
    00155
    00156	defaultproperties
    00157	{
    00158	     DTSilencer=Class'XIII.DTGunnedSilenced'
    00159	     WeaponOnoClass=Class'XIDSpec.GunWeaponOno'
    00160	     bUseSilencer=True
    00161	     bShouldGoThroughTraversable=True
    00162	     bHaveBoredSfx=True
    00163	     bCanHaveSlave=True
    00164	     bDrawMuzzleFlash=True
    00165	     WHand=WHA_1HShot
    00166	     WeaponMode=WM_SemiAuto
    00167	     AmmoName=Class'XIII.c9mmAmmo'
    00168	     PickupAmmoCount=13
    00169	     ReloadCount=13
    00170	     MeshName="XIIIArmes.FpsBerrettaM"
    00171	     FireOffset=(X=9.000000,Y=5.000000,Z=-4.000000)
    00172	     CrossHair=Texture'XIIIMenu.HUD.MireBeretta'
    00173	     TraceAccuracy=1.500000
    00174	     ShotTime=0.500000
    00175	     FiringMode="FM_1H"
    00176	     FireNoise=1.312000
    00177	     ReLoadNoise=0.000000
    00178	     AltFireNoise=0.000000
    00179	     ViewFeedBack=(X=1.500000,Y=3.000000)
    00180	     RumbleFXNum=1
    00181	     FPMFRelativeLoc=(Y=13.000000,Z=6.000000)
    00182	     ShakeMag=200.000000
    00183	     ShakeVert=(Z=8.000000)
    00184	     ShakeCycles=3.000000
    00185	     TraceDist=100.000000
    00186	     hFireSound=Sound'XIIIsound.Guns__9mmFire.9mmFire__h9mmFire'
    00187	     hReloadSound=Sound'XIIIsound.Guns__9mmRel.9mmRel__h9mmRel'
    00188	     hNoAmmoSound=Sound'XIIIsound.Guns__9mmDryFire.9mmDryFire__h9mmDry'
    00189	     hSelectWeaponSound=Sound'XIIIsound.Guns__9mmSelWp.9mmSelWp__h9mmSelWp'
    00190	     hActWaitSound=Sound'XIIIsound.Guns__9mmWait.9mmWait__h9mmWait'
    00191	     MuzzleScale=0.600000
    00192	     FlashOffsetY=0.160000
    00193	     FlashOffsetX=0.185000
    00194	     InventoryGroup=2
    00195	     PickupClassName="XIII.BerettaPick"
    00196	     PlayerViewOffset=(X=5.000000,Y=3.500000,Z=-4.000000)
    00197	     ThirdPersonRelativeLocation=(X=13.000000,Y=-2.500000,Z=4.500000)
    00198	     AttachmentClass=Class'XIII.BerettaAttach'
    00199	     ItemName="9 MM"
    00200	     DrawScale=0.300000
    00201	}

End Source Code