mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-22 17:23:00 +02:00
UI: Warn player if they are editing and saving files on non-home servers (#1968)
This commit is contained in:
@@ -12,11 +12,13 @@ function getServerCode(scripts: OpenScript[], index: number): string | null {
|
||||
return data;
|
||||
}
|
||||
|
||||
function dirty(scripts: OpenScript[], index: number): string {
|
||||
function isUnsavedFile(scripts: OpenScript[], index: number): boolean {
|
||||
const openScript = scripts[index];
|
||||
const serverData = getServerCode(scripts, index);
|
||||
if (serverData === null) return " *";
|
||||
return serverData !== openScript.code ? " *" : "";
|
||||
if (serverData === null) {
|
||||
return true;
|
||||
}
|
||||
return serverData !== openScript.code;
|
||||
}
|
||||
|
||||
function reorder(list: unknown[], startIndex: number, endIndex: number): void {
|
||||
@@ -60,4 +62,4 @@ function makeModel(hostname: string, filename: string, code: string): editor.ITe
|
||||
return editor.createModel(code, language, uri);
|
||||
}
|
||||
|
||||
export { getServerCode, dirty, reorder, makeModel };
|
||||
export { getServerCode, isUnsavedFile, reorder, makeModel };
|
||||
|
||||
Reference in New Issue
Block a user