hytopia 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/LICENSE.md +69 -0
  2. package/README.md +49 -0
  3. package/assets/audio/music/cave.mp3 +0 -0
  4. package/assets/audio/music/desert.mp3 +0 -0
  5. package/assets/audio/music/end.mp3 +0 -0
  6. package/assets/audio/music/jungle.mp3 +0 -0
  7. package/assets/audio/music/nether.mp3 +0 -0
  8. package/assets/audio/music/night.mp3 +0 -0
  9. package/assets/audio/music/night2.mp3 +0 -0
  10. package/assets/audio/music/overworld.mp3 +0 -0
  11. package/assets/audio/music/snow.mp3 +0 -0
  12. package/assets/audio/sfx/damage.wav +0 -0
  13. package/assets/cubemaps/skybox/+x.png +0 -0
  14. package/assets/cubemaps/skybox/+y.png +0 -0
  15. package/assets/cubemaps/skybox/+z.png +0 -0
  16. package/assets/cubemaps/skybox/-x.png +0 -0
  17. package/assets/cubemaps/skybox/-y.png +0 -0
  18. package/assets/cubemaps/skybox/-z.png +0 -0
  19. package/assets/models/player.gltf +1 -0
  20. package/assets/models/spider.gltf +1 -0
  21. package/assets/models/zombie.gltf +1 -0
  22. package/assets/textures/bricks.png +0 -0
  23. package/assets/textures/clay.png +0 -0
  24. package/assets/textures/diamond_ore.png +0 -0
  25. package/assets/textures/dirt.png +0 -0
  26. package/assets/textures/dragons_stone.png +0 -0
  27. package/assets/textures/glass.png +0 -0
  28. package/assets/textures/grass/+x.png +0 -0
  29. package/assets/textures/grass/+y.png +0 -0
  30. package/assets/textures/grass/+z.png +0 -0
  31. package/assets/textures/grass/-x.png +0 -0
  32. package/assets/textures/grass/-y.png +0 -0
  33. package/assets/textures/grass/-z.png +0 -0
  34. package/assets/textures/grass.png +0 -0
  35. package/assets/textures/gravel.png +0 -0
  36. package/assets/textures/ice.png +0 -0
  37. package/assets/textures/infected_shadowrock.png +0 -0
  38. package/assets/textures/log_side.png +0 -0
  39. package/assets/textures/log_top.png +0 -0
  40. package/assets/textures/mossy_coblestone.png +0 -0
  41. package/assets/textures/nuit.png +0 -0
  42. package/assets/textures/oak_leaves.png +0 -0
  43. package/assets/textures/oak_planks.png +0 -0
  44. package/assets/textures/sand.png +0 -0
  45. package/assets/textures/shadowrock.png +0 -0
  46. package/assets/textures/stone.png +0 -0
  47. package/assets/textures/stone_bricks.png +0 -0
  48. package/assets/textures/void_sand.png +0 -0
  49. package/assets/textures/water_still.png +0 -0
  50. package/docs/assets/banner.png +0 -0
  51. package/examples/payload/assets/world.json +7179 -0
  52. package/examples/payload/index.ts +0 -0
  53. package/examples/zombies/index.ts +0 -0
  54. package/package.json +51 -0
  55. package/server.d.ts +1120 -0
  56. package/server.js +269 -0
  57. package/tsdoc-metadata.json +11 -0
