## XIII
Class XIIIPickup

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

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Pickup
             |
             +--XIII.XIIIPickup

Direct Known Subclasses:EventItemPick, FullMedPick, HookPick, KeyPicks, MedPick, MicroPick, PhotoPick, SilencerPick, UnLockerPick, XIIIDocumentPick

class XIIIPickup
extends Engine.Pickup

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

States
Pickup

State Pickup Function Summary
`void` | `Touch(Actor Other)`
    // When touched by an actor.
`bool` | `ValidTouch(Actor Other)`

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class XIIIPickup extends Pickup;
    00005
    00006	var(Pickup) localized string InvItemName;
    00007	var(Pickup) bool bCauseEventOnPick;
    00008
    00009	//_____________________________________________________________________________
    00010	event ParseDynamicLoading(LevelInfo MyLI)
    00011	{
    00012	    Log("ParseDynamicLoading Actor="$self);
    00013	    MyLI.ForcedMeshes[MyLI.ForcedMeshes.Length] = mesh(DynamicLoadObject(class<XIIIItems>(default.InventoryType).default.MeshName, class'mesh'));
    00014	    default.InventoryType.Static.StaticParseDynamicLoading(MyLI);
    00015	}
    00016
    00017	//_____________________________________________________________________________
    00018	// ELR Let's override the TriggerEvent.
    00019	auto state Pickup
    00020	{
    00021	    function bool ValidTouch( actor Other )
    00022	    {
    00023	      // make sure its a live player
    00024	      if ( (Pawn(Other)==none) || !Pawn(Other).bCanPickupInventory || (Pawn(Other).Health <= 0) )
    00025	        return false;
    00026	      // make sure not touching through wall
    00027	      if ( !FastTrace(Other.Location+Pawn(Other).EyeHeight*vect(0,0,1), Location) )
    00028	        return false;
    00029	      // make sure game will let player pick me up
    00030	      if( Level.Game.PickupQuery(Pawn(Other), self) )
    00031	      {
    00032	        // ELR Get rid of the line below for XIII Items !
    00033	        if ( bCauseEventOnPick )
    00034	          TriggerEvent(Event, self, Pawn(Other));
    00035	        return true;
    00036	      }
    00037	    return false;
    00038	    }
    00039
    00040	    // When touched by an actor.
    00041	    function Touch( actor Other )
    00042	    {
    00043	      local Inventory Copy;
    00044
    00045	      // If touched by a player pawn, let him pick this up.
    00046	      if( ValidTouch(Other) )
    00047	      {
    00048	        Copy = SpawnCopy(Pawn(Other));
    00049	        AnnouncePickup(Pawn(Other));
    00050	        Copy.PickupFunction(Pawn(Other));
    00051	      }
    00052	      // don't allow inventory to pile up (frame rate hit)
    00053	      else if ( (Inventory != None) && (Pickup(Other) != none)
    00054	        && (Pickup(Other).Inventory != None) )
    00055	        Destroy();
    00056	    }
    00057	}
    00058
    00059
    00060
    00061	defaultproperties
    00062	{
    00063	     RespawnTime=5.000000
    00064	     PickupMessage="Got a XIII Item ::BUG:: (Message should be defined in sub-classes) !!"
    00065	     DrawType=DT_StaticMesh
    00066	     CollisionRadius=34.000000
    00067	     CollisionHeight=8.000000
    00068	     MessageClass=Class'XIII.XIIIPickupMessage'
    00069	}

End Source Code