@utsp/core 0.9.0 → 0.10.0-nightly.20251213135145.115c488

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _utsp_types from '@utsp/types';
2
- import { ScalingModeValue, Vector2, AxisSource, ButtonSource, InputBindingLoadPacket, AxisBinding, ButtonBinding, SoundInstanceId, AudioConfigCommand, PlaySoundCommand, StopSoundCommand, FadeOutSoundCommand, PauseSoundCommand, ResumeSoundCommand, SetSoundEffectsCommand, IAudioProcessor, AudioAck, PostProcessConfig, PostProcessCommand, ScalingMode, GridConfig, SoundFormat, SoundLoadType, SoundLoadPacket, SoundExternalLoadPacket, UserRenderState } from '@utsp/types';
2
+ import { ScalingModeValue, Vector2, AxisSource, ButtonSource, InputBindingLoadPacket, AxisBinding, ButtonBinding, SoundInstanceId, AudioConfigCommand, PlaySoundCommand, StopSoundCommand, FadeOutSoundCommand, PauseSoundCommand, ResumeSoundCommand, SetSoundEffectsCommand, IAudioProcessor, VibrationPattern, GamepadVibrationOptions, GamepadVibrationCommand, IGamepadVibrationProcessor, MobileVibrationCommand, IMobileVibrationProcessor, AudioAck, PostProcessConfig, PostProcessCommand, ScalingMode, GridConfig, SoundFormat, SoundLoadType, SoundLoadPacket, SoundExternalLoadPacket, UserRenderState } from '@utsp/types';
3
3
  export { AxisBinding, AxisSource, ButtonBinding, ButtonSource, InputBindingLoadPacket, RenderState, RenderedCell, ScalingModeValue, UserRenderState, Vector2 } from '@utsp/types';
4
4
 
5
5
  /**
@@ -2341,6 +2341,167 @@ interface SetSoundEffectsOrder extends AudioOrder {
2341
2341
  */
2342
2342
  type AnyAudioOrder = PlaySoundOrder | PlayGlobalSoundOrder | StopSoundOrder | FadeOutSoundOrder | PauseSoundOrder | ResumeSoundOrder | SetListenerPositionOrder | ConfigureSpatialOrder | SetSoundEffectsOrder;
2343
2343
 