package/server.d.ts ADDED
@@ -0,0 +1,1120 @@
1
+ /// <reference types="node" />
2
+
3
+ import type { AnyPacket } from '@hytopia.com/server-protocol';
4
+ import type { IncomingMessage } from 'http';
5
+ import type { InputSchema } from '@hytopia.com/server-protocol';
6
+ import type { IPacket } from '@hytopia.com/server-protocol';
7
+ import protocol from '@hytopia.com/server-protocol';
8
+ import RAPIER from '@dimforge/rapier3d-compat';
9
+ import { SdpMatrix3 } from '@dimforge/rapier3d-compat';
10
+ import { Vector } from '@dimforge/rapier3d-compat';
11
+ import { WebSocket as WebSocket_2 } from 'ws';
12
+
13
+ export declare class Audio implements protocol.Serializable {
14
+ private _id;
15
+ private _attachedToEntity;
16
+ private _duration;
17
+ private _detune;
18
+ private _distortion;
19
+ private _loop;
20
+ private _offset;
21
+ private _position;
22
+ private _playbackRate;
23
+ private _playing;
24
+ private _referenceDistance;
25
+ private _startTick;
26
+ private _uri;
27
+ private _volume;
28
+ private _world;
29
+ constructor(audioData: AudioData);
30
+ get id(): number | undefined;
31
+ get attachedToEntity(): Entity | undefined;
32
+ get duration(): number | undefined;
33
+ get detune(): number | undefined;
34
+ get distortion(): number | undefined;
35
+ get loop(): boolean;
36
+ get offset(): number | undefined;
37
+ get isLoaded(): boolean;
38
+ get isPlaying(): boolean;
39
+ get isPositional(): boolean;
40
+ get position(): Vector3 | undefined;
41
+ get playbackRate(): number | undefined;
42
+ get referenceDistance(): number | undefined;
43
+ get startTick(): number | undefined;
44
+ get uri(): string;
45
+ get volume(): number | undefined;
46
+ get world(): World | undefined;
47
+ play(world: World, restart?: boolean): void;
48
+ pause(): void;
49
+ setAttachedToEntity(entity: Entity): void;
50
+ setDetune(detune: number): void;
51
+ setDistortion(distortion: number): void;
52
+ setPosition(position: Vector3): void;
53
+ setPlaybackRate(playbackRate: number): void;
54
+ setReferenceDistance(referenceDistance: number): void;
55
+ setVolume(volume: number): void;
56
+ serialize(): protocol.AudioSchema;
57
+ private _requirePositional;
58
+ }
59
+
60
+ export declare interface AudioData {
61
+ attachedToEntity?: Entity;
62
+ duration?: number;
63
+ detune?: number;
64
+ distortion?: number;
65
+ loop?: boolean;
66
+ offset?: number;
67
+ position?: Vector3;
68
+ playbackRate?: number;
69
+ referenceDistance?: number;
70
+ uri: string;
71
+ volume?: number;
72
+ }
73
+
74
+ export declare namespace AudioEventPayload {
75
+ export interface Pause {
76
+ audio: Audio;
77
+ }
78
+ export interface Play {
79
+ audio: Audio;
80
+ }
81
+ export interface PlayRestart {
82
+ audio: Audio;
83
+ }
84
+ export interface SetAttachedToEntity {
85
+ audio: Audio;
86
+ entity: Entity | undefined;
87
+ }
88
+ export interface SetDetune {
89
+ audio: Audio;
90
+ detune: number;
91
+ }
92
+ export interface SetDistortion {
93
+ audio: Audio;
94
+ distortion: number;
95
+ }
96
+ export interface SetPosition {
97
+ audio: Audio;
98
+ position: Vector3;
99
+ }
100
+ export interface SetPlaybackRate {
101
+ audio: Audio;
102
+ playbackRate: number;
103
+ }
104
+ export interface SetReferenceDistance {
105
+ audio: Audio;
106
+ referenceDistance: number;
107
+ }
108
+ export interface SetVolume {
109
+ audio: Audio;
110
+ volume: number;
111
+ }
112
+ }
113
+
114
+ export declare enum AudioEventType {
115
+ PAUSE = "AUDIO.PAUSE",
116
+ PLAY = "AUDIO.PLAY",
117
+ PLAY_RESTART = "AUDIO.PLAY_RESTART",
118
+ SET_ATTACHED_TO_ENTITY = "AUDIO.SET_ATTACHED_TO_ENTITY",
119
+ SET_DETUNE = "AUDIO.SET_DETUNE",
120
+ SET_DISTORTION = "AUDIO.SET_DISTORTION",
121
+ SET_POSITION = "AUDIO.SET_POSITION",
122
+ SET_PLAYBACK_RATE = "AUDIO.SET_PLAYBACK_RATE",
123
+ SET_REFERENCE_DISTANCE = "AUDIO.SET_REFERENCE_DISTANCE",
124
+ SET_VOLUME = "AUDIO.SET_VOLUME"
125
+ }
126
+
127
+ export declare class AudioManager {
128
+ private _audios;
129
+ private _nextAudioId;
130
+ private _world;
131
+ constructor(world: World);
132
+ get world(): World;
133
+ registerAudio(audio: Audio): number;
134
+ unregisterAudio(audio: Audio): void;
135
+ getAllAudios(): Audio[];
136
+ getAllEntityAttachedAudios(entity: Entity): Audio[];
137
+ getAllLoopedAudios(): Audio[];
138
+ getAllOneshotAudios(): Audio[];
139
+ }
140
+
141
+ export declare class BaseCharacterController {
142
+ readonly entity: Entity;
143
+ onTickPlayerMovement?: (inputState: PlayerInputState, orientationState: PlayerOrientationState, deltaTimeMs: number) => void;
144
+ onTickPathfindingMovement?: (destination: Vector3, deltaTimeMs: number) => void;
145
+ constructor(entity: Entity, _options?: Record<string, unknown>);
146
+ createSensorColliders(): Collider[];
147
+ tickPlayerMovement(inputState: PlayerInputState, orientationState: PlayerOrientationState, deltaTimeMs: number): void;
148
+ tickPathfindingMovement(destination: Vector3, deltaTimeMs: number): void;
149
+ }
150
+
151
+ export declare class Block {
152
+ readonly globalCoordinate: Vector3;
153
+ readonly blockType: BlockType;
154
+ constructor(coordinate: Vector3, blockType: BlockType);
155
+ static fromGlobalCoordinate(globalCoordinate: Vector3, blockType: BlockType): Block;
156
+ }
157
+
158
+ export declare class BlockType implements protocol.Serializable {
159
+ onEntityCollision?: (this: BlockType, entity: Entity, started: boolean) => void;
160
+ onEntityContactForce?: (this: BlockType, entity: Entity, contactForceData: ContactForceData) => void;
161
+ private readonly _id;
162
+ private _textureUri;
163
+ private _name;
164
+ private _customColliderOptions;
165
+ private _isSolid;
166
+ private _world;
167
+ constructor(world: World, blockTypeData?: BlockTypeData);
168
+ get id(): number;
169
+ get colliderOptions(): ColliderOptions;
170
+ get textureUri(): string;
171
+ get name(): string;
172
+ get world(): World;
173
+ get isSolid(): boolean;
174
+ get isMeshable(): boolean;
175
+ createCollider(halfExtents?: Vector3): Collider;
176
+ serialize(): protocol.BlockTypeSchema;
177
+ }
178
+
179
+ export declare interface BlockTypeData {
180
+ id: number;
181
+ textureUri: string;
182
+ name: string;
183
+ customColliderOptions?: ColliderOptions;
184
+ isSolid?: boolean;
185
+ }
186
+
187
+ export declare class BlockTypeRegistry implements protocol.Serializable {
188
+ private _blockTypes;
189
+ private _world;
190
+ constructor(world: World);
191
+ get world(): World;
192
+ getAllBlockTypes(): BlockType[];
193
+ getBlockType(id: number): BlockType;
194
+ registerGenericBlockType(blockTypeData: BlockTypeData): BlockType;
195
+ registerBlockType(id: number, blockTypeReference: BlockType): void;
196
+ serialize(): protocol.BlockTypesSchema;
197
+ }
198
+
199
+ export declare namespace BlockTypeRegistryEventPayload {
200
+ export interface RegisterBlockType {
201
+ blockTypeRegistry: BlockTypeRegistry;
202
+ id: number;
203
+ blockType: BlockType;
204
+ }
205
+ }
206
+
207
+ export declare enum BlockTypeRegistryEventType {
208
+ REGISTER_BLOCK_TYPE = "BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE"
209
+ }
210
+
211
+ export declare namespace ChatEventPayload {
212
+ export interface SendBroadcastMessage {
213
+ message: string;
214
+ color?: string;
215
+ }
216
+ export interface SendPlayerMessage {
217
+ player: Player;
218
+ message: string;
219
+ color?: string;
220
+ }
221
+ }
222
+
223
+ export declare enum ChatEventType {
224
+ SEND_BROADCAST_MESSAGE = "CHAT.SEND_BROADCAST_MESSAGE",
225
+ SEND_PLAYER_MESSAGE = "CHAT.SEND_PLAYER_MESSAGE"
226
+ }
227
+
228
+ export declare class ChatManager {
229
+ private _commandCallbacks;
230
+ private _world;
231
+ constructor(world: World);
232
+ registerCommand(command: string, callback: CommandCallback): void;
233
+ unregisterCommand(command: string): void;
234
+ sendBroadcastMessage(message: string, color?: string): void;
235
+ sendPlayerMessage(player: Player, message: string, color?: string): void;
236
+ private _subscribeToPlayerEvents;
237
+ private _onPlayerChatMessage;
238
+ }
239
+
240
+ export declare class Chunk implements protocol.Serializable {
241
+ private _blocks;
242
+ private _originCoordinate;
243
+ private _requiresUpdate;
244
+ private _rigidBody;
245
+ private _world;
246
+ constructor();
247
+ get blocks(): Readonly<Uint8Array>;
248
+ get requiresUpdate(): boolean;
249
+ get isSimulated(): boolean;
250
+ get isSpawned(): boolean;
251
+ get originCoordinate(): Vector3 | undefined;
252
+ get world(): World | undefined;
253
+ static blockIndexToLocalCoordinate(index: number): Vector3;
254
+ static globalCoordinateToLocalCoordinate(globalCoordinate: Vector3): Vector3;
255
+ static globalCoordinateToOriginCoordinate(globalCoordinate: Vector3): Vector3;
256
+ static isValidOriginCoordinate(coordinate: Vector3): boolean;
257
+ spawn(world: World, originCoordinate: Vector3): void;
258
+ despawn(): void;
259
+ setBlock(localCoordinate: Vector3, blockTypeId: number): void;
260
+ update(): void;
261
+ serialize(): protocol.ChunkSchema;
262
+ private _meshColliders;
263
+ private _removeFromSimulation;
264
+ private _getGlobalCoordinate;
265
+ private _getIndex;
266
+ private _isValidLocalCoordinate;
267
+ }
268
+
269
+ export declare namespace ChunkEventPayload {
270
+ export interface Despawn {
271
+ chunk: Chunk;
272
+ }
273
+ export interface SetBlock {
274
+ chunk: Chunk;
275
+ globalCoordinate: Vector3;
276
+ localCoordinate: Vector3;
277
+ blockTypeId: number;
278
+ }
279
+ export interface Spawn {
280
+ chunk: Chunk;
281
+ }
282
+ }
283
+
284
+ export declare enum ChunkEventType {
285
+ DESPAWN = "CHUNK.DESPAWN",
286
+ SET_BLOCK = "CHUNK.SET_BLOCK",
287
+ SPAWN = "CHUNK.SPAWN"
288
+ }
289
+
290
+ export declare class ChunkLattice {
291
+ private _chunks;
292
+ private _world;
293
+ constructor(world: World);
294
+ registerChunk(chunk: Chunk): void;
295
+ unregisterChunk(chunk: Chunk): void;
296
+ getChunk(originCoordinate: Vector3): Chunk | undefined;
297
+ getAllChunks(): Chunk[];
298
+ hasChunk(originCoordinate: Vector3): boolean;
299
+ setBlock(globalCoordinate: Vector3, blockTypeId: number): void;
300
+ updateChunks(): void;
301
+ private _getChunkKey;
302
+ }
303
+
304
+ export declare class Collider {
305
+ private _collider;
306
+ private _colliderDesc;
307
+ private _onCollision;
308
+ private _parentRigidBody;
309
+ private _simulation;
310
+ private _tag;
311
+ constructor(colliderOptions: ColliderOptions);
312
+ get isEnabled(): boolean;
313
+ get isRemoved(): boolean;
314
+ get isSensor(): boolean;
315
+ get isSimulated(): boolean;
316
+ get parentRigidBody(): RigidBody | undefined;
317
+ get rawCollider(): RAPIER.Collider | undefined;
318
+ get tag(): string | undefined;
319
+ getCollisionGroups(): CollisionGroups;
320
+ getFriction(): number;
321
+ getRestitution(): number;
322
+ getRelativeRotation(): Rotation;
323
+ getRelativeTranslation(): Vector3;
324
+ setBounciness(bounciness: number): void;
325
+ setOnCollision(callback: CollisionCallback | undefined): void;
326
+ setCollisionGroups(collisionGroups: CollisionGroups): void;
327
+ setEnabled(enabled: boolean): void;
328
+ setFriction(friction: number): void;
329
+ setMass(mass: number): void;
330
+ setRelativeRotation(rotation: Rotation): void;
331
+ setRelativeTranslation(translation: Vector3): void;
332
+ setSensor(sensor: boolean): void;
333
+ setTag(tag: string): void;
334
+ addToSimulation(simulation: Simulation, parentRigidBody?: RigidBody): void;
335
+ enableCollisionEvents(enabled: boolean): void;
336
+ enableContactForceEvents(enabled: boolean): void;
337
+ removeFromSimulation(): void;
338
+ private _applyColliderOptions;
339
+ private _autoAddToSimulation;
340
+ private _createColliderDesc;
341
+ private _requireNotRemoved;
342
+ private _setActiveCollisionTypes;
343
+ }
344
+
345
+ export declare class ColliderMap {
346
+ private _rawColliderBlockTypeMap;
347
+ private _rawColliderCollisionCallbackMap;
348
+ private _rawRigidBodyEntityMap;
349
+ getRawColliderBlockType(collider: RAPIER.Collider): BlockType | undefined;
350
+ getColliderBlockType(collider: Collider): BlockType | undefined;
351
+ setColliderBlockType(collider: Collider, block: BlockType): void;
352
+ removeColliderBlockType(collider: Collider): void;
353
+ getRawColliderCollisionCallback(collider: RAPIER.Collider): CollisionCallback | undefined;
354
+ getColliderCollisionCallback(collider: Collider): CollisionCallback | undefined;
355
+ setColliderCollisionCallback(collider: Collider, callback: CollisionCallback): void;
356
+ removeColliderCollisionCallback(collider: Collider): void;
357
+ getRawRigidBodyEntity(rigidBody: RAPIER.RigidBody): Entity | undefined;
358
+ setRawRigidBodyEntity(rigidBody: RAPIER.RigidBody, entity: Entity): void;
359
+ removeRawRigidBodyEntity(rigidBody: RAPIER.RigidBody): void;
360
+ private _requireSimulatedCollider;
361
+ private _requireSimulatedRigidBody;
362
+ }
363
+
364
+ export declare interface ColliderOptions {
365
+ shape: ColliderShape;
366
+ borderRadius?: number;
367
+ bounciness?: number;
368
+ collisionGroups?: CollisionGroups;
369
+ enabled?: boolean;
370
+ friction?: number;
371
+ halfExtents?: Vector3;
372
+ halfHeight?: number;
373
+ isSensor?: boolean;
374
+ mass?: number;
375
+ onCollision?: CollisionCallback;
376
+ parentRigidBody?: RigidBody;
377
+ radius?: number;
378
+ relativeRotation?: Rotation;
379
+ relativeTranslation?: Vector3;
380
+ simulation?: Simulation;
381
+ tag?: string;
382
+ }
383
+
384
+ export declare enum ColliderShape {
385
+ BALL = "ball",
386
+ BLOCK = "block",
387
+ CAPSULE = "capsule",
388
+ CONE = "cone",
389
+ CYLINDER = "cylinder",
390
+ ROUND_CYLINDER = "round-cylinder"
391
+ }
392
+
393
+ export declare type CollisionCallback = (other: BlockType | Entity, started: boolean) => void;
394
+
395
+ export declare enum CollisionGroup {
396
+ BLOCK = 1,
397
+ ENTITY = 2,
398
+ ENTITY_SENSOR = 4,
399
+ PLAYER = 8,
400
+ ALL = 65535
401
+ }
402
+
403
+ export declare type CollisionGroups = {
404
+ belongsTo: CollisionGroup[];
405
+ collidesWith: CollisionGroup[];
406
+ };
407
+
408
+ export declare class CollisionGroupsBuilder {
409
+ private static readonly BELONGS_TO_SHIFT;
410
+ private static readonly COLLIDES_WITH_MASK;
411
+ static buildRawCollisionGroups(collisionGroups: CollisionGroups): RawCollisionGroups;
412
+ static decodeRawCollisionGroups(groups: RawCollisionGroups): CollisionGroups;
413
+ static decodeCollisionGroups(collisionGroups: CollisionGroups): DecodedCollisionGroups;
414
+ static isDefaultCollisionGroups(collisionGroups: CollisionGroups): boolean;
415
+ private static combineGroups;
416
+ private static bitsToGroups;
417
+ private static groupToName;
418
+ }
419
+
420
+ export declare type CollisionObject = BlockType | Entity | CollisionCallback;
421
+
422
+ export declare type CommandCallback = (player: Player, args: string[], message: string) => void;
423
+
424
+ declare class Connection {
425
+ private _ws;
426
+ readonly id: string;
427
+ constructor(ws: WebSocket_2, req: IncomingMessage);
428
+ send(packet: AnyPacket): void;
429
+ close(): void;
430
+ on<TConnectionEventPayload>(event: ConnectionEventType, callback: (payload: TConnectionEventPayload) => void): void;
431
+ onPacket<T extends AnyPacket>(id: T[0], callback: (packet: T) => void): void;
432
+ off<TConnectionEventPayload>(event: ConnectionEventType, callback: (payload: TConnectionEventPayload) => void): void;
433
+ offAll(): void;
434
+ offPacket<T extends AnyPacket>(id: T[0], callback: (packet: T) => void): void;
435
+ private _onClose;
436
+ private _onError;
437
+ private _onMessage;
438
+ private _serialize;
439
+ private _deserialize;
440
+ private _instanceEventType;
441
+ }
442
+
443
+ declare enum ConnectionEventType {
444
+ OPENED = "CONNECTION.OPENED",
445
+ CLOSED = "CONNECTION.CLOSED",
446
+ PACKET_RECEIVED = "CONNECTION.PACKET_RECEIVED",
447
+ PACKET_SENT = "CONNECTION.PACKET_SENT",
448
+ ERROR = "CONNECTION.ERROR"
449
+ }
450
+
451
+ declare type ContactForceData = {
452
+ totalForce: RAPIER.Vector;
453
+ totalForceMagnitude: number;
454
+ maxForceDirection: RAPIER.Vector;
455
+ maxForceMagnitude: number;
456
+ };
457
+
458
+ export declare type DecodedCollisionGroups = {
459
+ belongsTo: string[];
460
+ collidesWith: string[];
461
+ };
462
+
463
+ export declare const DEFAULT_ENTITY_RIGID_BODY_OPTIONS: RigidBodyOptions;
464
+
465
+ export declare class DefaultCharacterController extends BaseCharacterController {
466
+ jumpVelocity: number;
467
+ runVelocity: number;
468
+ walkVelocity: number;
469
+ canWalk: (this: DefaultCharacterController) => boolean;
470
+ canRun: (this: DefaultCharacterController) => boolean;
471
+ canJump: (this: DefaultCharacterController) => boolean;
472
+ private _stepAudio;
473
+ private _groundContactCount;
474
+ private _platform;
475
+ constructor(entity: Entity, options?: DefaultCharacterControllerOptions);
476
+ get isGrounded(): boolean;
477
+ get isOnPlatform(): boolean;
478
+ get platform(): Entity | undefined;
479
+ createSensorColliders(): Collider[];
480
+ tickPlayerMovement(inputState: PlayerInputState, orientationState: PlayerOrientationState, deltaTimeMs: number): void;
481
+ tickPathfindingMovement(destination: Vector3, deltaTimeMs: number): void;
482
+ }
483
+
484
+ export declare interface DefaultCharacterControllerOptions {
485
+ jumpVelocity?: number;
486
+ runVelocity?: number;
487
+ walkVelocity?: number;
488
+ canJump?: () => boolean;
489
+ canWalk?: () => boolean;
490
+ canRun?: () => boolean;
491
+ }
492
+
493
+ export declare class Entity extends RigidBody implements protocol.Serializable {
494
+ createCustomCharacterController?: (this: Entity) => BaseCharacterController;
495
+ onBlockCollision?: (this: Entity, block: BlockType, started: boolean) => void;
496
+ onBlockContactForce?: (this: Entity, block: BlockType, contactForceData: ContactForceData) => void;
497
+ onEntityCollision?: (this: Entity, entity: Entity, started: boolean) => void;
498
+ onEntityContactForce?: (this: Entity, entity: Entity, contactForceData: ContactForceData) => void;
499
+ onSpawn?: (this: Entity) => void;
500
+ onDespawn?: (this: Entity) => void;
501
+ onTick?: (this: Entity, tickDeltaMs: number) => void;
502
+ private _id;
503
+ private _modelUri;
504
+ private _modelLoopedAnimations;
505
+ private _modelOneshotAnimations;
506
+ private _modelScale;
507
+ private _name;
508
+ private _characterController;
509
+ private _lastUpdatedRotation;
510
+ private _lastUpdatedTranslation;
511
+ private _world;
512
+ constructor(options: EntityOptions);
513
+ get id(): number | undefined;
514
+ get modelUri(): string | undefined;
515
+ get modelLoopedAnimations(): ReadonlySet<string>;
516
+ get modelScale(): number | undefined;
517
+ get name(): string;
518
+ get characterController(): BaseCharacterController | undefined;
519
+ get isSpawned(): boolean;
520
+ get world(): World | undefined;
521
+ spawn(world: World, coordinate: Vector3): void;
522
+ despawn(): void;
523
+ setCharacterController(characterController: BaseCharacterController): void;
524
+ startModelLoopedAnimations(animations: string[]): void;
525
+ startModelOneshotAnimations(animations: string[]): void;
526
+ stopModelAnimations(animations: string[]): void;
527
+ serialize(): protocol.EntitySchema;
528
+ tick(tickDeltaMs: number): void;
529
+ checkAndEmitUpdates(): void;
530
+ private _requireSpawned;
531
+ private _requireModelUri;
532
+ private _rotationExceedsThreshold;
533
+ private _translationExceedsThreshold;
534
+ }
535
+
536
+ export declare namespace EntityEventPayload {
537
+ export interface Despawn {
538
+ entity: Entity;
539
+ }
540
+ export interface Spawn {
541
+ entity: Entity;
542
+ }
543
+ export interface StartModelLoopedAnimations {
544
+ entity: Entity;
545
+ animations: Set<string>;
546
+ }
547
+ export interface StartModelOneshotAnimations {
548
+ entity: Entity;
549
+ animations: Set<string>;
550
+ }
551
+ export interface StopModelAnimations {
552
+ entity: Entity;
553
+ animations: Set<string>;
554
+ }
555
+ export interface UpdateRotation {
556
+ entity: Entity;
557
+ rotation: Rotation;
558
+ }
559
+ export interface UpdateTranslation {
560
+ entity: Entity;
561
+ translation: Vector3;
562
+ }
563
+ }
564
+
565
+ export declare enum EntityEventType {
566
+ DESPAWN = "ENTITY.DESPAWN",
567
+ SPAWN = "ENTITY.SPAWN",
568
+ START_MODEL_LOOPED_ANIMATIONS = "ENTITY.UPDATE_MODEL_LOOPED_ANIMATIONS",
569
+ START_MODEL_ONESHOT_ANIMATIONS = "ENTITY.START_MODEL_ONESHOT_ANIMATIONS",
570
+ STOP_MODEL_ANIMATIONS = "ENTITY.STOP_MODEL_ANIMATIONS",
571
+ UPDATE_ROTATION = "ENTITY.UPDATE_ROTATION",
572
+ UPDATE_TRANSLATION = "ENTITY.UPDATE_TRANSLATION"
573
+ }
574
+
575
+ export declare class EntityManager {
576
+ private _entities;
577
+ private _nextEntityId;
578
+ private _world;
579
+ constructor(world: World);
580
+ get world(): World;
581
+ registerEntity(entity: Entity): number;
582
+ unregisterEntity(entity: Entity): void;
583
+ getAllEntities(): Entity[];
584
+ getAllPlayerEntities(player: Player): PlayerEntity[];
585
+ getEntity<T extends Entity>(id: number): T | undefined;
586
+ tickEntities(tickDeltaMs: number): void;
587
+ checkAndEmitUpdates(): void;
588
+ }
589
+
590
+ export declare interface EntityOptions {
591
+ modelUri?: string;
592
+ modelLoopedAnimations?: string[];
593
+ modelScale?: number;
594
+ name?: string;
595
+ rigidBodyOptions?: RigidBodyOptions;
596
+ }
597
+
598
+ declare interface Event_2<TPayload> {
599
+ type: string;
600
+ payload: TPayload;
601
+ }
602
+ export { Event_2 as Event }
603
+
604
+ export declare class EventRouter {
605
+ static readonly serverInstance: EventRouter;
606
+ private _emitter;
607
+ private _wrappedListenerMap;
608
+ private _tag;
609
+ logAllEvents: boolean;
610
+ logEventsPayloads: boolean;
611
+ logUnlistenedEvents: boolean;
612
+ logIgnoreEvents: string[];
613
+ logIgnoreEventPrefixes: string[];
614
+ constructor(tag: string);
615
+ on<TPayload>(eventType: string, listener: (payload: TPayload) => void): void;
616
+ off<TPayload>(eventType: string, listener: (payload: TPayload) => void): void;
617
+ offAll(eventType: string): void;
618
+ emit<TPayload>(event: Event_2<TPayload>): boolean;
619
+ }
620
+
621
+ declare namespace HYTOPIA {
622
+ export {
623
+ Audio,
624
+ AudioEventType,
625
+ AudioData,
626
+ AudioEventPayload,
627
+ AudioManager,
628
+ BaseCharacterController,
629
+ Block,
630
+ BlockType,
631
+ BlockTypeData,
632
+ BlockTypeRegistry,
633
+ BlockTypeRegistryEventType,
634
+ BlockTypeRegistryEventPayload,
635
+ ChatManager,
636
+ ChatEventType,
637
+ CommandCallback,
638
+ ChatEventPayload,
639
+ Chunk,
640
+ ChunkEventType,
641
+ ChunkEventPayload,
642
+ ChunkLattice,
643
+ Collider,
644
+ ColliderShape,
645
+ ColliderOptions,
646
+ ColliderMap,
647
+ CollisionCallback,
648
+ CollisionObject,
649
+ CollisionGroupsBuilder,
650
+ CollisionGroup,
651
+ CollisionGroups,
652
+ DecodedCollisionGroups,
653
+ RawCollisionGroups,
654
+ DefaultCharacterController,
655
+ DefaultCharacterControllerOptions,
656
+ Entity,
657
+ EntityEventType,
658
+ DEFAULT_ENTITY_RIGID_BODY_OPTIONS,
659
+ ROTATION_UPDATE_THRESHOLD,
660
+ TRANSLATION_UPDATE_THRESHOLD_SQ,
661
+ EntityOptions,
662
+ EntityEventPayload,
663
+ EntityManager,
664
+ EventRouter,
665
+ Event_2 as Event,
666
+ startServer,
667
+ Rotation,
668
+ SpdMatrix3,
669
+ Vector3,
670
+ Vector3Boolean,
671
+ Player,
672
+ PlayerEventType,
673
+ PlayerInputState,
674
+ PlayerOrientationState,
675
+ PlayerEventPayload,
676
+ PlayerEntity,
677
+ PlayerEntityOptions,
678
+ PlayerManager,
679
+ PlayerManagerEventType,
680
+ PlayerManagerEventPayload,
681
+ RigidBody,
682
+ RigidBodyType,
683
+ RigidBodyAdditionalMassProperties,
684
+ RigidBodyOptions,
685
+ Simulation,
686
+ Ticker,
687
+ World,
688
+ WorldData,
689
+ WorldLoop
690
+ }
691
+ }
692
+ export default HYTOPIA;
693
+
694
+ declare class NetworkSynchronizer {
695
+ private _queuedBroadcasts;
696
+ private _queuedAudioSynchronizations;
697
+ private _queuedBlockSynchronizations;
698
+ private _queuedBlockTypeSynchronizations;
699
+ private _queuedChunkSynchronizations;
700
+ private _queuedDebugRaycastSynchronizations;
701
+ private _queuedEntitySynchronizations;
702
+ private _queuedPlayerPackets;
703
+ private _spawnedChunks;
704
+ private _spawnedEntities;
705
+ private _world;
706
+ constructor(world: World);
707
+ synchronize(): void;
708
+ private _subscribeToAudioEvents;
709
+ private _subscribeToBlockTypeRegistryEvents;
710
+ private _subscribeToChatEvents;
711
+ private _subscribeToChunkEvents;
712
+ private _subscribeToEntityEvents;
713
+ private _subscribeToPlayerEvents;
714
+ private _subscribeToSimulationEvents;
715
+ private _onAudioPause;
716
+ private _onAudioPlay;
717
+ private _onAudioPlayRestart;
718
+ private _onAudioSetAttachedToEntity;
719
+ private _onAudioSetDetune;
720
+ private _onAudioSetDistortion;
721
+ private _onAudioSetPosition;
722
+ private _onAudioSetPlaybackRate;
723
+ private _onAudioSetReferenceDistance;
724
+ private _onAudioSetVolume;
725
+ private _onBlockTypeRegistryRegisterBlockType;
726
+ private _onChatSendBroadcastMessage;
727
+ private _onChatSendPlayerMessage;
728
+ private _onChunkSpawn;
729
+ private _onChunkDespawn;
730
+ private _onChunkSetBlock;
731
+ private _onEntitySpawn;
732
+ private _onEntityDespawn;
733
+ private _onEntityStartModelLoopedAnimations;
734
+ private _onEntityStartModelOneshotAnimations;
735
+ private _onEntityStopModelAnimations;
736
+ private _onEntityUpdateRotation;
737
+ private _onEntityUpdateTranslation;
738
+ private _onPlayerJoinedWorld;
739
+ private _onPlayerLeftWorld;
740
+ private _onPlayerRequestSync;
741
+ private _onSimulationDebugRaycast;
742
+ private _onSimulationDebugRender;
743
+ private _createOrGetQueuedAudioSync;
744
+ private _createOrGetQueuedBlockSync;
745
+ private _createOrGetQueuedChunkSync;
746
+ private _createOrGetQueuedEntitySync;
747
+ }
748
+
749
+ export declare class Player {
750
+ readonly id: number;
751
+ readonly username: string;
752
+ readonly connection: Connection;
753
+ private _inputState;
754
+ private _orientationState;
755
+ private _world;
756
+ constructor(connection: Connection);
757
+ get inputState(): Readonly<PlayerInputState>;
758
+ get orientationState(): Readonly<PlayerOrientationState>;
759
+ get world(): World | undefined;
760
+ joinWorld(world: World): void;
761
+ leaveWorld(): void;
762
+ disconnect(): void;
763
+ private _onChatMessageSendPacket;
764
+ private _onDebugPacket;
765
+ private _onInputPacket;
766
+ private _onSyncRequestPacket;
767
+ }
768
+
769
+ export declare class PlayerEntity extends Entity {
770
+ player: Player;
771
+ constructor(options: PlayerEntityOptions);
772
+ tick(tickDeltaMs: number): void;
773
+ }
774
+
775
+ export declare interface PlayerEntityOptions extends EntityOptions {
776
+ player: Player;
777
+ }
778
+
779
+ export declare namespace PlayerEventPayload {
780
+ export interface ChatMessageSend {
781
+ player: Player;
782
+ message: protocol.ChatMessageSchema;
783
+ }
784
+ export interface JoinedWorld {
785
+ player: Player;
786
+ world: World;
787
+ }
788
+ export interface LeftWorld {
789
+ player: Player;
790
+ world: World;
791
+ }
792
+ export interface RequestSync {
793
+ player: Player;
794
+ receivedAt: number;
795
+ receivedAtMs: number;
796
+ }
797
+ }
798
+
799
+ export declare enum PlayerEventType {
800
+ CHAT_MESSAGE_SEND = "PLAYER.CHAT_MESSAGE_SEND",
801
+ JOINED_WORLD = "PLAYER.JOINED_WORLD",
802
+ LEFT_WORLD = "PLAYER.LEFT_WORLD",
803
+ REQUEST_SYNC = "PLAYER.REQUEST_SYNC"
804
+ }
805
+
806
+ export declare type PlayerInputState = Partial<Record<keyof InputSchema, boolean>>;
807
+
808
+ export declare class PlayerManager {
809
+ static readonly instance: PlayerManager;
810
+ private _connectionPlayers;
811
+ private constructor();
812
+ broadcast(packet: IPacket<number, any>): void;
813
+ broadcastForWorld(worldId: number, packet: IPacket<number, any>): void;
814
+ private _onConnectionOpened;
815
+ private _onConnectionClosed;
816
+ }
817
+
818
+ export declare namespace PlayerManagerEventPayload {
819
+ export interface PlayerConnected {
820
+ player: Player;
821
+ }
822
+ export interface PlayerDisconnected {
823
+ player: Player;
824
+ }
825
+ }
826
+
827
+ export declare enum PlayerManagerEventType {
828
+ PLAYER_CONNECTED = "PLAYER_MANAGER.PLAYER_CONNECTED",
829
+ PLAYER_DISCONNECTED = "PLAYER_MANAGER.PLAYER_DISCONNECTED"
830
+ }
831
+
832
+ export declare type PlayerOrientationState = {
833
+ pitch: number;
834
+ yaw: number;
835
+ };
836
+
837
+ export declare type RawCollisionGroups = RAPIER.InteractionGroups;
838
+
839
+ declare type RayCastOptions = {
840
+ ignoresSensors?: boolean;
841
+ filterFlags?: RAPIER.QueryFilterFlags;
842
+ filterGroups?: number;
843
+ filterExcludeCollider?: RAPIER.Collider;
844
+ filterExcludeRigidBody?: RAPIER.RigidBody;
845
+ filterPredicate?: (collider: RAPIER.Collider) => boolean;
846
+ };
847
+
848
+ export declare class RigidBody {
849
+ private _additionalMass;
850
+ private _colliders;
851
+ private _explicitSleep;
852
+ private _enabledRotations;
853
+ private _enabledTranslations;
854
+ private _rigidBody;
855
+ private _rigidBodyDesc;
856
+ private _rigidBodyType;
857
+ private _simulation;
858
+ private _tag;
859
+ constructor(options: RigidBodyOptions);
860
+ get colliders(): Set<Collider>;
861
+ get isCcdEnabled(): boolean;
862
+ get isDynamic(): boolean;
863
+ get isEnabled(): boolean;
864
+ get isFixed(): boolean;
865
+ get isKinematic(): boolean;
866
+ get isKinematicPositionBased(): boolean;
867
+ get isKinematicVelocityBased(): boolean;
868
+ get isMoving(): boolean;
869
+ get isRemoved(): boolean;
870
+ get isSimulated(): boolean;
871
+ get isSleeping(): boolean;
872
+ get numColliders(): number;
873
+ get rawRigidBody(): RAPIER.RigidBody | undefined;
874
+ get tag(): string | undefined;
875
+ getAdditionalMass(): number;
876
+ getAdditionalSolverIterations(): number;
877
+ getAngularDamping(): number;
878
+ getAngularVelocity(): Vector3;
879
+ getCollidersByTag(tag: string): Collider[];
880
+ getDominanceGroup(): number;
881
+ getDirectionFromRotation(): Vector3;
882
+ getEffectiveAngularInertia(): SpdMatrix3 | undefined;
883
+ getEffectiveInverseMass(): Vector3 | undefined;
884
+ getEffectiveWorldInversePrincipalAngularInertiaSqrt(): SpdMatrix3 | undefined;
885
+ getEnabledRotations(): Vector3Boolean;
886
+ getEnabledTranslations(): Vector3Boolean;
887
+ getGravityScale(): number;
888
+ getInverseMass(): number | undefined;
889
+ getInversePrincipalAngularInertiaSqrt(): Vector3 | undefined;
890
+ getLinearDamping(): number;
891
+ getLinearVelocity(): Vector3;
892
+ getLocalCenterOfMass(): Vector3;
893
+ getMass(): number;
894
+ getNextKinematicRotation(): Rotation;
895
+ getNextKinematicTranslation(): Vector3;
896
+ getPrincipalAngularInertia(): Vector3;
897
+ getPrincipalAngularInertiaLocalFrame(): Rotation | undefined;
898
+ getRotation(): Rotation;
899
+ getSoftCcdPrediction(): number;
900
+ getTranslation(): Vector3;
901
+ getType(): RigidBodyType;
902
+ getWorldCenterOfMass(): Vector3 | undefined;
903
+ setAdditionalMass(additionalMass: number): void;
904
+ setAdditionalMassProperties(additionalMassProperties: RigidBodyAdditionalMassProperties): void;
905
+ setAdditionalSolverIterations(solverIterations: number): void;
906
+ setAngularDamping(angularDamping: number): void;
907
+ setAngularVelocity(angularVelocity: Vector): void;
908
+ setCcdEnabled(ccdEnabled: boolean): void;
909
+ setDominanceGroup(dominanceGroup: number): void;
910
+ setEnabled(enabled: boolean): void;
911
+ setEnabledRotations(enabledRotations: Vector3Boolean): void;
912
+ setEnabledTranslations(enabledTranslations: Vector3Boolean): void;
913
+ setGravityScale(gravityScale: number): void;
914
+ setLinearDamping(linearDamping: number): void;
915
+ setLinearVelocity(linearVelocity: Vector): void;
916
+ setNextKinematicRotation(nextKinematicRotation: Rotation): void;
917
+ setNextKinematicTranslation(nextKinematicTranslation: Vector): void;
918
+ setRotation(rotation: Rotation): void;
919
+ setSleeping(sleeping: boolean): void;
920
+ setSoftCcdPrediction(softCcdPrediction: number): void;
921
+ setCollisionGroupsForSolidColliders(collisionGroups: CollisionGroups): void;
922
+ setTag(tag: string): void;
923
+ setTranslation(translation: Vector): void;
924
+ setType(type: RigidBodyType): void;
925
+ addForce(force: Vector): void;
926
+ addTorque(torque: Vector): void;
927
+ addChildColliderToSimulation(collider: Collider): void;
928
+ addToSimulation(simulation: Simulation): void;
929
+ applyImpulse(impulse: Vector): void;
930
+ applyImpulseAtPoint(impulse: Vector, point: Vector): void;
931
+ applyTorqueImpulse(impulse: Vector): void;
932
+ createAndAddPendingChildCollider(colliderOptions: ColliderOptions): Collider;
933
+ createAndAddPendingChildColliders(colliderOptions: ColliderOptions[]): Collider[];
934
+ createAndAddChildColliderToSimulation(colliderOptions: ColliderOptions): Collider;
935
+ createAndAddChildCollidersToSimulation(colliderOptions: ColliderOptions[]): Collider[];
936
+ linkCollider(collider: Collider): void;
937
+ lockAllRotations(): void;
938
+ lockAllTranslations(): void;
939
+ removeFromSimulation(): void;
940
+ unlinkCollider(collider: Collider): void;
941
+ sleep(): void;
942
+ wakeUp(): void;
943
+ private _applyRigidBodyOptions;
944
+ private _autoAddToSimulation;
945
+ private _createRigidBodyDesc;
946
+ private _requireCreated;
947
+ private _requireDynamic;
948
+ private _requireKinematic;
949
+ private _requireNotKinematicPositionBased;
950
+ private _requireNotRemoved;
951
+ private _requireNotSimulated;
952
+ private _isEqualVectors;
953
+ private _isEqualRotations;
954
+ private _isNegligibleVector;
955
+ }
956
+
957
+ export declare type RigidBodyAdditionalMassProperties = {
958
+ additionalMass: number;
959
+ centerOfMass: Vector3;
960
+ principalAngularInertia: Vector3;
961
+ principalAngularInertiaLocalFrame: Rotation;
962
+ };
963
+
964
+ export declare interface RigidBodyOptions {
965
+ type: RigidBodyType;
966
+ additionalMass?: number;
967
+ additionalMassProperties?: RigidBodyAdditionalMassProperties;
968
+ additionalSolverIterations?: number;
969
+ angularDamping?: number;
970
+ angularVelocity?: Vector3;
971
+ ccdEnabled?: boolean;
972
+ colliders?: ColliderOptions[];
973
+ dominanceGroup?: number;
974
+ enabled?: boolean;
975
+ enabledRotations?: Vector3Boolean;
976
+ enabledTranslations?: Vector3Boolean;
977
+ gravityScale?: number;
978
+ linearDamping?: number;
979
+ linearVelocity?: Vector3;
980
+ rotation?: Rotation;
981
+ simulation?: Simulation;
982
+ sleeping?: boolean;
983
+ softCcdPrediction?: number;
984
+ tag?: string;
985
+ translation?: Vector3;
986
+ }
987
+
988
+ export declare enum RigidBodyType {
989
+ DYNAMIC = "dynamic",
990
+ FIXED = "fixed",
991
+ KINEMATIC_POSITION = "kinematic_position",
992
+ KINEMATIC_VELOCITY = "kinematic_velocity"
993
+ }
994
+
995
+ export declare interface Rotation {
996
+ x: number;
997
+ y: number;
998
+ z: number;
999
+ w: number;
1000
+ }
1001
+
1002
+ export declare const ROTATION_UPDATE_THRESHOLD: number;
1003
+
1004
+ export declare class Simulation {
1005
+ private _colliderMap;
1006
+ private _rapierEventQueue;
1007
+ private _rapierSimulation;
1008
+ private _world;
1009
+ constructor(world: World, tickRate?: number, gravity?: RAPIER.Vector3);
1010
+ get colliderMap(): ColliderMap;
1011
+ get gravity(): RAPIER.Vector3;
1012
+ get timestepS(): number;
1013
+ get world(): World;
1014
+ castRay(origin: RAPIER.Vector3, direction: RAPIER.Vector3, length: number, options?: RayCastOptions): Block | Entity | null;
1015
+ createRawCollider(rawColliderDesc: RAPIER.ColliderDesc, rawParent?: RAPIER.RigidBody): RAPIER.Collider;
1016
+ createRawRigidBody(rawRigidBodyDesc: RAPIER.RigidBodyDesc): RAPIER.RigidBody;
1017
+ removeRawCollider(rawCollider: RAPIER.Collider): void;
1018
+ removeRawRigidBody(rawRigidBody: RAPIER.RigidBody): void;
1019
+ step: (tickDeltaMs: number) => void;
1020
+ private _onCollisionEvent;
1021
+ private _onContactForceEvent;
1022
+ private _getCollisionObjects;
1023
+ }
1024
+
1025
+ export declare interface SpdMatrix3 extends SdpMatrix3 {
1026
+ }
1027
+
1028
+ export declare function startServer(init: (world: World) => Promise<void>): Promise<void>;
1029
+
1030
+ export declare class Ticker {
1031
+ private _accumulatorMs;
1032
+ private _targetTicksPerSecond;
1033
+ private _fixedTimestepMs;
1034
+ private _fixedTimestepS;
1035
+ private _nextTickMs;
1036
+ private _lastLoopTimeMs;
1037
+ private _tickFunction;
1038
+ private _tickErrorCallback?;
1039
+ private _tickHandle;
1040
+ constructor(ticksPerSecond: number, tickFunction: (tickDeltaMs: number) => void, tickErrorCallback?: (error: Error) => void);
1041
+ get targetTicksPerSecond(): number;
1042
+ get fixedTimestepMs(): number;
1043
+ get fixedTimestepS(): number;
1044
+ get nextTickMs(): number;
1045
+ start(): void;
1046
+ stop(): void;
1047
+ private _tick;
1048
+ }
1049
+
1050
+ export declare const TRANSLATION_UPDATE_THRESHOLD_SQ: number;
1051
+
1052
+ export declare interface Vector3 {
1053
+ x: number;
1054
+ y: number;
1055
+ z: number;
1056
+ }
1057
+
1058
+ export declare interface Vector3Boolean {
1059
+ x: boolean;
1060
+ y: boolean;
1061
+ z: boolean;
1062
+ }
1063
+
1064
+ export declare class World implements protocol.Serializable {
1065
+ onPlayerJoin?: (player: Player) => void;
1066
+ onPlayerLeave?: (player: Player) => void;
1067
+ private _id;
1068
+ private _name;
1069
+ private _skyboxUri;
1070
+ private _audioManager;
1071
+ private _blockTypeRegistry;
1072
+ private _chatManager;
1073
+ private _chunkLattice;
1074
+ private _entityManager;
1075
+ private _eventRouter;
1076
+ private _loop;
1077
+ private _networkSynchronizer;
1078
+ private _simulation;
1079
+ constructor(worldData: WorldData);
1080
+ get id(): number;
1081
+ get name(): string;
1082
+ get skyboxUri(): string;
1083
+ get audioManager(): AudioManager;
1084
+ get blockTypeRegistry(): BlockTypeRegistry;
1085
+ get chatManager(): ChatManager;
1086
+ get chunkLattice(): ChunkLattice;
1087
+ get entityManager(): EntityManager;
1088
+ get eventRouter(): EventRouter;
1089
+ get loop(): WorldLoop;
1090
+ get networkSynchronizer(): NetworkSynchronizer;
1091
+ get simulation(): Simulation;
1092
+ start(): void;
1093
+ stop(): void;
1094
+ serialize(): protocol.WorldSchema;
1095
+ }
1096
+
1097
+ export declare interface WorldData {
1098
+ id: number;
1099
+ name: string;
1100
+ skyboxUri: string;
1101
+ tickRate?: number;
1102
+ gravity?: Vector3;
1103
+ }
1104
+
1105
+ export declare class WorldLoop {
1106
+ private _currentTick;
1107
+ private _ticker;
1108
+ private _world;
1109
+ constructor(world: World, tickRate?: number);
1110
+ get currentTick(): number;
1111
+ get nextTickMs(): number;
1112
+ get timestepS(): number;
1113
+ get world(): World;
1114
+ start(): void;
1115
+ stop(): void;
1116
+ protected _tick: (tickDeltaMs: number) => void;
1117
+ protected _onTickError: (error: Error) => void;
1118
+ }
1119
+
1120
+ export { }