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 |
/*============================================================================= // LadderVolumes, when touched, cause ladder supporting actors to use Phys_Ladder. // note that underwater ladders won't be waterzones (no breathing problems) ============================================================================= */ class LadderVolume extends PhysicsVolume native; var() name ClimbingAnimation, TopAnimation; // name of animation to play when climbing this ladder var() rotator WallDir; // points at wall to push against var vector LookDir; // vector(WallDir) var vector ClimbDir; // pawn can move in this direction (or reverse) var const Ladder LadderList; // list of Ladder actors associated with this LadderVolume var() bool bNoPhysicalLadder; // if true, won't push into/keep player against geometry in lookdir var() bool bAutoPath; // add top and bottom ladders automatically var Pawn PendingClimber; //NEW (mdf) Ladder fixes from SteveP to me 02/18/02 simulated event PostBeginPlay() { local Ladder L, M; local vector Dir; Super.PostBeginPlay(); LookDir = vector(WallDir); if ( !bAutoPath && (LookDir.Z != 0) ) { ClimbDir = vect(0,0,1); for ( L=LadderList; L!=None; L=L.LadderList ) for ( M=LadderList; M!=None; M=M.LadderList ) if ( M != L ) { Dir = Normal(M.Location - L.Location); if ( (Dir dot ClimbDir) < 0 ) Dir *= -1; ClimbDir += Dir; } ClimbDir = Normal(ClimbDir); if ( (ClimbDir Dot vect(0,0,1)) < 0 ) ClimbDir *= -1; } } //NEW (mdf) Ladder fixes from SteveP to me 02/18/02 function bool InUse(Pawn Ignored) { local Pawn StillClimbing; ForEach TouchingActors(class'Pawn',StillClimbing) { if ( (StillClimbing != Ignored) && StillClimbing.bCollideActors && StillClimbing.bBlockActors ) return true; } if ( PendingClimber != None ) { if ( (PendingClimber.Controller == None) || !PendingClimber.bCollideActors || !PendingClimber.bBlockActors || (Ladder(PendingClimber.Controller.MoveTarget) == None) || (Ladder(PendingClimber.Controller.MoveTarget).MyLadder != self) ) PendingClimber = None; } return ( (PendingClimber != None) && (PendingClimber != Ignored) ); } //OLD //NEW (mdf) fix? static function bool CanStartClimbing( LadderVolume L, Pawn P, Actor OldMoveTarget ) { local rotator PawnRotation; PawnRotation = P.Rotation; PawnRotation.Pitch = 0; if( !P.IsPlayer() ) { // NPC needs to be looking at ladder return ( (vector(PawnRotation) Dot L.LookDir) > 0.9 ); } else { //AddArrow( P.Location, P.Location + 128 * L.LookDir, ColorBlue() ); //AddArrow( P.Location, P.Location + 128 * Normal( P.Acceleration ), ColorGreen() ); //P.DMTNS( "cos Accel angle: " $ Normal( P.Acceleration ) dot L.LookDir ); //P.DMTNS( "Acceleration: " $ P.Acceleration ); //P.DMTNS( "Physics: " $ EnumStr( enum'EPhysics', P.Physics ) ); // player needs to be looking more-or-less at ladder and moving more-or-less towards ladder // or else this messes with player backing off of bottom of ladder return ( vector(PawnRotation) dot L.LookDir > 0.9 && (P.Location.Z > L.Location.Z || P.Physics == PHYS_Falling || Normal( P.Acceleration ) dot L.LookDir > 0.9) ); //return ( vector(PawnRotation) dot L.LookDir > 0.9 ); /* AddArrow( P.Location, P.Location + 128 * L.LookDir, ColorBlue() ); AddArrow( P.Location, P.Location + 128 * Normal( P.Velocity), ColorGreen() ); P.DMTNS( "cos Accel angle: " $ Normal( P.Velocity ) dot L.LookDir ); P.DMTNS( "Velocity: " $ P.Velocity ); P.DMTNS( "Physics: " $ EnumStr( enum'EPhysics', P.Physics ) ); // player needs to be looking more-or-less at ladder and moving more-or-less towards ladder return ( vector(PawnRotation) dot L.LookDir > 0.9 && Normal( P.Velocity ) dot L.LookDir > 0.9 ); */ } } //OLD //NEW (mdf) ladder grabbing changes sent to me by Steve 02/07/02 simulated event PawnEnteredVolume(Pawn P) { local PotentialClimbWatcher PCW; Super.PawnEnteredVolume(P); if ( !P.CanGrabLadder() ) return; if( CanStartClimbing( Self, P, None ) ) P.ClimbLadder( Self ); else if( !P.bDeleteMe && P.Controller != None ) { PCW = Spawn( class'PotentialClimbWatcher', P ); PCW.OriginalMoveTarget = P.Controller.MoveTarget; } } /*OLD simulated event PawnEnteredVolume(Pawn P) { local rotator PawnRot; if ( !P.bCanClimbLadders || (P.Controller == None) || (P.Physics == PHYS_Ladder) ) return; Super.PawnEnteredVolume(P); PawnRot = P.Rotation; PawnRot.Pitch = 0; if ( (vector(PawnRot) Dot LookDir > 0.9) || ((AIController(P.Controller) != None) && (Ladder(P.Controller.MoveTarget) != None)) ) P.ClimbLadder(self); else if ( !P.bDeleteMe && (P.Controller != None) ) spawn(class'PotentialClimbWatcher',P); } */ //NEW (mdf) Ladder fixes from SteveP to me 02/18/02 simulated event PawnLeavingVolume(Pawn P) { local Controller C; if ( P.OnLadder != self ) return; Super.PawnLeavingVolume(P); P.OnLadder = None; P.EndClimbLadder(); if ( P == PendingClimber ) PendingClimber = None; // tell all waiting pawns, if not in use if ( !InUse(P) ) { for ( C=Level.ControllerList; C!=None; C=C.NextController ) if ( C.bPreparingMove && (Ladder(C.MoveTarget) != None) &&(Ladder(C.MoveTarget).MyLadder == self) ) { C.bPreparingMove = false; PendingClimber = C.Pawn; return; } } } /*OLD simulated event PawnLeavingVolume(Pawn P) { if ( P.OnLadder != self ) return; Super.PawnLeavingVolume(P); P.OnLadder = None; P.EndClimbLadder(self); } */ simulated event PhysicsChangedFor(Actor Other) { if ( (Other.Physics == PHYS_Falling) || (Other.Physics == PHYS_Ladder) || Other.bDeleteMe || (Pawn(Other) == None) || (Pawn(Other).Controller == None) ) return; spawn(class'PotentialClimbWatcher',Other); } defaultproperties { ClimbDir=(Z=1.000000) bAutoPath=true RemoteRole=ROLE_SimulatedProxy UseReticleOnEvents(0)="UseReticleText" UseReticleOnEvents(1)="UseReticleCorners" UseReticleOnEvents(2)="UseReticleTopBars" ProximityReticleOnEvents(0)="ProximityReticleCorners" ProximityReticleOnEvents(1)="ProximityReticleTopBars" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |