mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 22:22:26 +01:00
Change lastServer to reference the server ip
Should fix issue with newly saved scripts failing to run
This commit is contained in:
parent
4278191b0e
commit
386f8a11c5
@ -23,7 +23,7 @@ import { libSource } from "../NetscriptDefinitions";
|
||||
import { NetscriptFunctions } from "../../NetscriptFunctions";
|
||||
import { WorkerScript } from "../../Netscript/WorkerScript";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { GetServerByHostname } from "../../Server/ServerHelpers";
|
||||
import { getServer } from "../../Server/ServerHelpers";
|
||||
import {
|
||||
iTutorialNextStep,
|
||||
ITutorial,
|
||||
@ -91,7 +91,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
useEffect(() => {
|
||||
if(props.filename === "") return;
|
||||
if(lastFilename === "")
|
||||
lastServer = props.player.getCurrentServer().hostname;
|
||||
lastServer = props.player.getCurrentServer().ip;
|
||||
lastFilename = props.filename;
|
||||
lastCode = props.code;
|
||||
lastPosition = null;
|
||||
@ -122,7 +122,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
//Save the script
|
||||
const server = GetServerByHostname(lastServer);
|
||||
const server = getServer(lastServer);
|
||||
if(server === null) throw new Error('Server should not be null but it is.');
|
||||
for (let i = 0; i < server.scripts.length; i++) {
|
||||
if (filename == server.scripts[i].filename) {
|
||||
@ -150,7 +150,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
return;
|
||||
}
|
||||
|
||||
const server = GetServerByHostname(lastServer);
|
||||
const server = getServer(lastServer);
|
||||
if(server === null) throw new Error('Server should not be null but it is.');
|
||||
if (filename === ".fconf") {
|
||||
try {
|
||||
@ -328,4 +328,4 @@ export function Root(props: IProps): React.ReactElement {
|
||||
<a className="std-button" style={{display: "inline-block"}} target="_blank" href="https://bitburner.readthedocs.io/en/latest/index.html">Netscript Documentation</a>
|
||||
</div>
|
||||
</div>);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user