Engine
Class WarpZoneInfo

source: C:\XIII\Engine\Classes\WarpZoneInfo.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Info
         |
         +--Engine.ZoneInfo
            |
            +--Engine.WarpZoneInfo
Direct Known Subclasses:None

class WarpZoneInfo
extends Engine.ZoneInfo

//============================================================================= // WarpZoneInfo. For making disjoint spaces appear as if they were connected; // supports both in-level warp zones and cross-level warp zones. //=============================================================================
Variables
 string Destinations[8]
 WarpZoneInfo OtherSideActor
 Object OtherSideLevel
 string OtherSideURL
 name ThisTag
 coords WarpCoords
 bool bNoTeleFrag
 int iWarpZone
 int numDestinations

States
DelayedWarp

Function Summary
 
simulated
ActorEntered(Actor Other)
     
// When an actor enters this warp zone.
 void PreBeginPlay()
 void Trigger(Actor Other, Pawn EventInstigator)
 void UnWarp(out vector, out vector, out rotator)
 void Warp(out vector, out vector, out rotator)
     
// Warp coordinate system transformations.


State DelayedWarp Function Summary
 void Tick(float DeltaTime)



Source Code


00001	//=============================================================================
00002	// WarpZoneInfo. For making disjoint spaces appear as if they were connected;
00003	// supports both in-level warp zones and cross-level warp zones.
00004	//=============================================================================
00005	class WarpZoneInfo extends ZoneInfo
00006		native;
00007	
00008	//-----------------------------------------------------------------------------
00009	// Information set by the level designer.
00010	
00011	var() string     OtherSideURL;
00012	var() name       ThisTag;
00013	var() bool		 bNoTeleFrag;
00014	
00015	//-----------------------------------------------------------------------------
00016	// Internal.
00017	
00018	var const int              iWarpZone;
00019	var const coords           WarpCoords;
00020	var transient WarpZoneInfo OtherSideActor;
00021	var transient object       OtherSideLevel;
00022	var() string		       Destinations[8];
00023	var int					   numDestinations;
00024	
00025	//-----------------------------------------------------------------------------
00026	// Network replication.
00027	
00028	replication
00029	{
00030		reliable if( Role==ROLE_Authority )
00031			OtherSideURL, ThisTag, OtherSideActor;
00032	}
00033	
00034	//-----------------------------------------------------------------------------
00035	// Functions.
00036	
00037	// Warp coordinate system transformations.
00038	native(314) final function Warp  ( out vector Loc, out vector Vel, out rotator R );
00039	native(315) final function UnWarp( out vector Loc, out vector Vel, out rotator R );
00040	
00041	function PreBeginPlay()
00042	{
00043	/*
00044		Super.PreBeginPlay();
00045	
00046		// Generate the local connection.
00047		Generate();
00048	
00049		// Setup destination list.
00050		numDestinations = 0;
00051		While( numDestinations < 8 )
00052			if (Destinations[numDestinations] != "")
00053				numDestinations++;
00054			else
00055				numDestinations = 8;
00056	
00057		// Generate URL if necessary.
00058		if( numDestinations>0 && (OtherSideURL == "") )
00059			OtherSideURL = Destinations[0];
00060	*/
00061	}
00062	
00063	function Trigger( actor Other, pawn EventInstigator )
00064	{
00065	/*
00066		local int nextPick;
00067		if (numDestinations == 0)
00068			return;
00069	
00070		nextPick = 0;
00071		While( (nextPick < 8) && (Destinations[nextPick] != OtherSideURL )  )
00072			nextPick++;
00073	
00074		nextPick++;
00075		if ( (nextPick > 7) || (Destinations[nextPick] == "") )
00076			nextPick = 0;
00077	
00078		OtherSideURL = Destinations[nextPick];
00079		ForceGenerate();
00080	*/
00081	}
00082	
00083	// Set up this warp zone's destination.
00084	simulated event Generate()
00085	{
00086	/*
00087		if( OtherSideLevel != None )
00088			return;
00089		ForceGenerate();
00090	*/
00091	}
00092	
00093	// Set up this warp zone's destination.
00094	simulated event ForceGenerate()
00095	{
00096	/*
00097		if( InStr(OtherSideURL,"/") >= 0 )
00098		{
00099			// Remote level.
00100			//log( "Warpzone " $ Self $ " remote" );
00101			OtherSideLevel = None;
00102			OtherSideActor = None;
00103		}
00104		else
00105		{
00106			// Local level.
00107			OtherSideLevel = XLevel;
00108			foreach AllActors( class 'WarpZoneInfo', OtherSideActor )
00109				if( string(OtherSideActor.ThisTag)~=OtherSideURL && OtherSideActor!=Self )
00110					break;
00111			//log( "Warpzone " $ Self $ " local, connected to " $ OtherSideActor );
00112		}
00113	*/
00114	}
00115	
00116	// When an actor enters this warp zone.
00117	simulated function ActorEntered( actor Other )
00118	{
00119	/*
00120		local vector L;
00121		local rotator R;
00122		local Controller P;
00123	
00124		//if ( Other.Role == ROLE_AutonomousProxy )
00125		//	return; // don't simulate for client players
00126		if( !Other.bJustTeleported )
00127		{
00128			Generate();
00129			if( OtherSideActor != None )
00130			{
00131				// This needs to also perform a coordinate system transformation,
00132				// in case the portals aren't directionally aligned. This is easy to
00133				// do but UnrealScript doesn't provide coordinate system operators yet.
00134				Other.Disable('Touch');
00135				Other.Disable('UnTouch');
00136	
00137				L = Other.Location;
00138				if( Pawn(Other) != None )
00139					R = Pawn(Other).GetViewRotation();
00140	
00141				UnWarp( L, Other.Velocity, R );
00142				OtherSideActor.Warp( L, Other.Velocity, R );
00143	
00144				if( Other.IsA('Pawn') )
00145				{
00146					Pawn(Other).bWarping = bNoTelefrag;
00147					if ( Other.SetLocation(L) )
00148					{
00149						//tell enemies about teleport
00150						if ( Role == ROLE_Authority )
00151							For ( P=Level.ControllerList; P!=None; P=P.NextController )
00152								if (P.Enemy == Other)
00153									P.LastSeenPos = Other.Location;
00154						R.Roll = 0;
00155						Pawn(Other).SetViewRotation(R);
00156						Pawn(Other).ClientSetLocation(L, R );
00157						if ( Pawn(Other).Controller != None )
00158							Pawn(Other).Controller.MoveTimer = -1.0;
00159					}
00160					else
00161					{
00162						// set up to keep trying to teleport
00163						GotoState('DelayedWarp');
00164					}
00165				}
00166				else
00167				{
00168					Other.SetLocation(L);
00169					Other.SetRotation( R );
00170				}
00171				Other.Enable('Touch');
00172				Other.Enable('UnTouch');
00173				// Change rotation according to portal's rotational change.
00174			}
00175		}
00176	*/
00177	}
00178	
00179	event ActorLeaving( actor Other )
00180	{
00181	/*
00182		If ( Other.IsA('Pawn') )
00183			Pawn(Other).bWarping = false;
00184	*/
00185	}
00186	
00187	State DelayedWarp
00188	{
00189		function Tick(float DeltaTime)
00190		{
00191	/*
00192			local Controller P;
00193			local bool bFound;
00194	
00195			For ( P=Level.ControllerList; P!=None; P=P.NextController )
00196				if ( P.Pawn.bWarping && (P.Pawn.Region.Zone == Self) )
00197				{
00198					bFound = true;
00199					ActorEntered(P);
00200				}
00201	
00202			If ( !bFound )
00203				GotoState('');
00204	*/
00205		}
00206	}
00207	
00208	defaultproperties
00209	{
00210	}

End Source Code