omegga 1.0.5 → 1.0.8

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.
@@ -66,7 +66,7 @@ export declare type EnvironmentPreset = Preset<"Environment", {
66
66
  starsIntensity?: number;
67
67
  starsColor?: BRColor;
68
68
  auroraIntensity?: number;
69
- weatherIntensity?: BRColor;
69
+ weatherIntensity?: number;
70
70
  rainSnow?: number;
71
71
  cloudCoverage?: number;
72
72
  cloudSpeedMultiplier?: number;
@@ -176,8 +176,9 @@ export declare type UnrealRotator = [
176
176
  number,
177
177
  number
178
178
  ];
179
- export declare type UnrealType = UnrealClass | UnrealObject | UnrealBoolean | UnrealFloat | UnrealColor | UnrealByte | UnrealRotator;
180
- export declare type UnrealTypeFromString<T> = T extends "Class" ? UnrealClass : T extends "Object" ? UnrealObject : T extends "Boolean" ? UnrealBoolean : T extends "Float" ? UnrealFloat : T extends "Color" ? UnrealColor : T extends "Byte" ? UnrealByte : T extends "Rotator" ? UnrealRotator : UnrealType;
179
+ export declare type UnrealString = string;
180
+ export declare type UnrealType = UnrealClass | UnrealObject | UnrealBoolean | UnrealFloat | UnrealColor | UnrealByte | UnrealRotator | UnrealString;
181
+ export declare type UnrealTypeFromString<T> = T extends "Class" ? UnrealClass : T extends "Object" ? UnrealObject : T extends "Boolean" ? UnrealBoolean : T extends "Float" ? UnrealFloat : T extends "Color" ? UnrealColor : T extends "Byte" ? UnrealByte : T extends "Rotator" ? UnrealRotator : T extends "String" ? UnrealString : UnrealType;
181
182
  export interface User {
182
183
  id: Uuid;
183
184
  name: string;
@@ -277,6 +278,8 @@ export declare type KnownComponents = {
277
278
  brick_indices?: number[];
278
279
  properties: {
279
280
  bPlayInteractSound: "Boolean";
281
+ Message: "String";
282
+ ConsoleTag: "String";
280
283
  };
281
284
  };
282
285
  BCD_AudioEmitter: {
@@ -414,6 +417,42 @@ declare function hsv(h: number | {
414
417
  s: number;
415
418
  v: number;
416
419
  }, s?: number, v?: number): number[];
420
+ export interface DebouncedFunc<T extends (...args: any[]) => any> {
421
+ /**
422
+ * Call the original function, but applying the debounce rules.
423
+ *
424
+ * If the debounced function can be run immediately, this calls it and returns its return
425
+ * value.
426
+ *
427
+ * Otherwise, it returns the return value of the last invocation, or undefined if the debounced
428
+ * function was not invoked yet.
429
+ */
430
+ (...args: Parameters<T>): ReturnType<T> | undefined;
431
+ /**
432
+ * Throw away any pending invocation of the debounced function.
433
+ */
434
+ cancel(): void;
435
+ /**
436
+ * If there is a pending invocation of the debounced function, invoke it immediately and return
437
+ * its return value.
438
+ *
439
+ * Otherwise, return the value from the last invocation, or undefined if the debounced function
440
+ * was never invoked.
441
+ */
442
+ flush(): ReturnType<T> | undefined;
443
+ }
444
+ export interface DebouncedFuncLeading<T extends (...args: any[]) => any> extends DebouncedFunc<T> {
445
+ (...args: Parameters<T>): ReturnType<T>;
446
+ flush(): ReturnType<T>;
447
+ }
448
+ export interface DebounceSettings {
449
+ leading?: boolean | undefined;
450
+ maxWait?: number | undefined;
451
+ trailing?: boolean | undefined;
452
+ }
453
+ export interface DebounceSettingsLeading extends DebounceSettings {
454
+ leading: true;
455
+ }
417
456
  declare function parseDuration(str: string): number;
418
457
  declare function parseBrickadiaTime(str: string): number;
419
458
  declare function brn2n(brName: string): string;
@@ -493,12 +532,13 @@ export declare const _OMEGGA_UTILS_IMPORT: {
493
532
  time: {
494
533
  parseDuration: typeof parseDuration;
495
534
  parseBrickadiaTime: typeof parseBrickadiaTime;
535
+ debounce: (<T_1 extends (...args: any) => any>(func: T_1, wait: number, options: DebounceSettingsLeading) => DebouncedFuncLeading<T_1>) | (<T_2 extends (...args: any) => any>(func: T_2, wait?: number, options?: DebounceSettings) => DebouncedFunc<T_2>);
496
536
  };
497
537
  map: {
498
538
  DEFAULT_MAPS: {
499
539
  name: string;
500
540
  brName: string;
501
- }[]; /** Brick name from catalog (Turkey Body, 4x Cube) */
541
+ }[];
502
542
  brn2n: typeof brn2n;
503
543
  n2brn: typeof n2brn;
504
544
  };
@@ -525,12 +565,12 @@ export declare const _OMEGGA_UTILS_IMPORT: {
525
565
  number
526
566
  ]>;
527
567
  };
528
- checkBounds: typeof checkBounds;
568
+ checkBounds: typeof checkBounds; /** message sent from a brick click interaction */
529
569
  getBounds: typeof getBounds;
530
570
  getBrickSize: typeof getBrickSize;
531
571
  getScaleAxis: typeof getScaleAxis;
532
572
  setOwnership: typeof setOwnership;
533
- rotate: typeof rotate;
573
+ rotate: typeof rotate; /** data parsed from the line (if it starts with json:) */
534
574
  rotate_x: typeof rotate_x;
535
575
  rotate_y: typeof rotate_y;
536
576
  rotate_z: typeof rotate_z;
@@ -548,13 +588,13 @@ export declare const _OMEGGA_UTILS_IMPORT: {
548
588
  }): Uint8Array;
549
589
  utils: any;
550
590
  constants: {
551
- MAGIC: Uint8Array; /**
552
- * True if the player is the host
553
- */
591
+ MAGIC: Uint8Array;
554
592
  LATEST_VERSION: number;
555
593
  MAX_INT: number;
556
594
  DEFAULT_UUID: string;
557
- };
595
+ }; /**
596
+ * Returns omegga
597
+ */
558
598
  };
