Engine
Class LadderVolume

source: C:\XIII\Engine\Classes\LadderVolume.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Brush
         |
         +--Engine.Volume
            |
            +--Engine.PhysicsVolume
               |
               +--Engine.LadderVolume
Direct Known Subclasses:None

class LadderVolume
extends Engine.PhysicsVolume

// LadderVolumes, when touched, cause ladder supporting actors to use Phys_Ladder. // note that underwater ladders won't be waterzones (no breathing problems) ============================================================================= */
Variables
 vector ClimbDir
           pawn can move in this direction (or reverse)
 Ladder LadderList
           list of Ladder actors associated with this LadderVolume
 vector LookDir
           name of animation to play when climbing this ladder
 ClimbingAnimation, TopAnimation
           name of animation to play when climbing this ladder
 rotator WallDir
           name of animation to play when climbing this ladder
 bool bAutoPath
           add top and bottom ladders automatically
 bool bNoPhysicalLadder
           if true, won't push into/keep player against geometry in lookdir


Function Summary
 
simulated
PostBeginPlay()
     
// sound to play for a footstep on this ladder



Source Code


00001	/*=============================================================================
00002	// LadderVolumes, when touched, cause ladder supporting actors to use Phys_Ladder.
00003	// note that underwater ladders won't be waterzones (no breathing problems)
00004	============================================================================= */
00005	
00006	class LadderVolume extends PhysicsVolume
00007		native;
00008	
00009	
00010	var() name ClimbingAnimation, TopAnimation;	// name of animation to play when climbing this ladder
00011	var() rotator WallDir;
00012	var vector LookDir;
00013	var vector ClimbDir;            // pawn can move in this direction (or reverse)
00014	var const Ladder LadderList;    // list of Ladder actors associated with this LadderVolume
00015	var() bool bNoPhysicalLadder;   // if true, won't push into/keep player against geometry in lookdir
00016	var() bool bAutoPath;           // add top and bottom ladders automatically
00017	var(sound) sound hFootLadderSound;   // sound to play for a footstep on this ladder
00018	
00019	simulated function PostBeginPlay()
00020	{
00021		local Ladder L, M;
00022		local vector Dir;
00023	
00024		Super.PostBeginPlay();
00025		LookDir = vector(WallDir);
00026		if ( !bAutoPath && (LookDir.Z != 0) )
00027		{
00028			ClimbDir = vect(0,0,1);
00029			for ( L=LadderList; L!=None; L=L.LadderList )
00030				for ( M=LadderList; M!=None; M=M.LadderList )
00031					if ( M != L )
00032					{
00033						Dir = Normal(M.Location - L.Location);
00034						if ( (Dir dot ClimbDir) < 0 )
00035							Dir *= -1;
00036						ClimbDir += Dir;
00037					}
00038	
00039			ClimbDir = Normal(ClimbDir);
00040			if ( (ClimbDir Dot vect(0,0,1)) < 0 )
00041				ClimbDir *= -1;
00042		}
00043	}
00044	
00045	simulated event PawnEnteredVolume(Pawn P)
00046	{
00047	    local rotator PawnRot;
00048	
00049	    if ( !P.bCanClimbLadders || (P.Controller == None) || (P.Physics == PHYS_Ladder) || Level.Game.bGameEnded )
00050	      return;
00051	
00052	    Super.PawnEnteredVolume(P);
00053	    PawnRot = P.Rotation;
00054	    PawnRot.Pitch = 0;
00055	    if ( (vector(PawnRot) Dot LookDir > 0.9)
00056	      || ((AIController(P.Controller) != None) && (Ladder(P.Controller.MoveTarget) != None)) )
00057	    {
00058	//      Log("LADDER Volume, OnlyOneHandFree="$P.bHaveOnlyOneHandFree);
00059	      if ( P.bHaveOnlyOneHandFree )
00060	        P.YouCantClimb();
00061	      else
00062	        P.ClimbLadder(self);
00063	    }
00064	    else if ( !P.bDeleteMe && (P.Controller != None) )
00065	      spawn(class'PotentialClimbWatcher',P);
00066	}
00067	
00068	simulated event PawnLeavingVolume(Pawn P)
00069	{
00070	    if ( P.OnLadder != self )
00071	      return;
00072	    Super.PawnLeavingVolume(P);
00073	    P.OnLadder = None;
00074	    P.EndClimbLadder(self);
00075	}
00076	
00077	simulated event PhysicsChangedFor(Actor Other)
00078	{
00079	    if ( (Other.Physics == PHYS_Falling) || (Other.Physics == PHYS_Ladder) || Other.bDeleteMe || (Pawn(Other) == None) || (Pawn(Other).Controller == None) || !Pawn(Other).bCanClimbLadders )
00080	      return;
00081	    if ( Level.bLonePlayer && Level.Game.bGameEnded )
00082	      return;
00083	    spawn(class'PotentialClimbWatcher',Other);
00084	}
00085	
00086	// ELR Can't reference type that do not exists in PREVIOUS compiled packages (not even in own package)
00087	//	hFootLadderSound=Sound'XIIIsound.SpecActions__LadderClimb.LadderClimb__hXIIIClimbLadder'
00088	
00089	defaultproperties
00090	{
00091	     ClimbDir=(Z=1.000000)
00092	     RemoteRole=ROLE_SimulatedProxy
00093	}

End Source Code