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