pw-js-api 0.3.14-dev.e61d93a → 0.3.14
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/browser/pw.dev.js +84 -84
- package/browser/pw.prod.js +1 -1
- package/cm/game/PWGameClient.d.ts +1 -1
- package/cm/gen/world_pb.d.ts +284 -18
- package/cm/gen/world_pb.js +131 -59
- package/cm/util/block.d.ts +1546 -1542
- package/cm/util/block.js +1547 -1543
- package/esm/game/PWGameClient.d.ts +1 -1
- package/esm/gen/world_pb.d.ts +284 -18
- package/esm/gen/world_pb.js +117 -45
- package/esm/types/api.d.ts +77 -10
- package/esm/util/block.d.ts +1546 -1542
- package/esm/util/block.js +1547 -1543
- package/package.json +4 -4
|
@@ -111,5 +111,5 @@ export default class PWGameClient<StateT extends Partial<{
|
|
|
111
111
|
*/
|
|
112
112
|
disconnect(reconnect?: number | boolean): boolean;
|
|
113
113
|
}
|
|
114
|
-
type Sendable<E extends keyof WorldEvents, WE extends WorldEvents> = E extends "worldBlockPlacedPacket" ? Optional<WorldBlockPlacedPacket, "
|
|
114
|
+
type Sendable<E extends keyof WorldEvents, WE extends WorldEvents> = E extends "worldBlockPlacedPacket" ? Optional<WorldBlockPlacedPacket, "fields"> : E extends "WorldBlockFilledPacket" ? Optional<WorldBlockFilledPacket, "fields"> : E extends "playerChatPacket" ? Omit<PlayerChatPacket, "playerId"> : WE[E];
|
|
115
115
|
export {};
|
package/cm/gen/world_pb.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/
|
|
1
|
+
import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
2
2
|
import type { Message } from "@bufbuild/protobuf";
|
|
3
3
|
/**
|
|
4
4
|
* Describes the file world.proto.
|
|
@@ -173,6 +173,18 @@ export type WorldPacket = Message<"WorldPackets.WorldPacket"> & {
|
|
|
173
173
|
*/
|
|
174
174
|
value: PlayerMagicPacket;
|
|
175
175
|
case: "playerMagicPacket";
|
|
176
|
+
} | {
|
|
177
|
+
/**
|
|
178
|
+
* @generated from field: WorldPackets.GameTicksSyncRequestPacket game_ticks_sync_request_packet = 42;
|
|
179
|
+
*/
|
|
180
|
+
value: GameTicksSyncRequestPacket;
|
|
181
|
+
case: "gameTicksSyncRequestPacket";
|
|
182
|
+
} | {
|
|
183
|
+
/**
|
|
184
|
+
* @generated from field: WorldPackets.GameTicksSyncResponsePacket game_ticks_sync_response_packet = 43;
|
|
185
|
+
*/
|
|
186
|
+
value: GameTicksSyncResponsePacket;
|
|
187
|
+
case: "gameTicksSyncResponsePacket";
|
|
176
188
|
} | {
|
|
177
189
|
/**
|
|
178
190
|
* World packets - Mostly send out by the server
|
|
@@ -344,15 +356,44 @@ export type SystemMessagePacket = Message<"WorldPackets.SystemMessagePacket"> &
|
|
|
344
356
|
*/
|
|
345
357
|
message: string;
|
|
346
358
|
/**
|
|
347
|
-
* @generated from field:
|
|
359
|
+
* @generated from field: WorldPackets.SystemMessagePacket.Type type = 3;
|
|
360
|
+
*/
|
|
361
|
+
type: SystemMessagePacket_Type;
|
|
362
|
+
/**
|
|
363
|
+
* @generated from field: bool is_broadcast = 4;
|
|
364
|
+
*/
|
|
365
|
+
isBroadcast: boolean;
|
|
366
|
+
/**
|
|
367
|
+
* @generated from field: optional string icon = 5;
|
|
348
368
|
*/
|
|
349
|
-
|
|
369
|
+
icon?: string;
|
|
350
370
|
};
|
|
351
371
|
/**
|
|
352
372
|
* Describes the message WorldPackets.SystemMessagePacket.
|
|
353
373
|
* Use `create(SystemMessagePacketSchema)` to create a new message.
|
|
354
374
|
*/
|
|
355
375
|
export declare const SystemMessagePacketSchema: GenMessage<SystemMessagePacket>;
|
|
376
|
+
/**
|
|
377
|
+
* @generated from enum WorldPackets.SystemMessagePacket.Type
|
|
378
|
+
*/
|
|
379
|
+
export declare enum SystemMessagePacket_Type {
|
|
380
|
+
/**
|
|
381
|
+
* @generated from enum value: CHAT = 0;
|
|
382
|
+
*/
|
|
383
|
+
CHAT = 0,
|
|
384
|
+
/**
|
|
385
|
+
* @generated from enum value: TOAST = 1;
|
|
386
|
+
*/
|
|
387
|
+
TOAST = 1,
|
|
388
|
+
/**
|
|
389
|
+
* @generated from enum value: DIALOG = 2;
|
|
390
|
+
*/
|
|
391
|
+
DIALOG = 2
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Describes the enum WorldPackets.SystemMessagePacket.Type.
|
|
395
|
+
*/
|
|
396
|
+
export declare const SystemMessagePacket_TypeSchema: GenEnum<SystemMessagePacket_Type>;
|
|
356
397
|
/**
|
|
357
398
|
* @generated from message WorldPackets.OldChatMessagesPacket
|
|
358
399
|
*/
|
|
@@ -454,9 +495,23 @@ export declare const PlayerCounterTransactionPacketSchema: GenMessage<PlayerCoun
|
|
|
454
495
|
*/
|
|
455
496
|
export type WorldReloadedPacket = Message<"WorldPackets.WorldReloadedPacket"> & {
|
|
456
497
|
/**
|
|
457
|
-
*
|
|
498
|
+
* New structured world data format (same as PlayerInitPacket)
|
|
499
|
+
*
|
|
500
|
+
* @generated from field: repeated WorldPackets.BlockDataInfo block_data_palette = 1;
|
|
501
|
+
*/
|
|
502
|
+
blockDataPalette: BlockDataInfo[];
|
|
503
|
+
/**
|
|
504
|
+
* @generated from field: bytes background_layer_data = 2;
|
|
505
|
+
*/
|
|
506
|
+
backgroundLayerData: Uint8Array;
|
|
507
|
+
/**
|
|
508
|
+
* @generated from field: bytes foreground_layer_data = 3;
|
|
509
|
+
*/
|
|
510
|
+
foregroundLayerData: Uint8Array;
|
|
511
|
+
/**
|
|
512
|
+
* @generated from field: bytes overlay_layer_data = 4;
|
|
458
513
|
*/
|
|
459
|
-
|
|
514
|
+
overlayLayerData: Uint8Array;
|
|
460
515
|
};
|
|
461
516
|
/**
|
|
462
517
|
* Describes the message WorldPackets.WorldReloadedPacket.
|
|
@@ -474,6 +529,55 @@ export type WorldClearedPacket = Message<"WorldPackets.WorldClearedPacket"> & {}
|
|
|
474
529
|
* Use `create(WorldClearedPacketSchema)` to create a new message.
|
|
475
530
|
*/
|
|
476
531
|
export declare const WorldClearedPacketSchema: GenMessage<WorldClearedPacket>;
|
|
532
|
+
/**
|
|
533
|
+
* Block field value that can hold different types
|
|
534
|
+
*
|
|
535
|
+
* @generated from message WorldPackets.BlockFieldValue
|
|
536
|
+
*/
|
|
537
|
+
export type BlockFieldValue = Message<"WorldPackets.BlockFieldValue"> & {
|
|
538
|
+
/**
|
|
539
|
+
* @generated from oneof WorldPackets.BlockFieldValue.value
|
|
540
|
+
*/
|
|
541
|
+
value: {
|
|
542
|
+
/**
|
|
543
|
+
* @generated from field: int32 int32_value = 1;
|
|
544
|
+
*/
|
|
545
|
+
value: number;
|
|
546
|
+
case: "int32Value";
|
|
547
|
+
} | {
|
|
548
|
+
/**
|
|
549
|
+
* @generated from field: uint32 uint32_value = 2;
|
|
550
|
+
*/
|
|
551
|
+
value: number;
|
|
552
|
+
case: "uint32Value";
|
|
553
|
+
} | {
|
|
554
|
+
/**
|
|
555
|
+
* @generated from field: string string_value = 3;
|
|
556
|
+
*/
|
|
557
|
+
value: string;
|
|
558
|
+
case: "stringValue";
|
|
559
|
+
} | {
|
|
560
|
+
/**
|
|
561
|
+
* @generated from field: bool bool_value = 4;
|
|
562
|
+
*/
|
|
563
|
+
value: boolean;
|
|
564
|
+
case: "boolValue";
|
|
565
|
+
} | {
|
|
566
|
+
/**
|
|
567
|
+
* @generated from field: bytes byte_array_value = 5;
|
|
568
|
+
*/
|
|
569
|
+
value: Uint8Array;
|
|
570
|
+
case: "byteArrayValue";
|
|
571
|
+
} | {
|
|
572
|
+
case: undefined;
|
|
573
|
+
value?: undefined;
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
/**
|
|
577
|
+
* Describes the message WorldPackets.BlockFieldValue.
|
|
578
|
+
* Use `create(BlockFieldValueSchema)` to create a new message.
|
|
579
|
+
*/
|
|
580
|
+
export declare const BlockFieldValueSchema: GenMessage<BlockFieldValue>;
|
|
477
581
|
/**
|
|
478
582
|
* @generated from message WorldPackets.WorldBlockPlacedPacket
|
|
479
583
|
*/
|
|
@@ -497,11 +601,13 @@ export type WorldBlockPlacedPacket = Message<"WorldPackets.WorldBlockPlacedPacke
|
|
|
497
601
|
*/
|
|
498
602
|
blockId: number;
|
|
499
603
|
/**
|
|
500
|
-
*
|
|
604
|
+
* Structured block fields
|
|
501
605
|
*
|
|
502
|
-
* @generated from field:
|
|
606
|
+
* @generated from field: map<string, WorldPackets.BlockFieldValue> fields = 5;
|
|
503
607
|
*/
|
|
504
|
-
|
|
608
|
+
fields: {
|
|
609
|
+
[key: string]: BlockFieldValue;
|
|
610
|
+
};
|
|
505
611
|
};
|
|
506
612
|
/**
|
|
507
613
|
* Describes the message WorldPackets.WorldBlockPlacedPacket.
|
|
@@ -529,11 +635,13 @@ export type WorldBlockFilledPacket = Message<"WorldPackets.WorldBlockFilledPacke
|
|
|
529
635
|
*/
|
|
530
636
|
blockId: number;
|
|
531
637
|
/**
|
|
532
|
-
*
|
|
638
|
+
* Structured block fields
|
|
533
639
|
*
|
|
534
|
-
* @generated from field:
|
|
640
|
+
* @generated from field: map<string, WorldPackets.BlockFieldValue> fields = 5;
|
|
535
641
|
*/
|
|
536
|
-
|
|
642
|
+
fields: {
|
|
643
|
+
[key: string]: BlockFieldValue;
|
|
644
|
+
};
|
|
537
645
|
};
|
|
538
646
|
/**
|
|
539
647
|
* Describes the message WorldPackets.WorldBlockFilledPacket.
|
|
@@ -587,22 +695,70 @@ export type PlayerInitPacket = Message<"WorldPackets.PlayerInitPacket"> & {
|
|
|
587
695
|
* @generated from field: bytes global_switch_state = 5;
|
|
588
696
|
*/
|
|
589
697
|
globalSwitchState: Uint8Array;
|
|
590
|
-
/**
|
|
591
|
-
* @generated from field: bytes world_data = 6;
|
|
592
|
-
*/
|
|
593
|
-
worldData: Uint8Array;
|
|
594
698
|
/**
|
|
595
699
|
* Did player woot?
|
|
596
700
|
*
|
|
597
|
-
* @generated from field: WorldPackets.PlayerWoot player_woot =
|
|
701
|
+
* @generated from field: WorldPackets.PlayerWoot player_woot = 6;
|
|
598
702
|
*/
|
|
599
703
|
playerWoot?: PlayerWoot;
|
|
704
|
+
/**
|
|
705
|
+
* Text labels to display in the world
|
|
706
|
+
*
|
|
707
|
+
* @generated from field: repeated WorldPackets.TextLabel text_labels = 7;
|
|
708
|
+
*/
|
|
709
|
+
textLabels: TextLabel[];
|
|
710
|
+
/**
|
|
711
|
+
* Structured world data format
|
|
712
|
+
*
|
|
713
|
+
* @generated from field: repeated WorldPackets.BlockDataInfo block_data_palette = 8;
|
|
714
|
+
*/
|
|
715
|
+
blockDataPalette: BlockDataInfo[];
|
|
716
|
+
/**
|
|
717
|
+
* @generated from field: bytes background_layer_data = 9;
|
|
718
|
+
*/
|
|
719
|
+
backgroundLayerData: Uint8Array;
|
|
720
|
+
/**
|
|
721
|
+
* @generated from field: bytes foreground_layer_data = 10;
|
|
722
|
+
*/
|
|
723
|
+
foregroundLayerData: Uint8Array;
|
|
724
|
+
/**
|
|
725
|
+
* @generated from field: bytes overlay_layer_data = 11;
|
|
726
|
+
*/
|
|
727
|
+
overlayLayerData: Uint8Array;
|
|
728
|
+
/**
|
|
729
|
+
* Elapsed ticks since game started (100 ticks per second) - clients use this as reference point (0)
|
|
730
|
+
*
|
|
731
|
+
* @generated from field: int64 game_elapsed_time = 12;
|
|
732
|
+
*/
|
|
733
|
+
gameElapsedTime: bigint;
|
|
600
734
|
};
|
|
601
735
|
/**
|
|
602
736
|
* Describes the message WorldPackets.PlayerInitPacket.
|
|
603
737
|
* Use `create(PlayerInitPacketSchema)` to create a new message.
|
|
604
738
|
*/
|
|
605
739
|
export declare const PlayerInitPacketSchema: GenMessage<PlayerInitPacket>;
|
|
740
|
+
/**
|
|
741
|
+
* Information about a block data type for the palette
|
|
742
|
+
*
|
|
743
|
+
* @generated from message WorldPackets.BlockDataInfo
|
|
744
|
+
*/
|
|
745
|
+
export type BlockDataInfo = Message<"WorldPackets.BlockDataInfo"> & {
|
|
746
|
+
/**
|
|
747
|
+
* @generated from field: int32 block_id = 1;
|
|
748
|
+
*/
|
|
749
|
+
blockId: number;
|
|
750
|
+
/**
|
|
751
|
+
* @generated from field: map<string, WorldPackets.BlockFieldValue> fields = 2;
|
|
752
|
+
*/
|
|
753
|
+
fields: {
|
|
754
|
+
[key: string]: BlockFieldValue;
|
|
755
|
+
};
|
|
756
|
+
};
|
|
757
|
+
/**
|
|
758
|
+
* Describes the message WorldPackets.BlockDataInfo.
|
|
759
|
+
* Use `create(BlockDataInfoSchema)` to create a new message.
|
|
760
|
+
*/
|
|
761
|
+
export declare const BlockDataInfoSchema: GenMessage<BlockDataInfo>;
|
|
606
762
|
/**
|
|
607
763
|
* Pong back to the server that init has been done.
|
|
608
764
|
*
|
|
@@ -1169,6 +1325,35 @@ export type PlayerWoot = Message<"WorldPackets.PlayerWoot"> & {
|
|
|
1169
1325
|
* Use `create(PlayerWootSchema)` to create a new message.
|
|
1170
1326
|
*/
|
|
1171
1327
|
export declare const PlayerWootSchema: GenMessage<PlayerWoot>;
|
|
1328
|
+
/**
|
|
1329
|
+
* Empty - client requests current game ticks
|
|
1330
|
+
*
|
|
1331
|
+
* @generated from message WorldPackets.GameTicksSyncRequestPacket
|
|
1332
|
+
*/
|
|
1333
|
+
export type GameTicksSyncRequestPacket = Message<"WorldPackets.GameTicksSyncRequestPacket"> & {};
|
|
1334
|
+
/**
|
|
1335
|
+
* Describes the message WorldPackets.GameTicksSyncRequestPacket.
|
|
1336
|
+
* Use `create(GameTicksSyncRequestPacketSchema)` to create a new message.
|
|
1337
|
+
*/
|
|
1338
|
+
export declare const GameTicksSyncRequestPacketSchema: GenMessage<GameTicksSyncRequestPacket>;
|
|
1339
|
+
/**
|
|
1340
|
+
* @generated from message WorldPackets.GameTicksSyncResponsePacket
|
|
1341
|
+
*/
|
|
1342
|
+
export type GameTicksSyncResponsePacket = Message<"WorldPackets.GameTicksSyncResponsePacket"> & {
|
|
1343
|
+
/**
|
|
1344
|
+
* @generated from field: int64 game_elapsed_time = 1;
|
|
1345
|
+
*/
|
|
1346
|
+
gameElapsedTime: bigint;
|
|
1347
|
+
/**
|
|
1348
|
+
* @generated from field: bool is_paused = 2;
|
|
1349
|
+
*/
|
|
1350
|
+
isPaused: boolean;
|
|
1351
|
+
};
|
|
1352
|
+
/**
|
|
1353
|
+
* Describes the message WorldPackets.GameTicksSyncResponsePacket.
|
|
1354
|
+
* Use `create(GameTicksSyncResponsePacketSchema)` to create a new message.
|
|
1355
|
+
*/
|
|
1356
|
+
export declare const GameTicksSyncResponsePacketSchema: GenMessage<GameTicksSyncResponsePacket>;
|
|
1172
1357
|
/**
|
|
1173
1358
|
*
|
|
1174
1359
|
* ============================================
|
|
@@ -1349,11 +1534,27 @@ export type WorldMeta = Message<"WorldPackets.WorldMeta"> & {
|
|
|
1349
1534
|
*/
|
|
1350
1535
|
minimapEnabled: boolean;
|
|
1351
1536
|
/**
|
|
1352
|
-
* @generated from field: bool
|
|
1537
|
+
* @generated from field: bool minimap_scaled = 11;
|
|
1538
|
+
*/
|
|
1539
|
+
minimapScaled: boolean;
|
|
1540
|
+
/**
|
|
1541
|
+
* @generated from field: int32 minimap_max_width = 12;
|
|
1542
|
+
*/
|
|
1543
|
+
minimapMaxWidth: number;
|
|
1544
|
+
/**
|
|
1545
|
+
* @generated from field: int32 minimap_max_height = 13;
|
|
1546
|
+
*/
|
|
1547
|
+
minimapMaxHeight: number;
|
|
1548
|
+
/**
|
|
1549
|
+
* @generated from field: int32 minimap_edge_fade_width = 14;
|
|
1550
|
+
*/
|
|
1551
|
+
minimapEdgeFadeWidth: number;
|
|
1552
|
+
/**
|
|
1553
|
+
* @generated from field: bool has_secret_edit_key = 15;
|
|
1353
1554
|
*/
|
|
1354
1555
|
hasSecretEditKey: boolean;
|
|
1355
1556
|
/**
|
|
1356
|
-
* @generated from field: int32 woots =
|
|
1557
|
+
* @generated from field: int32 woots = 16;
|
|
1357
1558
|
*/
|
|
1358
1559
|
woots: number;
|
|
1359
1560
|
};
|
|
@@ -1476,3 +1677,68 @@ export type PlayerEffect = Message<"WorldPackets.PlayerEffect"> & {
|
|
|
1476
1677
|
* Use `create(PlayerEffectSchema)` to create a new message.
|
|
1477
1678
|
*/
|
|
1478
1679
|
export declare const PlayerEffectSchema: GenMessage<PlayerEffect>;
|
|
1680
|
+
/**
|
|
1681
|
+
*
|
|
1682
|
+
* Represents a text label.
|
|
1683
|
+
*
|
|
1684
|
+
* @generated from message WorldPackets.TextLabel
|
|
1685
|
+
*/
|
|
1686
|
+
export type TextLabel = Message<"WorldPackets.TextLabel"> & {
|
|
1687
|
+
/**
|
|
1688
|
+
* @generated from field: WorldPackets.PointInteger position = 1;
|
|
1689
|
+
*/
|
|
1690
|
+
position?: PointInteger;
|
|
1691
|
+
/**
|
|
1692
|
+
* @generated from field: string text = 2;
|
|
1693
|
+
*/
|
|
1694
|
+
text: string;
|
|
1695
|
+
/**
|
|
1696
|
+
* @generated from field: uint32 color = 3;
|
|
1697
|
+
*/
|
|
1698
|
+
color: number;
|
|
1699
|
+
/**
|
|
1700
|
+
* @generated from field: float max_width = 4;
|
|
1701
|
+
*/
|
|
1702
|
+
maxWidth: number;
|
|
1703
|
+
/**
|
|
1704
|
+
* @generated from field: bool shadow = 5;
|
|
1705
|
+
*/
|
|
1706
|
+
shadow: boolean;
|
|
1707
|
+
/**
|
|
1708
|
+
* @generated from field: WorldPackets.TextAlignment text_alignment = 6;
|
|
1709
|
+
*/
|
|
1710
|
+
textAlignment: TextAlignment;
|
|
1711
|
+
/**
|
|
1712
|
+
* @generated from field: int32 font_size = 7;
|
|
1713
|
+
*/
|
|
1714
|
+
fontSize: number;
|
|
1715
|
+
};
|
|
1716
|
+
/**
|
|
1717
|
+
* Describes the message WorldPackets.TextLabel.
|
|
1718
|
+
* Use `create(TextLabelSchema)` to create a new message.
|
|
1719
|
+
*/
|
|
1720
|
+
export declare const TextLabelSchema: GenMessage<TextLabel>;
|
|
1721
|
+
/**
|
|
1722
|
+
*
|
|
1723
|
+
* Text alignment options for TextLabel.
|
|
1724
|
+
*
|
|
1725
|
+
* @generated from enum WorldPackets.TextAlignment
|
|
1726
|
+
*/
|
|
1727
|
+
export declare enum TextAlignment {
|
|
1728
|
+
/**
|
|
1729
|
+
* @generated from enum value: LEFT = 0;
|
|
1730
|
+
*/
|
|
1731
|
+
LEFT = 0,
|
|
1732
|
+
/**
|
|
1733
|
+
* @generated from enum value: CENTER = 1;
|
|
1734
|
+
*/
|
|
1735
|
+
CENTER = 1,
|
|
1736
|
+
/**
|
|
1737
|
+
* @generated from enum value: RIGHT = 2;
|
|
1738
|
+
*/
|
|
1739
|
+
RIGHT = 2
|
|
1740
|
+
}
|
|
1741
|
+
/**
|
|
1742
|
+
* Describes the enum WorldPackets.TextAlignment.
|
|
1743
|
+
*/
|
|
1744
|
+
export declare const TextAlignmentSchema: GenEnum<TextAlignment>;
|