mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
Merge branch 'dev' into feat/add-vim-mode
This commit is contained in:
commit
cdd85c09e1
36
dist/vendor.bundle.js
vendored
36
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -7,6 +7,8 @@ if (greenworks.init()) {
|
||||
console.log("Steam API has failed to initialize.");
|
||||
}
|
||||
|
||||
console.log(greenworks.shutdown);
|
||||
|
||||
const debug = false;
|
||||
|
||||
function createWindow(killall) {
|
||||
@ -45,6 +47,7 @@ function createWindow(killall) {
|
||||
greenworks.activateAchievement(ach, () => undefined);
|
||||
}
|
||||
}, 1000);
|
||||
win.achievementsIntervalID = intervalID;
|
||||
|
||||
// Create the Application's main menu
|
||||
Menu.setApplicationMenu(
|
||||
@ -74,6 +77,7 @@ function createWindow(killall) {
|
||||
{
|
||||
label: "reload & kill all scripts",
|
||||
click: () => {
|
||||
setStopProcessHandler(app, win, false);
|
||||
if (intervalID) clearInterval(intervalID);
|
||||
win.webContents.forcefullyCrashRenderer();
|
||||
win.close();
|
||||
@ -109,8 +113,35 @@ function createWindow(killall) {
|
||||
},
|
||||
]),
|
||||
);
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
function setStopProcessHandler(app, window, enabled) {
|
||||
const clearWindowHandler = () => {
|
||||
if (window.achievementsIntervalID) {
|
||||
clearInterval(window.achievementsIntervalID);
|
||||
}
|
||||
window = null;
|
||||
};
|
||||
|
||||
const stopProcessHandler = () => {
|
||||
if (process.platform !== "darwin") {
|
||||
app.quit();
|
||||
process.exit(0);
|
||||
}
|
||||
};
|
||||
|
||||
if (enabled) {
|
||||
window.on("closed", clearWindowHandler);
|
||||
app.on("window-all-closed", stopProcessHandler);
|
||||
} else {
|
||||
window.removeListener("closed", clearWindowHandler);
|
||||
app.removeListener("window-all-closed", stopProcessHandler);
|
||||
}
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow(false);
|
||||
const win = createWindow(false);
|
||||
setStopProcessHandler(app, win, true);
|
||||
});
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -110,6 +110,6 @@
|
||||
"watch": "webpack --watch --mode production",
|
||||
"watch:dev": "webpack --watch --mode development",
|
||||
"electron": "cp -r electron/* .package && cp index.html .package && cp main.bundle.js .package && cp dist/vendor.bundle.js .package/dist/ && cp -r dist/ext .package/dist/ && electron-packager .package bitburner --all --out .build --overwrite --icon .package/icon.png",
|
||||
"allbuild": "npm run build && npm run electron && git add --all && git commit --amend --no-edit"
|
||||
"allbuild": "npm run build && npm run electron && git add --all && git commit --amend --no-edit && git push -f -u origin dev"
|
||||
}
|
||||
}
|
||||
|
2
src/@types/global.d.ts
vendored
2
src/@types/global.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
// Defined by webpack on startup or compilation
|
||||
declare const __COMMIT_HASH__: string;
|
||||
declare let __COMMIT_HASH__: string;
|
||||
|
@ -55,6 +55,7 @@ import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||
import { KEY } from "../../utils/helpers/keyCodes";
|
||||
import { ProgramsSeen } from "../../Programs/ui/ProgramsRoot";
|
||||
import { InvitationsSeen } from "../../Faction/ui/FactionsRoot";
|
||||
import { hash } from "../../hash/hash";
|
||||
|
||||
const openedMixin = (theme: Theme): CSSObject => ({
|
||||
width: theme.spacing(31),
|
||||
@ -338,11 +339,13 @@ export function SidebarRoot(props: IProps): React.ReactElement {
|
||||
<ListItemIcon>
|
||||
{!open ? <ChevronRightIcon color="primary" /> : <ChevronLeftIcon color="primary" />}
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={
|
||||
<Tooltip title={__COMMIT_HASH__}>
|
||||
<Typography>Bitburner v{CONSTANTS.VersionString}</Typography>
|
||||
<ListItemText
|
||||
primary={
|
||||
<Tooltip title={hash()}>
|
||||
<Typography>Bitburner v{CONSTANTS.VersionString}</Typography>
|
||||
</Tooltip>
|
||||
} />
|
||||
}
|
||||
/>
|
||||
</ListItem>
|
||||
<Divider />
|
||||
<List>
|
||||
|
@ -69,6 +69,7 @@ import { top } from "./commands/top";
|
||||
import { unalias } from "./commands/unalias";
|
||||
import { weaken } from "./commands/weaken";
|
||||
import { wget } from "./commands/wget";
|
||||
import { hash } from "../hash/hash";
|
||||
|
||||
export class Terminal implements ITerminal {
|
||||
// Flags to determine whether the player is currently running a hack or an analyze
|
||||
@ -77,7 +78,9 @@ export class Terminal implements ITerminal {
|
||||
commandHistory: string[] = [];
|
||||
commandHistoryIndex = 0;
|
||||
|
||||
outputHistory: (Output | Link | RawOutput)[] = [new Output(`Bitburner v${CONSTANTS.VersionString} (${__COMMIT_HASH__})`, "primary")];
|
||||
outputHistory: (Output | Link | RawOutput)[] = [
|
||||
new Output(`Bitburner v${CONSTANTS.VersionString} (${hash()})`, "primary"),
|
||||
];
|
||||
|
||||
// True if a Coding Contract prompt is opened
|
||||
contractOpen = false;
|
||||
@ -555,7 +558,7 @@ export class Terminal implements ITerminal {
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.outputHistory = [new Output(`Bitburner v${CONSTANTS.VersionString} (${__COMMIT_HASH__})`, "primary")];
|
||||
this.outputHistory = [new Output(`Bitburner v${CONSTANTS.VersionString} (${hash()})`, "primary")];
|
||||
TerminalEvents.emit();
|
||||
TerminalClearEvents.emit();
|
||||
}
|
||||
@ -668,6 +671,12 @@ export class Terminal implements ITerminal {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case iTutorialSteps.TerminalHackingMechanics:
|
||||
if (commandArray.length !== 1 || !["grow", "weaken", "hack"].includes(commandArray[0] + "")) {
|
||||
this.error("Bad command. Please follow the tutorial");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case iTutorialSteps.TerminalGoHome:
|
||||
if (commandArray.length == 1 && commandArray[0] == "home") {
|
||||
iTutorialNextStep();
|
||||
|
@ -20,7 +20,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
margin: theme.spacing(0),
|
||||
},
|
||||
input: {
|
||||
backgroundColor: "#000",
|
||||
backgroundColor: theme.colors.backgroundprimary,
|
||||
},
|
||||
nopadding: {
|
||||
padding: theme.spacing(0),
|
||||
|
@ -1,20 +1,28 @@
|
||||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Link from "@mui/material/Link";
|
||||
import Box from "@mui/material/Box";
|
||||
import Button from "@mui/material/Button";
|
||||
import { ConfirmationModal } from "../../ui/React/ConfirmationModal";
|
||||
|
||||
interface IProps {
|
||||
reactivateTutorial: () => void;
|
||||
}
|
||||
|
||||
export function TutorialRoot(props: IProps): React.ReactElement {
|
||||
const [confirmResetOpen, setConfirmResetOpen] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Typography variant="h4">Tutorial / Documentation</Typography>
|
||||
<Box m={2}>
|
||||
<Button onClick={props.reactivateTutorial}>Soft reset and Restart tutorial</Button>
|
||||
<Button onClick={() => setConfirmResetOpen(true)}>Soft reset and Restart tutorial</Button>
|
||||
<ConfirmationModal
|
||||
open={confirmResetOpen}
|
||||
onClose={() => setConfirmResetOpen(false)}
|
||||
onConfirm={props.reactivateTutorial}
|
||||
confirmationText={"This will reset all your stats to 1 and money to 1k. Are you sure?"}
|
||||
/>
|
||||
<Link
|
||||
color="primary"
|
||||
target="_blank"
|
||||
@ -94,6 +102,14 @@ export function TutorialRoot(props: IProps): React.ReactElement {
|
||||
<Link color="primary" target="_blank" href="https://bitburner.readthedocs.io/en/latest/shortcuts.html">
|
||||
<Typography>Keyboard Shortcuts</Typography>
|
||||
</Link>
|
||||
<br />
|
||||
<Link
|
||||
color="primary"
|
||||
target="_blank"
|
||||
href="https://bitburner.readthedocs.io/en/latest/netscript/netscriptlearntoprogram.html#netscript-1-0-vs-netscript-2-0"
|
||||
>
|
||||
<Typography>NS1 vs NS1 (or .script vs .js)</Typography>
|
||||
</Link>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
|
8
src/hash/hash.ts
Normal file
8
src/hash/hash.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export function hash(): string {
|
||||
try {
|
||||
if (__COMMIT_HASH__) {
|
||||
return __COMMIT_HASH__;
|
||||
}
|
||||
} catch (err) {}
|
||||
return "DEV";
|
||||
}
|
@ -12,6 +12,7 @@ import { CopyableText } from "../React/CopyableText";
|
||||
import ListItem from "@mui/material/ListItem";
|
||||
import EqualizerIcon from "@mui/icons-material/Equalizer";
|
||||
import LastPageIcon from "@mui/icons-material/LastPage";
|
||||
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
|
||||
import HelpIcon from "@mui/icons-material/Help";
|
||||
import AccountTreeIcon from "@mui/icons-material/AccountTree";
|
||||
import StorageIcon from "@mui/icons-material/Storage";
|
||||
@ -58,6 +59,9 @@ export function InteractiveTutorialRoot(): React.ReactElement {
|
||||
<br />
|
||||
<br />
|
||||
This tutorial will show you the basics of the game. You may skip the tutorial at any time.
|
||||
<br />
|
||||
<br />
|
||||
You can also click the eye symbol <VisibilityOffIcon /> to temporarily hide this tutorial.
|
||||
</Typography>
|
||||
</>
|
||||
),
|
||||
@ -287,7 +291,9 @@ export function InteractiveTutorialRoot(): React.ReactElement {
|
||||
The amount of money on a server is not limitless. So, if you constantly hack a server and deplete its money,
|
||||
then you will encounter diminishing returns in your hacking. You will need to use{" "}
|
||||
<Typography classes={{ root: classes.textfield }}>{"[n00dles ~/]> grow"}</Typography>
|
||||
and <Typography classes={{ root: classes.textfield }}>{"[n00dles ~/]> weaken"}</Typography>
|
||||
which tricks the company into adding money to their server and{" "}
|
||||
<Typography classes={{ root: classes.textfield }}>{"[n00dles ~/]> weaken"}</Typography>
|
||||
which increases the speed of hack and grow.
|
||||
</Typography>
|
||||
),
|
||||
canNext: true,
|
||||
@ -345,10 +351,6 @@ export function InteractiveTutorialRoot(): React.ReactElement {
|
||||
continuously hack the n00dles server.
|
||||
<br />
|
||||
<br />
|
||||
If you're an intermediate programmer you should use ns2 instead. It is much faster and offers more
|
||||
possibilities.
|
||||
<br />
|
||||
<br />
|
||||
To save and close the script editor, press the button in the bottom left, or press ctrl + b.
|
||||
</Typography>
|
||||
</>
|
||||
@ -447,7 +449,11 @@ export function InteractiveTutorialRoot(): React.ReactElement {
|
||||
<br />
|
||||
<br />
|
||||
If you know even a little bit of programming it is highly recommended you use NS2 instead. You will enjoy
|
||||
the game much more.
|
||||
the game much more. NS1 files end with .script and are a subset of javascript. NS2 files end with .js and
|
||||
are full speed native javascript.
|
||||
<br />
|
||||
<br />
|
||||
You can learn more about the difference between them later in the documentation.
|
||||
<br />
|
||||
<br />
|
||||
For now, let's move on to something else!
|
||||
|
@ -15,6 +15,7 @@ import { GameRoot } from "./GameRoot";
|
||||
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { ActivateRecoveryMode } from "./React/RecoveryRoot";
|
||||
import { hash } from "../hash/hash";
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
@ -69,7 +70,9 @@ export function LoadingScreen(): React.ReactElement {
|
||||
<CircularProgress size={150} color="primary" />
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Typography variant="h3">Loading Bitburner v{CONSTANTS.VersionString} ({__COMMIT_HASH__})</Typography>
|
||||
<Typography variant="h3">
|
||||
Loading Bitburner v{CONSTANTS.VersionString} ({hash()})
|
||||
</Typography>
|
||||
</Grid>
|
||||
{show && (
|
||||
<Grid item>
|
||||
|
@ -44,10 +44,7 @@ module.exports = (env, argv) => {
|
||||
|
||||
// Get the current commit hash to inject into the app
|
||||
// https://stackoverflow.com/a/38401256
|
||||
const commitHash = require('child_process')
|
||||
.execSync('git rev-parse --short HEAD')
|
||||
.toString()
|
||||
.trim();
|
||||
const commitHash = require("child_process").execSync("git rev-parse --short HEAD").toString().trim();
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
@ -113,7 +110,7 @@ module.exports = (env, argv) => {
|
||||
},
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
__COMMIT_HASH__: JSON.stringify(commitHash)
|
||||
__COMMIT_HASH__: JSON.stringify(commitHash || "DEV"),
|
||||
}),
|
||||
// In dev mode, use a faster method of create sourcemaps
|
||||
// while keeping lines/columns accurate
|
||||
|
Loading…
Reference in New Issue
Block a user