## XIIIMP
Class XIIIMPBombPick

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

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Pickup
             |
             +--Engine.WeaponPickup
                |
                +--XIIIMP.XIIIMPBombPick

Direct Known Subclasses:None

class XIIIMPBombPick
extends Engine.WeaponPickup

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

States
Pickup, DelayBeforePickable

Function Summary
`void` | `GiveHarnaisBomb(XIIIPawn P)`
    //_____________________________________________________________________________
`Inventory` | `SpawnCopy(Pawn Other)`
    // for this game the bomb pickup respawn only when the previous one is destroyed/used.

State Pickup Function Summary
`void` | `SetRespawn()`
    //_____________________________________________________________________________
`bool` | `ValidTouch(Actor Other)`

State DelayBeforePickable Function Summary

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class XIIIMPBombPick extends WeaponPickup;
    00005
    00006	state DelayBeforePickable
    00007	{
    00008
    00009	event beginstate()
    00010	{
    00011		  SetDrawType(DT_None);
    00012	}
    00013	event endstate()
    00014	{
    00015	      SetDrawType(DT_StaticMesh);
    00016	}
    00017	begin:
    00018	      Sleep( 10.0 );
    00019
    00020	      GotoState('Pickup');
    00021	}
    00022
    00023	//_____________________________________________________________________________
    00024
    00025	function GiveHarnaisBomb( XIIIPawn P)
    00026	{
    00027	    local Inventory NewItem;
    00028
    00029	    if( P.FindInventoryType(Class'XIIIMP.HarnaisBomb')==None )
    00030	    {
    00031	        NewItem = Spawn(Class'XIIIMP.HarnaisBomb',,,P.Location);
    00032
    00033	        if( NewItem != None )
    00034	            NewItem.GiveTo(P);
    00035	    }
    00036	}
    00037
    00038	//_____________________________________________________________________________
    00039
    00040	// for this game the bomb pickup respawn only when the previous one is destroyed/used.
    00041	function inventory SpawnCopy( pawn Other )
    00042	{
    00043	    local inventory Copy;
    00044
    00045	    if ( Inventory != None )
    00046	    {
    00047	      Copy = Inventory;
    00048	      Inventory = None;
    00049	    }
    00050	    else
    00051	      Copy = spawn(InventoryType,Other,,,rot(0,0,0));
    00052
    00053	    Copy.GiveTo( Other );
    00054	    if ( Copy == none ) // then the player could already have this type in inventory
    00055	      Copy = Other.FindInventoryType(InventoryType);
    00056	    MPBomb(Copy).PickupSource = self;
    00057	    //log( "BOMBING-] Setting PickupSource="@self@"for"@copy);
    00058	    StartSleeping();
    00059	    return Copy;
    00060	}
    00061
    00062	//_____________________________________________________________________________
    00063
    00064	auto state Pickup
    00065	{
    00066	    function bool ValidTouch( actor Other )
    00067	    {
    00068	      // make sure its a live player
    00069	      if ( (Pawn(Other) == None) || !Pawn(Other).bCanPickupInventory || (Pawn(Other).Health <= 0) )
    00070	        return false;
    00071
    00072	      // Only  players on team 0 (Attackers) can pickup the bomb
    00073
    00074	      if ( Pawn(Other).PlayerReplicationInfo.Team.TeamIndex != 0 )
    00075	        return false;
    00076
    00077	      // make sure not touching through wall
    00078	      // ELR take EyeHeight into account
    00079	      if ( !FastTrace(Other.Location+Pawn(Other).EyeHeight*vect(0,0,1), Location) )
    00080	        return false;
    00081
    00082	      GiveHarnaisBomb( XIIIPawn(Other) );
    00083
    00084	      // make sure game will let player pick me up
    00085	      if( Level.Game.PickupQuery(Pawn(Other), self) )
    00086	      {
    00087	         TriggerEvent(Event, self, Pawn(Other));
    00088	        return true;
    00089	      }
    00090
    00091	      return false;
    00092	    }
    00093	}
    00094
    00095	//_____________________________________________________________________________
    00096
    00097	function SetRespawn()
    00098	{
    00099	    GotoState('Sleeping');
    00100	}
    00101
    00102	//_____________________________________________________________________________
    00103
    00104
    00105
    00106	defaultproperties
    00107	{
    00108	     InventoryType=Class'XIIIMP.MPBomb'
    00109	     RespawnTime=60000.000000
    00110	     PickupMessage="Bomb"
    00111	     PickupSound=Sound'XIIIsound.Items.PassPick1'
    00112	     hRespawnSound=Sound'XIIIsound.Multi__SFXMulti.SFXMulti__hRespawnGun'
    00113	     DrawType=DT_StaticMesh
    00114	     StaticMesh=StaticMesh'MeshArmesPickup.bombemagnet'
    00115	     DrawScale3D=(X=2.000000,Y=2.000000,Z=2.000000)
    00116	}

End Source Code