Skip to content

Commit

Permalink
fmt and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
hydroflame committed Apr 6, 2022
1 parent 5a25faf commit 48f80f2
Show file tree
Hide file tree
Showing 163 changed files with 3,330 additions and 2,946 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Version (format: x.y.z)'
description: "Version (format: x.y.z)"
required: true
versionNumber:
description: 'Version Number (for saves migration)'
description: "Version Number (for saves migration)"
required: true
changelog:
description: 'Changelog (url that points to RAW markdown)'
default: ''
description: "Changelog (url that points to RAW markdown)"
default: ""
buildApp:
description: 'Include Application Build'
description: "Include Application Build"
type: boolean
default: 'true'
default: "true"
required: true
buildDoc:
description: 'Include Documentation Build'
description: "Include Documentation Build"
type: boolean
default: 'true'
default: "true"
required: true
prepareRelease:
description: 'Prepare Draft Release'
description: "Prepare Draft Release"
type: boolean
default: 'true'
default: "true"
required: true

jobs:
Expand All @@ -46,7 +46,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16.13.1
cache: 'npm'
cache: "npm"
- name: Install NPM dependencies for version updater
working-directory: ./tools/bump-version
run: npm ci
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-for-generated-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Get Comment Body
id: get-comment-body
if : steps.get-warnings.outputs.has_warnings == 'true'
if: steps.get-warnings.outputs.has_warnings == 'true'
run: |
cat warnings.txt > comment.txt
echo "" >> comment.txt
Expand All @@ -73,12 +73,12 @@ jobs:
echo ::set-output name=body::$body
- name: Add github comment on problem
if : steps.get-warnings.outputs.has_warnings == 'true'
if: steps.get-warnings.outputs.has_warnings == 'true'
uses: peter-evans/commit-comment@v1
with:
body: ${{ steps.get-comment-body.outputs.body }}
- name: Flag as error
if : steps.get-warnings.outputs.has_warnings == 'true'
if: steps.get-warnings.outputs.has_warnings == 'true'
run: |
COMMIT_WARNINGS=$(cat warnings.txt)
echo "::warning:: $COMMIT_WARNINGS"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/fetch-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ on:
workflow_dispatch:
inputs:
fromCommit:
description: 'From Commit SHA (full-length)'
description: "From Commit SHA (full-length)"
required: true
toCommit:
description: 'To Commit SHA (full-length, if omitted will use latest)'
description: "To Commit SHA (full-length, if omitted will use latest)"

jobs:
fetchChangelog:
Expand All @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16.13.1
cache: 'npm'
cache: "npm"
- name: Install NPM dependencies
working-directory: ./tools/fetch-changelog
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion doc/BN14.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ I need equations that test many different aspect of "math culture", it can be ch

All variable purchasing will be scriptable.


All equation must have:

- several variables that can be upgraded, at least 1 variable must be strategic in it's upgrading (upgrading too much can cause drop in performance)
- Some sort of math twist that requires some thinking, like (-2)^c1 alters between positive and negative.

Expand Down
2 changes: 0 additions & 2 deletions doc/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ Fork and clone the repo
- Regularly rebase your branch against `dev` to make sure you have the latest updates pulled.
- When merging, always merge your branch into `dev`. When releasing a new update, then merge `dev` into `master`


## Running locally.

Install
Expand All @@ -131,7 +130,6 @@ Inside the root of the repo run
After that you can open any browser and navigate to `localhost:8000` and play the game.
Saving a file will reload the game automatically.


### How to build the electron app

Tested on Node v16.13.1 (LTS) on Windows
Expand Down
23 changes: 13 additions & 10 deletions doc/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ Yes, just export the save file from the options menu & import it in the other pl
## Game is stuck after running scripts!

You may have created an infinite loop with no sleep. You'll have to restart the game by killing all scripts.
* On Browser: Stick `?noScript` at the end of the URL
* On Steam:
* In the menu, "Reloads" -> "Reload & Kill All Scripts".
* If this does not work, when launching the game, use the kill all script options.

- On Browser: Stick `?noScript` at the end of the URL
- On Steam:
- In the menu, "Reloads" -> "Reload & Kill All Scripts".
- If this does not work, when launching the game, use the kill all script options.

---

Expand All @@ -51,11 +52,13 @@ You can navigate to the game files by right-clicking the game in your library an
## Steam: Game won't launch

### **On Windows**

