## XIII
Class FusilPompe

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

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

Direct Known Subclasses:None

class FusilPompe
extends XIII.XIIIWeapon

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

Function Summary
`string` | `GetAmmoText(out int)`
    //_____________________________________________________________________________
    // ELR Text to be displayed in HUD
`Name` | `GetBaseWeaponBone()`
    //_____________________________________________________________________________
`bool` | `HasAltAmmo()`
    //_____________________________________________________________________________
`simulated` | `PlayFiring()`
    //_____________________________________________________________________________
`float` | `RateSelf()`
    //_____________________________________________________________________________
    // FRD
`void` | `TraceFire(float Accuracy, float YOffset, float ZOffset)`
    //_____________________________________________________________________________

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class FusilPompe extends XIIIWeapon;
    00005
    00006	//_____________________________________________________________________________
    00007	simulated function bool HasAltAmmo()
    00008	{ // because we can stun only if we have ammo (bAllowEmptyShot=false, must down weapon after last fire)
    00009	    return true;
    00010	}
    00011
    00012	//_____________________________________________________________________________
    00013	// ELR Text to be displayed in HUD
    00014	simulated function string GetAmmoText(out int bDrawbulletIcon)
    00015	{
    00016	    local string AmmoText,AltAmmoText;
    00017
    00018	    bDrawbulletIcon = 1;
    00019
    00020	    // Setup ammotext
    00021	    AmmoText = ReLoadCount@"|"@(Ammotype.AmmoAmount-ReLoadCount);
    00022	    return AmmoText;
    00023	}
    00024
    00025	//_____________________________________________________________________________
    00026	simulated function Name GetBaseWeaponBone()
    00027	{
    00028	    return 'Pompe';
    00029	}
    00030
    00031	//_____________________________________________________________________________
    00032	// FRD
    00033	function float RateSelf()
    00034	{
    00035	    local float distance;
    00036
    00037	    if ( !HasAmmo() )
    00038	      return -2;
    00039	    if (instigator.controller.enemy!=none)
    00040	    {
    00041	      distance=Vsize(instigator.controller.enemy.location-instigator.location);
    00042	      if (distance>811)
    00043	        return 0.294;
    00044	    }
    00045	    return AIRating;
    00046	}
    00047
    00048	//_____________________________________________________________________________
    00049	simulated function PlayFiring()
    00050	{
    00051	    if ( HasAmmo() )
    00052	    {
    00053	      if ( ReloadCount >= 1 )
    00054	        PlayAnim('Fire', 1.0);
    00055	      else
    00056	        PlayAnim('FireLast', 1.0);
    00057	    }
    00058	    else
    00059	      PlayAnim('FireVide', 1.0);
    00060	    if ( Instigator.IsLocallyControlled() || (Level.NetMode == NM_StandAlone) )
    00061	      PlayFiringSound();
    00062
    00063	    if ( !HasAmmo() )
    00064	      return;
    00065
    00066	    IncrementFlashCount();
    00067	    if ( bDrawMuzzleflash )
    00068	      SetUpMuzzleFlash();
    00069	}
    00070
    00071	//_____________________________________________________________________________
    00072	function TraceFire( float Accuracy, float YOffset, float ZOffset )
    00073	{
    00074	    local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z;
    00075	    local actor Other;
    00076	    local int I;
    00077	    local Material HitMat;
    00078	    local Vector vWaterDir;
    00079
    00080	    MakeNoise(FireNoise);
    00081	    GetAxes(Instigator.GetViewRotation(),X,Y,Z);
    00082	    StartTrace = GetFireStart(X,Y,Z);
    00083	    AdjustedAim = Instigator.AdjustAim(AmmoType, StartTrace, 0);
    00084
    00085	    // the one that uses ammo.
    00086	    EndTrace = StartTrace + (TraceDist * vector(AdjustedAim));
    00087	    EndTrace += vRand() * fRand() * (TraceAccuracy/100.0) * TraceDist;
    00088	    Other = Trace(HitLocation,HitNormal,EndTrace,StartTrace,True, vect(0,0,0), HitMat, TRACETYPE_DiscardIfCanShootThroughWithRayCastingWeapon|TRACETYPE_RequestBones);
    00089	    if ( XIIIPawn(Other) != none )
    00090	      XIIIPawn(Other).LastBoneHit = GetLastTraceBone();
    00091	    if ( HitMat != none )
    00092	      AmmoType.PlayImpactSound(HitMat.HitSound);
    00093	    AmmoType.ProcessTraceHit(self, Other, HitLocation, HitNormal, X,Y,Z);
    00094
    00095	    // 4 shots AFTER because ony the 1rst one update the impact visual type
    00096	    // 4 shots w/out ammo
    00097	    AmmoType.Ammoamount ++;
    00098	    for (i=0;i<4;i++)
    00099	    { // to make multiple shots without using ammo, must be played after to use the right HitMat
    00100	      EndTrace = StartTrace + (TraceDist * vector(AdjustedAim));
    00101	      EndTrace += vRand() * fRand() * (TraceAccuracy/100.0) * TraceDist;
    00102	      Other = IntersectWaterPlane(StartTrace, EndTrace, HitLocation);
    00103	      if ( Other != none )
    00104	      {
    00105	        vWaterDir = HitLocation - StartTrace;
    00106	        vWaterDir.Z = abs(vWaterDir.z) * 8.0;
    00107	        WRE = PhysicsVolume(Other).BeingHitByBullets(HitLocation+vect(0,0,1), rotator(vWaterDir cross Y), AmmoType.HitSoundType);
    00108	      }
    00109	      Other = Trace(HitLocation,HitNormal,EndTrace,StartTrace,True, vect(0,0,0), HitMat, TRACETYPE_DiscardIfCanShootThroughWithRayCastingWeapon|TRACETYPE_RequestBones);
    00110	      if ( XIIIPawn(Other) != none )
    00111	        XIIIPawn(Other).LastBoneHit = GetLastTraceBone();
    00112	      if ( HitMat != none )
    00113	        AmmoType.PlayImpactSound(HitMat.HitSound);
    00114	      if ( i>0 )
    00115	        AmmoType.bPlayHitSound = false;
    00116	      AmmoType.ProcessTraceHitNoAmmo(self, Other, HitLocation, HitNormal, X,Y,Z);
    00117	    }
    00118	    AmmoType.Ammoamount --;
    00119
    00120	    FeedBack();
    00121	}
    00122
    00123	//    Icon=texture'XIIIMenu.FPompeIcon'
    00124
    00125
    00126	defaultproperties
    00127	{
    00128	     WeaponOnoClass=Class'XIDSpec.RifleWeaponOno'
    00129	     bHaveAltFire=True
    00130	     bHaveBoredSfx=True
    00131	     bDrawMuzzleFlash=True
    00132	     WHand=WHA_2HShot
    00133	     AmmoName=Class'XIII.PompeAmmo'
    00134	     AltAmmoName=Class'XIII.ShotGunAltAmmo'
    00135	     PickupAmmoCount=5
    00136	     ReloadCount=5
    00137	     MeshName="XIIIArmes.FpsPompeM"
    00138	     FireOffset=(Y=5.000000,Z=-2.000000)
    00139	     AltFireOffset=(X=7.000000,Y=6.000000,Z=-6.000000)
    00140	     CrossHair=Texture'XIIIMenu.HUD.MireShotgun'
    00141	     TraceAccuracy=10.000000
    00142	     ShotTime=1.000000
    00143	     FiringMode="FM_2H"
    00144	     AltFireNoise=0.000000
    00145	     LoadedAltFiringAnim="FireAlt"
    00146	     ViewFeedBack=(X=3.000000,Y=15.000000)
    00147	     RumbleFXNum=4
    00148	     FirstPersonMFClass=Class'XIII.ShotgunFPMF'
    00149	     FPMFRelativeLoc=(Y=52.000000,Z=8.500000)
    00150	     ShakeVert=(X=5.000000,Z=-15.000000)
    00151	     ShakeSpeed=(Z=-300.000000)
    00152	     ShakeCycles=2.000000
    00153	     AIRating=0.600000
    00154	     TraceDist=180.000000
    00155	     hFireSound=Sound'XIIIsound.Guns__ShotFire.ShotFire__hShotFire'
    00156	     hReloadSound=Sound'XIIIsound.Guns__ShotRel.ShotRel__hShotRel'
    00157	     hNoAmmoSound=Sound'XIIIsound.Guns__ShotDryFire.ShotDryFire__hShotDry'
    00158	     hSelectWeaponSound=Sound'XIIIsound.Guns__ShotSelWp.ShotSelWp__hShotSelWp'
    00159	     hAltFireSound=Sound'XIIIsound.Guns__ShotFireAlt.ShotFireAlt__hShotFireAlt'
    00160	     hActWaitSound=Sound'XIIIsound.Guns__ShotWait.ShotWait__hShotWait'
    00161	     MuzzleScale=2.250000
    00162	     FlashOffsetY=0.170000
    00163	     FlashOffsetX=0.125000
    00164	     InventoryGroup=9
    00165	     PickupClassName="XIII.FusilPompePick"
    00166	     PlayerViewOffset=(X=4.000000,Y=7.000000,Z=-7.000000)
    00167	     ThirdPersonRelativeLocation=(X=25.000000,Y=-4.000000,Z=13.000000)
    00168	     ThirdPersonRelativeRotation=(Pitch=7000)
    00169	     AttachmentClass=Class'XIII.FusilPompeAttach'
    00170	     ItemName="SHOTGUN"
    00171	     DrawScale=0.300000
    00172	}

End Source Code