//============================================================================= // © 2003 Matt 'SquirrelZero' Farber //============================================================================= // "UT2k3 Ultimate Flashlight" // I wrote this using _both_ a dynamic projector and a dynamic light, with the // dynamic projector as the focal point and lightsource providing general // ambient illumination. Either one by itself is pretty dull, but combine the // two and you've got yourself a really nice effect if done correctly. //============================================================================= class Effect_TacLightProjector extends DynamicProjector; // add a light too, there seems to be a problem with the projector darkening terrain sometimes var Effect_TacLightGlow TacLightGlow; var Weapon ValidWeapon; var Pawn LightPawn; var bool bHasLight; var WeaponAttachment AssignedAttach; var byte LightRot[2]; var KFPlayerController AssignedPC; var bool bIsAssigned; var vector WallHitLocation; var() float ProjectorPullbackDist; replication { // relevant variables needed by the client reliable if (Role == ROLE_Authority) LightPawn,bHasLight; unreliable if( Role == ROLE_Authority && !bNetOwner && bHasLight ) LightRot; } // setup the pawn and controller variables, spawn the dynamic light simulated function PostBeginPlay() { SetCollision(True, False, False); if (Owner != None) { LightPawn = Pawn(Owner); ValidWeapon = LightPawn.Weapon; } if( Level.NetMode==NM_DedicatedServer ) Return; if( TacLightGlow==None ) TacLightGlow = spawn(class'Effect_TacLightGlow'); if( Class'KFPawn'.Default.bDetailedShadows ) { AssignedPC = KFPlayerController(Level.GetLocalPlayerController()); if( AssignedPC!=None ) AddProjecting(); LightRadius = 1; } } simulated function AddProjecting() { bIsAssigned = True; AssignedPC.LightSources[AssignedPC.LightSources.Length] = Self; } simulated function RemoveProjecting() { local int i,l; bIsAssigned = False; l = AssignedPC.LightSources.Length; for( i=0; i