2344
+ /**
2345
+ * UTSP Vibration Order Types Enumeration
2346
+ *
2347
+ * Vibration orders handle both mobile and gamepad vibration feedback.
2348
+ * They are included in the UpdatePacket and processed by vibration processors on client.
2349
+ *
2350
+ * This enables tactile feedback synchronized with game events.
2351
+ *
2352
+ * @example
2353
+ * ```typescript
2354
+ * import { VibrationOrderType } from '@utsp/core';
2355
+ *
2356
+ * const order = { type: VibrationOrderType.MobileVibrate, pattern: [100, 50, 100] };
2357
+ * ```
2358
+ */
2359
+ declare enum VibrationOrderType {
2360
+ /**
2361
+ * 0x01 - MobileVibrate: Trigger a vibration pattern on mobile device
2362
+ *
2363
+ * Parameters: patternLength, pattern[], intensity?
2364
+ */
2365
+ MobileVibrate = 1,
2366
+ /**
2367
+ * 0x02 - MobileCancel: Stop any ongoing mobile vibration
2368
+ *
2369
+ * No parameters
2370
+ */
2371
+ MobileCancel = 2,
2372
+ /**
2373
+ * 0x10 - GamepadVibrate: Trigger dual-motor vibration on gamepad
2374
+ *
2375
+ * Parameters: gamepadIndex, duration, strongMagnitude, weakMagnitude, startDelay?
2376
+ */
2377
+ GamepadVibrate = 16,
2378
+ /**
2379
+ * 0x11 - GamepadCancel: Stop vibration on gamepad
2380
+ *
2381
+ * Parameters: gamepadIndex (0xFF = all)
2382
+ */
2383
+ GamepadCancel = 17
2384
+ }
2385
+
2386
+ /**
2387
+ * UTSP Vibration Orders
2388
+ *
2389
+ * Binary-encoded vibration commands included in UpdatePacket.
2390
+ * Supports both mobile vibration (pattern-based) and gamepad vibration (dual-motor).
2391
+ *
2392
+ * Each order has a specific binary structure optimized for network transmission.
2393
+ */
2394
+
2395
+ /**
2396
+ * Base interface for all vibration orders
2397
+ */
2398
+ interface VibrationOrder {
2399
+ /** Vibration order type identifier */
2400
+ type: VibrationOrderType;
2401
+ }
2402
+ /**
2403
+ * Flags for MobileVibrate order
2404
+ * Packed into a single byte to minimize bandwidth
2405
+ */
2406
+ declare enum MobileVibrateFlags {
2407
+ /** Intensity is specified (otherwise default 100%) */
2408
+ HasIntensity = 1
2409
+ }
2410
+ /**
2411
+ * 0x01 - MobileVibrate: Trigger a vibration pattern on mobile device
2412
+ *
2413
+ * Binary structure (variable size, 3-N bytes):
2414
+ * - type: 1 byte (0x01)
2415
+ * - flags: 1 byte (MobileVibrateFlags bitfield)
2416
+ * - patternLength: 1 byte (0-255, number of pattern entries)
2417
+ * - pattern: patternLength * 2 bytes (each entry is 0-65535 ms, big-endian)
2418
+ * - intensity?: 1 byte (0-255, maps to 0.0-1.0) - if HasIntensity
2419
+ *
2420
+ * Maximum pattern length: 255 entries (510 bytes)
2421
+ * Pattern represents alternating vibrate/pause durations in milliseconds
2422
+ */
2423
+ interface MobileVibrateOrder extends VibrationOrder {
2424
+ type: VibrationOrderType.MobileVibrate;
2425
+ /** Flags bitfield */
2426
+ flags: number;
2427
+ /** Vibration pattern (array of durations in ms) */
2428
+ pattern: number[];
2429
+ /** Intensity (0-255, maps to 0.0-1.0). Present if HasIntensity flag set */
2430
+ intensity?: number;
2431
+ }
2432
+ /**
2433
+ * 0x02 - MobileCancel: Stop any ongoing mobile vibration
2434
+ *
2435
+ * Binary structure (1 byte):
2436
+ * - type: 1 byte (0x02)
2437
+ */
2438
+ interface MobileCancelOrder extends VibrationOrder {
2439
+ type: VibrationOrderType.MobileCancel;
2440
+ }
2441
+ /**
2442
+ * Flags for GamepadVibrate order
2443
+ */
2444
+ declare enum GamepadVibrateFlags {
2445
+ /** Start delay is specified (otherwise 0) */
2446
+ HasStartDelay = 1,
2447
+ /** Target all gamepads (gamepadIndex ignored) */
2448
+ AllGamepads = 2
2449
+ }
2450
+ /**
2451
+ * 0x10 - GamepadVibrate: Trigger dual-motor vibration on gamepad
2452
+ *
2453
+ * Binary structure (6-8 bytes):
2454
+ * - type: 1 byte (0x10)
2455
+ * - flags: 1 byte (GamepadVibrateFlags bitfield)
2456
+ * - gamepadIndex: 1 byte (0-3, ignored if AllGamepads flag)
2457
+ * - duration: 2 bytes (0-65535 ms, big-endian)
2458
+ * - strongMagnitude: 1 byte (0-255, maps to 0.0-1.0)
2459
+ * - weakMagnitude: 1 byte (0-255, maps to 0.0-1.0)
2460
+ * - startDelay?: 2 bytes (0-65535 ms, big-endian) - if HasStartDelay
2461
+ */
2462
+ interface GamepadVibrateOrder extends VibrationOrder {
2463
+ type: VibrationOrderType.GamepadVibrate;
2464
+ /** Flags bitfield */
2465
+ flags: number;
2466
+ /** Gamepad index (0-3), or 0xFF for all */
2467
+ gamepadIndex: number;
2468
+ /** Duration in milliseconds */
2469
+ duration: number;
2470
+ /** Strong motor magnitude (0-255) */
2471
+ strongMagnitude: number;
2472
+ /** Weak motor magnitude (0-255) */
2473
+ weakMagnitude: number;
2474
+ /** Start delay in milliseconds (optional) */
2475
+ startDelay?: number;
2476
+ }
2477
+ /**
2478
+ * 0x11 - GamepadCancel: Stop vibration on gamepad
2479
+ *
2480
+ * Binary structure (3 bytes):
2481
+ * - type: 1 byte (0x11)
2482
+ * - flags: 1 byte (AllGamepads flag)
2483
+ * - gamepadIndex: 1 byte (0-3, or 0xFF for all)
2484
+ */
2485
+ interface GamepadCancelOrder extends VibrationOrder {
2486
+ type: VibrationOrderType.GamepadCancel;
2487
+ /** Flags bitfield */
2488
+ flags: number;
2489
+ /** Gamepad index (0-3), or 0xFF for all */
2490
+ gamepadIndex: number;
2491
+ }
2492
+ /**
2493
+ * Union type for mobile vibration orders
2494
+ */
2495
+ type MobileVibrationOrder = MobileVibrateOrder | MobileCancelOrder;
2496
+ /**
2497
+ * Union type for gamepad vibration orders
2498
+ */
2499
+ type GamepadVibrationOrder = GamepadVibrateOrder | GamepadCancelOrder;
2500
+ /**
2501
+ * Union type of all vibration orders
2502
+ */
2503
+ type AnyVibrationOrder = MobileVibrateOrder | MobileCancelOrder | GamepadVibrateOrder | GamepadCancelOrder;
2504
+
2344
2505
  /**
2345
2506
  * Network representation of a display
2346
2507
  * Layers are NO LONGER under displays - they are at User level
@@ -2575,11 +2736,12 @@ type AnyPostProcessOrder = SetConfigOrder | SetScanlinesOrder | SetAmbientEffect
2575
2736
  * - Displays: Viewport definitions
2576
2737
  * - Layers: Render orders for visual output
2577
2738
  * - Audio Orders: Audio commands synchronized with the frame
2739
+ * - Vibration Orders: Vibration commands (mobile + gamepad) synchronized with the frame
2578
2740
  * - Macro Orders: Macro instance commands (create, update, remove)
2579
2741
  * - PostProcess Orders: Visual effects commands (scanlines, ambient effect)
2580
2742
  *
2581
- * Audio and PostProcess orders are in the same packet as render orders to ensure
2582
- * perfect frame-level synchronization between visuals, sound, and effects.
2743
+ * Audio, Vibration, and PostProcess orders are in the same packet as render orders
2744
+ * to ensure perfect frame-level synchronization between visuals, sound, vibration, and effects.
2583
2745
  */
