mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
NETSCRIPT: Add the 'cat' method to 'ns.singularity' (#1999)
This commit is contained in:
28
markdown/bitburner.singularity.cat.md
Normal file
28
markdown/bitburner.singularity.cat.md
Normal file
@@ -0,0 +1,28 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Singularity](./bitburner.singularity.md) > [cat](./bitburner.singularity.cat.md)
|
||||
|
||||
## Singularity.cat() method
|
||||
|
||||
Displays the content of a file on the currently connected server.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
cat(filename: string): void;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| filename | string | Name of the file to display, including its extension. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
void
|
||||
|
||||
## Remarks
|
||||
|
||||
RAM cost: 0.5 \* 16/4/1
|
||||
|
||||
@@ -22,6 +22,7 @@ This API requires Source-File 4 to use. The RAM cost of all these functions is m
|
||||
| --- | --- |
|
||||
| [applyToCompany(companyName, field)](./bitburner.singularity.applytocompany.md) | Apply for a job at a company. |
|
||||
| [b1tflum3(nextBN, callbackScript, bitNodeOptions)](./bitburner.singularity.b1tflum3.md) | b1t\_flum3 into a different BN. |
|
||||
| [cat(filename)](./bitburner.singularity.cat.md) | Displays the content of a file on the currently connected server. |
|
||||
| [checkFactionInvitations()](./bitburner.singularity.checkfactioninvitations.md) | List all current faction invitations. |
|
||||
| [commitCrime(crime, focus)](./bitburner.singularity.commitcrime.md) | Commit a crime. |
|
||||
| [connect(hostname)](./bitburner.singularity.connect.md) | Connect to a server. |
|
||||
|
||||
@@ -169,6 +169,7 @@ const singularity = {
|
||||
getCurrentServer: SF4Cost(RamCostConstants.SingularityFn1),
|
||||
getCompanyPositionInfo: SF4Cost(RamCostConstants.SingularityFn1),
|
||||
getCompanyPositions: SF4Cost(RamCostConstants.SingularityFn1),
|
||||
cat: SF4Cost(RamCostConstants.SingularityFn1 / 4),
|
||||
connect: SF4Cost(RamCostConstants.SingularityFn1),
|
||||
manualHack: SF4Cost(RamCostConstants.SingularityFn1),
|
||||
installBackdoor: SF4Cost(RamCostConstants.SingularityFn1),
|
||||
|
||||
@@ -52,6 +52,7 @@ import { calculateEffectiveRequiredReputation } from "../Company/utils";
|
||||
import { calculateFavorAfterResetting } from "../Faction/formulas/favor";
|
||||
import { validBitNodes } from "../BitNode/BitNodeUtils";
|
||||
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
|
||||
import { cat } from "../Terminal/commands/cat";
|
||||
|
||||
export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
const runAfterReset = function (cbScript: ScriptFilePath) {
|
||||
@@ -467,6 +468,12 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
return Player.getCurrentServer().hostname;
|
||||
},
|
||||
cat: (ctx) => (_filename) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
const filename = helpers.string(ctx, "filename", _filename);
|
||||
const server = Player.getCurrentServer();
|
||||
cat([filename], server);
|
||||
},
|
||||
connect: (ctx) => (_hostname) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
const hostname = helpers.string(ctx, "hostname", _hostname);
|
||||
|
||||
9
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
9
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@@ -2656,6 +2656,15 @@ export interface Singularity {
|
||||
*/
|
||||
getCurrentServer(): string;
|
||||
|
||||
/**
|
||||
* Displays the content of a file on the currently connected server.
|
||||
* @remarks
|
||||
* RAM cost: 0.5 * 16/4/1
|
||||
*
|
||||
* @param filename - Name of the file to display, including its extension.
|
||||
*/
|
||||
cat(filename: string): void;
|
||||
|
||||
/**
|
||||
* Connect to a server.
|
||||
* @remarks
|
||||
|
||||
Reference in New Issue
Block a user