MISC: Remove deprecated tail-related APIs (#2143)

This commit is contained in:
catloversg
2025-05-20 10:10:15 +07:00
committed by GitHub
parent 197e7f79cb
commit 37d9284d33
10 changed files with 57 additions and 365 deletions

View File

@@ -1,39 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [closeTail](./bitburner.ns.closetail.md)
## NS.closeTail() method
> Warning: This API is now obsolete.
>
> Use [ns.ui.closeTail](./bitburner.userinterface.closetail.md) instead.
>
Close the tail window of a script. This function is deprecated and will be removed in a later version.
**Signature:**
```typescript
closeTail(pid?: number): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| pid | number | _(Optional)_ Optional. PID of the script having its tail closed. If omitted, the current script is used. |
**Returns:**
void
## Remarks
RAM cost: 0 GB
Closes a scripts logs. This is functionally the same as pressing the "Close" button on the tail window.
If the function is called with no arguments, it will close the current scripts logs.
Otherwise, the pid argument can be used to close the logs from another script.

View File

@@ -62,7 +62,6 @@ export async function main(ns) {
| [clear(handle)](./bitburner.ns.clear.md) | Clear data from a file. |
| [clearLog()](./bitburner.ns.clearlog.md) | Clears the scripts logs. |
| [clearPort(portNumber)](./bitburner.ns.clearport.md) | Clear data from a port. |
| [closeTail(pid)](./bitburner.ns.closetail.md) | Close the tail window of a script. This function is deprecated and will be removed in a later version. |
| [deleteServer(host)](./bitburner.ns.deleteserver.md) | Delete a purchased server. |
| [disableLog(fn)](./bitburner.ns.disablelog.md) | Disables logging for the given NS function. |
| [dnsLookup(host)](./bitburner.ns.dnslookup.md) | Given a hostname, returns its IP address; or given an IP address, returns its hostname. |
@@ -131,7 +130,6 @@ export async function main(ns) {
| [kill(filename, host, args)](./bitburner.ns.kill_1.md) | Terminate the script(s) with the provided filename, host, and script arguments. |
| [killall(host, safetyGuard)](./bitburner.ns.killall.md) | Terminate all scripts on a server. |
| [ls(host, substring)](./bitburner.ns.ls.md) | List files on a server. |
| [moveTail(x, y, pid)](./bitburner.ns.movetail.md) | Move a tail window. This function is deprecated and will be removed in a later version. |
| [mv(host, source, destination)](./bitburner.ns.mv.md) | Move a file on the target server. |
| [nextPortWrite(port)](./bitburner.ns.nextportwrite.md) | Listen for a port write. |
| [nuke(host)](./bitburner.ns.nuke.md) | Runs NUKE.exe on a server. |
@@ -147,7 +145,6 @@ export async function main(ns) {
| [readPort(portNumber)](./bitburner.ns.readport.md) | Read data from a port. |
| [relaysmtp(host)](./bitburner.ns.relaysmtp.md) | Runs relaySMTP.exe on a server. |
| [renamePurchasedServer(hostname, newName)](./bitburner.ns.renamepurchasedserver.md) | Rename a purchased server. |
| [resizeTail(width, height, pid)](./bitburner.ns.resizetail.md) | Resize a tail window. This function is deprecated and will be removed in a later version. |
| [rm(name, host)](./bitburner.ns.rm.md) | Delete a file. |
| [run(script, threadOrOptions, args)](./bitburner.ns.run.md) | Start another script on the current server. |
| [scan(host, returnOpts)](./bitburner.ns.scan.md) | Get the list of hostnames or IP addresses connected to a server. |
@@ -156,13 +153,11 @@ export async function main(ns) {
| [scriptRunning(script, host)](./bitburner.ns.scriptrunning.md) | Check if any script with a filename is running. |
| [self()](./bitburner.ns.self.md) | Returns the currently running script. |
| [serverExists(host)](./bitburner.ns.serverexists.md) | Returns a boolean denoting whether or not the specified server exists. |
| [setTitle(title, pid)](./bitburner.ns.settitle.md) | Set the title of the tail window of a script. This function is deprecated and will be removed in a later version. |
| [share()](./bitburner.ns.share.md) | Share the server's ram with your factions to increase the reputation gain rate of faction work. This boost is applied to all faction work of all factions. |
| [sleep(millis)](./bitburner.ns.sleep.md) | Suspends the script for n milliseconds. |
| [spawn(script, threadOrOptions, args)](./bitburner.ns.spawn.md) | Terminate current script and start another in a defined number of milliseconds. |
| [sprintf(format, args)](./bitburner.ns.sprintf.md) | Format a string. |
| [sqlinject(host)](./bitburner.ns.sqlinject.md) | Runs SQLInject.exe on a server. |
| [tail(fn, host, args)](./bitburner.ns.tail.md) | Open the tail window of a script. This function is deprecated and will be removed in a later version. |
| [toast(msg, variant, duration)](./bitburner.ns.toast.md) | Queue a toast (bottom-right notification). |
| [tprint(args)](./bitburner.ns.tprint.md) | Prints one or more values or variables to the Terminal. |
| [tprintf(format, values)](./bitburner.ns.tprintf.md) | Prints a raw value or a variable to the Terminal. |

View File

@@ -1,37 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [moveTail](./bitburner.ns.movetail.md)
## NS.moveTail() method
> Warning: This API is now obsolete.
>
> Use [ns.ui.moveTail](./bitburner.userinterface.movetail.md) instead.
>
Move a tail window. This function is deprecated and will be removed in a later version.
**Signature:**
```typescript
moveTail(x: number, y: number, pid?: number): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| x | number | x coordinate. |
| y | number | y coordinate. |
| pid | number | _(Optional)_ Optional. PID of the script having its tail moved. If omitted, the current script is used. |
**Returns:**
void
## Remarks
RAM cost: 0 GB
Moves a tail window. Coordinates are in screen space pixels (top left is 0,0).

View File

@@ -1,37 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [resizeTail](./bitburner.ns.resizetail.md)
## NS.resizeTail() method
> Warning: This API is now obsolete.
>
> Use [ns.ui.resizeTail](./bitburner.userinterface.resizetail.md) instead.
>
Resize a tail window. This function is deprecated and will be removed in a later version.
**Signature:**
```typescript
resizeTail(width: number, height: number, pid?: number): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| width | number | Width of the window. |
| height | number | Height of the window. |
| pid | number | _(Optional)_ Optional. PID of the script having its tail resized. If omitted, the current script is used. |
**Returns:**
void
## Remarks
RAM cost: 0 GB
Resize a tail window. Size are in pixel.

View File

@@ -1,44 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [setTitle](./bitburner.ns.settitle.md)
## NS.setTitle() method
> Warning: This API is now obsolete.
>
> Use [ns.ui.setTailTitle](./bitburner.userinterface.settailtitle.md) instead.
>
Set the title of the tail window of a script. This function is deprecated and will be removed in a later version.
**Signature:**
```typescript
setTitle(title: string | ReactNode, pid?: number): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| title | string \| [ReactNode](./bitburner.reactnode.md) | The new title for the tail window. |
| pid | number | _(Optional)_ Optional. PID of the script having its tail closed. If omitted, the current script is used. |
**Returns:**
void
## Remarks
RAM cost: 0 GB
This sets the title to the given string, and also forces an update of the tail window's contents.
The title is saved across restarts, but only if it is a simple string.
If the pid is unspecified, it will modify the current scripts logs.
Otherwise, the pid argument can be used to change the logs from another script.
It is possible to pass any React Node instead of a string. See [ReactElement](./bitburner.reactelement.md) and [ReactNode](./bitburner.reactnode.md) types for additional info.

View File

@@ -1,55 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [tail](./bitburner.ns.tail.md)
## NS.tail() method
> Warning: This API is now obsolete.
>
> Use [ns.ui.openTail](./bitburner.userinterface.opentail.md) instead.
>
Open the tail window of a script. This function is deprecated and will be removed in a later version.
**Signature:**
```typescript
tail(fn?: FilenameOrPID, host?: string, ...args: ScriptArg[]): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| fn | [FilenameOrPID](./bitburner.filenameorpid.md) | _(Optional)_ Optional. Filename or PID of the script being tailed. If omitted, the current script is tailed. |
| host | string | _(Optional)_ Optional. Hostname of the script being tailed. Defaults to the server this script is running on. If args are specified, this is not optional. |
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments for the script being tailed. |
**Returns:**
void
## Remarks
RAM cost: 0 GB
Opens a scripts logs. This is functionally the same as the tail Terminal command.
If the function is called with no arguments, it will open the current scripts logs.
Otherwise, the PID or filename, hostname/ip, and args… arguments can be used to get the logs from another script. Remember that scripts are uniquely identified by both their names and arguments.
## Example
```js
//Open logs from foo.js on the current server that was run with no args
ns.tail("foo.js");
//Get logs from foo.js on the foodnstuff server that was run with no args
ns.tail("foo.js", "foodnstuff");
//Get logs from foo.js on the foodnstuff server that was run with the arguments [1, "test"]
ns.tail("foo.js", "foodnstuff", 1, "test");
```

View File

@@ -615,12 +615,7 @@ export const RamCosts: RamCostTree<NSFull> = {
mv: 0,
getResetInfo: 1,
getFunctionRamCost: 0,
tail: 0,
toast: 0,
moveTail: 0,
resizeTail: 0,
closeTail: 0,
setTitle: 0,
clearPort: 0,
openDevMenu: 0,
alert: 0,

View File

@@ -104,7 +104,6 @@ import { ContentFilePath } from "./Paths/ContentFile";
import { hasContractExtension } from "./Paths/ContractFilePath";
import { getRamCost } from "./Netscript/RamCostGenerator";
import { getEnumHelper } from "./utils/EnumHelper";
import { deprecationWarning } from "./utils/DeprecationHelper";
import { ServerConstants } from "./Server/data/Constants";
import { assertFunctionWithNSContext } from "./Netscript/TypeAssertion";
import { Router } from "./ui/GameRoot";
@@ -561,36 +560,6 @@ export const ns: InternalAPI<NSFull> = {
return runningScriptObj.logs.map((x) => String(x));
},
tail:
(ctx) =>
(scriptID, hostname, ...scriptArgs) => {
deprecationWarning("ns.tail", "Use ns.ui.openTail instead.");
ns.ui.openTail(ctx)(scriptID, hostname, ...scriptArgs);
},
moveTail:
(ctx) =>
(_x, _y, _pid = ctx.workerScript.scriptRef.pid) => {
deprecationWarning("ns.moveTail", "Use ns.ui.moveTail instead.");
ns.ui.moveTail(ctx)(_x, _y, _pid);
},
resizeTail:
(ctx) =>
(_w, _h, _pid = ctx.workerScript.scriptRef.pid) => {
deprecationWarning("ns.resizeTail", "Use ns.ui.resizeTail instead.");
ns.ui.resizeTail(ctx)(_w, _h, _pid);
},
closeTail:
(ctx) =>
(_pid = ctx.workerScript.scriptRef.pid) => {
deprecationWarning("ns.closeTail", "Use ns.ui.closeTail instead.");
ns.ui.closeTail(ctx)(_pid);
},
setTitle:
(ctx) =>
(title, _pid = ctx.workerScript.scriptRef.pid) => {
deprecationWarning("ns.setTitle", "Use ns.ui.setTailTitle instead.");
ns.ui.setTailTitle(ctx)(title, _pid);
},
nuke: (ctx) => (_host) => {
const host = helpers.string(ctx, "host", _host);
@@ -1814,6 +1783,42 @@ setRemovedFunctions(ns, {
version: "3.0.0",
replacement: "Date.now() - ns.getResetInfo().lastAugReset",
},
formatNumber: {
version: "3.0.0",
replacement: "ns.format.number()",
},
formatRam: {
version: "3.0.0",
replacement: "ns.format.ram()",
},
formatPercent: {
version: "3.0.0",
replacement: "ns.format.percent()",
},
tFormat: {
version: "3.0.0",
replacement: "ns.format.time()",
},
tail: {
version: "3.0.0",
replacement: "ns.ui.openTail()",
},
moveTail: {
version: "3.0.0",
replacement: "ns.ui.moveTail()",
},
resizeTail: {
version: "3.0.0",
replacement: "ns.ui.resizeTail()",
},
closeTail: {
version: "3.0.0",
replacement: "ns.ui.closeTail()",
},
setTitle: {
version: "3.0.0",
replacement: "ns.ui.setTailTitle()",
},
});
export function NetscriptFunctions(ws: WorkerScript): NSFull {

View File

@@ -6739,118 +6739,6 @@ export interface NS {
*/
getRecentScripts(): RecentScript[];
/**
* Open the tail window of a script. This function is deprecated and will be removed in a later version.
*
* @deprecated
* Use {@link UserInterface.openTail | ns.ui.openTail} instead.
*
* @remarks
* RAM cost: 0 GB
*
* Opens a scripts logs. This is functionally the same as the tail Terminal command.
*
* If the function is called with no arguments, it will open the current scripts logs.
*
* Otherwise, the PID or filename, hostname/ip, and args… arguments can be used to get the logs from another script.
* Remember that scripts are uniquely identified by both their names and arguments.
*
* @example
* ```js
* //Open logs from foo.js on the current server that was run with no args
* ns.tail("foo.js");
*
* //Get logs from foo.js on the foodnstuff server that was run with no args
* ns.tail("foo.js", "foodnstuff");
*
* //Get logs from foo.js on the foodnstuff server that was run with the arguments [1, "test"]
* ns.tail("foo.js", "foodnstuff", 1, "test");
* ```
* @param fn - Optional. Filename or PID of the script being tailed. If omitted, the current script is tailed.
* @param host - Optional. Hostname of the script being tailed. Defaults to the server this script is running on. If args are specified, this is not optional.
* @param args - Arguments for the script being tailed.
*/
tail(fn?: FilenameOrPID, host?: string, ...args: ScriptArg[]): void;
/**
* Move a tail window. This function is deprecated and will be removed in a later version.
*
* @deprecated
* Use {@link UserInterface.moveTail | ns.ui.moveTail} instead.
*
* @remarks
* RAM cost: 0 GB
*
* Moves a tail window. Coordinates are in screen space pixels (top left is 0,0).
*
* @param x - x coordinate.
* @param y - y coordinate.
* @param pid - Optional. PID of the script having its tail moved. If omitted, the current script is used.
*/
moveTail(x: number, y: number, pid?: number): void;
/**
* Resize a tail window. This function is deprecated and will be removed in a later version.
*
* @deprecated
* Use {@link UserInterface.resizeTail | ns.ui.resizeTail} instead.
*
* @remarks
* RAM cost: 0 GB
*
* Resize a tail window. Size are in pixel.
*
* @param width - Width of the window.
* @param height - Height of the window.
* @param pid - Optional. PID of the script having its tail resized. If omitted, the current script is used.
*/
resizeTail(width: number, height: number, pid?: number): void;
/**
* Close the tail window of a script. This function is deprecated and will be removed in a later version.
*
* @deprecated
* Use {@link UserInterface.closeTail | ns.ui.closeTail} instead.
*
* @remarks
* RAM cost: 0 GB
*
* Closes a scripts logs. This is functionally the same as pressing the "Close" button on the tail window.
*
* If the function is called with no arguments, it will close the current scripts logs.
*
* Otherwise, the pid argument can be used to close the logs from another script.
*
* @param pid - Optional. PID of the script having its tail closed. If omitted, the current script is used.
*/
closeTail(pid?: number): void;
/**
* Set the title of the tail window of a script. This function is deprecated and will be removed in a later version.
*
* @deprecated
* Use {@link UserInterface.setTailTitle | ns.ui.setTailTitle} instead.
*
* @remarks
* RAM cost: 0 GB
*
* This sets the title to the given string, and also forces an update of the
* tail window's contents.
*
* The title is saved across restarts, but only if it is a simple string.
*
* If the pid is unspecified, it will modify the current scripts logs.
*
* Otherwise, the pid argument can be used to change the logs from another script.
*
* It is possible to pass any React Node instead of a string.
* See {@link ReactElement} and {@link ReactNode} types for additional info.
*
* @param title - The new title for the tail window.
* @param pid - Optional. PID of the script having its tail closed. If omitted, the current script is used.
*/
setTitle(title: string | ReactNode, pid?: number): void;
/**
* Get the list of hostnames or IP addresses connected to a server.
* @remarks

View File

@@ -73,4 +73,25 @@ export const breakInfos300: APIBreakInfo[] = [
"Additionally, the naming of ns.tFormat has been changed to ns.format.time.",
showPopUp: false,
},
{
brokenAPIs: [
{ name: "ns.tail", migration: { searchValue: "ns.tail", replaceValue: "ns.ui.openTail" } },
{ name: "ns.moveTail", migration: { searchValue: "ns.moveTail", replaceValue: "ns.ui.moveTail" } },
{ name: "ns.resizeTail", migration: { searchValue: "ns.resizeTail", replaceValue: "ns.ui.resizeTail" } },
{ name: "ns.closeTail", migration: { searchValue: "ns.closeTail", replaceValue: "ns.ui.closeTail" } },
{ name: "ns.setTitle", migration: { searchValue: "ns.setTitle", replaceValue: "ns.ui.setTailTitle" } },
],
info:
"ns.tail() was removed.\n" +
'It has been automatically replaced with "ns.ui.openTail()".\n\n' +
"ns.moveTail() was removed.\n" +
'It has been automatically replaced with "ns.ui.moveTail()".\n\n' +
"ns.resizeTail() was removed.\n" +
'It has been automatically replaced with "ns.ui.resizeTail()".\n\n' +
"ns.closeTail() was removed.\n" +
'It has been automatically replaced with "ns.ui.closeTail()".\n\n' +
"ns.setTitle() was removed.\n" +
'It has been automatically replaced with "ns.ui.setTailTitle()".\n\n',
showPopUp: false,
},
];