dredless 0.7.0 → 1.0.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/README.md +22 -58
- package/dist/browser/dredless.global.js +794 -98
- package/dist/browser/dredless.global.js.map +4 -4
- package/docs/ACCOUNT.md +146 -0
- package/docs/API_REFERENCE.md +63 -2563
- package/docs/BROWSER_API.md +151 -70
- package/docs/CLIENT.md +183 -0
- package/docs/EVENTS.md +136 -0
- package/docs/GETTING_STARTED.md +135 -0
- package/docs/MACHINES.md +351 -0
- package/docs/MANAGEMENT.md +285 -0
- package/docs/NODE_API.md +120 -318
- package/docs/PLAYER_INVENTORY.md +235 -0
- package/docs/PROTOCOL.md +227 -0
- package/docs/README.md +44 -0
- package/docs/TROUBLESHOOTING.md +91 -0
- package/docs/WORLD_STATE.md +183 -0
- package/package.json +1 -2
- package/src/browser.d.ts +31 -1
- package/src/browser.js +10 -0
- package/src/client/core.js +302 -15
- package/src/client/domains/index.js +57 -7
- package/src/client/index.d.ts +1 -1
- package/src/index.d.ts +299 -13
- package/src/index.js +10 -0
- package/src/network/account.js +182 -0
- package/src/network/disconnect.d.ts +2 -0
- package/src/network/disconnect.js +53 -0
- package/src/network/index.d.ts +1 -0
- package/src/network/index.js +1 -0
- package/src/network/invites.d.ts +0 -3
- package/src/network/invites.js +3 -40
- package/src/network/session.d.ts +2 -0
- package/src/network/session.js +21 -0
- package/src/protocol/outbound/ship-management.d.ts +66 -1
- package/src/protocol/outbound/ship-management.js +83 -0
- package/src/state/model/decoder.js +70 -10
- package/src/state/model/index.d.ts +4 -0
- package/src/state/model/state.js +22 -7
- package/src/state/world/index.js +27 -1
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
export const GravityDirection: {
|
|
2
|
+
readonly Down: "down";
|
|
3
|
+
readonly Up: "up";
|
|
4
|
+
readonly Left: "left";
|
|
5
|
+
readonly Right: "right";
|
|
6
|
+
};
|
|
7
|
+
export type GravityDirection = typeof GravityDirection[keyof typeof GravityDirection];
|
|
8
|
+
export type ShipGravityDirection = GravityDirection | 0 | 1 | 2 | 3;
|
|
9
|
+
|
|
1
10
|
export interface Server {
|
|
2
11
|
index: number;
|
|
3
12
|
domain: string;
|
|
@@ -26,15 +35,12 @@ export interface ShipList {
|
|
|
26
35
|
export interface InviteMetadata {
|
|
27
36
|
shipId: string | null;
|
|
28
37
|
name: string | null;
|
|
29
|
-
/** CSS RGB color sampled from the preview image's top-left pixel, when available. */
|
|
30
|
-
color?: string | null;
|
|
31
38
|
previewImageUrl: string | null;
|
|
32
39
|
hostname: string;
|
|
33
40
|
inviteCode: string;
|
|
34
41
|
}
|
|
35
42
|
export interface InviteFetchOptions {
|
|
36
43
|
fetchImpl?: typeof fetch;
|
|
37
|
-
includeColor?: boolean;
|
|
38
44
|
}
|
|
39
45
|
export function fetchInviteMetadata(invite: string | URL, options?: InviteFetchOptions): Promise<InviteMetadata>;
|
|
40
46
|
export function parseInviteMetadata(html: string): InviteMetadata;
|
|
@@ -54,6 +60,73 @@ export type ServerRef = number | Server;
|
|
|
54
60
|
export type ShipRef = number | string | Ship | ShipSpec | null;
|
|
55
61
|
export type ShipPrivacy = 0 | 1 | boolean | "public" | "private";
|
|
56
62
|
export type ShipPlayerRank = 0 | 1 | 3 | "guest" | "crew" | "captain";
|
|
63
|
+
|
|
64
|
+
export const DropReason: Readonly<{
|
|
65
|
+
ProtocolError: 4000;
|
|
66
|
+
BadVersion: 4001;
|
|
67
|
+
ConnectLimit: 4002;
|
|
68
|
+
ConnectRate: 4003;
|
|
69
|
+
TeamLimit: 4004;
|
|
70
|
+
FullPlayers: 4005;
|
|
71
|
+
FullTeams: 4006;
|
|
72
|
+
TeamNotAvailable: 4007;
|
|
73
|
+
Kicked: 4008;
|
|
74
|
+
Banned: 4009;
|
|
75
|
+
Idle: 4010;
|
|
76
|
+
ShipDestruct: 4011;
|
|
77
|
+
JoinBlocked: 4012;
|
|
78
|
+
HardBanned: 4013;
|
|
79
|
+
NoLoad: 4014;
|
|
80
|
+
Saved: 4015;
|
|
81
|
+
InvalidInvite: 4016;
|
|
82
|
+
Shutdown: 4017;
|
|
83
|
+
ServerError: 4018;
|
|
84
|
+
GTFO: 4019;
|
|
85
|
+
}>;
|
|
86
|
+
export type DropReason = typeof DropReason[keyof typeof DropReason];
|
|
87
|
+
|
|
88
|
+
export interface DisconnectInfo {
|
|
89
|
+
readonly code: number;
|
|
90
|
+
/** Official application reason name; null for standard WebSocket or unknown codes. */
|
|
91
|
+
readonly name: keyof typeof DropReason | null;
|
|
92
|
+
readonly reason: string;
|
|
93
|
+
/** Null when the socket API does not report handshake cleanliness. */
|
|
94
|
+
readonly wasClean: boolean | null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export class DisconnectError extends Error {
|
|
98
|
+
constructor(disconnect: DisconnectInfo, message?: string);
|
|
99
|
+
disconnect: DisconnectInfo;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function normalizeDisconnect(eventOrCode?: unknown, reason?: unknown): DisconnectInfo;
|
|
103
|
+
|
|
104
|
+
export interface ShipManagementOptions {
|
|
105
|
+
/** Milliseconds to wait for server confirmation; default 10000. */
|
|
106
|
+
timeout?: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface StarterRecoveryOptions {
|
|
110
|
+
/** Milliseconds to wait for the response; default 10000. */
|
|
111
|
+
timeout?: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface StarterRecoveryResult {
|
|
115
|
+
readonly success: boolean;
|
|
116
|
+
readonly failReason: string | null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface RenameShipOptions {
|
|
120
|
+
/** #RRGGBB hex string; omitted preserves the color returned by the server. */
|
|
121
|
+
color?: string;
|
|
122
|
+
/** Milliseconds to wait for rename permission; default 10000. */
|
|
123
|
+
timeout?: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface SaveShipOptions {
|
|
127
|
+
/** Milliseconds to wait for the Saved disconnect code; default 10000. */
|
|
128
|
+
timeout?: number;
|
|
129
|
+
}
|
|
57
130
|
export type PlayerShipRank = "guest" | "crew" | "crew-invite-pending-deprecated" | "captain" | "banned";
|
|
58
131
|
export const FabricatorType: {
|
|
59
132
|
readonly Starter: "starter";
|
|
@@ -82,12 +155,24 @@ export type InventorySlotRef = number | EquipmentSlot | InventorySlotHandle | In
|
|
|
82
155
|
export type ReadWorldScope = "ship" | "current" | "overworld" | number;
|
|
83
156
|
export type EntityRef = number | EntityHandle | EntitySummary | EntityDebugSummary;
|
|
84
157
|
|
|
158
|
+
export interface ShipPatronPerk {
|
|
159
|
+
name: string;
|
|
160
|
+
/** Packed RGB color, as sent by the server. */
|
|
161
|
+
color: number;
|
|
162
|
+
/** Official tiers include bronze, silver, gold, plat, and flux. */
|
|
163
|
+
tier: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface PatronPerksResponse {
|
|
167
|
+
readonly failure: boolean;
|
|
168
|
+
}
|
|
169
|
+
|
|
85
170
|
export interface ShipConfig {
|
|
86
171
|
privacy: number | null;
|
|
87
172
|
privacyName: "public" | "private" | null;
|
|
88
173
|
inviteKey: string | null;
|
|
89
174
|
teamId: number | null;
|
|
90
|
-
patronPerks:
|
|
175
|
+
patronPerks: ShipPatronPerk[];
|
|
91
176
|
}
|
|
92
177
|
|
|
93
178
|
export interface CaptainSubrank {
|
|
@@ -196,10 +281,30 @@ export interface Command {
|
|
|
196
281
|
drag?: DragPayload | null;
|
|
197
282
|
}
|
|
198
283
|
|
|
284
|
+
export interface CrewLogEntry {
|
|
285
|
+
icon: string | null;
|
|
286
|
+
/** Plain text; formatting, images, badges, and date tokens remain in rawText. */
|
|
287
|
+
text: string;
|
|
288
|
+
rawText: unknown;
|
|
289
|
+
count: number;
|
|
290
|
+
refId: number | null;
|
|
291
|
+
secondaryRefId: number | null;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface CrewLog {
|
|
295
|
+
/** Retained entries in server order, oldest first; at most 500. */
|
|
296
|
+
entries: CrewLogEntry[];
|
|
297
|
+
/** Entries appended by the latest message, including amended replacements. */
|
|
298
|
+
changes: CrewLogEntry[];
|
|
299
|
+
reset: boolean;
|
|
300
|
+
amend: boolean;
|
|
301
|
+
}
|
|
302
|
+
|
|
199
303
|
export interface ShipManagementMessage {
|
|
200
304
|
type: 4;
|
|
201
305
|
act: string;
|
|
202
306
|
arg: unknown;
|
|
307
|
+
arg2?: unknown;
|
|
203
308
|
rank?: unknown;
|
|
204
309
|
}
|
|
205
310
|
|
|
@@ -324,6 +429,34 @@ export interface LoaderFullConfig extends LoaderConfig {
|
|
|
324
429
|
filterSlots?: Array<number | null | undefined>;
|
|
325
430
|
}
|
|
326
431
|
|
|
432
|
+
export interface ClanTagDetails {
|
|
433
|
+
/** Current tag, or null when cleared. */
|
|
434
|
+
tag: string | null;
|
|
435
|
+
/** Number of other users with this tag; null when unavailable. */
|
|
436
|
+
otherUsers: number | null;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export interface AccountPerkShip {
|
|
440
|
+
/** Decimal identifier from the removal form; use this for removeShipPerks(). */
|
|
441
|
+
shipId: string;
|
|
442
|
+
name: string;
|
|
443
|
+
/** Identifier displayed in braces; distinct from the removal form's ID. */
|
|
444
|
+
hexCode: string | null;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export interface AccountDetails {
|
|
448
|
+
name: string | null;
|
|
449
|
+
/** Packed RGB account color from the name's background, matching account/status. */
|
|
450
|
+
color: number | null;
|
|
451
|
+
email: string | null;
|
|
452
|
+
/** Identity value without the parenthesized service suffix. */
|
|
453
|
+
identity: string | null;
|
|
454
|
+
identityService: string | null;
|
|
455
|
+
clan: ClanTagDetails;
|
|
456
|
+
/** This account's applied ships; null when the section is unavailable. */
|
|
457
|
+
shipsWithPerks: AccountPerkShip[] | null;
|
|
458
|
+
}
|
|
459
|
+
|
|
327
460
|
export class Session {
|
|
328
461
|
constructor(gameSession?: string | null, gameVersion?: string | null);
|
|
329
462
|
|
|
@@ -349,6 +482,16 @@ export class Session {
|
|
|
349
482
|
|
|
350
483
|
fetchAccountStatus(): Promise<unknown>;
|
|
351
484
|
|
|
485
|
+
/** Scrape the authenticated account page; does not update account/status or session serialization. */
|
|
486
|
+
fetchAccountDetails(): Promise<AccountDetails>;
|
|
487
|
+
fetchClanTag(): Promise<ClanTagDetails>;
|
|
488
|
+
/** Submit the form and confirm the stored tag on the account page. */
|
|
489
|
+
setClanTag(tag: string): Promise<ClanTagDetails>;
|
|
490
|
+
clearClanTag(): Promise<ClanTagDetails>;
|
|
491
|
+
/** Remove this account's perks and return the confirmed remaining applied ships. */
|
|
492
|
+
removeShipPerks(shipId: string | number): Promise<AccountPerkShip[]>;
|
|
493
|
+
|
|
494
|
+
|
|
352
495
|
fetchShips(server: ServerRef): Promise<Ship[]>;
|
|
353
496
|
|
|
354
497
|
fetchShipList(server: ServerRef): Promise<ShipList>;
|
|
@@ -475,6 +618,8 @@ export class DredlessClient {
|
|
|
475
618
|
ready: boolean;
|
|
476
619
|
packetCount: number;
|
|
477
620
|
lastPacket: unknown;
|
|
621
|
+
lastDisconnect: DisconnectInfo | null;
|
|
622
|
+
crewLog: CrewLog | null;
|
|
478
623
|
net: ClientNetDomain;
|
|
479
624
|
debug: ClientDebugDomain;
|
|
480
625
|
player: PlayerDomain;
|
|
@@ -490,6 +635,19 @@ export class DredlessClient {
|
|
|
490
635
|
disconnect(code?: number, reason?: string): this;
|
|
491
636
|
sendChatMessage(message?: string): this;
|
|
492
637
|
sendCommsMessage(message?: string): this;
|
|
638
|
+
/** Whether the connected, ready client's ship has parent-world danger level 0. */
|
|
639
|
+
canSaveShip(): boolean;
|
|
640
|
+
/** Save and await the server's Saved close code; reject on ineligibility, timeout, or any other disconnect. */
|
|
641
|
+
saveShip(options?: SaveShipOptions): Promise<DisconnectInfo>;
|
|
642
|
+
/** Request permission and send the rename commit; does not await confirmation of the new name. */
|
|
643
|
+
renameShip(name: string, options?: RenameShipOptions): Promise<void>;
|
|
644
|
+
unbanPlayer(refId: number): this;
|
|
645
|
+
setShipGravity(direction: ShipGravityDirection): this;
|
|
646
|
+
setShipPatronPerks(enabled: boolean): this;
|
|
647
|
+
resetInvite(options?: ShipManagementOptions): Promise<ShipConfig>;
|
|
648
|
+
demoteSelf(options?: ShipManagementOptions): Promise<void>;
|
|
649
|
+
/** Await recovery success; reject with the server's failure reason. */
|
|
650
|
+
recoverStarterItem(itemId: number, options?: StarterRecoveryOptions): Promise<void>;
|
|
493
651
|
|
|
494
652
|
currentShip(): ShipDomain | null;
|
|
495
653
|
|
|
@@ -513,12 +671,27 @@ export class DredlessClient {
|
|
|
513
671
|
|
|
514
672
|
entity(entityId: number, scope?: number | string): EntitySnapshot | null;
|
|
515
673
|
|
|
674
|
+
on(type: "disconnect", callback: (info: DisconnectInfo) => void): this;
|
|
675
|
+
on(type: "starter-recovery", callback: (result: StarterRecoveryResult, packet: unknown) => void): this;
|
|
676
|
+
on(type: "demote", callback: (packet: unknown) => void): this;
|
|
677
|
+
on(type: "patron-perks-response", callback: (response: PatronPerksResponse, packet: unknown) => void): this;
|
|
678
|
+
on(type: "crew-log", callback: (log: CrewLog | null, packet: unknown) => void): this;
|
|
516
679
|
on(type: "tip-list", callback: (menu: TipList, world: WorldState) => void): this;
|
|
517
680
|
on(type: string, callback: (...args: unknown[]) => void): this;
|
|
518
681
|
|
|
682
|
+
off(type: "disconnect", callback: (info: DisconnectInfo) => void): this;
|
|
683
|
+
off(type: "starter-recovery", callback: (result: StarterRecoveryResult, packet: unknown) => void): this;
|
|
684
|
+
off(type: "demote", callback: (packet: unknown) => void): this;
|
|
685
|
+
off(type: "patron-perks-response", callback: (response: PatronPerksResponse, packet: unknown) => void): this;
|
|
686
|
+
off(type: "crew-log", callback: (log: CrewLog | null, packet: unknown) => void): this;
|
|
519
687
|
off(type: "tip-list", callback: (menu: TipList, world: WorldState) => void): this;
|
|
520
688
|
off(type: string, callback: (...args: unknown[]) => void): this;
|
|
521
689
|
|
|
690
|
+
once(type: "disconnect", callback: (info: DisconnectInfo) => void): this;
|
|
691
|
+
once(type: "starter-recovery", callback: (result: StarterRecoveryResult, packet: unknown) => void): this;
|
|
692
|
+
once(type: "demote", callback: (packet: unknown) => void): this;
|
|
693
|
+
once(type: "patron-perks-response", callback: (response: PatronPerksResponse, packet: unknown) => void): this;
|
|
694
|
+
once(type: "crew-log", callback: (log: CrewLog | null, packet: unknown) => void): this;
|
|
522
695
|
once(type: "tip-list", callback: (menu: TipList, world: WorldState) => void): this;
|
|
523
696
|
once(type: string, callback: (...args: unknown[]) => void): this;
|
|
524
697
|
}
|
|
@@ -554,6 +727,7 @@ export interface ClientNetDomain {
|
|
|
554
727
|
sid: number | null;
|
|
555
728
|
packetCount: number;
|
|
556
729
|
lastPacket: unknown;
|
|
730
|
+
readonly lastDisconnect: DisconnectInfo | null;
|
|
557
731
|
|
|
558
732
|
send(command?: Command): DredlessClient;
|
|
559
733
|
|
|
@@ -636,13 +810,36 @@ export interface PlayerDomain {
|
|
|
636
810
|
}
|
|
637
811
|
|
|
638
812
|
export interface ShipManagementDomain {
|
|
813
|
+
/** Checks the current ship's parent-world danger level; server permissions still apply. */
|
|
814
|
+
canSave(): boolean;
|
|
815
|
+
|
|
816
|
+
/** Save and await the server's Saved close code; reject on ineligibility, timeout, or any other disconnect. */
|
|
817
|
+
save(options?: SaveShipOptions): Promise<DisconnectInfo>;
|
|
818
|
+
|
|
819
|
+
/** Request permission and send the rename commit; does not await confirmation of the new name. */
|
|
820
|
+
rename(name: string, options?: RenameShipOptions): Promise<void>;
|
|
821
|
+
|
|
639
822
|
requestPlayerList(): DredlessClient;
|
|
640
823
|
|
|
641
|
-
|
|
824
|
+
/** Await a server config containing a changed, nonempty invite key. */
|
|
825
|
+
resetInvite(options?: ShipManagementOptions): Promise<ShipConfig>;
|
|
642
826
|
|
|
643
827
|
setPrivacy(privacy: ShipPrivacy): DredlessClient;
|
|
644
828
|
|
|
645
|
-
|
|
829
|
+
/** Set gravity using the official coolsnake303 command. Does not await confirmation. */
|
|
830
|
+
setGravity(direction: ShipGravityDirection): DredlessClient;
|
|
831
|
+
|
|
832
|
+
/** Apply or remove the caller's perks; does not await server confirmation. */
|
|
833
|
+
setPatronPerks(enabled: boolean): DredlessClient;
|
|
834
|
+
enablePatronPerks(): DredlessClient;
|
|
835
|
+
disablePatronPerks(): DredlessClient;
|
|
836
|
+
/** Current server-reported patrons; null when config is unavailable. */
|
|
837
|
+
patronPerks(): ShipPatronPerk[] | null;
|
|
838
|
+
/** Any applied patron, or an exact patron name match when supplied. */
|
|
839
|
+
hasPatronPerks(name?: string): boolean;
|
|
840
|
+
|
|
841
|
+
/** Await recovery success; reject with the server's failure reason. */
|
|
842
|
+
recoverStarterItem(itemId: number, options?: StarterRecoveryOptions): Promise<void>;
|
|
646
843
|
|
|
647
844
|
setPlayerRank(refId: number, rank: ShipPlayerRank): DredlessClient;
|
|
648
845
|
|
|
@@ -650,13 +847,19 @@ export interface ShipManagementDomain {
|
|
|
650
847
|
|
|
651
848
|
banPlayer(refId: number): DredlessClient;
|
|
652
849
|
|
|
653
|
-
|
|
850
|
+
/** Remove a ship ban using the player list entry’s refId. */
|
|
851
|
+
unbanPlayer(refId: number): DredlessClient;
|
|
852
|
+
|
|
853
|
+
/** Await server demotion; management caches have been cleared when this resolves. */
|
|
854
|
+
demoteSelf(options?: ShipManagementOptions): Promise<void>;
|
|
654
855
|
|
|
655
856
|
config(): ShipConfig | null;
|
|
656
857
|
|
|
657
858
|
hasCheats(): boolean;
|
|
658
859
|
|
|
659
860
|
playerList(): ShipPlayerList | null;
|
|
861
|
+
|
|
862
|
+
crewLog(): CrewLog | null;
|
|
660
863
|
}
|
|
661
864
|
|
|
662
865
|
export interface InventoryDomain {
|
|
@@ -1228,6 +1431,7 @@ export interface ClientSnapshot {
|
|
|
1228
1431
|
sid: number | null;
|
|
1229
1432
|
ready: boolean;
|
|
1230
1433
|
connected: boolean;
|
|
1434
|
+
lastDisconnect: DisconnectInfo | null;
|
|
1231
1435
|
currentWorldId: number | null;
|
|
1232
1436
|
worlds: WorldSnapshot[];
|
|
1233
1437
|
cpuLoad: number | null;
|
|
@@ -1245,6 +1449,7 @@ export interface ClientSnapshot {
|
|
|
1245
1449
|
shipConfig: ShipConfig | null;
|
|
1246
1450
|
captainSubrank: CaptainSubrank | null;
|
|
1247
1451
|
playerList: ShipPlayerList | null;
|
|
1452
|
+
crewLog: CrewLog | null;
|
|
1248
1453
|
outfits: { sid: number; outfit: unknown }[];
|
|
1249
1454
|
commandAcks: CommandAck[];
|
|
1250
1455
|
lastCommandAck: CommandAck | null;
|
|
@@ -1638,6 +1843,9 @@ export interface CommsBubbleSummary {
|
|
|
1638
1843
|
}
|
|
1639
1844
|
|
|
1640
1845
|
export class ModelState {
|
|
1846
|
+
/** Local entity identified by the decrypted camera-focus message, when known. */
|
|
1847
|
+
readonly localPlayerEntity: number | null;
|
|
1848
|
+
setLocalPlayerEntity(entity: number | null): void;
|
|
1641
1849
|
generation: number | null;
|
|
1642
1850
|
tables: Map<number, Map<number, ModelRecord>>;
|
|
1643
1851
|
/** Capped at 500 retained ids; see `totalRemovedCount` for the true total. */
|
|
@@ -1839,10 +2047,17 @@ export interface CannonSummary {
|
|
|
1839
2047
|
recoil: number | null;
|
|
1840
2048
|
recoil2: number | null;
|
|
1841
2049
|
recoils: [number | null, number | null];
|
|
1842
|
-
|
|
1843
|
-
|
|
2050
|
+
/** Official indicator scalar (wire value / 50); defaults to 0. Not a resource count or readiness flag. */
|
|
2051
|
+
indicatorValue: number;
|
|
2052
|
+
indicatorVisible: boolean;
|
|
2053
|
+
/** Packed RGB; null when hidden. Red is the first phase of a blinking indicator. */
|
|
2054
|
+
indicatorColor: number | null;
|
|
2055
|
+
indicatorBlinking: boolean;
|
|
2056
|
+
/** Alternate packed RGB color for blinking; otherwise null. */
|
|
2057
|
+
indicatorBlinkColor: number | null;
|
|
1844
2058
|
spin: number | null;
|
|
1845
|
-
|
|
2059
|
+
/** Burst charges on burst cannons, cooling cells on machine cannons; defaults to 0. */
|
|
2060
|
+
resourceCount: number;
|
|
1846
2061
|
state: ModelRecord;
|
|
1847
2062
|
}
|
|
1848
2063
|
|
|
@@ -2037,18 +2252,73 @@ export interface PlayerSummary {
|
|
|
2037
2252
|
name: string | null;
|
|
2038
2253
|
heldItemId: number | null;
|
|
2039
2254
|
heldItemName: string | null;
|
|
2040
|
-
|
|
2041
|
-
|
|
2255
|
+
/** Server-reported item mode code. */
|
|
2256
|
+
itemMode: number | null;
|
|
2257
|
+
/** Multiplier used by the official client for build reach. */
|
|
2258
|
+
buildMultiplier: number | null;
|
|
2259
|
+
/** Beam distance shared by repair tools and handheld pushers, in world units. */
|
|
2260
|
+
heldItemBeamDistance: number | null;
|
|
2261
|
+
/** Held tool angle in radians in the current world's coordinate frame. */
|
|
2262
|
+
heldItemAngle: number | null;
|
|
2042
2263
|
shipRank: PlayerShipRank | null;
|
|
2043
2264
|
patronTier: "bronze" | "silver" | "gold" | "plat" | "flux" | null;
|
|
2044
2265
|
isDeveloper: boolean;
|
|
2045
2266
|
isPatron: boolean;
|
|
2046
|
-
|
|
2267
|
+
isLocal: boolean;
|
|
2268
|
+
/** Server-requested camera zoom state; does not identify the operated machine. */
|
|
2269
|
+
zoomedOut: boolean;
|
|
2047
2270
|
muted: boolean;
|
|
2271
|
+
invisible: boolean;
|
|
2272
|
+
cheats: { noclip: boolean; sandboxBuild: boolean };
|
|
2273
|
+
/** Shared item effect flag, including active rocket/hover pack exhaust. */
|
|
2274
|
+
itemEffectActive: boolean;
|
|
2275
|
+
animation: PlayerAnimationSummary;
|
|
2276
|
+
appearance: PlayerAppearanceSummary | null;
|
|
2048
2277
|
actionPreview: PlayerActionPreviewSummary | null;
|
|
2049
2278
|
state: ModelRecord;
|
|
2050
2279
|
}
|
|
2051
2280
|
|
|
2281
|
+
export interface PlayerAnimationSummary {
|
|
2282
|
+
/** Horizontal sprite mirror sign, normally -1 or 1. */
|
|
2283
|
+
facing: number;
|
|
2284
|
+
/** Server orientation code used to align the sprite and limb animation. */
|
|
2285
|
+
orientation: number;
|
|
2286
|
+
/** Selects speed-based limb swing instead of the hovering pose; not a movement detector. */
|
|
2287
|
+
walking: boolean;
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
export interface PlayerAppearanceStyleSummary {
|
|
2291
|
+
color: number;
|
|
2292
|
+
/** Index into the official client's style catalog; zero means no style. */
|
|
2293
|
+
styleId: number;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
export interface PlayerAppearanceItemSummary {
|
|
2297
|
+
itemId: number;
|
|
2298
|
+
itemName: string | null;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
export interface PlayerAppearanceSummary {
|
|
2302
|
+
/** Packed RGB colors. */
|
|
2303
|
+
bodyColor: number;
|
|
2304
|
+
legsColor: number;
|
|
2305
|
+
skinColor: number;
|
|
2306
|
+
feetColor: number;
|
|
2307
|
+
hair: PlayerAppearanceStyleSummary;
|
|
2308
|
+
hat: PlayerAppearanceStyleSummary;
|
|
2309
|
+
face1: PlayerAppearanceStyleSummary;
|
|
2310
|
+
face2: PlayerAppearanceStyleSummary;
|
|
2311
|
+
/** Equipped item visuals applied over the base outfit; null means no item override. */
|
|
2312
|
+
itemOverrides: {
|
|
2313
|
+
back: PlayerAppearanceItemSummary | null;
|
|
2314
|
+
hands: PlayerAppearanceItemSummary | null;
|
|
2315
|
+
feet: PlayerAppearanceItemSummary | null;
|
|
2316
|
+
head1: PlayerAppearanceItemSummary | null;
|
|
2317
|
+
head2: PlayerAppearanceItemSummary | null;
|
|
2318
|
+
};
|
|
2319
|
+
state: ModelRecord;
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2052
2322
|
export interface PlayerActionPreviewSummary {
|
|
2053
2323
|
entity: number;
|
|
2054
2324
|
active: boolean;
|
|
@@ -2194,10 +2464,22 @@ export function buildShipManagementMessage(act: string, arg?: unknown, extra?: R
|
|
|
2194
2464
|
|
|
2195
2465
|
export function buildShipPrivacyMessage(privacy: ShipPrivacy): ShipManagementMessage;
|
|
2196
2466
|
|
|
2467
|
+
export function buildShipGravityMessage(direction: ShipGravityDirection): ShipManagementMessage;
|
|
2468
|
+
|
|
2469
|
+
export function buildSetPatronPerksMessage(enabled: boolean): ShipManagementMessage;
|
|
2470
|
+
|
|
2471
|
+
export function normalizeGravityDirection(direction: ShipGravityDirection): 0 | 1 | 2 | 3;
|
|
2472
|
+
|
|
2197
2473
|
export function buildStarterRecoveryMessage(itemId: number): ShipManagementMessage;
|
|
2198
2474
|
|
|
2199
2475
|
export function buildPlayerListMessage(): ShipManagementMessage;
|
|
2200
2476
|
|
|
2477
|
+
export function buildSaveShipMessage(): ShipManagementMessage;
|
|
2478
|
+
|
|
2479
|
+
export function buildShipRenameRequestMessage(): ShipManagementMessage;
|
|
2480
|
+
|
|
2481
|
+
export function buildShipRenameCommitMessage(name: string, color: string): ShipManagementMessage;
|
|
2482
|
+
|
|
2201
2483
|
export function buildInviteResetMessage(): ShipManagementMessage;
|
|
2202
2484
|
|
|
2203
2485
|
export function buildSetPlayerRankMessage(refId: number, rank: ShipPlayerRank): ShipManagementMessage;
|
|
@@ -2206,6 +2488,8 @@ export function buildKickPlayerMessage(refId: number): ShipManagementMessage;
|
|
|
2206
2488
|
|
|
2207
2489
|
export function buildBanPlayerMessage(refId: number): ShipManagementMessage;
|
|
2208
2490
|
|
|
2491
|
+
export function buildUnbanPlayerMessage(refId: number): ShipManagementMessage;
|
|
2492
|
+
|
|
2209
2493
|
export function buildDemoteSelfMessage(): ShipManagementMessage;
|
|
2210
2494
|
|
|
2211
2495
|
export function normalizePrivacy(privacy: ShipPrivacy): 0 | 1;
|
|
@@ -2216,6 +2500,8 @@ export function normalizeShipConfig(event: unknown): ShipConfig;
|
|
|
2216
2500
|
|
|
2217
2501
|
export function normalizeCaptainSubrank(event: unknown): CaptainSubrank;
|
|
2218
2502
|
|
|
2503
|
+
export function normalizeCrewLog(event: unknown, previous?: CrewLog | null): CrewLog;
|
|
2504
|
+
|
|
2219
2505
|
export function normalizeShipPlayerList(event: unknown, previous?: ShipPlayerList | null, currentCaptainSubrank?: CaptainSubrank | null): ShipPlayerList;
|
|
2220
2506
|
|
|
2221
2507
|
export function buildSignTextMessage(text?: string, mode?: SignDisplayMode): SignTextMessage;
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export {Session, AnonSession} from "./network/session.js";
|
|
2
2
|
export {Connection} from "./network/connection.js";
|
|
3
|
+
export {DropReason, DisconnectError, normalizeDisconnect} from "./network/disconnect.js";
|
|
3
4
|
export {DredlessClient, WrenchMode, TurretMode} from "./client/index.js";
|
|
4
5
|
export {WorldStore, WorldState} from "./state/world/index.js";
|
|
5
6
|
export {FabricatorType, ModelState, decodeModelData} from "./state/model/index.js";
|
|
@@ -24,15 +25,24 @@ export {
|
|
|
24
25
|
} from "./protocol/outbound/inventory.js";
|
|
25
26
|
export {
|
|
26
27
|
buildBanPlayerMessage,
|
|
28
|
+
buildUnbanPlayerMessage,
|
|
27
29
|
buildDemoteSelfMessage,
|
|
28
30
|
buildInviteResetMessage,
|
|
29
31
|
buildKickPlayerMessage,
|
|
30
32
|
buildPlayerListMessage,
|
|
33
|
+
buildSaveShipMessage,
|
|
34
|
+
buildShipRenameRequestMessage,
|
|
35
|
+
buildShipRenameCommitMessage,
|
|
31
36
|
buildShipManagementMessage,
|
|
32
37
|
buildSetPlayerRankMessage,
|
|
33
38
|
buildShipPrivacyMessage,
|
|
39
|
+
buildShipGravityMessage,
|
|
40
|
+
buildSetPatronPerksMessage,
|
|
41
|
+
GravityDirection,
|
|
42
|
+
normalizeGravityDirection,
|
|
34
43
|
buildStarterRecoveryMessage,
|
|
35
44
|
normalizeCaptainSubrank,
|
|
45
|
+
normalizeCrewLog,
|
|
36
46
|
normalizeShipPlayerList,
|
|
37
47
|
normalizePlayerRank,
|
|
38
48
|
normalizePrivacy,
|