mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-09 09:13:52 +01:00
SETTINGS: add tailRenderInterval (#1107)
currently tails are on a static rerender time of 1000ms there are ways to force a rerender with ns.moveTail / ns.resizeTail but i dont know why this shouldnt be a setting set by the player currently its static set on creation of the tail window but that could be expanded to allow setting it per script and maybe through a ns function
This commit is contained in:
parent
e6755afcb3
commit
47cf5c1610
@ -159,7 +159,6 @@
|
|||||||
| [GoOpponent](./bitburner.goopponent.md) | |
|
| [GoOpponent](./bitburner.goopponent.md) | |
|
||||||
| [NSEnums](./bitburner.nsenums.md) | |
|
| [NSEnums](./bitburner.nsenums.md) | |
|
||||||
| [PlayerRequirement](./bitburner.playerrequirement.md) | Structured interface to requirements for joining a faction or company. For fields with numerical value > 0, the player must have at least this value. For fields with numerical value <<!-- -->= 0, the player must have at most this value. For "not", the sub-condition must be failed instead of passed. For "someCondition", at least one sub-condition must be passed. |
|
| [PlayerRequirement](./bitburner.playerrequirement.md) | Structured interface to requirements for joining a faction or company. For fields with numerical value > 0, the player must have at least this value. For fields with numerical value <<!-- -->= 0, the player must have at most this value. For "not", the sub-condition must be failed instead of passed. For "someCondition", at least one sub-condition must be passed. |
|
||||||
| [PortData](./bitburner.portdata.md) | |
|
|
||||||
| [ReactNode](./bitburner.reactnode.md) | <p>A stand-in for the real React.ReactNode. A [ReactElement](./bitburner.reactelement.md) is rendered dynamically with React. number and string are displayed directly. boolean, null, and undefined are ignored and not rendered. An array of ReactNodes will display all members of that array sequentially.</p><p>Use React.createElement to make the ReactElement type, see [creating an element without jsx](https://react.dev/reference/react/createElement#creating-an-element-without-jsx) from the official React documentation.</p> |
|
| [ReactNode](./bitburner.reactnode.md) | <p>A stand-in for the real React.ReactNode. A [ReactElement](./bitburner.reactelement.md) is rendered dynamically with React. number and string are displayed directly. boolean, null, and undefined are ignored and not rendered. An array of ReactNodes will display all members of that array sequentially.</p><p>Use React.createElement to make the ReactElement type, see [creating an element without jsx](https://react.dev/reference/react/createElement#creating-an-element-without-jsx) from the official React documentation.</p> |
|
||||||
| [ScriptArg](./bitburner.scriptarg.md) | |
|
| [ScriptArg](./bitburner.scriptarg.md) | |
|
||||||
| [SleeveBladeburnerTask](./bitburner.sleevebladeburnertask.md) | |
|
| [SleeveBladeburnerTask](./bitburner.sleevebladeburnertask.md) | |
|
||||||
|
@ -19,7 +19,7 @@ export interface NetscriptPort
|
|||||||
| [clear()](./bitburner.netscriptport.clear.md) | Empties all data from the port. |
|
| [clear()](./bitburner.netscriptport.clear.md) | Empties all data from the port. |
|
||||||
| [empty()](./bitburner.netscriptport.empty.md) | Check if the port is empty. |
|
| [empty()](./bitburner.netscriptport.empty.md) | Check if the port is empty. |
|
||||||
| [full()](./bitburner.netscriptport.full.md) | Check if the port is full. |
|
| [full()](./bitburner.netscriptport.full.md) | Check if the port is full. |
|
||||||
| [nextWrite()](./bitburner.netscriptport.nextwrite.md) | Sleeps until the port is written to. |
|
| [nextWrite()](./bitburner.netscriptport.nextwrite.md) | Waits until the port is written to. |
|
||||||
| [peek()](./bitburner.netscriptport.peek.md) | Retrieve the first element from the port without removing it. |
|
| [peek()](./bitburner.netscriptport.peek.md) | Retrieve the first element from the port without removing it. |
|
||||||
| [read()](./bitburner.netscriptport.read.md) | Shift an element out of the port. |
|
| [read()](./bitburner.netscriptport.read.md) | Shift an element out of the port. |
|
||||||
| [tryWrite(value)](./bitburner.netscriptport.trywrite.md) | Attempt to write data to the port. |
|
| [tryWrite(value)](./bitburner.netscriptport.trywrite.md) | Attempt to write data to the port. |
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## NetscriptPort.nextWrite() method
|
## NetscriptPort.nextWrite() method
|
||||||
|
|
||||||
Sleeps until the port is written to.
|
Waits until the port is written to.
|
||||||
|
|
||||||
**Signature:**
|
**Signature:**
|
||||||
|
|
||||||
|
@ -9,11 +9,11 @@ Retrieve the first element from the port without removing it.
|
|||||||
**Signature:**
|
**Signature:**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
peek(): PortData;
|
peek(): any;
|
||||||
```
|
```
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
[PortData](./bitburner.portdata.md)
|
any
|
||||||
|
|
||||||
the data read
|
the data read
|
||||||
|
|
||||||
|
@ -9,11 +9,11 @@ Shift an element out of the port.
|
|||||||
**Signature:**
|
**Signature:**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
read(): PortData;
|
read(): any;
|
||||||
```
|
```
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
[PortData](./bitburner.portdata.md)
|
any
|
||||||
|
|
||||||
the data read.
|
the data read.
|
||||||
|
|
||||||
|
@ -9,14 +9,14 @@ Attempt to write data to the port.
|
|||||||
**Signature:**
|
**Signature:**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
tryWrite(value: string | number): boolean;
|
tryWrite(value: any): boolean;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| value | string \| number | |
|
| value | any | Data to write, it's cloned with structuredClone(). |
|
||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
|
@ -9,18 +9,18 @@ Write data to a port.
|
|||||||
**Signature:**
|
**Signature:**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
write(value: string | number): PortData | null;
|
write(value: any): any;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| value | string \| number | |
|
| value | any | Data to write, it's cloned with structuredClone(). |
|
||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
[PortData](./bitburner.portdata.md) \| null
|
any
|
||||||
|
|
||||||
The data popped off the queue if it was full.
|
The data popped off the queue if it was full.
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Get a copy of the data from a port without popping it.
|
|||||||
**Signature:**
|
**Signature:**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
peek(portNumber: number): PortData;
|
peek(portNumber: number): any;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -20,7 +20,7 @@ peek(portNumber: number): PortData;
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
[PortData](./bitburner.portdata.md)
|
any
|
||||||
|
|
||||||
Data in the specified port.
|
Data in the specified port.
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Read data from a port.
|
|||||||
**Signature:**
|
**Signature:**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
readPort(portNumber: number): PortData;
|
readPort(portNumber: number): any;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -20,7 +20,7 @@ readPort(portNumber: number): PortData;
|
|||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
[PortData](./bitburner.portdata.md)
|
any
|
||||||
|
|
||||||
The data read.
|
The data read.
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Attempt to write to a port.
|
|||||||
**Signature:**
|
**Signature:**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
tryWritePort(portNumber: number, data: string | number): boolean;
|
tryWritePort(portNumber: number, data: any): boolean;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -17,7 +17,7 @@ tryWritePort(portNumber: number, data: string | number): boolean;
|
|||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| portNumber | number | Port to attempt to write to. Must be a positive integer. |
|
| portNumber | number | Port to attempt to write to. Must be a positive integer. |
|
||||||
| data | string \| number | Data to write. |
|
| data | any | Data to write, it's cloned with structuredClone(). |
|
||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Write data to a port.
|
|||||||
**Signature:**
|
**Signature:**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
writePort(portNumber: number, data: string | number): PortData | null;
|
writePort(portNumber: number, data: any): any;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -17,11 +17,11 @@ writePort(portNumber: number, data: string | number): PortData | null;
|
|||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| portNumber | number | Port to write to. Must be a positive integer. |
|
| portNumber | number | Port to write to. Must be a positive integer. |
|
||||||
| data | string \| number | Data to write. |
|
| data | any | Data to write, it's cloned with structuredClone(). |
|
||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
[PortData](./bitburner.portdata.md) \| null
|
any
|
||||||
|
|
||||||
The data popped off the queue if it was full, or null if it was not full.
|
The data popped off the queue if it was full, or null if it was not full.
|
||||||
|
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [bitburner](./bitburner.md) > [PortData](./bitburner.portdata.md)
|
|
||||||
|
|
||||||
## PortData type
|
|
||||||
|
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
type PortData = string | number;
|
|
||||||
```
|
|
@ -12,6 +12,7 @@ export const SystemPage = (): React.ReactElement => {
|
|||||||
const [portSize, setPortSize] = useState(Settings.MaxPortCapacity);
|
const [portSize, setPortSize] = useState(Settings.MaxPortCapacity);
|
||||||
const [terminalSize, setTerminalSize] = useState(Settings.MaxTerminalCapacity);
|
const [terminalSize, setTerminalSize] = useState(Settings.MaxTerminalCapacity);
|
||||||
const [autosaveInterval, setAutosaveInterval] = useState(Settings.AutosaveInterval);
|
const [autosaveInterval, setAutosaveInterval] = useState(Settings.AutosaveInterval);
|
||||||
|
const [tailrenderInterval, setTailRenderInterval] = useState(Settings.TailRenderInterval);
|
||||||
|
|
||||||
function handlePortSizeChange(_event: Event | React.SyntheticEvent, newValue: number | number[]): void {
|
function handlePortSizeChange(_event: Event | React.SyntheticEvent, newValue: number | number[]): void {
|
||||||
setPortSize(newValue as number);
|
setPortSize(newValue as number);
|
||||||
@ -28,6 +29,11 @@ export const SystemPage = (): React.ReactElement => {
|
|||||||
Settings.CodeInstructionRunTime = newValue as number;
|
Settings.CodeInstructionRunTime = newValue as number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleTailIntervalChange(_event: Event | React.SyntheticEvent, newValue: number | number[]): void {
|
||||||
|
setTailRenderInterval(newValue as number);
|
||||||
|
Settings.TailRenderInterval = newValue as number;
|
||||||
|
}
|
||||||
|
|
||||||
function handleRecentScriptsSizeChange(_event: Event | React.SyntheticEvent, newValue: number | number[]): void {
|
function handleRecentScriptsSizeChange(_event: Event | React.SyntheticEvent, newValue: number | number[]): void {
|
||||||
setRecentScriptsSize(newValue as number);
|
setRecentScriptsSize(newValue as number);
|
||||||
Settings.MaxRecentScriptsCapacity = newValue as number;
|
Settings.MaxRecentScriptsCapacity = newValue as number;
|
||||||
@ -132,6 +138,20 @@ export const SystemPage = (): React.ReactElement => {
|
|||||||
tooltip={<>The time (in seconds) between each autosave. Set to 0 to disable autosave.</>}
|
tooltip={<>The time (in seconds) between each autosave. Set to 0 to disable autosave.</>}
|
||||||
marks
|
marks
|
||||||
/>
|
/>
|
||||||
|
<OptionsSlider
|
||||||
|
label="Tail render interval (ms)"
|
||||||
|
initialValue={tailrenderInterval}
|
||||||
|
callback={handleTailIntervalChange}
|
||||||
|
step={200}
|
||||||
|
min={50}
|
||||||
|
max={5 * 1000}
|
||||||
|
tooltip={
|
||||||
|
<>
|
||||||
|
The minimum number of milliseconds between tail rerenders. Setting this too low can result in poor
|
||||||
|
performance if you have many tail windows open.
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
<OptionSwitch
|
<OptionSwitch
|
||||||
|
@ -72,6 +72,8 @@ export const Settings = {
|
|||||||
ExcludeRunningScriptsFromSave: false,
|
ExcludeRunningScriptsFromSave: false,
|
||||||
/** Whether the game's sidebar is opened. */
|
/** Whether the game's sidebar is opened. */
|
||||||
IsSidebarOpened: true,
|
IsSidebarOpened: true,
|
||||||
|
/** Tail rendering intervall in ms */
|
||||||
|
TailRenderInterval: 1000,
|
||||||
/** Theme colors. */
|
/** Theme colors. */
|
||||||
theme: { ...defaultTheme },
|
theme: { ...defaultTheme },
|
||||||
/** Interface styles. */
|
/** Interface styles. */
|
||||||
|
@ -171,7 +171,7 @@ function LogWindow({ hidden, script, onClose }: LogWindowProps): React.ReactElem
|
|||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const container = useRef<HTMLDivElement>(null);
|
const container = useRef<HTMLDivElement>(null);
|
||||||
const textArea = useRef<HTMLDivElement>(null);
|
const textArea = useRef<HTMLDivElement>(null);
|
||||||
const rerender = useRerender(1000);
|
const rerender = useRerender(Settings.TailRenderInterval);
|
||||||
const propsRef = useRef(new LogBoxProperties(rerender, rootRef));
|
const propsRef = useRef(new LogBoxProperties(rerender, rootRef));
|
||||||
script.tailProps = propsRef.current;
|
script.tailProps = propsRef.current;
|
||||||
const [minimized, setMinimized] = useState(false);
|
const [minimized, setMinimized] = useState(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user