## XIIIMP
Class FlashBangBot

source: C:\XIII\XIIIMP\Classes\FlashBangBot.uc

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

Direct Known Subclasses:None

class FlashBangBot
extends XIII.XIIIWeapon

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

Function Summary
`simulated` | `PlayIdleAnim()`
    //_____________________________________________________________________________
`float` | `RateSelf()`
    //_____________________________________________________________________________
    // FRD
`simulated` | `TweenDown()`
    //_____________________________________________________________________________

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class FlashBangBot extends XIIIWeapon;
    00005
    00006	//var bool bPendingEnded;         // to not thrown before ending the pendingfire anim
    00007	//var bool bUnFired;              // to not thrown before ending the pendingfire anim
    00008	//var float ProjectileLifeTime;   // to make the projectile live less if hold a long time (GD request)
    00009	//
    00010	//CONST DBGren=false;
    00011	//
    00012	////_____________________________________________________________________________
    00013	//replication
    00014	//{
    00015	//    Reliable if( Role<ROLE_Authority )
    00016	//      ServerSetProjectileLifeTime;
    00017	//}
    00018
    00019	//_____________________________________________________________________________
    00020	// FRD
    00021	function float RateSelf()
    00022	{
    00023	    local float distance;
    00024	    local vector PositionRelative;
    00025
    00026	    if ( !HasAmmo() )
    00027	      return -2;
    00028	    if (instigator.controller.enemy!=none)
    00029	    {
    00030	      PositionRelative=instigator.controller.enemy.location-instigator.location;
    00031	      distance=Vsize(PositionRelative);
    00032	      if (distance>1170)
    00033	        return 0.23;
    00034	      else if (distance<500)
    00035	        return 0.25;
    00036	      if (PositionRelative.z>400) // enemy au dessus donc pas prendre
    00037	        return (AIRating-2);
    00038	     }
    00039	     return AIRating;
    00040	}
    00041
    00042	//_____________________________________________________________________________
    00043	//simulated function Fire(float value)
    00044	//{
    00045	//    if ( DBGren ) Log(">>> Fire call for "$self$" in state "$GetStateName());
    00046	//    bUnFired = false;
    00047	//    bPendingEnded = false;
    00048	//    ProjectileLifeTime = Level.TimeSeconds + 5.0;
    00049	//    if ( DBGren ) Log("  > Calling ServerSetProjectileLifeTime from Fire");
    00050	//    ServerSetProjectileLifeTime();
    00051	//    SetTimer(5.0, false);
    00052	//    GotoState('PendingFire');
    00053	//}
    00054
    00055	//_____________________________________________________________________________
    00056	// Replicate to server because projectiles spawned need their life time
    00057	//function ServerSetProjectileLifeTime()
    00058	//{
    00059	//    if ( DBGren ) Log(">>> ServerSetProjectileLifeTime call");
    00060	//    ProjectileLifeTime = Level.TimeSeconds + 5.0;
    00061	//}
    00062
    00063	//_____________________________________________________________________________
    00064	//simulated function UnFire( float value )
    00065	//{
    00066	//    if ( DBGren ) Log(">>> Global UnFire call for "$self$" in state "$GetStateName());
    00067	//    bUnFired = true;
    00068	//}
    00069
    00070	//_____________________________________________________________________________
    00071	//state PendingFire
    00072	//{
    00073	//    simulated event BeginState()
    00074	//    {
    00075	//      if ( DBGren ) Log(">>> ClientPendingFire BeginState for "$self$" in state "$GetStateName());
    00076	//      PlayThrowPrep();
    00077	//    }
    00078	//    simulated function Fire(float F) {}
    00079	//    simulated function AltFire(float F) {}
    00080	//    simulated function UnFire( float value )
    00081	//    {
    00082	//      if ( DBGren ) Log(">>> ClientPendingFire UnFire for "$self$" in state "$GetStateName());
    00083	//      Global.UnFire(value);
    00084	//      if ( bPendingEnded )
    00085	//      {
    00086	//        Instigator.controller.bFire = 1;
    00087	//        Super(XIIIWeapon).Fire(0);
    00088	//        Instigator.controller.bFire = 0;
    00089	//        bUnFired = false;
    00090	//        bPendingEnded = false;
    00091	//      }
    00092	//    }
    00093	//    simulated function bool PutDown()
    00094	//    {
    00095	//      UnFire(0);
    00096	//      return True;
    00097	//    }
    00098	//    simulated event AnimEnd(int channel)
    00099	//    {
    00100	//      if ( DBGren ) Log(">>> ClientPendingFire AnimEnd for "$self$" in state "$GetStateName());
    00101	//      bPendingEnded = true;
    00102	//      if ( bUnFired )
    00103	//      {
    00104	//        Instigator.controller.bFire = 1;
    00105	//        Super(XIIIWeapon).Fire(0);
    00106	//        Instigator.controller.bFire = 0;
    00107	//        bUnFired = false;
    00108	//        bPendingEnded = false;
    00109	//      }
    00110	//    }
    00111	//    //_____________________________________________________________________________
    00112	//    // ELR Text to be displayed in HUD
    00113	//    simulated function string GetAmmoText(out int bDrawbulletIcon)
    00114	//    {
    00115	//      local string AmmoText,AltAmmoText;
    00116	//      local int iSec, iMillisec;
    00117	//      local string sT;
    00118	//
    00119	//      iSec = ProjectileLifeTime - Level.TimeSeconds;
    00120	//      iMilliSec = (ProjectileLifeTime*10.0 - Level.TimeSeconds*10.0 - iSec*10.0);
    00121	//      sT = iSec$":"$iMilliSec$"0";
    00122	//
    00123	//      bDrawbulletIcon = 1;
    00124	//
    00125	//      AmmoText = "["$sT$"]"@string(Ammotype.AmmoAmount);
    00126	//      return AmmoText;
    00127	//    }
    00128	///*
    00129	//    simulated event Tick(float dT)
    00130	//    {
    00131	//
    00132	//      Log("dif="$(ProjectileLifeTime - Level.TimeSeconds)$" >>"$sT);
    00133	//      XIIIBaseHUD(Playercontroller(Pawn(Owner).Controller).MyHud).AddChronoDisplay(sT, 0.1);
    00134	//    }
    00135	//*/
    00136	//    Simulated Event Timer()
    00137	//    { // Force player to throw gren & make himself blow up
    00138	//      UnFire(0);
    00139	//    }
    00140	//}
    00141
    00142	//_____________________________________________________________________________
    00143	simulated function PlayIdleAnim()
    00144	{
    00145	    if ( HasAmmo() )
    00146	      PlayAnim('Wait', 1.0, 0.3);
    00147	    else
    00148	      PlayAnim('WaitVide', 1.0, 0.3);
    00149	}
    00150
    00151	//_____________________________________________________________________________
    00152	simulated function TweenDown()
    00153	{
    00154	    if ( HasAmmo() )
    00155	      PlayAnim('Down', 1.0);
    00156	    else
    00157	      PlayAnim('DownVide', 1.0);
    00158	}
    00159
    00160	//_____________________________________________________________________________
    00161	//simulated function PlayThrowPrep()
    00162	//{
    00163	//    PlayAnim('PendingFire', 1.0);
    00164	//    PlayPendingFiringSound();
    00165	//}
    00166
    00167	//_____________________________________________________________________________
    00168	//simulated function PlayPendingFiringSound()
    00169	//{
    00170	//    if ( bEmptyShot )
    00171	//      Instigator.PlayRolloffSound(hNoAmmoSound, self, 0, int(Pawn(Owner).IsPlayerPawn()), 3 );
    00172	//    else
    00173	//    {
    00174	//      if ( HasSilencer() )
    00175	//        Instigator.PlayRolloffSound(hFireSound, self, 1, int(Pawn(Owner).IsPlayerPawn()), 3 );
    00176	//      else
    00177	//        Instigator.PlayRolloffSound(hFireSound, self, 0, int(Pawn(Owner).IsPlayerPawn()), 3 );
    00178	//    }
    00179	//}
    00180
    00181	//    Icon=texture'XIIIMenu.FlashbIcon'
    00182
    00183
    00184	defaultproperties
    00185	{
    00186	     bAllowEmptyShot=False
    00187	     WHand=WHA_2HShot
    00188	     WeaponMode=WM_SemiAuto
    00189	     AmmoName=Class'XIIIMP.FlashBangAmmo'
    00190	     PickupAmmoCount=1
    00191	     MeshName="XIIIArmes.FpsFlashBangM"
    00192	     FireOffset=(Y=5.000000,Z=-2.000000)
    00193	     CrossHair=Texture'XIIIMenu.HUD.MireCouteau'
    00194	     ShotTime=2.000000
    00195	     FiringMode="FM_Throw"
    00196	     FireNoise=0.000000
    00197	     AIRating=0.450000
    00198	     TraceDist=0.000000
    00199	     hFireSound=Sound'XIIIsound.Guns__GrenFire.GrenFire__hGrenFire'
    00200	     hSelectWeaponSound=Sound'XIIIsound.Guns__GrenSelWp.GrenSelWp__hGrenSelWp'
    00201	     InventoryGroup=17
    00202	     PickupClassName="XIIIMP.FlashBangPick"
    00203	     PlayerViewOffset=(X=5.000000,Y=4.000000,Z=-4.200000)
    00204	     ThirdPersonRelativeLocation=(X=7.000000,Y=-5.000000,Z=2.000000)
    00205	     ThirdPersonRelativeRotation=(Yaw=16384)
    00206	     AttachmentClass=Class'XIIIMP.FlashBangAttach'
    00207	     ItemName="FLASHBANG"
    00208	     DrawScale=0.300000
    00209	}

End Source Code