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 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 |
//============================================================================= // $Author: Mfox $ // $Date: 4/30/02 12:34p $ // $Revision: 4 $ //============================================================================= //------------------------------------------------------------------------------ // Name: U2Grapple.uc // Author: Aaron R Leiby // Date: 4 August 2000 //------------------------------------------------------------------------------ // Description: //------------------------------------------------------------------------------ // How to use this class: //------------------------------------------------------------------------------ class U2Grapple extends Inventory; // Fix ARL: Needs pickup. struct T_Contact { var() Actor Actor; var vector Offset; var() vector Point; var PulseLineGenerator Cable; }; var() float ContractSpeed; var() float MinContractLength; var() float ExtendSpeed; var() float MaxExtendLength; var T_Contact Contacts[32]; var int cIndex; var float TimeActivated; var float LastDeltaTime; var float Dampening; var bool bGrappling; replication { unreliable if( Role<ROLE_Authority ) Grapple, UnGrapple; } //------------------------------------------------------------------------------ function SetContactPoint( int Index, Actor A, vector P ) { Contacts[Index].Actor = A; Contacts[Index].Point = P; if( A != None ) { Contacts[Index].Offset = (P - A.Location) << A.Rotation; } } //------------------------------------------------------------------------------ function vector GetContactPoint( int Index ) { if( Contacts[Index].Actor != None ) { return Contacts[Index].Actor.Location + (Contacts[Index].Offset >> Contacts[Index].Actor.Rotation); } else { return Contacts[Index].Point; } } //------------------------------------------------------------------------------ function InitCable( int Index, vector Start, vector End ) { if( Contacts[Index].Cable == None ) { Contacts[Index].Cable = Spawn( class'PulseLineGenerator' ); } Contacts[Index].Cable.Connections[0].Start = End; Contacts[Index].Cable.Connections[0].End = Start; Contacts[Index].Cable.bHidden = false; Owner.SwingPivot = Start; Owner.SwingLength = VSize(Start - End); } //------------------------------------------------------------------------------ function ResetContact( int Index ) { if( Contacts[Index].Cable != None ) { Contacts[Index].Cable.bHidden = true; } Contacts[Index].Actor = None; } //------------------------------------------------------------------------------ function UpdateCables() { local vector Start, Dir, P; local CheckResult Hit; P = GetContactPoint( cIndex ); Start = Owner.Location; Dir = P - Owner.Location; if ( !class'Util'.static.RSLC( Hit, Owner, Start, Dir,,, TRACE_AllColliding | TRACE_ProjTargets ) //!!arl && (GetSurfFlags(Hit) & PF_FakeBackdrop)==0 ) { if( Hit.Actor != None && Hit.Actor.IsA('LevelInfo') ) { Hit.Actor = None; } SetContactPoint( cIndex, Hit.Actor, Hit.Location ); InitCable( cIndex, GetContactPoint( cIndex ), Owner.Location ); } } //------------------------------------------------------------------------------ event Tick( float DeltaTime ) { if( bGrappling ) { TimeActivated += DeltaTime; LastDeltaTime = DeltaTime; UpdateCables(); if( Owner.SwingLength > MinContractLength ) { Owner.SwingLength -= FMin( Sqrt(Owner.SwingLength - MinContractLength) * 60.0, ContractSpeed ) * DeltaTime; } else if( Owner.SwingLength < MaxExtendLength ) { Owner.SwingLength += (MaxExtendLength - Owner.SwingLength) / 10.0 * DeltaTime; } } } //------------------------------------------------------------------------------ exec function Grapple() { local vector Start, Dir; local CheckResult Hit; TimeActivated = 0; Start = Owner.Location + vect(0,0,1) * Pawn(Owner).BaseEyeHeight; Dir = vector(Pawn(Owner).GetViewRotation()); if ( !class'Util'.static.RSLC( Hit, Owner, Start, Dir,,, TRACE_AllColliding | TRACE_ProjTargets ) //!!arl && (GetSurfFlags(Hit) & PF_FakeBackdrop)==0 ) { Owner.Velocity = vect(0,0,0); Owner.SetPhysics( PHYS_Swinging ); Owner.SwingFriction = Dampening; if( Hit.Actor != None && Hit.Actor.IsA('LevelInfo') ) { Hit.Actor = None; } cIndex = 0; SetContactPoint( cIndex, Hit.Actor, Hit.Location ); InitCable( cIndex, GetContactPoint( cIndex ), Owner.Location ); bGrappling = true; } } //------------------------------------------------------------------------------ exec function UnGrapple() { local int i; Owner.SetPhysics( PHYS_Falling ); Owner.SwingLength = 0; if( TimeActivated > 0.2 ) { Owner.Velocity = 0.7 * (Owner.Location - Owner.ColLocation) / LastDeltaTime; } for( i=0; i<ArrayCount(Contacts); i++ ) { ResetContact(i); } bGrappling = false; } /* // bActivatable=True // PickupMessage="You picked up Aaron's test grapple" // RespawnTime=40.000000 // PickupViewMesh=Mesh'UnrealShare.Flashl' // PickupSound=Sound'UnrealShare.Pickups.GenPickSnd' // Icon=Texture'UnrealShare.Icons.I_Flashlight' // Mesh=Mesh'UnrealShare.Flashl' */ defaultproperties { ContractSpeed=900.000000 MinContractLength=200.000000 ExtendSpeed=30.000000 MaxExtendLength=100.000000 Dampening=0.300000 bDisplayableInv=true RemoteRole=ROLE_DumbProxy AmbientGlow=96 CollisionHeight=4.000000 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 |