559
599
  };
560
600
  declare global {
@@ -584,7 +624,7 @@ export interface BrickBounds {
584
624
  ];
585
625
  }
586
626
  /** Created when a player clicks on a brick with an interact component */
587
- export declare type BrickInteraction = {
627
+ export interface BrickInteraction {
588
628
  /** Brick name from catalog (Turkey Body, 4x Cube) */
589
629
  brick_name: string;
590
630
  /** Player information, id, name, controller, and pawn */
@@ -600,7 +640,15 @@ export declare type BrickInteraction = {
600
640
  number,
601
641
  number
602
642
  ];
603
- };
643
+ /** message sent from a brick click interaction */
644
+ message: string;
645
+ /** data parsed from the line (if it starts with json:) */
646
+ data: null | number | string | boolean | Record<string, unknown>;
647
+ /** True when there was a json payload */
648
+ json: boolean;
649
+ /** True when there was a parse error */
650
+ error: boolean;
651
+ }
604
652
  /** AutoRestart options */
605
653
  export declare type AutoRestartConfig = {
606
654
  players: boolean;
@@ -759,6 +807,27 @@ export interface OmeggaPlayer {
759
807
  * @param item Item name (Weapon_Bow)
760
808
  */
761
809
  takeItem(item: WeaponClass): void;
810
+ /**
811
+ * Changes a player's team
812
+ * @param teamIndex Team index
813
+ */
814
+ setTeam(teamIndex: number): void;
815
+ /**
816
+ * Changes a player's minigame
817
+ * @param index Minigame index
818
+ */
819
+ setMinigame(index: number): void;
820
+ /**
821
+ * Changes a player's score
822
+ * @param minigameIndex minigame index
823
+ * @param score Score
824
+ */
825
+ setScore(minigameIndex: number, score: number): void;
826
+ /**
827
+ * Fetch a player's score
828
+ * @param minigameIndex minigame index
829
+ */
830
+ getScore(minigameIndex: number): Promise<number>;
762
831
  }
763
832
  export interface StaticPlayer {
764
833
  /**
@@ -809,6 +878,35 @@ export interface StaticPlayer {
809
878
  * @param item Item name (Weapon_Bow)
810
879
  */
811
880
  takeItem(omegga: OmeggaLike, target: string | OmeggaPlayer, item: WeaponClass): void;
881
+ /**
882
+ * Changes a player's team
883
+ * @param omegga Omegga instance
884
+ * @param target Player or player name/id
885
+ * @param teamIndex Team name? index?
886
+ */
887
+ setTeam(omegga: OmeggaLike, target: string | OmeggaPlayer, teamIndex: number): void;
888
+ /**
889
+ * Changes a player's minigame
890
+ * @param omegga Omegga instance
891
+ * @param target Player or player name/id
892
+ * @param index Minigame index
893
+ */
894
+ setMinigame(omegga: OmeggaLike, target: string | OmeggaPlayer, index: number): void;
895
+ /**
896
+ * Changes a player's score
897
+ * @param omegga Omegga instance
898
+ * @param target Player or player name/id
899
+ * @param minigameIndex minigame index
900
+ * @param score Score
901
+ */
902
+ setScore(omegga: OmeggaLike, target: string | OmeggaPlayer, minigameIndex: number, score: number): void;
903
+ /**
904
+ * Fetches a player's score
905
+ * @param omegga Omegga instance
906
+ * @param target Player or player name/id
907
+ * @param minigameIndex minigame index
908
+ */
909
+ getScore(omegga: OmeggaLike, target: string | OmeggaPlayer, minigameIndex: number): Promise<number>;
812
910
  }
813
911
  export interface InjectedCommands {
814
912
  /** Get server status */
@@ -974,7 +1072,14 @@ export interface OmeggaCore {
974
1072
  * Save an environment preset
975
1073
  * @param presetName preset name
976
1074
  */
977
- saveEnvironment(presetName: string): void;
1075
+ saveEnvironment(presetName: string): Promise<void>;
1076
+ /** Save a temporary environment preset and return its contents */
1077
+ getEnvironmentData(): Promise<EnvironmentPreset>;
1078
+ /**
1079
+ * Read environment data as json
1080
+ * @param presetName preset name
1081
+ */
1082
+ readEnvironmentData(presetName: string): void;
978
1083
  /**
979
1084
  * Load an environment preset
980
1085
  * @param presetName preset name