RuneI
Class Pump

source: c:\runehov\RuneI\Classes\pump.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Triggers
         |
         +--Engine.Trigger
            |
            +--RuneI.Pump
Direct Known Subclasses:None

class Pump
extends Engine.Trigger

//============================================================================= // Pump. //=============================================================================
Variables
 bool bUp

States
Dormant

Function Summary
 bool CanBeUsed(Actor Other)
     
//============================================================================
//
// CanBeUsed
//
// Whether the actor can be used.
//============================================================================
 void ChangedState()
     
// State of trigger changed, query bInitiallyActive to tell state
 void Fired(Actor Other)
     
//--------------------------------------------------------
//
// Fired
//
//--------------------------------------------------------
 name GetUseAnim()
     
//============================================================================
//
// GetUseAnim
//
// Returns the animation that the player (or a viking) should play when
// this item is 'used'.
//============================================================================
 int GetUsePriority()
     
//============================================================================
//
// GetUsePriority
//
// Returns the priority of the weapon, lower is better
//============================================================================
 EMatterType MatterForJoint(int joint)
     
//============================================================
//
// MatterForJoint
//
// Returns what kind of material joint is associated with
//============================================================
 void PreBeginPlay()
 void Timer()
     
//--------------------------------------------------------
//
// Timer
//
//--------------------------------------------------------


State Dormant Function Summary
 void BeginState()
 bool CanBeUsed(Actor Other)



Source Code


00001	//=============================================================================
00002	// Pump. 
00003	//=============================================================================
00004	class Pump extends Trigger;
00005	
00006	/*
00007		Note: RepeatTriggerTime invalid for pumps
00008	*/
00009	
00010	var(Sounds) Sound GoingDown;
00011	var(Sounds) Sound GoingUp;
00012	
00013	var bool bUp;
00014	
00015	//============================================================================
00016	//
00017	// GetUseAnim
00018	//
00019	// Returns the animation that the player (or a viking) should play when
00020	// this item is 'used'.
00021	//============================================================================
00022	
00023	function name GetUseAnim()
00024	{
00025		return('PumpTrigger');
00026	}
00027	
00028	//============================================================================
00029	//
00030	// CanBeUsed
00031	//
00032	// Whether the actor can be used.
00033	//============================================================================
00034	
00035	function bool CanBeUsed(Actor Other)
00036	{
00037		// Can only be used if the player is facing it
00038		if(!Other.ActorInSector(self, ANGLE_45))
00039			return(false);
00040	
00041		return(true);
00042	}
00043	
00044	//============================================================================
00045	//
00046	// GetUsePriority
00047	//
00048	// Returns the priority of the weapon, lower is better
00049	//============================================================================
00050	
00051	function int GetUsePriority()
00052	{
00053		return(5);
00054	}
00055	
00056	//============================================================
00057	//
00058	// MatterForJoint
00059	//
00060	// Returns what kind of material joint is associated with
00061	//============================================================
00062	function EMatterType MatterForJoint(int joint)
00063	{
00064		return MATTER_METAL;
00065	}
00066	
00067	
00068	function PreBeginPlay()
00069	{
00070		Super.PreBeginPlay();
00071	
00072		if (bInitiallyActive)
00073		{
00074			bUp = true;
00075			AnimSequence='up';
00076		}
00077		else
00078		{
00079			bUp = false;
00080			AnimSequence='down';
00081		}
00082	}
00083	
00084	// State of trigger changed, query bInitiallyActive to tell state
00085	function ChangedState()
00086	{
00087		if (bInitiallyActive)
00088		{
00089			bUp = true;
00090			PlaySound(GoingUp, SLOT_Misc,,,, FRand()*0.5 + 0.8);
00091			PlayAnim('up', 1.0, 0.5);
00092		}
00093		else
00094		{
00095			bUp = false;
00096			PlaySound(GoingDown, SLOT_Misc,,,, FRand()*0.5 + 0.8);
00097			PlayAnim('down', 1.0, 0.5);
00098		}
00099	}
00100	
00101	
00102	//--------------------------------------------------------
00103	//
00104	// Timer
00105	//
00106	//--------------------------------------------------------
00107	function Timer()
00108	{
00109		// ReTriggerDelay has expired, make trigger operable again
00110		bInitiallyActive = true;
00111		ChangedState();
00112	}
00113	
00114	
00115	//--------------------------------------------------------
00116	//
00117	// Fired
00118	//
00119	//--------------------------------------------------------
00120	function Fired(actor Other)
00121	{
00122		local RunePlayer P;
00123	
00124		// Toggle state of plunger
00125		if (bUp)
00126		{
00127			PlaySound(GoingDown, SLOT_Misc,,,, FRand()*0.5 + 0.8);
00128			PlayAnim('down', 1.0, 0.5);
00129			bUp = false;
00130	
00131			if ( ReTriggerDelay > 0 )
00132			{
00133				SetTimer(ReTriggerDelay, false);
00134			}
00135		}
00136		else
00137		{
00138			PlaySound(GoingUp, SLOT_Misc,,,, FRand()*0.5 + 0.8);
00139			PlayAnim('up', 1.0, 0.5);
00140			bUp = true;
00141		}
00142	}
00143	
00144	
00145	state Dormant
00146	{
00147		ignores Touch, UnTouch, Timer, JointDamaged, Trigger, UseTrigger;
00148	
00149		function bool CanBeUsed(Actor Other)
00150		{
00151			return(false);
00152		}
00153	
00154		function BeginState()
00155		{
00156			bLookFocusPlayer=false;
00157		}
00158	}
00159	
00160	defaultproperties
00161	{
00162	     GoingDown=Sound'OtherSnd.Switches.switch16'
00163	     GoingUp=Sound'OtherSnd.Switches.switch04'
00164	     TriggerType=TT_Use
00165	     bHidden=False
00166	     bLookFocusPlayer=True
00167	     AnimSequence=up
00168	     DrawType=DT_SkeletalMesh
00169	     LODCurve=LOD_CURVE_ULTRA_CONSERVATIVE
00170	     CollisionRadius=20.000000
00171	     CollisionHeight=17.000000
00172	     bBlockActors=True
00173	     bBlockPlayers=True
00174	     bSweepable=True
00175	     Skeletal=SkelModel'objects.Trigger'
00176	     SkelGroupSkins(0)=Texture'objects.Triggertrigger'
00177	     SkelGroupSkins(1)=Texture'objects.Triggertrigger'
00178	     SkelGroupSkins(2)=Texture'objects.Triggertrigger'
00179	}

End Source Code