If the game is installed on a network drive, it will fail to start due to a [limitation in Chromium](https://github.com/electron/electron/issues/27356).

If you cannot move the game to another drive, you'll have to add the `--no-sandbox` launch option. In your Steam Library, Right click the game and hit "Properties". You'll see the launch option section in the "General" window.

### **On Linux**

The game is built natively, do not use Proton unless native does not work.

When launching the game, you will be prompted with three options. If the standard launch does not work, you may attempt the `--disable-seccomp-filter-sandbox` or `--no-sandbox` launch option. If this still does not work, the game should be able to start by launching it directly or through the terminal. See [How do I get to the game files?](#game-files).
Expand All @@ -68,17 +71,17 @@ When launching the game, you will be prompted with three options. If the standar

You may want access the logs to get information about crashes or such.

* on Linux: `~/.config/bitburner/logs/main.log`
* on macOS: `~/Library/Logs/bitburner/main.log`
* on Windows: `%USERPROFILE%\AppData\Roaming\bitburner\logs\main.log`
- on Linux: `~/.config/bitburner/logs/main.log`
- on macOS: `~/Library/Logs/bitburner/main.log`
- on Windows: `%USERPROFILE%\AppData\Roaming\bitburner\logs\main.log`

### Config (using [electron-store](https://github.com/sindresorhus/electron-store#readme))

Configuration file will be written to disk in the application data directory.

* on Linux: `~/.config/bitburner/config.json`
* on macOS: `~/Library/Application\ Support/bitburner/config.json`
* on Windows: `%USERPROFILE%\AppData\Roaming\bitburner\config.json`
- on Linux: `~/.config/bitburner/config.json`
- on macOS: `~/Library/Application\ Support/bitburner/config.json`
- on Windows: `%USERPROFILE%\AppData\Roaming\bitburner\config.json`

---

Expand Down
25 changes: 15 additions & 10 deletions electron/achievements.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ async function enableAchievementsInterval(window) {
// If the Steam API could not be initialized on game start, we'll abort this.
if (global.greenworksError) return;

// This is backward but the game fills in an array called `document.achievements` and we retrieve it from
// This is backward but the game fills in an array called `document.achievements` and we retrieve it from
// here. Hey if it works it works.
const steamAchievements = greenworks.getAchievementNames();
log.silly(`All Steam achievements ${JSON.stringify(steamAchievements)}`);
const playerAchieved = (await Promise.all(steamAchievements.map(checkSteamAchievement))).filter(name => !!name);
const playerAchieved = (await Promise.all(steamAchievements.map(checkSteamAchievement))).filter((name) => !!name);
log.debug(`Player has Steam achievements ${JSON.stringify(playerAchieved)}`);
const intervalID = setInterval(async () => {
try {
const playerAchievements = await window.webContents.executeJavaScript("document.achievements");
for (const ach of playerAchievements) {
if (!steamAchievements.includes(ach)) continue; // Don't try activating achievements that don't exist Steam-side
if (playerAchieved.includes(ach)) continue; // Don't spam achievements that have already been recorded
if (playerAchieved.includes(ach)) continue; // Don't spam achievements that have already been recorded
log.info(`Granting Steam achievement ${ach}`);
greenworks.activateAchievement(ach, () => undefined);
playerAchieved.push(ach);
Expand All @@ -26,7 +26,7 @@ async function enableAchievementsInterval(window) {
log.error(error);

// The interval probably did not get cleared after a window kill
log.warn('Clearing achievements timer');
log.warn("Clearing achievements timer");
clearInterval(intervalID);
return;
}
Expand All @@ -36,10 +36,14 @@ async function enableAchievementsInterval(window) {

function checkSteamAchievement(name) {
return new Promise((resolve) => {
greenworks.getAchievement(name, playerHas => resolve(playerHas ? name : ""), err => {
log.warn(`Failed to get Steam achievement ${name} status: ${err}`);
resolve("");
});
greenworks.getAchievement(
name,
(playerHas) => resolve(playerHas ? name : ""),
(err) => {
log.warn(`Failed to get Steam achievement ${name} status: ${err}`);
resolve("");
},
);
});
}

Expand All @@ -50,5 +54,6 @@ function disableAchievementsInterval(window) {
}

module.exports = {
enableAchievementsInterval, disableAchievementsInterval
}
enableAchievementsInterval,
disableAchievementsInterval,
};
Loading

0 comments on commit 48f80f2

Please sign in to comment.