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

    Main class of Cosmos Journeyer. It handles the underlying BabylonJS engine, and the communication between the starmap view and the star system view. It also provides utility methods to take screenshots and record videos. It also handles the pause menu.

    Index

    Properties

    assets: Assets
    engine: AbstractEngine
    mainMenu: MainMenu
    musicConductor: MusicConductor
    pauseMenu: PauseMenu
    player: Player
    sidePanels: SidePanels
    soundPlayer: ISoundPlayer
    starMap: StarMap
    starSystemView: StarSystemView
    tts: Tts
    tutorialLayer: TutorialLayer

    Methods

    • Generates a save file data object from the current star system and the player's position

      Returns Promise<
          {
              player: {
                  balance: number;
                  completedMissions: {
                      missionGiver: {
                          idInSystem: string;
                          systemCoordinates: {
                              localX: number;
                              localY: number;
                              localZ: number;
                              starSectorX: number;
                              starSectorY: number;
                              starSectorZ: number;
                          };
                      };
                      reward: number;
                      tree: MissionNodeSerializedShape;
                      type: MissionType;
                  }[];
                  creationDate: string;
                  currentItinerary: | null
                  | [
                      {
                          localX: number;
                          localY: number;
                          localZ: number;
                          starSectorX: number;
                          starSectorY: number;
                          starSectorZ: number;
                      },
                      {
                          localX: number;
                          localY: number;
                          localZ: number;
                          starSectorX: number;
                          starSectorY: number;
                          starSectorZ: number;
                      },
                      ...{
                          localX: number;
                          localY: number;
                          localZ: number;
                          starSectorX: number;
                          starSectorY: number;
                          starSectorZ: number;
                      }[],
                  ];
                  currentMissions: {
                      missionGiver: {
                          idInSystem: string;
                          systemCoordinates: {
                              localX: number;
                              localY: number;
                              localZ: number;
                              starSectorX: number;
                              starSectorY: number;
                              starSectorZ: number;
                          };
                      };
                      reward: number;
                      tree: MissionNodeSerializedShape;
                      type: MissionType;
                  }[];
                  discoveries: {
                      local: {
                          discoveryTimestamp: number;
                          explorerName: string;
                          objectId: {
                              idInSystem: string;
                              systemCoordinates: {
                                  localX: number;
                                  localY: number;
                                  localZ: number;
                                  starSectorX: number;
                                  starSectorY: number;
                                  starSectorZ: number;
                              };
                          };
                      }[];
                      uploaded: {
                          discoveryTimestamp: number;
                          explorerName: string;
                          objectId: {
                              idInSystem: string;
                              systemCoordinates: {
                                  localX: number;
                                  localY: number;
                                  localZ: number;
                                  starSectorX: number;
                                  starSectorY: number;
                                  starSectorZ: number;
                              };
                          };
                      }[];
                  };
                  name: string;
                  spaceShips: {
                      components: {
                          optional: [
                              | null
                              | { quality: number; size: number; type: "discoveryScanner" }
                              | { quality: number; size: number; type: "fuelScoop" }
                              | {
                                  currentFuel01: number;
                                  quality: number;
                                  size: number;
                                  type: "fuelTank";
                              },
                              | null
                              | { quality: number; size: number; type: "discoveryScanner" }
                              | { quality: number; size: number; type: "fuelScoop" }
                              | {
                                  currentFuel01: number;
                                  quality: number;
                                  size: number;
                                  type: "fuelTank";
                              },
                              | null
                              | { quality: number; size: number; type: "discoveryScanner" }
                              | { quality: number; size: number; type: "fuelScoop" }
                              | {
                                  currentFuel01: number;
                                  quality: number;
                                  size: number;
                                  type: "fuelTank";
                              },
                          ];
                          primary: {
                              fuelTank: | null
                              | {
                                  currentFuel01: number;
                                  quality: number;
                                  size: number;
                                  type: "fuelTank";
                              };
                              thrusters: null
                              | { quality: number; size: number; type: "thrusters" };
                              warpDrive: null | { quality: number; size: number; type: "warpDrive" };
                          };
                      };
                      id: string;
                      name: string;
                      type: WANDERER;
                  }[];
                  spareSpaceshipComponents: (
                      | { quality: number; size: number; type: "discoveryScanner" }
                      | { quality: number; size: number; type: "fuelScoop" }
                      | {
                          currentFuel01: number;
                          quality: number;
                          size: number;
                          type: "fuelTank";
                      }
                      | { quality: number; size: number; type: "thrusters" }
                      | { quality: number; size: number; type: "warpDrive" }
                  )[];
                  systemBookmarks: {
                      localX: number;
                      localY: number;
                      localZ: number;
                      starSectorX: number;
                      starSectorY: number;
                      starSectorZ: number;
                  }[];
                  timePlayedSeconds: number;
                  tutorials: {
                      flightCompleted: boolean;
                      fuelScoopingCompleted: boolean;
                      starMapCompleted: boolean;
                      stationLandingCompleted: boolean;
                  };
                  uuid: string;
                  visitedSystemHistory: {
                      localX: number;
                      localY: number;
                      localZ: number;
                      starSectorX: number;
                      starSectorY: number;
                      starSectorZ: number;
                  }[];
              };
              playerLocation: | {
                  position: { x: number; y: number; z: number };
                  rotation: { w: number; x: number; y: number; z: number };
                  type: "relative";
                  universeObjectId: {
                      idInSystem: string;
                      systemCoordinates: {
                          localX: number;
                          localY: number;
                          localZ: number;
                          starSectorX: number;
                          starSectorY: number;
                          starSectorZ: number;
                      };
                  };
              }
              | {
                  type: "atStation";
                  universeObjectId: {
                      idInSystem: string;
                      systemCoordinates: {
                          localX: number;
                          localY: number;
                          localZ: number;
                          starSectorX: number;
                          starSectorY: number;
                          starSectorZ: number;
                      };
                  };
              }
              | {
                  latitude: number;
                  longitude: number;
                  type: "onSurface";
                  universeObjectId: {
                      idInSystem: string;
                      systemCoordinates: {
                          localX: number;
                          localY: number;
                          localZ: number;
                          starSectorX: number;
                          starSectorY: number;
                          starSectorZ: number;
                      };
                  };
              }
              | { shipId: string; type: "inSpaceship" };
              shipLocations: Record<
                  string,
                  | {
                      position: { x: number; y: number; z: number };
                      rotation: { w: number; x: number; y: number; z: number };
                      type: "relative";
                      universeObjectId: {
                          idInSystem: string;
                          systemCoordinates: {
                              localX: number;
                              localY: number;
                              localZ: number;
                              starSectorX: number;
                              starSectorY: number;
                              starSectorZ: number;
                          };
                      };
                  }
                  | {
                      type: "atStation";
                      universeObjectId: {
                          idInSystem: string;
                          systemCoordinates: {
                              localX: number;
                              localY: number;
                              localZ: number;
                              starSectorX: number;
                              starSectorY: number;
                              starSectorZ: number;
                          };
                      };
                  }
                  | {
                      latitude: number;
                      longitude: number;
                      type: "onSurface";
                      universeObjectId: {
                          idInSystem: string;
                          systemCoordinates: {
                              localX: number;
                              localY: number;
                              localZ: number;
                              starSectorX: number;
                              starSectorY: number;
                              starSectorZ: number;
                          };
                      };
                  }
                  | { shipId: string; type: "inSpaceship" },
              >;
              thumbnail?: string;
              timestamp: number;
              uuid: string;
          },
      >

    • Parameters

      • transform: TransformNode

      Returns {
          position: { x: number; y: number; z: number };
          rotation: { w: number; x: number; y: number; z: number };
          type: "relative";
          universeObjectId: {
              idInSystem: string;
              systemCoordinates: {
                  localX: number;
                  localY: number;
                  localZ: number;
                  starSectorX: number;
                  starSectorY: number;
                  starSectorZ: number;
              };
          };
      }

      • position: { x: number; y: number; z: number }

        The position in the object's frame of reference.

      • rotation: { w: number; x: number; y: number; z: number }

        The rotation quaternion in the object's frame of reference.

      • type: "relative"
      • universeObjectId: {
            idInSystem: string;
            systemCoordinates: {
                localX: number;
                localY: number;
                localZ: number;
                starSectorX: number;
                starSectorY: number;
                starSectorZ: number;
            };
        }

        The coordinates of the body in the universe.

        • idInSystem: string
        • systemCoordinates: {
              localX: number;
              localY: number;
              localZ: number;
              starSectorX: number;
              starSectorY: number;
              starSectorZ: number;
          }

          The coordinates of the star system.

          • localX: number

            Floating point X coordinate of the star system inside the star sector. Must be between -0.5 and 0.5.

          • localY: number

            Floating point Y coordinate of the star system inside the star sector. Must be between -0.5 and 0.5.

          • localZ: number

            Floating point Z coordinate of the star system inside the star sector. Must be between -0.5 and 0.5.

          • starSectorX: number

            Integer coordinates of the star sector along the universe X axis

          • starSectorY: number

            Integer coordinates of the star sector along the universe Y axis

          • starSectorZ: number

            Integer coordinates of the star sector along the universe Z axis

    • Parameters

      • location: {
            type: "atStation";
            universeObjectId: {
                idInSystem: string;
                systemCoordinates: {
                    localX: number;
                    localY: number;
                    localZ: number;
                    starSectorX: number;
                    starSectorY: number;
                    starSectorZ: number;
                };
            };
        }

      Returns Promise<void>

    • Parameters

      • location:
            | {
                position: { x: number; y: number; z: number };
                rotation: { w: number; x: number; y: number; z: number };
                type: "relative";
                universeObjectId: {
                    idInSystem: string;
                    systemCoordinates: {
                        localX: number;
                        localY: number;
                        localZ: number;
                        starSectorX: number;
                        starSectorY: number;
                        starSectorZ: number;
                    };
                };
            }
            | {
                type: "atStation";
                universeObjectId: {
                    idInSystem: string;
                    systemCoordinates: {
                        localX: number;
                        localY: number;
                        localZ: number;
                        starSectorX: number;
                        starSectorY: number;
                        starSectorZ: number;
                    };
                };
            }
            | {
                latitude: number;
                longitude: number;
                type: "onSurface";
                universeObjectId: {
                    idInSystem: string;
                    systemCoordinates: {
                        localX: number;
                        localY: number;
                        localZ: number;
                        starSectorX: number;
                        starSectorY: number;
                        starSectorZ: number;
                    };
                };
            }
            | { shipId: string; type: "inSpaceship" }
        • {
              position: { x: number; y: number; z: number };
              rotation: { w: number; x: number; y: number; z: number };
              type: "relative";
              universeObjectId: {
                  idInSystem: string;
                  systemCoordinates: {
                      localX: number;
                      localY: number;
                      localZ: number;
                      starSectorX: number;
                      starSectorY: number;
                      starSectorZ: number;
                  };
              };
          }
          • position: { x: number; y: number; z: number }

            The position in the object's frame of reference.

          • rotation: { w: number; x: number; y: number; z: number }

            The rotation quaternion in the object's frame of reference.

          • type: "relative"
          • universeObjectId: {
                idInSystem: string;
                systemCoordinates: {
                    localX: number;
                    localY: number;
                    localZ: number;
                    starSectorX: number;
                    starSectorY: number;
                    starSectorZ: number;
                };
            }

            The coordinates of the body in the universe.

            • idInSystem: string
            • systemCoordinates: {
                  localX: number;
                  localY: number;
                  localZ: number;
                  starSectorX: number;
                  starSectorY: number;
                  starSectorZ: number;
              }

              The coordinates of the star system.

              • localX: number

                Floating point X coordinate of the star system inside the star sector. Must be between -0.5 and 0.5.

              • localY: number

                Floating point Y coordinate of the star system inside the star sector. Must be between -0.5 and 0.5.

              • localZ: number

                Floating point Z coordinate of the star system inside the star sector. Must be between -0.5 and 0.5.

              • starSectorX: number

                Integer coordinates of the star sector along the universe X axis

              • starSectorY: number

                Integer coordinates of the star sector along the universe Y axis

              • starSectorZ: number

                Integer coordinates of the star sector along the universe Z axis

        • {
              type: "atStation";
              universeObjectId: {
                  idInSystem: string;
                  systemCoordinates: {
                      localX: number;
                      localY: number;
                      localZ: number;
                      starSectorX: number;
                      starSectorY: number;
                      starSectorZ: number;
                  };
              };
          }
        • {
              latitude: number;
              longitude: number;
              type: "onSurface";
              universeObjectId: {
                  idInSystem: string;
                  systemCoordinates: {
                      localX: number;
                      localY: number;
                      localZ: number;
                      starSectorX: number;
                      starSectorY: number;
                      starSectorZ: number;
                  };
              };
          }
        • { shipId: string; type: "inSpaceship" }

      Returns Promise<void>

    • Parameters

      • location: {
            position: { x: number; y: number; z: number };
            rotation: { w: number; x: number; y: number; z: number };
            type: "relative";
            universeObjectId: {
                idInSystem: string;
                systemCoordinates: {
                    localX: number;
                    localY: number;
                    localZ: number;
                    starSectorX: number;
                    starSectorY: number;
                    starSectorZ: number;
                };
            };
        }
        • position: { x: number; y: number; z: number }

          The position in the object's frame of reference.

        • rotation: { w: number; x: number; y: number; z: number }

          The rotation quaternion in the object's frame of reference.

        • type: "relative"
        • universeObjectId: {
              idInSystem: string;
              systemCoordinates: {
                  localX: number;
                  localY: number;
                  localZ: number;
                  starSectorX: number;
                  starSectorY: number;
                  starSectorZ: number;
              };
          }

          The coordinates of the body in the universe.

          • idInSystem: string
          • systemCoordinates: {
                localX: number;
                localY: number;
                localZ: number;
                starSectorX: number;
                starSectorY: number;
                starSectorZ: number;
            }

            The coordinates of the star system.

            • localX: number

              Floating point X coordinate of the star system inside the star sector. Must be between -0.5 and 0.5.

            • localY: number

              Floating point Y coordinate of the star system inside the star sector. Must be between -0.5 and 0.5.

            • localZ: number

              Floating point Z coordinate of the star system inside the star sector. Must be between -0.5 and 0.5.

            • starSectorX: number

              Integer coordinates of the star sector along the universe X axis

            • starSectorY: number

              Integer coordinates of the star sector along the universe Y axis

            • starSectorZ: number

              Integer coordinates of the star sector along the universe Z axis

      Returns Promise<void>

    • Loads a save file and apply it. This will generate the requested star system and position the player at the requested position around the requested orbital object. This will perform engine initialization if the engine is not initialized.

      Parameters

      Returns Promise<void>

    • Takes a screenshot of the current scene. By default, the screenshot is taken at a 4x the resolution of the canvas

      Returns Promise<boolean>