dredless 1.3.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/dredless.global.js +651 -467
- package/dist/browser/dredless.global.js.map +4 -4
- package/docs/CLIENT.md +1 -1
- package/docs/MACHINES.md +97 -14
- package/docs/MANAGEMENT.md +1 -1
- package/docs/PROTOCOL.md +27 -0
- package/docs/WORLD_STATE.md +11 -0
- package/package.json +1 -1
- package/src/browser.d.ts +20 -0
- package/src/browser.js +12 -0
- package/src/client/core.js +71 -6
- package/src/client/domains/index.js +69 -13
- package/src/client/domains/tips.js +0 -15
- package/src/index.d.ts +90 -13
- package/src/index.js +12 -0
- package/src/protocol/outbound/machine-config.d.ts +19 -0
- package/src/protocol/outbound/machine-config.js +112 -0
- package/src/protocol/outbound/ui-config.d.ts +25 -0
- package/src/protocol/outbound/ui-config.js +6 -0
- package/src/state/model/decoder.js +39 -18
- package/src/state/model/reader.js +7 -3
- package/src/state/model/state.js +9 -11
package/docs/CLIENT.md
CHANGED
|
@@ -59,7 +59,7 @@ management/menu methods have their own readiness checks, timeout, and overlap ru
|
|
|
59
59
|
|-----------------------------|----------------------------------------|
|
|
60
60
|
| `loader.configure(config)` | Configuration sent/queued |
|
|
61
61
|
| `tips.choose(entity, text)` | Menu received and selection sent |
|
|
62
|
-
| `door.
|
|
62
|
+
| `door.configure(config)` | Configuration sent/queued |
|
|
63
63
|
| `management.rename(name)` | Rename allowed and commit sent |
|
|
64
64
|
| `management.resetInvite()` | A changed nonempty invite key observed |
|
|
65
65
|
| `management.save()` | Server closed with `DropReason.Saved` |
|
package/docs/MACHINES.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
- [Find a machine](#find-a-machine)
|
|
8
8
|
- [Targeting and completion](#targeting-and-completion)
|
|
9
9
|
- [Context menus and access](#context-menus-and-access)
|
|
10
|
+
- [Doors and spawn points](#doors-and-spawn-points)
|
|
10
11
|
- [Loaders](#loaders)
|
|
11
12
|
- [Pushers](#pushers)
|
|
12
13
|
- [Launchers](#launchers)
|
|
@@ -51,13 +52,12 @@ The server enforces range, permissions, and game state. Helpers neither move the
|
|
|
51
52
|
|
|
52
53
|
| Action family | Target | Completion |
|
|
53
54
|
|-------------------------------------------------------------|-----------------------------------|-------------------------------------------------------|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
55
|
+
| Machine configuration, generator puzzle | Entity embedded in config payload | Sent/queued |
|
|
56
|
+
| Fabricator controls, sign text, comms | Active server interaction | Sent/queued; the handle's ID is not in these messages |
|
|
56
57
|
| `open()` | Entity focus in player input | Sent/queued, not panel-ready |
|
|
57
58
|
| Tip menu operations | Requested current-world entity | See menu contracts below |
|
|
58
|
-
| Door/spawn `setRank()` | Menu target | Requested rank observed in model |
|
|
59
59
|
|
|
60
|
-
For active-interaction actions, first open/use the intended machine and wait for the relevant panel or interaction state. The library does not offer a general `waitForPanel()` helper.
|
|
60
|
+
For active-interaction actions, first open/use the intended machine and wait for the relevant panel or interaction state. The library does not offer a general `waitForPanel()` helper. Launcher settings and door/spawn filters use entity-targeted configuration messages and do not require opening a panel.
|
|
61
61
|
|
|
62
62
|
## Context menus and access
|
|
63
63
|
|
|
@@ -69,8 +69,6 @@ client.tips.choose(entity: number | EntityHandle, option: number | string,
|
|
|
69
69
|
options?: TipOptions): Promise<DredlessClient>;
|
|
70
70
|
client.tips.close(options?: TipOptions): Promise<DredlessClient>;
|
|
71
71
|
entity.openTips(options?: TipOptions): Promise<TipList>;
|
|
72
|
-
door.setRank(rank: ShipPlayerRank, options?: TipOptions): Promise<DredlessClient>;
|
|
73
|
-
spawnPoint.setRank(rank: ShipPlayerRank, options?: TipOptions): Promise<DredlessClient>;
|
|
74
72
|
|
|
75
73
|
interface TipOptions { timeout?: number; command?: Command; }
|
|
76
74
|
interface TipList {
|
|
@@ -97,11 +95,74 @@ await client.tips.close();
|
|
|
97
95
|
- `select()` accepts an exact displayed string or zero-based index. It sends the selection and clears the local menu without waiting for its effect.
|
|
98
96
|
- `choose()` opens a fresh menu and sends a selection. Its promise does not confirm the selected action finished.
|
|
99
97
|
- `close()` uses the normal dismissal click and waits for an empty tip list. With no menu, it resolves without sending.
|
|
100
|
-
- Door/spawn `setRank()` accepts `"guest"`, `"crew"`, `"captain"`, or `0`, `1`, `3`. It opens the appropriate menu, selects the restriction, and waits for model confirmation. It sends nothing if the rank already matches. This controls entity access, not a player's crew rank.
|
|
101
98
|
|
|
102
|
-
Timeout defaults to **5000 ms per response
|
|
99
|
+
Timeout defaults to **5000 ms per response**. Only one asynchronous tip operation can run per client; overlaps reject.
|
|
100
|
+
Disconnect, timeout, invalid menu choices, and invalid targets reject. Raw context-menu commands or another actor using
|
|
101
|
+
the same socket can interfere with these operations.
|
|
103
102
|
|
|
104
|
-
|
|
103
|
+
## Doors and spawn points
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
door.configure(config?: DoorConfig): DredlessClient;
|
|
107
|
+
door.copy(config?: DoorClipboardConfig): DredlessClient;
|
|
108
|
+
door.paste(config?: DoorClipboardConfig): DredlessClient;
|
|
109
|
+
door.setAllowedRanks(allowedRanks: AllowedRanks): DredlessClient;
|
|
110
|
+
door.setRankMask(rankMask: number): DredlessClient;
|
|
111
|
+
spawnPoint.configure(config?: SpawnPointConfig): DredlessClient;
|
|
112
|
+
spawnPoint.copy(config?: SpawnPointConfig): DredlessClient;
|
|
113
|
+
spawnPoint.paste(config?: SpawnPointConfig): DredlessClient;
|
|
114
|
+
spawnPoint.setAllowedRanks(allowedRanks: AllowedRanks): DredlessClient;
|
|
115
|
+
spawnPoint.setRankMask(rankMask: number): DredlessClient;
|
|
116
|
+
|
|
117
|
+
type AllowedRanks = readonly ("guest" | "crew" | "captain")[] | "all";
|
|
118
|
+
interface RankFilterConfig { allowedRanks?: AllowedRanks; rankMask?: number; }
|
|
119
|
+
interface DoorConfig extends RankFilterConfig {}
|
|
120
|
+
interface SpawnPointConfig extends RankFilterConfig {}
|
|
121
|
+
interface DoorClipboardConfig extends DoorConfig { orientation?: "vertical" | "horizontal"; }
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Supply either `allowedRanks` or `rankMask`. Sets are exact: `["crew"]` permits crew only, while `["crew", "captain"]`
|
|
125
|
+
permits both. `[]` disables all ranks; `"all"` includes current and future ranks. Numeric masks must be `0–7` or
|
|
126
|
+
`0xffffffff`. Omitting both uses the observed filter, or captain-only (`4`) if unavailable.
|
|
127
|
+
|
|
128
|
+
These methods send the new configuration protocol introduced in the November 6 test build. They replace `setRank()`
|
|
129
|
+
and its right-click menu flow. They target the handle's entity ID and return after sending or queueing, without
|
|
130
|
+
server confirmation. The server still checks range and permissions; spawn configuration requires captain access.
|
|
131
|
+
Older servers can still be read, but these writes require the new configuration protocol.
|
|
132
|
+
|
|
133
|
+
`copy()` updates the placement clipboard for the relevant machine type. `paste()` sends an explicit configuration
|
|
134
|
+
to the target entity, using supplied values merged with that entity's observed state; it does not fetch a clipboard.
|
|
135
|
+
For doors, both include placement orientation, defaulting to the observed transform or vertical if unavailable.
|
|
136
|
+
The orientation field is enabled only for placement/clipboard use in the official UI. `configure()` rejects it;
|
|
137
|
+
use it with `copy()` to choose the orientation for future placement, rather than to rotate an existing door.
|
|
138
|
+
|
|
139
|
+
**Fragment:**
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
door.configure({allowedRanks: ["guest", "captain"]});
|
|
143
|
+
spawnPoint.setAllowedRanks(["crew", "captain"]);
|
|
144
|
+
door.copy({orientation: "horizontal", allowedRanks: "all"});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Door and spawn reads use rank filters for both server formats:
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
door.rankMask: number | null | undefined;
|
|
151
|
+
door.allowedRanks: ("guest" | "crew" | "captain")[] | null | undefined;
|
|
152
|
+
spawnPoint.rankMask: number | null | undefined;
|
|
153
|
+
spawnPoint.allowedRanks: ("guest" | "crew" | "captain")[] | null | undefined;
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Their summaries replace `rank`/`rankName` with `rankMask`, `allowedRanks`, `allRanks`, and raw `rankState`.
|
|
157
|
+
Bits are guest `1`, crew `2`, and captain `4`. An empty array means no known ranks are allowed; `null` means the
|
|
158
|
+
filter has not been observed. Unknown bits remain in the unsigned `rankMask`; `allRanks` identifies `0xffffffff`,
|
|
159
|
+
which includes future ranks. Legacy restrictions normalize as follows:
|
|
160
|
+
|
|
161
|
+
| Legacy restriction | `rankMask` | `allowedRanks` |
|
|
162
|
+
| --- | --- | --- |
|
|
163
|
+
| Guest | `7` | `["guest", "crew", "captain"]` |
|
|
164
|
+
| Crew | `6` | `["crew", "captain"]` |
|
|
165
|
+
| Captain | `4` | `["captain"]` |
|
|
105
166
|
|
|
106
167
|
## Loaders
|
|
107
168
|
|
|
@@ -205,15 +266,37 @@ pusher.configure({mode: "push", filteredMode: "pull", angle: 90, speed: 20, leng
|
|
|
205
266
|
## Launchers
|
|
206
267
|
|
|
207
268
|
```ts
|
|
208
|
-
launcher.
|
|
209
|
-
launcher.
|
|
269
|
+
launcher.configure(config?: LauncherConfig): DredlessClient;
|
|
270
|
+
launcher.copy(config?: LauncherConfig): DredlessClient;
|
|
271
|
+
launcher.paste(config?: LauncherConfig): DredlessClient;
|
|
272
|
+
launcher.setAngle(degrees: number, config?: LauncherConfig): DredlessClient;
|
|
273
|
+
launcher.setPower(power: number, config?: LauncherConfig): DredlessClient;
|
|
274
|
+
interface LauncherConfig { angle?: number; power?: number; }
|
|
210
275
|
```
|
|
211
276
|
|
|
212
|
-
|
|
277
|
+
These methods use the entity-targeted configuration protocol introduced in the November 6 test build. No active
|
|
278
|
+
launcher interaction is required. Angle is in degrees in `0–360`; power is `0–30`. Both accept fractional values.
|
|
279
|
+
Omitted fields use observed state, then defaults of angle `0` and power `30`. `setAngle()` preserves observed power,
|
|
280
|
+
and `setPower()` preserves observed angle. Calls return after sending or queueing, without server confirmation.
|
|
213
281
|
|
|
214
|
-
|
|
282
|
+
`copy()` updates the launcher placement clipboard. `paste()` sends an explicit merged configuration to the target,
|
|
283
|
+
rather than reading the clipboard. For direct client calls, the entity ID is now required:
|
|
284
|
+
`client.setLauncherAngle(entity, angle, config?)` and `client.setLauncherPower(entity, power, config?)`.
|
|
285
|
+
|
|
286
|
+
**Fragment:**
|
|
287
|
+
|
|
288
|
+
```js
|
|
289
|
+
launcher.configure({angle: 45, power: 17.5});
|
|
290
|
+
launcher.setPower(20);
|
|
291
|
+
launcher.copy({angle: 90});
|
|
292
|
+
```
|
|
215
293
|
|
|
216
|
-
Read `.state.angleDegrees`, `.state.angleRadians`, or `.state.angleRaw`. The angle is the launcher's decoded angle;
|
|
294
|
+
Read `.state.angleDegrees`, `.state.angleRadians`, or `.state.angleRaw`. The angle is the launcher's decoded angle;
|
|
295
|
+
the API does not add an inferred mounting rotation. New launcher configuration takes precedence over the legacy
|
|
296
|
+
angle component. `.state.power` is the replicated power on the November 6 test format, or `null` on legacy servers.
|
|
297
|
+
`.state.configState` contains the new raw configuration record or `null`; `.state.state` retains the legacy record.
|
|
298
|
+
`angleRaw` is in tenths of a degree when `configState` is present, or the legacy `1/200` radian units otherwise.
|
|
299
|
+
Prefer the converted angle fields for code that supports both formats. New-format defaults are angle `0` and power `30`.
|
|
217
300
|
|
|
218
301
|
## Navigation units
|
|
219
302
|
|
package/docs/MANAGEMENT.md
CHANGED
|
@@ -160,7 +160,7 @@ if (!player || player.refId === null) throw new Error("No matching management en
|
|
|
160
160
|
client.management.unbanPlayer(player.refId);
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
Player-rank changes are different from [door/spawn access restrictions](MACHINES.md#
|
|
163
|
+
Player-rank changes are different from [door/spawn access restrictions](MACHINES.md#doors-and-spawn-points).
|
|
164
164
|
|
|
165
165
|
## Demote yourself
|
|
166
166
|
|
package/docs/PROTOCOL.md
CHANGED
|
@@ -173,6 +173,28 @@ client.net.sendUiConfig(payload);
|
|
|
173
173
|
|
|
174
174
|
Named-enum validation and the numeric/default mismatch also affect low-level optional-config calls. Supply all required enum fields explicitly as described in [loaders](MACHINES.md#loaders), [pushers](MACHINES.md#pushers), and [hatches](MACHINES.md#hatches-ejectors-and-clipboard-settings).
|
|
175
175
|
|
|
176
|
+
The new launcher/door/spawn builders are also exported from runtime entrypoints:
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
normalizeRankMask(config?: RankFilterConfig): number;
|
|
180
|
+
buildLauncherConfigData(entity: number, config?: LauncherConfig): Uint8Array;
|
|
181
|
+
buildLauncherCopyConfigData(config?: LauncherConfig): Uint8Array;
|
|
182
|
+
buildLauncherPasteConfigData(entity: number, config?: LauncherConfig): Uint8Array;
|
|
183
|
+
buildDoorConfigData(entity: number, config?: DoorConfig): Uint8Array;
|
|
184
|
+
buildDoorCopyConfigData(config?: DoorClipboardConfig): Uint8Array;
|
|
185
|
+
buildDoorPasteConfigData(entity: number, config?: DoorClipboardConfig): Uint8Array;
|
|
186
|
+
buildSpawnPointConfigData(entity: number, config?: SpawnPointConfig): Uint8Array;
|
|
187
|
+
buildSpawnPointCopyConfigData(config?: SpawnPointConfig): Uint8Array;
|
|
188
|
+
buildSpawnPointPasteConfigData(entity: number, config?: SpawnPointConfig): Uint8Array;
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
These builders use defaults of angle `0`, power `30`, rank mask `4`, and vertical door orientation. They encode
|
|
192
|
+
unsigned 32-bit entity IDs, including IDs above `255` for paste. Copy targets use configuration class IDs: launcher
|
|
193
|
+
`8`, spawn `9`, door `10`. Target aliases `"launcher"`, `"spawn"`/`"spawn-point"`/`"spawnPoint"`, and `"door"` are
|
|
194
|
+
also accepted by generic clipboard builders. Launcher values use `config_item_launcher`; ranks use `filter_ranks`;
|
|
195
|
+
door clipboard orientation uses `angle_symmetric`. See [doors/spawns](MACHINES.md#doors-and-spawn-points) and
|
|
196
|
+
[launchers](MACHINES.md#launchers) for field ranges, merge behavior, and server-version requirements.
|
|
197
|
+
|
|
176
198
|
## Generator maze helpers
|
|
177
199
|
|
|
178
200
|
```ts
|
|
@@ -254,6 +276,11 @@ Binary tools include `decryptPayload(wireBytes, worldId, seed)`, `decompressLz4F
|
|
|
254
276
|
|
|
255
277
|
## Decoding limitations
|
|
256
278
|
|
|
279
|
+
The November 6 test model additions are supported alongside legacy production data: wire `170` is launcher
|
|
280
|
+
configuration, `171` is the rank filter, and `172` is the spawn marker. Dredless stores them under stable internal
|
|
281
|
+
table IDs `79`, `80`, and `81`; these IDs do not mirror the updated official client's native memory-table ordering.
|
|
282
|
+
Legacy spawn/rank section `44` remains supported. Public door/spawn reads normalize both formats to rank filters.
|
|
283
|
+
|
|
257
284
|
A decoder can retain partial results while recording unsupported tags or malformed sections. Read `decode-error`, model errors, and the retained raw packet before concluding an entity/component is absent. Website parsers and protocol internals can change independently of this package.
|
|
258
285
|
|
|
259
286
|
Raw `ModelRecord` keys (`q20`, blobs, table IDs, and section tags) are implementation details. Prefer normalized public summaries for application code. Protocol research belongs in a local capture workflow; avoid encoding application behavior around guessed raw-field semantics when a typed field exists.
|
package/docs/WORLD_STATE.md
CHANGED
|
@@ -137,6 +137,17 @@ An egg has public type `"egg"` and a `ball` component with `isEgg: true`; the ba
|
|
|
137
137
|
| `rcd` | Sandbox/flux variant and variant code, corresponding item ID, stored item identity/count, beam vector, raw `state`. |
|
|
138
138
|
| `ball` | Nullable `health`, radius in world units, `rubber`, `isEgg`, raw `state`. |
|
|
139
139
|
| `recycler` | Stored item identity/count. Identified from the recycler marker in a ship interior. |
|
|
140
|
+
| `itemCrate` | Item identity/count, `boxSprite`, raw size values `width`/`height`, and raw `itemState`/`sizeState`. |
|
|
141
|
+
|
|
142
|
+
Read crates through `entity.feature("itemCrate")` or an entity summary's `contents.itemCrate` from the debug/model API.
|
|
143
|
+
`boxSprite` means the official renderer uses its box sprite instead of the item's normal sprite; it does not indicate
|
|
144
|
+
ownership or a source ship. Elimination loot boxes retain their item IDs and names from the item schema. Crate
|
|
145
|
+
`width`/`height` retain their existing raw wire units.
|
|
146
|
+
|
|
147
|
+
The `health` component includes `barWidth` (full width) and `barOffsetY` in world units. `barWidth` is the wire
|
|
148
|
+
half-width divided by `5`, defaulting to `2`; `barOffsetY` is the wire offset divided by `10`, defaulting to `1`.
|
|
149
|
+
`barOffsetY` is the vertical displacement from the entity position. These are display values, not collision dimensions.
|
|
150
|
+
HP and maximum HP remain `hp` and `maxHp`.
|
|
140
151
|
|
|
141
152
|
Projectile `botStyle` selects the official bot-bullet sprite; it does not prove ownership or identify the shooter.
|
|
142
153
|
`indicatorCount` is the number of orbiting visual markers. `spriteItemId` is the item image used by the official
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dredless",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "A fully-featured and from-scratch headless drednot.io client implementation written in pure js.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/certainhuman/dredless#readme",
|
package/src/browser.d.ts
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
export {
|
|
2
|
+
buildLauncherConfigData,
|
|
3
|
+
buildLauncherCopyConfigData,
|
|
4
|
+
buildLauncherPasteConfigData,
|
|
5
|
+
buildDoorConfigData,
|
|
6
|
+
buildDoorCopyConfigData,
|
|
7
|
+
buildDoorPasteConfigData,
|
|
8
|
+
buildSpawnPointConfigData,
|
|
9
|
+
buildSpawnPointCopyConfigData,
|
|
10
|
+
buildSpawnPointPasteConfigData,
|
|
11
|
+
normalizeRankMask,
|
|
12
|
+
type AllowedRank,
|
|
13
|
+
type AllowedRanks,
|
|
14
|
+
type RankFilterConfig,
|
|
15
|
+
type LauncherConfig,
|
|
16
|
+
type DoorConfig,
|
|
17
|
+
type DoorClipboardConfig,
|
|
18
|
+
type SpawnPointConfig,
|
|
19
|
+
} from "./index.js";
|
|
20
|
+
|
|
1
21
|
export {
|
|
2
22
|
buildPvpPartyMessage,
|
|
3
23
|
buildCreatePvpPartyMessage,
|
package/src/browser.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
export {
|
|
2
|
+
buildLauncherConfigData,
|
|
3
|
+
buildLauncherCopyConfigData,
|
|
4
|
+
buildLauncherPasteConfigData,
|
|
5
|
+
buildDoorConfigData,
|
|
6
|
+
buildDoorCopyConfigData,
|
|
7
|
+
buildDoorPasteConfigData,
|
|
8
|
+
buildSpawnPointConfigData,
|
|
9
|
+
buildSpawnPointCopyConfigData,
|
|
10
|
+
buildSpawnPointPasteConfigData,
|
|
11
|
+
normalizeRankMask,
|
|
12
|
+
} from "./protocol/outbound/machine-config.js";
|
|
1
13
|
export {Connection} from "./network/connection.js";
|
|
2
14
|
export {DropReason, DisconnectError, normalizeDisconnect} from "./network/disconnect.js";
|
|
3
15
|
export {DredlessClient, WrenchMode, TurretMode} from "./client/index.js";
|
package/src/client/core.js
CHANGED
|
@@ -36,6 +36,15 @@ import {
|
|
|
36
36
|
} from "../protocol/outbound/ship-management.js";
|
|
37
37
|
import {buildSignTextMessage} from "../protocol/outbound/sign.js";
|
|
38
38
|
import {
|
|
39
|
+
buildLauncherConfigData,
|
|
40
|
+
buildLauncherCopyConfigData,
|
|
41
|
+
buildLauncherPasteConfigData,
|
|
42
|
+
buildDoorConfigData,
|
|
43
|
+
buildDoorCopyConfigData,
|
|
44
|
+
buildDoorPasteConfigData,
|
|
45
|
+
buildSpawnPointConfigData,
|
|
46
|
+
buildSpawnPointCopyConfigData,
|
|
47
|
+
buildSpawnPointPasteConfigData,
|
|
39
48
|
buildCargoEjectorClipboardDirectionData,
|
|
40
49
|
buildCargoEjectorCopyConfigData,
|
|
41
50
|
buildCargoEjectorDirectionData,
|
|
@@ -84,8 +93,6 @@ import {
|
|
|
84
93
|
summariesFor,
|
|
85
94
|
entitySnapshotFor,
|
|
86
95
|
emptyMachineSummary,
|
|
87
|
-
normalizeDegrees,
|
|
88
|
-
normalizeLauncherPower,
|
|
89
96
|
normalizeWrenchMode,
|
|
90
97
|
normalizeTurretMode,
|
|
91
98
|
normalizePositiveFinite,
|
|
@@ -564,12 +571,48 @@ export class DredlessClient extends EventBus {
|
|
|
564
571
|
return this.sendFabricatorMessage("eject", [row, -1, -1]);
|
|
565
572
|
}
|
|
566
573
|
|
|
567
|
-
|
|
568
|
-
return this.
|
|
574
|
+
sendLauncherConfig(entity, config = {}) {
|
|
575
|
+
return this.sendUiConfig(buildLauncherConfigData(entity, this.#launcherConfigDefaults(entity, config)));
|
|
569
576
|
}
|
|
570
577
|
|
|
571
|
-
|
|
572
|
-
return this.
|
|
578
|
+
setLauncherAngle(entity, angle, config = {}) {
|
|
579
|
+
return this.sendLauncherConfig(entity, {...config, angle});
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
setLauncherPower(entity, power, config = {}) {
|
|
583
|
+
return this.sendLauncherConfig(entity, {...config, power});
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
copyLauncherConfig(entity, config = {}) {
|
|
587
|
+
return this.sendUiConfig(buildLauncherCopyConfigData(this.#launcherConfigDefaults(entity, config)));
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
pasteLauncherConfig(entity, config = {}) {
|
|
591
|
+
return this.sendUiConfig(buildLauncherPasteConfigData(entity, this.#launcherConfigDefaults(entity, config)));
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
sendDoorConfig(entity, config = {}) {
|
|
595
|
+
return this.sendUiConfig(buildDoorConfigData(entity, this.#rankFilterConfigDefaults(entity, "door", config)));
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
copyDoorConfig(entity, config = {}) {
|
|
599
|
+
return this.sendUiConfig(buildDoorCopyConfigData(this.#doorClipboardConfigDefaults(entity, config)));
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
pasteDoorConfig(entity, config = {}) {
|
|
603
|
+
return this.sendUiConfig(buildDoorPasteConfigData(entity, this.#doorClipboardConfigDefaults(entity, config)));
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
sendSpawnPointConfig(entity, config = {}) {
|
|
607
|
+
return this.sendUiConfig(buildSpawnPointConfigData(entity, this.#rankFilterConfigDefaults(entity, "spawnPoint", config)));
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
copySpawnPointConfig(entity, config = {}) {
|
|
611
|
+
return this.sendUiConfig(buildSpawnPointCopyConfigData(this.#rankFilterConfigDefaults(entity, "spawnPoint", config)));
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
pasteSpawnPointConfig(entity, config = {}) {
|
|
615
|
+
return this.sendUiConfig(buildSpawnPointPasteConfigData(entity, this.#rankFilterConfigDefaults(entity, "spawnPoint", config)));
|
|
573
616
|
}
|
|
574
617
|
|
|
575
618
|
setSignText(text = "", mode = 0) {
|
|
@@ -1431,6 +1474,28 @@ export class DredlessClient extends EventBus {
|
|
|
1431
1474
|
};
|
|
1432
1475
|
}
|
|
1433
1476
|
|
|
1477
|
+
#launcherConfigDefaults(entity, config = {}) {
|
|
1478
|
+
const summary = this.worlds.shipWorld()?.entity(entity)?.contents?.launcher;
|
|
1479
|
+
return {
|
|
1480
|
+
angle: config.angle !== undefined ? config.angle : summary?.angleDegrees ?? 0,
|
|
1481
|
+
power: config.power !== undefined ? config.power : summary?.power ?? 30
|
|
1482
|
+
};
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
#rankFilterConfigDefaults(entity, kind, config = {}) {
|
|
1486
|
+
if (config.allowedRanks !== undefined || config.rankMask !== undefined) return {...config};
|
|
1487
|
+
const summary = this.worlds.shipWorld()?.entity(entity)?.contents?.[kind];
|
|
1488
|
+
return {...config, rankMask: summary?.rankMask ?? 4};
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
#doorClipboardConfigDefaults(entity, config = {}) {
|
|
1492
|
+
const angle = this.entity(entity)?.transform?.rot ?? 0;
|
|
1493
|
+
return {
|
|
1494
|
+
...this.#rankFilterConfigDefaults(entity, "door", config),
|
|
1495
|
+
orientation: config.orientation ?? (Math.abs(Math.round(angle / (Math.PI / 2))) % 2 ? "horizontal" : "vertical")
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1434
1499
|
#pusherConfigDefaults(entity, config = {}) {
|
|
1435
1500
|
const summary = this.entity(entity)?.contents?.pusher || null;
|
|
1436
1501
|
return {
|
|
@@ -566,7 +566,7 @@ export class EntitySnapshot {
|
|
|
566
566
|
this.id = Number(data.entity ?? data.id);
|
|
567
567
|
this.entity = this.id;
|
|
568
568
|
this.position = data.transform || null;
|
|
569
|
-
this.rotation = data.transform?.
|
|
569
|
+
this.rotation = data.transform?.rot ?? null;
|
|
570
570
|
this.type = entityPublicType(data, this.#contents);
|
|
571
571
|
this.features = Object.freeze(entityFeatures(data, this.#contents));
|
|
572
572
|
deepFreeze(this.#contents);
|
|
@@ -1150,12 +1150,28 @@ export class LauncherHandle extends MachineHandle {
|
|
|
1150
1150
|
return summaryForEntity(this.client, this.scope, this.id)?.contents?.launcher || null;
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
|
-
|
|
1154
|
-
return this.client.
|
|
1153
|
+
configure(config = {}) {
|
|
1154
|
+
return this.client.sendLauncherConfig(this.id, config);
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
copy(config = {}) {
|
|
1158
|
+
return this.client.copyLauncherConfig(this.id, config);
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
paste(config = {}) {
|
|
1162
|
+
return this.client.pasteLauncherConfig(this.id, config);
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
setAngle(angle, config = {}) {
|
|
1166
|
+
return this.client.setLauncherAngle(this.id, angle, config);
|
|
1155
1167
|
}
|
|
1156
1168
|
|
|
1157
|
-
setPower(power) {
|
|
1158
|
-
return this.client.setLauncherPower(power);
|
|
1169
|
+
setPower(power, config = {}) {
|
|
1170
|
+
return this.client.setLauncherPower(this.id, power, config);
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
get power() {
|
|
1174
|
+
return this.state?.power;
|
|
1159
1175
|
}
|
|
1160
1176
|
|
|
1161
1177
|
get angleDegrees() {
|
|
@@ -1368,16 +1384,36 @@ export class HelmHandle extends MachineHandle {
|
|
|
1368
1384
|
}
|
|
1369
1385
|
|
|
1370
1386
|
export class DoorHandle extends MachineHandle {
|
|
1371
|
-
|
|
1372
|
-
return this.client.
|
|
1387
|
+
configure(config = {}) {
|
|
1388
|
+
return this.client.sendDoorConfig(this.id, config);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
copy(config = {}) {
|
|
1392
|
+
return this.client.copyDoorConfig(this.id, config);
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
paste(config = {}) {
|
|
1396
|
+
return this.client.pasteDoorConfig(this.id, config);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
setAllowedRanks(allowedRanks) {
|
|
1400
|
+
return this.configure({allowedRanks});
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
setRankMask(rankMask) {
|
|
1404
|
+
return this.configure({rankMask});
|
|
1373
1405
|
}
|
|
1374
1406
|
|
|
1375
1407
|
get state() {
|
|
1376
1408
|
return summaryForEntity(this.client, this.scope, this.id)?.contents?.door || null;
|
|
1377
1409
|
}
|
|
1378
1410
|
|
|
1379
|
-
get
|
|
1380
|
-
return this.state?.
|
|
1411
|
+
get rankMask() {
|
|
1412
|
+
return this.state?.rankMask;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
get allowedRanks() {
|
|
1416
|
+
return this.state?.allowedRanks;
|
|
1381
1417
|
}
|
|
1382
1418
|
|
|
1383
1419
|
get open() {
|
|
@@ -1386,16 +1422,36 @@ export class DoorHandle extends MachineHandle {
|
|
|
1386
1422
|
}
|
|
1387
1423
|
|
|
1388
1424
|
export class SpawnPointHandle extends MachineHandle {
|
|
1389
|
-
|
|
1390
|
-
return this.client.
|
|
1425
|
+
configure(config = {}) {
|
|
1426
|
+
return this.client.sendSpawnPointConfig(this.id, config);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
copy(config = {}) {
|
|
1430
|
+
return this.client.copySpawnPointConfig(this.id, config);
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
paste(config = {}) {
|
|
1434
|
+
return this.client.pasteSpawnPointConfig(this.id, config);
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
setAllowedRanks(allowedRanks) {
|
|
1438
|
+
return this.configure({allowedRanks});
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
setRankMask(rankMask) {
|
|
1442
|
+
return this.configure({rankMask});
|
|
1391
1443
|
}
|
|
1392
1444
|
|
|
1393
1445
|
get state() {
|
|
1394
1446
|
return summaryForEntity(this.client, this.scope, this.id)?.contents?.spawnPoint || null;
|
|
1395
1447
|
}
|
|
1396
1448
|
|
|
1397
|
-
get
|
|
1398
|
-
return this.state?.
|
|
1449
|
+
get rankMask() {
|
|
1450
|
+
return this.state?.rankMask;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
get allowedRanks() {
|
|
1454
|
+
return this.state?.allowedRanks;
|
|
1399
1455
|
}
|
|
1400
1456
|
}
|
|
1401
1457
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {normalizePlayerRank} from "../../protocol/outbound/ship-management.js";
|
|
2
|
-
|
|
3
1
|
function timeoutValue(options) {
|
|
4
2
|
const timeout = options.timeout ?? 5000;
|
|
5
3
|
if (!Number.isFinite(timeout) || timeout <= 0) throw new RangeError("timeout must be positive milliseconds");
|
|
@@ -137,17 +135,4 @@ export class TipDomain {
|
|
|
137
135
|
});
|
|
138
136
|
}
|
|
139
137
|
|
|
140
|
-
setRank(handle, rank, options = {}) {
|
|
141
|
-
return this.#exclusive(async () => {
|
|
142
|
-
const value = normalizePlayerRank(rank);
|
|
143
|
-
const timeout = timeoutValue(options);
|
|
144
|
-
if (!handle.exists()) throw new Error("Rank target no longer exists");
|
|
145
|
-
if (handle.rank === value) return this.client;
|
|
146
|
-
const text = {0: "Restrict to Guests", 1: "Restrict to Crew", 3: "Restrict to Captains"}[value];
|
|
147
|
-
await this.#open(handle, options);
|
|
148
|
-
await waitFor(this.client, "model", () => handle.rank === value, timeout, "access rank update",
|
|
149
|
-
() => this.#select(text));
|
|
150
|
-
return this.client;
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
138
|
}
|