MISC: Add versionNumber to ns.ui.getGameInfo() (#2155)

This commit is contained in:
catloversg
2025-05-26 06:56:22 +07:00
committed by GitHub
parent bf7101c1b0
commit e31b174137
7 changed files with 41 additions and 15 deletions

View File

@@ -4,6 +4,8 @@
## GameInfo.commit property
Git commit hash that the release was built from. E.g.: "d0d776700"
**Signature:**
```typescript

View File

@@ -16,7 +16,8 @@ interface GameInfo
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [commit](./bitburner.gameinfo.commit.md) | | string | |
| [platform](./bitburner.gameinfo.platform.md) | | string | |
| [version](./bitburner.gameinfo.version.md) | | string | |
| [commit](./bitburner.gameinfo.commit.md) | | string | Git commit hash that the release was built from. E.g.: "d0d776700" |
| [platform](./bitburner.gameinfo.platform.md) | | "Browser" \| "Steam" | Platform that the game is running on |
| [version](./bitburner.gameinfo.version.md) | | string | <p>Version as shown in release notes and in the UI. E.g.: "2.8.1"</p><p>Note that this property does not have the prefix "v". For example, with v2.8.1, this property is "2.8.1".</p> |
| [versionNumber](./bitburner.gameinfo.versionnumber.md) | | number | Internal version number that increments during releases. E.g.: 43 |

View File

@@ -4,8 +4,10 @@
## GameInfo.platform property
Platform that the game is running on
**Signature:**
```typescript
platform: string;
platform: "Browser" | "Steam";
```

View File

@@ -4,6 +4,10 @@
## GameInfo.version property
Version as shown in release notes and in the UI. E.g.: "2.8.1"
Note that this property does not have the prefix "v". For example, with v2.8.1, this property is "2.8.1".
**Signature:**
```typescript

View File

@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [GameInfo](./bitburner.gameinfo.md) &gt; [versionNumber](./bitburner.gameinfo.versionnumber.md)
## GameInfo.versionNumber property
Internal version number that increments during releases. E.g.: 43
**Signature:**
```typescript
versionNumber: number;
```

View File

@@ -159,17 +159,12 @@ export function NetscriptUserInterface(): InternalAPI<IUserInterface> {
},
getGameInfo: () => () => {
const version = CONSTANTS.VersionString;
const commit = commitHash();
const platform = navigator.userAgent.toLowerCase().includes(" electron/") ? "Steam" : "Browser";
const gameInfo = {
version,
commit,
platform,
return {
version: CONSTANTS.VersionString,
versionNumber: CONSTANTS.VersionNumber,
commit: commitHash(),
platform: navigator.userAgent.toLowerCase().includes(" electron/") ? "Steam" : "Browser",
};
return gameInfo;
},
clearTerminal: (ctx) => () => {

View File

@@ -10104,9 +10104,18 @@ interface IStyleSettings {
* @public
*/
interface GameInfo {
/**
* Version as shown in release notes and in the UI. E.g.: "2.8.1"
*
* Note that this property does not have the prefix "v". For example, with v2.8.1, this property is "2.8.1".
*/
version: string;
/** Internal version number that increments during releases. E.g.: 43 */
versionNumber: number;
/** Git commit hash that the release was built from. E.g.: "d0d776700" */
commit: string;
platform: string;
/** Platform that the game is running on */
platform: "Browser" | "Steam";
}
/**