Cosmos Journeyer API Documentation - v1.10.1
    Preparing search index...

    Interface of the warp drive of a spaceship that can only be read.

    Implements

    Index

    Constructors

    • Parameters

      • serializedWarpDrive: { quality: number; size: number; type: "warpDrive" }
      • enabledByDefault: boolean = false

      Returns WarpDrive

    Properties

    defaultThrottle: number = 0.5

    The default throttle value for the warp drive.

    maxWarpSpeed: number

    Maximum speed of the warp drive in m/s. It can be reached when the ship is far from any body and the user throttle is set to 1.

    quality: number
    rangeLY: number
    size: number
    type: "warpDrive"

    Methods

    • Returns the amount of fuel consumed by the warp drive to travel the given distance in light-years.

      Parameters

      • distanceLY: number

        The distance to travel in light-years.

      Returns number

    • Increases the target throttle by the given delta and clamps it between 0 and 1.

      Parameters

      • deltaThrottle: number

        The delta to apply to the target throttle.

      Returns void

    • Updates the warp drive based on the current speed of the ship, the distance to the closest body and the time elapsed since the last update.

      Parameters

      • closestObjectDistance: number
      • closestObjectRadius: number
      • deltaSeconds: number

        The time elapsed since the last update in seconds.

      Returns void

    • Computes the target speed of the warp drive based on the distance to the closest body and the user throttle.

      Parameters

      • closestObjectDistance: number

        The distance to the closest body in m.

      • closestObjectRadius: number

      Returns number

      The computed target speed in m/s.