mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 01:53:48 +01:00
Adding IPort interface and correcting return value of getPortHandle in NetscriptDefinitions file
This commit is contained in:
parent
f742782e4a
commit
51edac414e
32
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
32
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
interface Player {
|
interface Player {
|
||||||
hacking: number;
|
hacking: number;
|
||||||
hp: number;
|
hp: number;
|
||||||
max_hp: number;
|
max_hp: number;
|
||||||
@ -109,6 +109,32 @@ interface RunningScript {
|
|||||||
threads: number;
|
threads: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface of a netscript port
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export interface IPort {
|
||||||
|
/** write data to the port and removes and returns first element if full */
|
||||||
|
write: (value: any) => any;
|
||||||
|
/** add data to port if not full.
|
||||||
|
* @returns true if added and false if full and not added */
|
||||||
|
tryWrite: (value: any) => boolean;
|
||||||
|
/** reads and removes first element from port
|
||||||
|
* if no data in port returns "NULL PORT DATA"
|
||||||
|
*/
|
||||||
|
read: () => any;
|
||||||
|
/** reads first element without removing it from port
|
||||||
|
* if no data in port returns "NULL PORT DATA"
|
||||||
|
*/
|
||||||
|
peek: () => any;
|
||||||
|
/** check if port is full */
|
||||||
|
full: () => boolean;
|
||||||
|
/** check if port is empty */
|
||||||
|
empty: () => boolean;
|
||||||
|
/** removes all data from port */
|
||||||
|
clear: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data representing the internal values of a crime.
|
* Data representing the internal values of a crime.
|
||||||
* @public
|
* @public
|
||||||
@ -5404,12 +5430,12 @@ export interface NS extends Singularity {
|
|||||||
* Get a handle to a Netscript Port.
|
* Get a handle to a Netscript Port.
|
||||||
*
|
*
|
||||||
* WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0.
|
* WARNING: Port Handles only work in NetscriptJS (Netscript 2.0). They will not work in Netscript 1.0.
|
||||||
*
|
*
|
||||||
* @see https://bitburner.readthedocs.io/en/latest/netscript/netscriptmisc.html#netscript-ports
|
* @see https://bitburner.readthedocs.io/en/latest/netscript/netscriptmisc.html#netscript-ports
|
||||||
* @param port - Port number. Must be an integer between 1 and 20.
|
* @param port - Port number. Must be an integer between 1 and 20.
|
||||||
* @returns Data in the specified port.
|
* @returns Data in the specified port.
|
||||||
*/
|
*/
|
||||||
getPortHandle(port: number): any[];
|
getPortHandle(port: number): IPort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a file.
|
* Delete a file.
|
||||||
|
Loading…
Reference in New Issue
Block a user