mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-01 20:13:51 +01:00
Merge pull request #3618 from Hoekstraa/clearTerminal
API: Terminal screen can now be cleared from within scripts with ns.ui.clearTerminal()
This commit is contained in:
commit
88b7b141f7
@ -51,6 +51,7 @@ export const RamCostConstants: IMap<number> = {
|
|||||||
ScriptCodingContractBaseRamCost: 10,
|
ScriptCodingContractBaseRamCost: 10,
|
||||||
ScriptSleeveBaseRamCost: 4,
|
ScriptSleeveBaseRamCost: 4,
|
||||||
ScriptGetOwnedSourceFiles: 5,
|
ScriptGetOwnedSourceFiles: 5,
|
||||||
|
ScriptClearTerminalCost: 0.2,
|
||||||
|
|
||||||
ScriptSingularityFn1RamCost: 2,
|
ScriptSingularityFn1RamCost: 2,
|
||||||
ScriptSingularityFn2RamCost: 3,
|
ScriptSingularityFn2RamCost: 3,
|
||||||
@ -358,6 +359,7 @@ export const RamCosts: IMap<any> = {
|
|||||||
enableLog: 0,
|
enableLog: 0,
|
||||||
isLogEnabled: 0,
|
isLogEnabled: 0,
|
||||||
getScriptLogs: 0,
|
getScriptLogs: 0,
|
||||||
|
clearTerminal: RamCostConstants.ScriptClearTerminalCost,
|
||||||
nuke: RamCostConstants.ScriptPortProgramRamCost,
|
nuke: RamCostConstants.ScriptPortProgramRamCost,
|
||||||
brutessh: RamCostConstants.ScriptPortProgramRamCost,
|
brutessh: RamCostConstants.ScriptPortProgramRamCost,
|
||||||
ftpcrack: RamCostConstants.ScriptPortProgramRamCost,
|
ftpcrack: RamCostConstants.ScriptPortProgramRamCost,
|
||||||
|
@ -14,6 +14,7 @@ import { defaultTheme } from "../Themes/Themes";
|
|||||||
import { defaultStyles } from "../Themes/Styles";
|
import { defaultStyles } from "../Themes/Styles";
|
||||||
import { CONSTANTS } from "../Constants";
|
import { CONSTANTS } from "../Constants";
|
||||||
import { hash } from "../hash/hash";
|
import { hash } from "../hash/hash";
|
||||||
|
import { Terminal } from "../../src/Terminal";
|
||||||
|
|
||||||
export function NetscriptUserInterface(
|
export function NetscriptUserInterface(
|
||||||
player: IPlayer,
|
player: IPlayer,
|
||||||
@ -108,5 +109,11 @@ export function NetscriptUserInterface(
|
|||||||
|
|
||||||
return gameInfo;
|
return gameInfo;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clearTerminal: function (): void {
|
||||||
|
updateRam("clearTerminal");
|
||||||
|
workerScript.log("ui.clearTerminal", () => `Clearing terminal`);
|
||||||
|
Terminal.clear();
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
7
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
7
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -4391,6 +4391,13 @@ interface UserInterface {
|
|||||||
* RAM cost: 0 GB
|
* RAM cost: 0 GB
|
||||||
*/
|
*/
|
||||||
getGameInfo(): GameInfo;
|
getGameInfo(): GameInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the Terminal window, as if the player ran `clear` in the terminal
|
||||||
|
* @remarks
|
||||||
|
* RAM cost: 0.2 GB
|
||||||
|
*/
|
||||||
|
clearTerminal(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user