// Written by Marco, more simulated. Class FSFlashLightBeam extends FlashLightBeam; var bool bIsPlayerOwner; var byte RepPitch; var Pawn PawnOwner; // #if GAMEVER==227 var FSFlashlightProj MyDecal; var float ProjectDistance; // #endif // Moved from local to here for less mem alloc on tick. var transient rotator R; var transient vector End,Start,HL,HN; replication { // Variables the server should send to the client. reliable if ( Role==ROLE_Authority && !bNetOwner ) RepPitch; } function PostBeginPlay() { PawnOwner = Pawn(Owner); bIsPlayerOwner = PlayerPawn(Owner)!=None; } simulated function Tick( float Delta ) { if( Level.NetMode!=NM_DedicatedServer ) { if( Level.NetMode==NM_Client ) { if( Owner==None ) return; if( PlayerPawn(Owner)!=None && PlayerPawn(Owner).Player!=None ) // Net owner. R = Pawn(Owner).ViewRotation; else { R.Yaw = Owner.Rotation.Yaw; R.Pitch = RepPitch*256; } Start = Owner.Location+vect(0,0,1)*Pawn(Owner).EyeHeight; } else { Start = Owner.Location+vect(0,0,1)*PawnOwner.EyeHeight; if( bIsPlayerOwner ) { RepPitch = (PawnOwner.ViewRotation.Pitch/256); R = PawnOwner.ViewRotation; } else { RepPitch = (PawnOwner.Rotation.Pitch/256); R = PawnOwner.Rotation; } } // #if GAMEVER==227 if( R!=Rotation ) SetRotation(R); SetLocation(Start); End = Start+vector(R)*3800; if( Trace(HL,HN,End,Start,true)!=None ) { ProjectDistance = VSize(HL-Start); if( ProjectDistance<300.f ) End = Start; else End = HL-vector(R)*300.f; } else { ProjectDistance = 3800.f; End-=vector(R)*300.f; } if( MyDecal==None ) MyDecal = Spawn(Class'FSFlashlightProj',,,End,R); else { MyDecal.SetLocation(End); MyDecal.SetRotation(R); } MyDecal.SetProjecting(ProjectDistance); // #else // End = Start+vector(R)*10000; // if( Trace(HL,HN,End,Start,true)!=None ) // End = HL-vector(R)*64.f; // SetLocation(End); // #endif } else { SetLocation(Owner.Location); if( bIsPlayerOwner ) RepPitch = (PawnOwner.ViewRotation.Pitch/256); else RepPitch = (PawnOwner.Rotation.Pitch/256); } } simulated function Destroyed() { // #if GAMEVER==227 if( MyDecal!=None ) MyDecal.Destroy(); // #endif } defaultproperties { RemoteRole=ROLE_SimulatedProxy LightHue=33 LightSaturation=187 // #if GAMEVER==227 LightEffect=LE_Spotlight LightRadius=60 LightCone=26 // #else // LightRadius=9 // #endif }