Engine
Class Door

source: C:\XIII\Engine\Classes\Door.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.NavigationPoint
         |
         +--Engine.Door
Direct Known Subclasses:None

class Door
extends Engine.NavigationPoint

/*============================================================================= Door. Used to mark a door on the Navigation network (a door is a mover that may act as an obstruction). ============================================================================= */
Variables
 name DoorTag
           tag of mover associated with this node
 name DoorTrigger
           recommended trigger to use (if door is triggerable)
 Actor RecommendedTrigger
           recommended trigger to use (if door is triggerable)
 bool bBlockedWhenClosed
           don't even try to go through this path if door is closed
 bool bDoorOpen
           don't even try to go through this path if door is closed
 bool bInitiallyClosed
           if true, means that the initial position of the mover blocks navigation
 bool bTempNoCollide
           used during path building


Function Summary
 void MoverClosed()
 void MoverOpened()
 void PostBeginPlay()
 bool ProceedWithMove(Pawn Other)
 Actor SpecialHandling(Pawn Other)
     
/* SpecialHandling is called by the navigation code when the next path has been found.  
It gives that path an opportunity to modify the result based on any special considerations
*/



Source Code


00001	/*=============================================================================
00002	 Door.
00003	 Used to mark a door on the Navigation network (a door is a mover that may act
00004	 as an obstruction).
00005	=============================================================================
00006	*/
00007	class Door extends NavigationPoint
00008		placeable
00009		native;
00010	
00011	#exec Texture Import File=Textures\Door.pcx Name=S_Door Mips=Off MASKED=1 COMPRESS=DXT1
00012	
00013	var() name DoorTag;				// tag of mover associated with this node
00014	var	 mover MyDoor;
00015	var() name DoorTrigger;			// recommended trigger to use (if door is triggerable)
00016	var actor RecommendedTrigger;
00017	var() bool bInitiallyClosed;	// if true, means that the initial position of the mover blocks navigation
00018	var() bool bBlockedWhenClosed;	// don't even try to go through this path if door is closed
00019	var bool bDoorOpen;
00020	var bool bTempNoCollide;		// used during path building
00021	
00022	function PostBeginPlay()
00023	{
00024		local vector Dist;
00025	
00026		if ( DoorTrigger != '' )
00027		{
00028			ForEach AllActors(class'Actor', RecommendedTrigger, DoorTrigger )
00029				break;
00030			// ignore recommended trigger if door is within its radius
00031			// (DoorTrigger shouldn't have been set)
00032			if ( RecommendedTrigger != None )
00033			{
00034				Dist = Location - RecommendedTrigger.Location;
00035				if ( abs(Dist.Z) < RecommendedTrigger.CollisionHeight )
00036				{
00037					Dist.Z = 0;
00038					if ( VSize(Dist) < RecommendedTrigger.CollisionRadius )
00039						RecommendedTrigger = None;
00040				}
00041			}		
00042		}
00043		bBlocked = ( bInitiallyClosed && bBlockedWhenClosed );
00044		bDoorOpen = !bInitiallyClosed;
00045		Super.PostBeginPlay();
00046	}
00047	
00048	function MoverOpened()
00049	{
00050		bBlocked = ( !bInitiallyClosed && bBlockedWhenClosed );
00051		bDoorOpen = bInitiallyClosed;
00052	}
00053	
00054	function MoverClosed()
00055	{
00056		bBlocked = ( bInitiallyClosed && bBlockedWhenClosed );
00057		bDoorOpen = !bInitiallyClosed;
00058	}
00059	
00060	/* SpecialHandling is called by the navigation code when the next path has been found.  
00061	It gives that path an opportunity to modify the result based on any special considerations
00062	*/
00063	
00064	function Actor SpecialHandling(Pawn Other)
00065	{
00066		if ( MyDoor == None )
00067			return self;
00068	
00069		if ( MyDoor.BumpType == BT_PlayerBump && !Other.IsPlayerPawn() )
00070			return None;
00071	
00072		if ( bInitiallyClosed == (bDoorOpen || MyDoor.bOpening || MyDoor.bDelaying) )
00073			return self;
00074	
00075		if ( RecommendedTrigger != None )
00076			return RecommendedTrigger;
00077	
00078		return self;
00079	}
00080	
00081	function bool ProceedWithMove(Pawn Other)
00082	{
00083		if ( bDoorOpen || !MyDoor.bDamageTriggered )
00084			return true;
00085	
00086		// door still needs to be shot
00087		Other.ShootSpecial(MyDoor);
00088		MyDoor.Trigger(Other,Other);
00089		Other.Controller.WaitForMover(MyDoor);
00090		return false;
00091	}
00092	
00093	event bool SuggestMovePreparation(Pawn Other)
00094	{
00095		if ( bDoorOpen )
00096			return false;
00097		if ( MyDoor.bOpening || MyDoor.bDelaying )
00098		{
00099			Other.Controller.WaitForMover(MyDoor);
00100			return true;
00101		}
00102		if ( MyDoor.bDamageTriggered )
00103		{
00104			// handle shootable doors
00105			Other.ShootSpecial(MyDoor);
00106			MyDoor.Trigger(Other,Other);
00107			Other.Controller.WaitForMover(MyDoor);
00108			return true;
00109		}
00110	
00111		return false;
00112	}
00113	
00114	defaultproperties
00115	{
00116	     bInitiallyClosed=True
00117	     ExtraCost=100
00118	     bSpecialMove=True
00119	     bNoDelete=True
00120	     RemoteRole=ROLE_None
00121	     Texture=Texture'Engine.S_Door'
00122	}

End Source Code