2584
2746
  interface UpdatePacket {
2585
2747
  /** Tick counter (8 bytes) */
@@ -2596,6 +2758,10 @@ interface UpdatePacket {
2596
2758
  audioOrderCount: number;
2597
2759
  /** List of audio orders (synchronized with this frame) */
2598
2760
  audioOrders: AnyAudioOrder[];
2761
+ /** Number of vibration orders (1 byte) */
2762
+ vibrationOrderCount: number;
2763
+ /** List of vibration orders (mobile + gamepad, synchronized with this frame) */
2764
+ vibrationOrders: AnyVibrationOrder[];
2599
2765
  /** Number of macro orders (1 byte) */
2600
2766
  macroOrderCount: number;
2601
2767
  /** List of macro orders (create, update, remove instances) */
@@ -3471,6 +3637,10 @@ declare class User<TData = Record<string, any>> {
3471
3637
  private loadedSounds;
3472
3638
  private soundLoadErrors;
3473
3639
  private playingSounds;
3640
+ private mobileVibrationCommands;
3641
+ private mobileVibrationProcessor?;
3642
+ private gamepadVibrationCommands;
3643
+ private gamepadVibrationProcessor?;
3474
3644
  private macroRegistry;
3475
3645
  private macroEngine;
3476
3646
  private macroEventHandlers;
@@ -4465,6 +4635,221 @@ declare class User<TData = Record<string, any>> {
4465
4635
  * @internal
4466
4636
  */
4467
4637
  applyAudioConfigCommands(commands: AudioConfigCommand[]): void;
4638
+ /**
4639
+ * Trigger a vibration on the user's device
4640
+ *
4641
+ * Vibration requires user interaction to be enabled (browser security).
4642
+ * If using autoplay: false, vibration will work after the first click.
4643
+ *
4644
+ * @param pattern - Duration in ms, or array of [vibrate, pause, vibrate, ...]
4645
+ *
4646
+ * @example
4647
+ * ```typescript
4648
+ * // Simple vibration (100ms)
4649
+ * user.vibrate(100);
4650
+ *
4651
+ * // Pattern: vibrate 100ms, pause 50ms, vibrate 100ms
4652
+ * user.vibrate([100, 50, 100]);
4653
+ *
4654
+ * // Use with game events
4655
+ * if (playerTookDamage) {
4656
+ * user.vibrate([50, 30, 100]); // Impact feedback
4657
+ * }
4658
+ * ```
4659
+ */
4660
+ vibrate(pattern: VibrationPattern): void;
4661
+ /**
4662
+ * Cancel any ongoing vibration
4663
+ *
4664
+ * @example
4665
+ * ```typescript
4666
+ * user.cancelVibration();
4667
+ * ```
4668
+ */
4669
+ cancelVibration(): void;
4670
+ /**
4671
+ * Light tap feedback - for button presses, selections
4672
+ */
4673
+ vibrateTap(): void;
4674
+ /**
4675
+ * Medium tap feedback
4676
+ */
4677
+ vibrateMediumTap(): void;
4678
+ /**
4679
+ * Heavy tap feedback - for important actions
4680
+ */
4681
+ vibrateHeavyTap(): void;
4682
+ /**
4683
+ * Success feedback - for completed actions
4684
+ */
4685
+ vibrateSuccess(): void;
4686
+ /**
4687
+ * Error feedback - for failed actions
4688
+ */
4689
+ vibrateError(): void;
4690
+ /**
4691
+ * Warning feedback - for important notices
4692
+ */
4693
+ vibrateWarning(): void;
4694
+ /**
4695
+ * Selection feedback - very light, for UI navigation
4696
+ */
4697
+ vibrateSelection(): void;
4698
+ /**
4699
+ * Impact feedback (light, medium, or heavy)
4700
+ *
4701
+ * @param intensity - 'light', 'medium', or 'heavy'
4702
+ */
4703
+ vibrateImpact(intensity?: 'light' | 'medium' | 'heavy'): void;
4704
+ /**
4705
+ * Notification feedback - attention-grabbing pattern
4706
+ */
4707
+ vibrateNotification(): void;
4708
+ /**
4709
+ * Vibrate a gamepad with dual-motor control
4710
+ *
4711
+ * Modern gamepads have two motors:
4712
+ * - Strong motor (low frequency): Heavy rumble, felt in the palm
4713
+ * - Weak motor (high frequency): Light vibration, felt in the fingers
4714
+ *
4715
+ * @param gamepadIndex - Gamepad index (0-3), or 'all' for all gamepads
4716
+ * @param options - Vibration options (duration, strongMagnitude, weakMagnitude)
4717
+ *
4718
+ * @example
4719
+ * ```typescript
4720
+ * // Strong rumble for 500ms on gamepad 0
4721
+ * user.vibrateGamepad(0, {
4722
+ * duration: 500,
4723
+ * strongMagnitude: 1.0,
4724
+ * weakMagnitude: 0.0,
4725
+ * });
4726
+ *
4727
+ * // Light vibration on all gamepads
4728
+ * user.vibrateGamepad('all', {
4729
+ * duration: 200,
4730
+ * strongMagnitude: 0.0,
4731
+ * weakMagnitude: 0.5,
4732
+ * });
4733
+ * ```
4734
+ */
4735
+ vibrateGamepad(gamepadIndex: number | 'all', options: GamepadVibrationOptions): void;
4736
+ /**
4737
+ * Stop vibration on a gamepad
4738
+ *
4739
+ * @param gamepadIndex - Gamepad index (0-3), or 'all' for all gamepads
4740
+ */
4741
+ stopGamepadVibration(gamepadIndex?: number | 'all'): void;
4742
+ /**
4743
+ * Quick rumble preset for gamepad - light tap
4744
+ */
4745
+ gamepadTap(gamepadIndex?: number | 'all'): void;
4746
+ /**
4747
+ * Quick rumble preset for gamepad - impact
4748
+ */
4749
+ gamepadImpact(gamepadIndex?: number | 'all'): void;
4750
+ /**
4751
+ * Quick rumble preset for gamepad - heavy rumble
4752
+ */
4753
+ gamepadHeavy(gamepadIndex?: number | 'all'): void;
4754
+ /**
4755
+ * Quick rumble preset for gamepad - explosion effect
4756
+ */
4757
+ gamepadExplosion(gamepadIndex?: number | 'all'): void;
4758
+ /**
4759
+ * Quick rumble preset for gamepad - success feedback
4760
+ */
4761
+ gamepadSuccess(gamepadIndex?: number | 'all'): void;
4762
+ /**
4763
+ * Quick rumble preset for gamepad - error feedback
4764
+ */
4765
+ gamepadError(gamepadIndex?: number | 'all'): void;
4766
+ /**
4767
+ * Check if there are pending gamepad vibration commands
4768
+ *
4769
+ * @returns true if there are commands to apply
4770
+ * @internal
4771
+ */
4772
+ hasGamepadVibrationCommands(): boolean;
4773
+ /**
4774
+ * Flush and return all pending gamepad vibration commands
4775
+ *
4776
+ * @returns Array of gamepad vibration commands
4777
+ * @internal
4778
+ */
4779
+ flushGamepadVibrationCommands(): GamepadVibrationCommand[];
4780
+ /**
4781
+ * Set the gamepad vibration processor for this user
4782
+ *
4783
+ * Called by ClientRuntime to inject the GamepadInputs instance.
4784
+ *
4785
+ * @param processor - The gamepad vibration processor
4786
+ * @internal
4787
+ */
4788
+ setGamepadVibrationProcessor(processor: IGamepadVibrationProcessor): void;
4789
+ /**
4790
+ * Apply gamepad vibration commands
4791
+ *
4792
+ * @param commands - Array of gamepad vibration commands
4793
+ * @internal
4794
+ */
4795
+ applyGamepadVibrationCommands(commands: GamepadVibrationCommand[]): void;
4796
+ /**
4797
+ * Check if there are pending mobile vibration commands
4798
+ *
4799
+ * @returns true if there are commands to apply
4800
+ * @internal
4801
+ */
4802
+ hasMobileVibrationCommands(): boolean;
4803
+ /**
4804
+ * Flush and return all pending mobile vibration commands
4805
+ *
4806
+ * @returns Array of mobile vibration commands
4807
+ * @internal
4808
+ */
4809
+ flushMobileVibrationCommands(): MobileVibrationCommand[];
4810
+ /**
4811
+ * Set the mobile vibration processor for this user
4812
+ *
4813
+ * Called by ClientRuntime to inject the MobileVibration instance.
4814
+ *
4815
+ * @param processor - The mobile vibration processor
4816
+ * @internal
4817
+ */
4818
+ setMobileVibrationProcessor(processor: IMobileVibrationProcessor): void;
4819
+ /**
4820
+ * Get the mobile vibration processor
4821
+ *
4822
+ * @returns The mobile vibration processor, or undefined if not set
4823
+ * @internal
4824
+ */
4825
+ getMobileVibrationProcessor(): IMobileVibrationProcessor | undefined;
4826
+ /**
4827
+ * Apply mobile vibration commands (vibrate/cancel)
4828
+ *
4829
+ * This is the unified entry point for mobile vibration feedback.
4830
+ * Vibrations are client-side only (no network transmission).
4831
+ *
4832
+ * @param commands - Array of mobile vibration commands
4833
+ * @internal
4834
+ */
4835
+ applyMobileVibrationCommands(commands: MobileVibrationCommand[]): void;
4836
+ /**
4837
+ * Apply vibration orders from an UpdatePacket (BINARY PROTOCOL)
4838
+ *
4839
+ * This method processes decoded vibration orders from the binary UpdatePacket.
4840
+ * Vibration orders are synchronized with the frame for perfect timing.
4841
+ * Supports both mobile vibration (pattern-based) and gamepad vibration (dual-motor).
4842
+ *
4843
+ * Order types:
4844
+ * - MobileVibrate: Trigger a vibration pattern on mobile device
4845
+ * - MobileCancel: Stop any ongoing mobile vibration
4846
+ * - GamepadVibrate: Trigger dual-motor vibration on gamepad
4847
+ * - GamepadCancel: Stop vibration on gamepad
4848
+ *
4849
+ * @param orders - Array of decoded vibration orders from UpdatePacket
4850
+ * @internal
4851
+ */
4852
+ applyVibrationOrders(orders: AnyVibrationOrder[]): void;
4468
4853
  /**
4469
4854
  * Apply audio orders from an UpdatePacket (BINARY PROTOCOL)
4470
4855
  *
@@ -5520,6 +5905,7 @@ declare class Core {
5520
5905
  private imageFontRegistry;
5521
5906
  private soundRegistry;
5522
5907
  private audioOrderCollector;
5908
+ private vibrationOrderCollector;
5523
5909
  private postProcessOrderCollector;
5524
5910
  private activeWebFontId;
5525
5911
  private _renderCallCount;
@@ -8296,6 +8682,7 @@ declare class UpdatePacketDecoder {
8296
8682
  private displayDecoder;
8297
8683
  private layerDecoder;
8298
8684
  private audioOrderDecoder;
8685
+ private vibrationOrderDecoder;
8299
8686
  private macroOrderDecoder;
8300
8687
  private postProcessOrderDecoder;
8301
8688
  constructor();
@@ -8310,12 +8697,14 @@ declare class UpdatePacketDecoder {
8310
8697
  * - Layers: variable (encoded layers)
8311
8698
  * - AudioOrderCount: 1 byte (max 255 audio orders)
8312
8699
  * - AudioOrders: variable (encoded audio orders)
8700
+ * - VibrationOrderCount: 1 byte (max 255 vibration orders)
8701
+ * - VibrationOrders: variable (encoded vibration orders - mobile + gamepad)
8313
8702
  * - MacroOrderCount: 1 byte (max 255 macro orders)
8314
8703
  * - MacroOrders: variable (encoded macro orders)
8315
8704
  * - PostProcessOrderCount: 1 byte (max 255 post-process orders)
8316
8705
  * - PostProcessOrders: variable (encoded post-process orders)
8317
8706
  *
8318
- * Minimum packet size: 14 bytes (Tick + DisplayCount + LayerCount + AudioOrderCount + MacroOrderCount + PostProcessOrderCount)
8707
+ * Minimum packet size: 15 bytes (Tick + DisplayCount + LayerCount + AudioOrderCount + VibrationOrderCount + MacroOrderCount + PostProcessOrderCount)
8319
8708
  */
8320
8709
  decode(data: Uint8Array, offset?: number): UpdatePacket;
8321
8710
  /**
@@ -8578,6 +8967,128 @@ declare class AudioOrderCollector {
8578
8967
  private encodeReverb;
8579
8968
  }
8580
8969
 
8970
+ /**
8971
+ * UTSP Vibration Order Decoder
8972
+ *
8973
+ * Decodes vibration orders (mobile + gamepad) from binary format received in UpdatePacket.
8974
+ * Vibration orders are processed by vibration processors on client.
8975
+ */
8976
+
8977
+ /**
8978
+ * Result of decoding a vibration order from a buffer
8979
+ */
8980
+ interface VibrationDecodeResult<T = AnyVibrationOrder> {
8981
+ order: T;
8982
+ bytesRead: number;
8983
+ }
8984
+ /**
8985
+ * Decoder for UTSP vibration orders
8986
+ * Converts binary buffers to vibration order interfaces
8987
+ */
8988
+ declare class VibrationOrderDecoder {
8989
+ /**
8990
+ * Main entry point - decodes any vibration order type from binary buffer
8991
+ * Returns the decoded order and the number of bytes consumed
8992
+ */
8993
+ decode(buffer: BufferCompat, offset?: number): VibrationDecodeResult;
8994
+ private decodeMobileVibrateOrder;
8995
+ private decodeMobileCancelOrder;
8996
+ private decodeGamepadVibrateOrder;
8997
+ private decodeGamepadCancelOrder;
8998
+ }
8999
+
9000
+ /**
9001
+ * VibrationOrderCollector - Converts high-level vibration commands to binary VibrationOrders
9002
+ *
9003
+ * This class bridges the gap between the User's high-level vibration API
9004
+ * (vibrate, vibrateGamepad, etc.) and the binary VibrationOrder protocol.
9005
+ *
9006
+ * It produces VibrationOrders ready for binary encoding in UpdatePacket.
9007
+ * Supports both mobile vibration (pattern-based) and gamepad vibration (dual-motor).
9008
+ *
9009
+ * @example
9010
+ * ```typescript
9011
+ * const collector = new VibrationOrderCollector();
9012
+ *
9013
+ * // Convert User's pending commands to orders
9014
+ * const vibrationOrders = collector.collectFromUser(user);
9015
+ *
9016
+ * // vibrationOrders can now be added to UpdatePacket
9017
+ * ```
9018
+ */
9019
+
9020
+ /**
9021
+ * Collects and converts vibration commands to binary VibrationOrders
9022
+ */
9023
+ declare class VibrationOrderCollector {
9024
+ /**
9025
+ * Collect all pending vibration orders from a user
9026
+ *
9027
+ * This flushes the user's vibration command queues (mobile + gamepad),
9028
+ * converts them to binary VibrationOrders, and returns them.
9029
+ *
9030
+ * @param user - The user to collect orders from
9031
+ * @returns Array of VibrationOrders ready for encoding
9032
+ */
9033
+ collectFromUser(user: User): AnyVibrationOrder[];
9034
+ /**
9035
+ * Convert a mobile vibration command to a VibrationOrder
9036
+ * Accepts both old format (without target) and new format (with target: 'mobile')
9037
+ */
9038
+ private convertMobileCommand;
9039
+ /**
9040
+ * Convert MobileVibrateCommand to MobileVibrateOrder
9041
+ * Accepts both old format { pattern, intensity? } and new format { target: 'mobile', pattern, intensity? }
9042
+ */
9043
+ private convertMobileVibrateCommand;
9044
+ /**
9045
+ * Convert MobileCancelVibrationCommand to MobileCancelOrder
9046
+ */
9047
+ private convertMobileCancelCommand;
9048
+ /**
9049
+ * Convert a gamepad vibration command to a VibrationOrder
9050
+ * Accepts both old format (without target) and new format (with target: 'gamepad')
9051
+ */
9052
+ private convertGamepadCommand;
9053
+ /**
9054
+ * Convert GamepadVibrateCommand to GamepadVibrateOrder
9055
+ */
9056
+ private convertGamepadVibrateCommand;
9057
+ /**
9058
+ * Convert GamepadCancelVibrationCommand to GamepadCancelOrder
9059
+ */
9060
+ private convertGamepadCancelCommand;
9061
+ }
9062
+
9063
+ /**
9064
+ * UTSP Vibration Order Encoder
9065
+ *
9066
+ * Encodes vibration orders (mobile + gamepad) to binary format for network transmission.
9067
+ * Vibration orders are included in UpdatePacket alongside render orders,
9068
+ * ensuring perfect synchronization at the frame level.
9069
+ */
9070
+
9071
+ /**
9072
+ * Encoder for UTSP vibration orders
9073
+ * Converts vibration order interfaces to binary buffers
9074
+ */
9075
+ declare class VibrationOrderEncoder {
9076
+ /**
9077
+ * Main entry point - encodes any vibration order type to binary buffer
9078
+ */
9079
+ encode(order: AnyVibrationOrder): Uint8Array;
9080
+ /**
9081
+ * Calculate the size of an encoded vibration order without encoding it
9082
+ */
9083
+ calculateSize(order: AnyVibrationOrder): number;
9084
+ private calculateMobileVibrateSize;
9085
+ private encodeMobileVibrateOrder;
9086
+ private encodeMobileCancelOrder;
9087
+ private calculateGamepadVibrateSize;
9088
+ private encodeGamepadVibrateOrder;
9089
+ private encodeGamepadCancelOrder;
9090
+ }
9091
+
8581
9092
  /**
8582
9093
  * UTSP Post-Process Order Decoder
8583
9094
  *
@@ -8683,5 +9194,5 @@ declare class PostProcessOrderCollector {
8683
9194
  private parseColor;
8684
9195
  }
8685
9196
 
8686
- export { ASCII_8X8_FONT, AUDIO_CONFIGURE_SPATIAL_SIZE, AUDIO_FADEOUT_SOUND_MIN_SIZE, AUDIO_PAUSE_SOUND_MIN_SIZE, AUDIO_PLAY_GLOBAL_SOUND_MIN_SIZE, AUDIO_PLAY_SOUND_MIN_SIZE, AUDIO_RESUME_SOUND_MIN_SIZE, AUDIO_SET_LISTENER_POSITION_SIZE, AUDIO_SET_SOUND_EFFECTS_MIN_SIZE, AUDIO_STOP_SOUND_MIN_SIZE, AudioOrderCollector, AudioOrderDecoder, AudioOrderType, AudioTargetType, BITMASK16_ORDER_MIN_SIZE, BITMASK4_ORDER_MIN_SIZE, BITMASK_ORDER_MIN_SIZE, BitmapFont, BitmapFontRegistry, CHAR_ORDER_SIZE, CIRCLE_SHAPE_SIZE, CLEAR_ORDER_SIZE, COLORMAP_ORDER_MIN_SIZE, COLOR_SKIP, CellBuffer, CharCodeBuffer, Core, CoreStats, DISPLAY_HEADER_SIZE, DOTCLOUD_MULTICOLOR_ORDER_MIN_SIZE, DOTCLOUD_ORDER_MIN_SIZE, Display, ELLIPSE_SHAPE_SIZE, FILLCHAR_ORDER_MIN_SIZE, FILLSPRITE_MULTICOLOR_ORDER_SIZE, FILLSPRITE_ORDER_SIZE, FULLFRAME_MULTICOLOR_ORDER_MIN_SIZE, FULLFRAME_ORDER_MIN_SIZE, FontType, ImageFont, ImageFontRegistry, InputBindingRegistry, LAYER_CELL_COUNT, LAYER_HEADER_SIZE, LAYER_SIZE, LINE_SHAPE_SIZE, Layer, LoadType, MacroEngine, MacroEventType, MacroOrderType, MacroRegistry, OrderBuilder, OrderType, POLYLINE_ORDER_MIN_SIZE, POSTPROCESS_SET_AMBIENT_EFFECT_SIZE, POSTPROCESS_SET_CONFIG_MIN_SIZE, POSTPROCESS_SET_GRID_SIZE, POSTPROCESS_SET_SCALING_MODE_SIZE, POSTPROCESS_SET_SCANLINES_SIZE, PlaySoundFlags, PostProcessOrderCollector, PostProcessOrderDecoder, PostProcessOrderType, RECTANGLE_SHAPE_SIZE, SHAPE_ORDER_MIN_SIZE, SPRITECLOUD_MULTICOLOR_ORDER_MIN_SIZE, SPRITECLOUD_ORDER_MIN_SIZE, SPRITECLOUD_VARIED_MULTICOLOR_ORDER_MIN_SIZE, SPRITECLOUD_VARIED_ORDER_MIN_SIZE, SPRITE_MULTICOLOR_ORDER_SIZE, SPRITE_ORDER_SIZE, SUBFRAME_MULTICOLOR_ORDER_MIN_SIZE, SUBFRAME_ORDER_MIN_SIZE, ShapeType, SoundEffectsFlags, SoundRegistry, SpriteRegistry, TEXT_MULTILINE_ORDER_MIN_SIZE, TEXT_ORDER_MIN_SIZE, TRIANGLE_SHAPE_SIZE, TRIGGERGLOBALSOUND_ORDER_SIZE, TRIGGERSOUND_ORDER_SIZE, UPDATE_PACKET_HEADER_SIZE, UpdateFlags, UpdateFlagsHelper, UpdatePacketDecoder, User, UserStats, WebFont, WebFontRegistry, charCodeByteSize, createASCII8x8FontLoad, createEmptyCompressedInputPacket, decodeCompressedInput, decodeInt8ToAxis, encodeAxisToInt8, encodeCompressedInput, getASCII8x8FontConfig, getAllCharCodes, getAtlasColumns, getAtlasDimensions, getAudioOrderTypeName, getButtonByteCount, getCharBitmap, getCompressedPacketSize, getMacroEventTypeName, getMacroOrderTypeName, getMaxCharCode, getOrderTypeName, hasChar, isValidAudioOrderType, isValidMacroEventType, isValidMacroOrderType, isValidOrderType };
8687
- export type { AnyAudioOrder, AnyLoad, AnyMacroEvent, AnyMacroOrder, AnyPostProcessOrder, AtlasBlocks, AudioOrder, BitmapFontConfig, BitmapFontLoad, Bitmask16Order, Bitmask16Variant, Bitmask4Order, Bitmask4Variant, BitmaskOrder, ButtonBorderStyle, ButtonConfig, ButtonStateColors, Cell, ChangeEvent, CharCodeMode, CircleShape, ClickEvent, Color, ColorPaletteLoad, CompressedInputPacket, ConfigureSpatialOrder, CoreMode, CoreOptions, CreateInstanceConfig, CreateInstanceOrder, EffectMacroTemplate, EffectTransform, EllipseShape, FadeOutSoundOrder, GlyphSize, ImageFontConfig, ImageFontLoad, ImageFontOptions, LineMacroTemplate, LineShape, MacroEntry, MacroEvent, MacroInstanceEntry, MacroLoad, MacroOrder, MacroTemplate, MacroTemplateBase, MacroType, MacroUpdateResult, MulticolorCell, MulticolorSprite, MulticolorSpriteLoad, NetworkDisplay, NetworkLayer, ParticleConfig, ParticleEmitter, ParticleMacroTemplate, PauseSoundOrder, PlayGlobalSoundOrder, PlaySoundOrder, RectangleShape, RemoveInstanceOrder, RenderCommand, ResumeSoundOrder, RevealCellDef, RevealContent, RevealContentType, RevealCursor, RevealDirection, RevealMacroTemplate, RevealPattern, RevealPause, SelectEvent, SetAmbientEffectOrder, SetConfigOrder, SetGridOrder, SetListenerPositionOrder, SetScalingModeOrder, SetScanlinesOrder, SetSoundEffectsOrder, ShapeData, SoundEntry, SoundLoad, SpriteLoad, StopSoundOrder, SubmitEvent, TickStats, TriangleShape, UIMacroTemplate, UIState, UISubtype, UnicolorSprite, UpdateInstanceOrder, UpdatePacket, UserTickStats, WebFontConfig, WebFontLoad };
9197
+ export { ASCII_8X8_FONT, AUDIO_CONFIGURE_SPATIAL_SIZE, AUDIO_FADEOUT_SOUND_MIN_SIZE, AUDIO_PAUSE_SOUND_MIN_SIZE, AUDIO_PLAY_GLOBAL_SOUND_MIN_SIZE, AUDIO_PLAY_SOUND_MIN_SIZE, AUDIO_RESUME_SOUND_MIN_SIZE, AUDIO_SET_LISTENER_POSITION_SIZE, AUDIO_SET_SOUND_EFFECTS_MIN_SIZE, AUDIO_STOP_SOUND_MIN_SIZE, AudioOrderCollector, AudioOrderDecoder, AudioOrderType, AudioTargetType, BITMASK16_ORDER_MIN_SIZE, BITMASK4_ORDER_MIN_SIZE, BITMASK_ORDER_MIN_SIZE, BitmapFont, BitmapFontRegistry, CHAR_ORDER_SIZE, CIRCLE_SHAPE_SIZE, CLEAR_ORDER_SIZE, COLORMAP_ORDER_MIN_SIZE, COLOR_SKIP, CellBuffer, CharCodeBuffer, Core, CoreStats, DISPLAY_HEADER_SIZE, DOTCLOUD_MULTICOLOR_ORDER_MIN_SIZE, DOTCLOUD_ORDER_MIN_SIZE, Display, ELLIPSE_SHAPE_SIZE, FILLCHAR_ORDER_MIN_SIZE, FILLSPRITE_MULTICOLOR_ORDER_SIZE, FILLSPRITE_ORDER_SIZE, FULLFRAME_MULTICOLOR_ORDER_MIN_SIZE, FULLFRAME_ORDER_MIN_SIZE, FontType, GamepadVibrateFlags, ImageFont, ImageFontRegistry, InputBindingRegistry, LAYER_CELL_COUNT, LAYER_HEADER_SIZE, LAYER_SIZE, LINE_SHAPE_SIZE, Layer, LoadType, MacroEngine, MacroEventType, MacroOrderType, MacroRegistry, MobileVibrateFlags, OrderBuilder, OrderType, POLYLINE_ORDER_MIN_SIZE, POSTPROCESS_SET_AMBIENT_EFFECT_SIZE, POSTPROCESS_SET_CONFIG_MIN_SIZE, POSTPROCESS_SET_GRID_SIZE, POSTPROCESS_SET_SCALING_MODE_SIZE, POSTPROCESS_SET_SCANLINES_SIZE, PlaySoundFlags, PostProcessOrderCollector, PostProcessOrderDecoder, PostProcessOrderType, RECTANGLE_SHAPE_SIZE, SHAPE_ORDER_MIN_SIZE, SPRITECLOUD_MULTICOLOR_ORDER_MIN_SIZE, SPRITECLOUD_ORDER_MIN_SIZE, SPRITECLOUD_VARIED_MULTICOLOR_ORDER_MIN_SIZE, SPRITECLOUD_VARIED_ORDER_MIN_SIZE, SPRITE_MULTICOLOR_ORDER_SIZE, SPRITE_ORDER_SIZE, SUBFRAME_MULTICOLOR_ORDER_MIN_SIZE, SUBFRAME_ORDER_MIN_SIZE, ShapeType, SoundEffectsFlags, SoundRegistry, SpriteRegistry, TEXT_MULTILINE_ORDER_MIN_SIZE, TEXT_ORDER_MIN_SIZE, TRIANGLE_SHAPE_SIZE, TRIGGERGLOBALSOUND_ORDER_SIZE, TRIGGERSOUND_ORDER_SIZE, UPDATE_PACKET_HEADER_SIZE, UpdateFlags, UpdateFlagsHelper, UpdatePacketDecoder, User, UserStats, VibrationOrderCollector, VibrationOrderDecoder, VibrationOrderEncoder, VibrationOrderType, WebFont, WebFontRegistry, charCodeByteSize, createASCII8x8FontLoad, createEmptyCompressedInputPacket, decodeCompressedInput, decodeInt8ToAxis, encodeAxisToInt8, encodeCompressedInput, getASCII8x8FontConfig, getAllCharCodes, getAtlasColumns, getAtlasDimensions, getAudioOrderTypeName, getButtonByteCount, getCharBitmap, getCompressedPacketSize, getMacroEventTypeName, getMacroOrderTypeName, getMaxCharCode, getOrderTypeName, hasChar, isValidAudioOrderType, isValidMacroEventType, isValidMacroOrderType, isValidOrderType };
9198
+ export type { AnyAudioOrder, AnyLoad, AnyMacroEvent, AnyMacroOrder, AnyPostProcessOrder, AnyVibrationOrder, AtlasBlocks, AudioOrder, BitmapFontConfig, BitmapFontLoad, Bitmask16Order, Bitmask16Variant, Bitmask4Order, Bitmask4Variant, BitmaskOrder, ButtonBorderStyle, ButtonConfig, ButtonStateColors, Cell, ChangeEvent, CharCodeMode, CircleShape, ClickEvent, Color, ColorPaletteLoad, CompressedInputPacket, ConfigureSpatialOrder, CoreMode, CoreOptions, CreateInstanceConfig, CreateInstanceOrder, EffectMacroTemplate, EffectTransform, EllipseShape, FadeOutSoundOrder, GamepadCancelOrder, GamepadVibrateOrder, GamepadVibrationOrder, GlyphSize, ImageFontConfig, ImageFontLoad, ImageFontOptions, LineMacroTemplate, LineShape, MacroEntry, MacroEvent, MacroInstanceEntry, MacroLoad, MacroOrder, MacroTemplate, MacroTemplateBase, MacroType, MacroUpdateResult, MobileCancelOrder, MobileVibrateOrder, MobileVibrationOrder, MulticolorCell, MulticolorSprite, MulticolorSpriteLoad, NetworkDisplay, NetworkLayer, ParticleConfig, ParticleEmitter, ParticleMacroTemplate, PauseSoundOrder, PlayGlobalSoundOrder, PlaySoundOrder, RectangleShape, RemoveInstanceOrder, RenderCommand, ResumeSoundOrder, RevealCellDef, RevealContent, RevealContentType, RevealCursor, RevealDirection, RevealMacroTemplate, RevealPattern, RevealPause, SelectEvent, SetAmbientEffectOrder, SetConfigOrder, SetGridOrder, SetListenerPositionOrder, SetScalingModeOrder, SetScanlinesOrder, SetSoundEffectsOrder, ShapeData, SoundEntry, SoundLoad, SpriteLoad, StopSoundOrder, SubmitEvent, TickStats, TriangleShape, UIMacroTemplate, UIState, UISubtype, UnicolorSprite, UpdateInstanceOrder, UpdatePacket, UserTickStats, VibrationOrder, WebFontConfig, WebFontLoad };