## XIII
Class EventItem

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

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Inventory
             |
             +--Engine.Powerups
                |
                +--XIII.XIIIItems
                   |
                   +--XIII.EventItem

Direct Known Subclasses:Banque01Bombe, Hual04aFusible, MagneticCard, Sanc02aStatuePart, Spads02Bombe, Spads02Micro, Usa01Bombe

class EventItem
extends XIII.XIIIItems

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

Variables
`float` | `EventDist`

States
Idle

Function Summary
`bool` | `HandlePickupQuery(Pickup Item)`
    //_____________________________________________________________________________
    // ELR OverRide HandlePickupQuery to allow multiple possession of same class
    // Only Return True if we are not allowed multiple possession of the same class
`simulated` | `UseMe()`
    //_____________________________________________________________________________
    // ELR CauseEvent

State Idle Function Summary

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class EventItem extends XIIIItems;
    00005
    00006	var float EventDist;
    00007
    00008	//_____________________________________________________________________________
    00009	// ELR OverRide HandlePickupQuery to allow multiple possession of same class
    00010	// Only Return True if we are not allowed multiple possession of the same class
    00011	function bool HandlePickupQuery( Pickup Item )
    00012	{
    00013	    //Default = always allowed to have multiple copies (multiple events)
    00014	    if ( Inventory == None )
    00015	      return false;
    00016
    00017	    return Inventory.HandlePickupQuery(Item);
    00018	}
    00019
    00020	//_____________________________________________________________________________
    00021	// ELR CauseEvent
    00022	Simulated function UseMe()
    00023	{
    00024	    local Actor A;
    00025	//    local vector X, Y, Z;
    00026	    local float dist;
    00027	    local vector dir;
    00028
    00029	//    GetAxes(pawn(owner).GetViewRotation(),X,Y,Z);
    00030
    00031	    A = XIIIPlayercontroller(Pawn(Owner).controller).MyInteraction.TargetActor;
    00032	    if ( (A != none) && (A.Tag == Event) )
    00033	    {
    00034	      Dir = A.Location - Owner.Location;
    00035	      Dist = VSize(Dir);
    00036	      if ( Dist<EventDist )
    00037	      {
    00038	        A.Trigger(self, Pawn(Owner));
    00039	        Instigator.PlayRolloffSound(ActivateSound, self);
    00040	      }
    00041	    }
    00042
    00043	    XIIIPlayerController(XIIIpawn(Owner).controller).TryPickLock();
    00044	}
    00045
    00046	//_____________________________________________________________________________
    00047	state Idle
    00048	{
    00049	/*
    00050	    simulated function Activate()
    00051	    {
    00052	      if ( XIIIPawn(Owner).bHaveOnlyOneHandFree && (IHand == IH_2H) )
    00053	      {
    00054	        PlayerController(Pawn(owner).controller).MyHud.LocalizedMessage(class'XIIISoloMessage', 8);
    00055	      }
    00056	      else
    00057	        GotoState('InUse');
    00058	    }
    00059	*/
    00060	    simulated function Activate()
    00061	    {
    00062	      local Actor A;
    00063	      local float dist;
    00064	      local vector dir;
    00065
    00066	      DebugLog("@@@ Idle Activate call for"@self);
    00067
    00068	      if( !bActivatable )
    00069	        return;
    00070
    00071	      A = XIIIPlayercontroller(Pawn(Owner).controller).MyInteraction.TargetActor;
    00072	      if ( (A != none) && (A.Tag == Event) )
    00073	      {
    00074	        Dir = A.Location - Owner.Location;
    00075	        Dist = VSize(Dir);
    00076	        if ( Dist<EventDist )
    00077	        {
    00078	          if (Level.Game.StatLog != None)
    00079	            Level.Game.StatLog.LogItemActivate(Self, Pawn(Owner));
    00080	          GoToState('InUse');
    00081	        }
    00082	      }
    00083	    }
    00084	}
    00085
    00086	//_____________________________________________________________________________
    00087	simulated function PlayUsing()
    00088	{
    00089	//    Log(self@"PlayUsing");
    00090	    PlayAnim('Fire', 2.0);
    00091	//    PlaySound(ActivateSound); // not playing sound when using, only when efficiently using
    00092	}
    00093
    00094
    00095
    00096	defaultproperties
    00097	{
    00098	     EventDist=200.000000
    00099	     IconNumber=22
    00100	     bAutoActivate=True
    00101	     bActivatable=True
    00102	     ExpireMessage="EventItem was used."
    00103	     InventoryGroup=10
    00104	     bDisplayableInv=True
    00105	     PickupClass=Class'XIII.EventItemPick'
    00106	     Charge=1
    00107	     PlayerViewOffset=(X=12.000000,Y=3.000000,Z=-8.000000)
    00108	     ItemName="EventItem"
    00109	}

End Source Code