//-----------------------------------------------------------
//
//  - UnrealRider -  UR_SurferRocket
//  Written/tested by Erwan Allain (zall1@hotmail.com)
//
//
//-----------------------------------------------------------
class UR_SurferRocket extends UTRemoteRedeemer_Content;

var int distanceBehind;
var Vector offset;
var rotator angle;

simulated function AttachDriver( Pawn P )
{
        if( !bAttachDriver )
                return;

        P.SetCollision( false, false);
        P.bCollideWorld = false;
        P.SetBase(none, offset);
        P.SetHardAttach(true);
        P.SetPhysics( PHYS_None );

        if ( (P.Mesh != None) && (Mesh != None) )
                P.Mesh.SetShadowParent(Mesh);

        P.SetBase(self);
    P.SetRelativeLocation(offset);
        // need to set PHYS_None again, because SetBase() changes physics to PHYS_Falling
        P.SetPhysics( PHYS_None );
}

reliable client function ClientSetCameraEffect(Controller C, bool bEnabled)
{
}

function bool DriverEnter(Pawn P)
{
        super.DriverEnter(P);
    return true;
}

singular event Touch(Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal)
{
}

simulated function StartFire(byte FireModeNum)
{
  getOutDriver();
}

reliable server function getOutDriver()
{
  DriverLeave(true);
}

simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
        GetActorEyesViewPoint(out_CamLoc, out_CamRot);
    out_CamRot.Pitch -= angle.Pitch;
    out_CamRot.Yaw -= angle.Yaw;
        out_CamLoc -=  vector(out_CamRot) * distanceBehind;
        return true;
}

defaultproperties
{
    //class Properties
    distanceBehind = 220
    angle = (Pitch=4000,Yaw=4000,Roll=0)
    offset = (X=60,Y=0,Z=50)

    //Parent class properties
    bAttachDriver=true
    bDriverIsVisible=true

    Begin Object name=WRocketMesh
                StaticMesh=StaticMesh'WP_AVRiL.mesh.S_WP_AVRiL_Missile'
                CullDistance=0
                Scale=3.0
                Translation=(X=32.0)
                CollideActors=false
                BlockRigidBody=false
                BlockActors=false
                bOwnerNoSee=false
                bUseAsOccluder=FALSE
        End Object

         Begin Object name=TrailComponent
                bOwnerNoSee=false
                SecondsBeforeInactive=1.0f
        End Object
        Trail=TrailComponent
}