hytopia 0.5.0-dev1 → 0.5.0-dev3
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/docs/server.chunklattice.chunkcount.md +13 -0
- package/docs/server.chunklattice.md +46 -0
- package/docs/server.defaultplayerentitycontroller.canswim.md +13 -0
- package/docs/server.defaultplayerentitycontroller.md +19 -0
- package/docs/server.defaultplayerentitycontrolleroptions.canswim.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.md +19 -0
- package/docs/server.entitymanager.entitycount.md +13 -0
- package/docs/server.entitymanager.md +21 -0
- package/docs/server.eventpayloads.md +2 -2
- package/docs/server.gameserver.md +3 -3
- package/docs/server.gameserver.worldmanager.md +13 -0
- package/docs/server.md +44 -0
- package/docs/server.player.md +2 -2
- package/docs/server.player.resetinputs.md +17 -0
- package/docs/server.playercamera.md +14 -0
- package/docs/server.playercamera.reset.md +17 -0
- package/docs/server.playerevent.md +14 -0
- package/docs/server.playereventpayloads._player.reconnected_world_.md +16 -0
- package/docs/server.playereventpayloads.md +19 -0
- package/docs/server.playermanager.md +22 -1
- package/docs/server.playermanager.playercount.md +13 -0
- package/docs/server.playermanagerevent.md +75 -0
- package/docs/server.playermanagereventpayloads._player_manager.player_reconnected_.md +15 -0
- package/docs/server.playermanagereventpayloads.md +19 -0
- package/docs/server.world.md +21 -0
- package/docs/server.world.tag.md +13 -0
- package/docs/server.worldmanager.createworld.md +55 -0
- package/docs/server.worldmanager.getallworlds.md +19 -0
- package/docs/server.worldmanager.getdefaultworld.md +19 -0
- package/docs/server.worldmanager.getworld.md +55 -0
- package/docs/server.worldmanager.getworldsbytag.md +55 -0
- package/docs/server.worldmanager.instance.md +13 -0
- package/docs/server.worldmanager.md +172 -0
- package/docs/server.worldmanagerevent.md +47 -0
- package/docs/server.worldmanagereventpayloads._world_manager.world_created_.md +15 -0
- package/docs/server.worldmanagereventpayloads.md +57 -0
- package/docs/server.worldoptions.md +19 -0
- package/docs/server.worldoptions.tag.md +13 -0
- package/examples/hygrounds/gc.log +11 -0
- package/package.json +1 -1
- package/server.api.json +878 -41
- package/server.d.ts +135 -18
- package/server.js +182 -145
- package/docs/server.gameserver.worlds.md +0 -15
- package/docs/server.player.leaveworld.md +0 -17
package/server.d.ts
CHANGED
@@ -1000,6 +1000,8 @@ export declare class ChunkLattice {
|
|
1000
1000
|
* @param world - The world the chunk lattice is for.
|
1001
1001
|
*/
|
1002
1002
|
constructor(world: World);
|
1003
|
+
/** The number of chunks in the lattice. */
|
1004
|
+
get chunkCount(): number;
|
1003
1005
|
|
1004
1006
|
|
1005
1007
|
/**
|
@@ -1471,11 +1473,11 @@ export declare class DefaultPlayerEntityController extends BaseEntityController
|
|
1471
1473
|
/** Whether to automatically cancel left click input after first processed tick, defaults to true. */
|
1472
1474
|
autoCancelMouseLeftClick: boolean;
|
1473
1475
|
/**
|
1474
|
-
* A function allowing custom logic to determine if the entity can
|
1476
|
+
* A function allowing custom logic to determine if the entity can jump.
|
1475
1477
|
* @param controller - The default player entity controller instance.
|
1476
|
-
* @returns Whether the entity of the entity controller can
|
1478
|
+
* @returns Whether the entity of the entity controller can jump.
|
1477
1479
|
*/
|
1478
|
-
|
1480
|
+
canJump: (controller: DefaultPlayerEntityController) => boolean;
|
1479
1481
|
/**
|
1480
1482
|
* A function allowing custom logic to determine if the entity can run.
|
1481
1483
|
* @param controller - The default player entity controller instance.
|
@@ -1483,11 +1485,17 @@ export declare class DefaultPlayerEntityController extends BaseEntityController
|
|
1483
1485
|
*/
|
1484
1486
|
canRun: (controller: DefaultPlayerEntityController) => boolean;
|
1485
1487
|
/**
|
1486
|
-
* A function allowing custom logic to determine if the entity can
|
1488
|
+
* A function allowing custom logic to determine if the entity can swim.
|
1487
1489
|
* @param controller - The default player entity controller instance.
|
1488
|
-
* @returns Whether the entity of the entity controller can
|
1490
|
+
* @returns Whether the entity of the entity controller can swim.
|
1489
1491
|
*/
|
1490
|
-
|
1492
|
+
canSwim: (controller: DefaultPlayerEntityController) => boolean;
|
1493
|
+
/**
|
1494
|
+
* A function allowing custom logic to determine if the entity can walk.
|
1495
|
+
* @param controller - The default player entity controller instance.
|
1496
|
+
* @returns Whether the entity of the entity controller can walk.
|
1497
|
+
*/
|
1498
|
+
canWalk: (controller: DefaultPlayerEntityController) => boolean;
|
1491
1499
|
/** The looped animation(s) that will play when the entity is idle. */
|
1492
1500
|
idleLoopedAnimations: string[];
|
1493
1501
|
/** The oneshot animation(s) that will play when the entity interacts (left click) */
|
@@ -1567,10 +1575,12 @@ export declare interface DefaultPlayerEntityControllerOptions {
|
|
1567
1575
|
autoCancelMouseLeftClick?: boolean;
|
1568
1576
|
/** A function allowing custom logic to determine if the entity can jump. */
|
1569
1577
|
canJump?: () => boolean;
|
1570
|
-
/** A function allowing custom logic to determine if the entity can walk. */
|
1571
|
-
canWalk?: () => boolean;
|
1572
1578
|
/** A function allowing custom logic to determine if the entity can run. */
|
1573
1579
|
canRun?: () => boolean;
|
1580
|
+
/** A function allowing custom logic to determine if the entity can swim. */
|
1581
|
+
canSwim?: () => boolean;
|
1582
|
+
/** A function allowing custom logic to determine if the entity can walk. */
|
1583
|
+
canWalk?: () => boolean;
|
1574
1584
|
/** Overrides the animation(s) that will play when the entity is idle. */
|
1575
1585
|
idleLoopedAnimations?: string[];
|
1576
1586
|
/** Overrides the animation(s) that will play when the entity interacts (left click) */
|
@@ -1988,6 +1998,8 @@ export declare class EntityManager {
|
|
1988
1998
|
|
1989
1999
|
|
1990
2000
|
|
2001
|
+
/** The number of spawned entities in the world. */
|
2002
|
+
get entityCount(): number;
|
1991
2003
|
/** The world the entity manager is for. */
|
1992
2004
|
get world(): World;
|
1993
2005
|
|
@@ -2074,7 +2086,7 @@ export declare class ErrorHandler {
|
|
2074
2086
|
*
|
2075
2087
|
* @public
|
2076
2088
|
*/
|
2077
|
-
export declare interface EventPayloads extends AudioEventPayloads, BaseEntityControllerEventPayloads, BlockTypeEventPayloads, BlockTypeRegistryEventPayloads, ChatEventPayloads, ChunkEventPayloads, ConnectionEventPayloads, EntityEventPayloads, GameServerEventPayloads, PlayerCameraEventPayloads, PlayerEventPayloads, PlayerManagerEventPayloads, PlayerUIEventPayloads, SceneUIEventPayloads, SimulationEventPayloads, SocketEventPayloads, LightEventPayloads, WebServerEventPayloads, WorldEventPayloads, WorldLoopEventPayloads {
|
2089
|
+
export declare interface EventPayloads extends AudioEventPayloads, BaseEntityControllerEventPayloads, BlockTypeEventPayloads, BlockTypeRegistryEventPayloads, ChatEventPayloads, ChunkEventPayloads, ConnectionEventPayloads, EntityEventPayloads, GameServerEventPayloads, PlayerCameraEventPayloads, PlayerEventPayloads, PlayerManagerEventPayloads, PlayerUIEventPayloads, SceneUIEventPayloads, SimulationEventPayloads, SocketEventPayloads, LightEventPayloads, WebServerEventPayloads, WorldEventPayloads, WorldLoopEventPayloads, WorldManagerEventPayloads {
|
2078
2090
|
}
|
2079
2091
|
|
2080
2092
|
/**
|
@@ -2225,11 +2237,8 @@ export declare class GameServer {
|
|
2225
2237
|
|
2226
2238
|
/** The web server for the game server. */
|
2227
2239
|
get webServer(): WebServer;
|
2228
|
-
/** The
|
2229
|
-
get
|
2230
|
-
[id: string]: World;
|
2231
|
-
};
|
2232
|
-
|
2240
|
+
/** The world manager for the game server */
|
2241
|
+
get worldManager(): WorldManager;
|
2233
2242
|
|
2234
2243
|
}
|
2235
2244
|
|
@@ -3501,10 +3510,11 @@ export declare class Player extends EventRouter implements protocol.Serializable
|
|
3501
3510
|
* @param world - The world to join the player to.
|
3502
3511
|
*/
|
3503
3512
|
joinWorld(world: World): void;
|
3513
|
+
|
3504
3514
|
/**
|
3505
|
-
*
|
3515
|
+
* Resets all inputs keys
|
3506
3516
|
*/
|
3507
|
-
|
3517
|
+
resetInputs(): void;
|
3508
3518
|
/**
|
3509
3519
|
* Set the persisted data for the player. This data can
|
3510
3520
|
* later be retrieved using {@link Player.getPersistedData},
|
@@ -3525,6 +3535,7 @@ export declare class Player extends EventRouter implements protocol.Serializable
|
|
3525
3535
|
|
3526
3536
|
|
3527
3537
|
|
3538
|
+
|
3528
3539
|
}
|
3529
3540
|
|
3530
3541
|
/**
|
@@ -3604,6 +3615,11 @@ export declare class PlayerCamera extends EventRouter implements protocol.Serial
|
|
3604
3615
|
* @param position - The position to look at.
|
3605
3616
|
*/
|
3606
3617
|
lookAtPosition(position: Vector3Like): void;
|
3618
|
+
/**
|
3619
|
+
* Resets the camera to its default, unattached,
|
3620
|
+
* spectator mode state.
|
3621
|
+
*/
|
3622
|
+
reset(): void;
|
3607
3623
|
/**
|
3608
3624
|
* Sets the entity the camera is attached to.
|
3609
3625
|
* @param entity - The entity to attach the camera to.
|
@@ -3826,6 +3842,7 @@ export declare enum PlayerEvent {
|
|
3826
3842
|
CHAT_MESSAGE_SEND = "PLAYER.CHAT_MESSAGE_SEND",
|
3827
3843
|
JOINED_WORLD = "PLAYER.JOINED_WORLD",
|
3828
3844
|
LEFT_WORLD = "PLAYER.LEFT_WORLD",
|
3845
|
+
RECONNECTED_WORLD = "PLAYER.RECONNECTED_WORLD",
|
3829
3846
|
REQUEST_SYNC = "PLAYER.REQUEST_SYNC"
|
3830
3847
|
}
|
3831
3848
|
|
@@ -3846,6 +3863,11 @@ export declare interface PlayerEventPayloads {
|
|
3846
3863
|
player: Player;
|
3847
3864
|
world: World;
|
3848
3865
|
};
|
3866
|
+
/** Emitted when a player reconnects to a world after a disconnect. */
|
3867
|
+
[PlayerEvent.RECONNECTED_WORLD]: {
|
3868
|
+
player: Player;
|
3869
|
+
world: World;
|
3870
|
+
};
|
3849
3871
|
/** Emitted when a player's client requests a round trip time synchronization. */
|
3850
3872
|
[PlayerEvent.REQUEST_SYNC]: {
|
3851
3873
|
player: Player;
|
@@ -3867,8 +3889,8 @@ export declare type PlayerInput = Partial<Record<keyof InputSchema, boolean>>;
|
|
3867
3889
|
*
|
3868
3890
|
* <h2>Events</h2>
|
3869
3891
|
*
|
3870
|
-
* This class
|
3871
|
-
*
|
3892
|
+
* This class emits global events with payloads listed
|
3893
|
+
* under {@link PlayerManagerEventPayloads}
|
3872
3894
|
*
|
3873
3895
|
* @example
|
3874
3896
|
* ```typescript
|
@@ -3885,6 +3907,8 @@ export declare class PlayerManager {
|
|
3885
3907
|
static readonly instance: PlayerManager;
|
3886
3908
|
|
3887
3909
|
|
3910
|
+
/** The number of players currently connected to the server. */
|
3911
|
+
get playerCount(): number;
|
3888
3912
|
/**
|
3889
3913
|
* Get all connected players.
|
3890
3914
|
* @returns An array of all connected players.
|
@@ -3904,6 +3928,15 @@ export declare class PlayerManager {
|
|
3904
3928
|
getConnectedPlayerByUsername(username: string): Player | undefined;
|
3905
3929
|
|
3906
3930
|
|
3931
|
+
|
3932
|
+
|
3933
|
+
}
|
3934
|
+
|
3935
|
+
/** Event types a PlayerManager can emit. See {@link PlayerManagerEventPayloads} for the payloads. @public */
|
3936
|
+
export declare enum PlayerManagerEvent {
|
3937
|
+
PLAYER_CONNECTED = "PLAYER_MANAGER.PLAYER_CONNECTED",
|
3938
|
+
PLAYER_DISCONNECTED = "PLAYER_MANAGER.PLAYER_DISCONNECTED",
|
3939
|
+
PLAYER_RECONNECTED = "PLAYER_MANAGER.PLAYER_RECONNECTED"
|
3907
3940
|
}
|
3908
3941
|
|
3909
3942
|
/** Event payloads for PlayerManager emitted events. @public */
|
@@ -3916,6 +3949,10 @@ export declare interface PlayerManagerEventPayloads {
|
|
3916
3949
|
[PlayerManagerEvent.PLAYER_DISCONNECTED]: {
|
3917
3950
|
player: Player;
|
3918
3951
|
};
|
3952
|
+
/** Emitted when a player reconnects to the server. */
|
3953
|
+
[PlayerManagerEvent.PLAYER_RECONNECTED]: {
|
3954
|
+
player: Player;
|
3955
|
+
};
|
3919
3956
|
}
|
3920
3957
|
|
3921
3958
|
/**
|
@@ -5654,6 +5691,7 @@ export declare class World extends EventRouter implements protocol.Serializable
|
|
5654
5691
|
|
5655
5692
|
|
5656
5693
|
|
5694
|
+
|
5657
5695
|
/**
|
5658
5696
|
* @param options - The options for the world.
|
5659
5697
|
*/
|
@@ -5676,6 +5714,8 @@ export declare class World extends EventRouter implements protocol.Serializable
|
|
5676
5714
|
get skyboxUri(): string;
|
5677
5715
|
/** The audio manager for the world. */
|
5678
5716
|
get audioManager(): AudioManager;
|
5717
|
+
/** An arbitrary identifier tag of the world. Useful for your own logic. */
|
5718
|
+
get tag(): string | undefined;
|
5679
5719
|
/** The block type registry for the world. */
|
5680
5720
|
get blockTypeRegistry(): BlockTypeRegistry;
|
5681
5721
|
/** The chat manager for the world. */
|
@@ -5865,6 +5905,81 @@ export declare interface WorldLoopEventPayloads {
|
|
5865
5905
|
};
|
5866
5906
|
}
|
5867
5907
|
|
5908
|
+
/**
|
5909
|
+
* Manages all worlds in a game server.
|
5910
|
+
*
|
5911
|
+
* @remarks
|
5912
|
+
* The WorldManager is created internally as a global
|
5913
|
+
* singleton accessible with the static property
|
5914
|
+
* `WorldManager.instance`.
|
5915
|
+
*
|
5916
|
+
* <h2>Events</h2>
|
5917
|
+
*
|
5918
|
+
* This class emits global events with payloads listed
|
5919
|
+
* under {@link WorldManagerEventPayloads}
|
5920
|
+
*
|
5921
|
+
* @example
|
5922
|
+
* ```typescript
|
5923
|
+
* import { WorldManager } from 'hytopia';
|
5924
|
+
*
|
5925
|
+
* const worldManager = WorldManager.instance;
|
5926
|
+
* const newWorld = worldManager.createWorld({
|
5927
|
+
* name: 'My New World',
|
5928
|
+
* skyboxUri: 'skyboxes/partly-cloudy',
|
5929
|
+
* });
|
5930
|
+
* ```
|
5931
|
+
*
|
5932
|
+
* @public
|
5933
|
+
*/
|
5934
|
+
export declare class WorldManager {
|
5935
|
+
/** The global WorldManager instance as a singleton. */
|
5936
|
+
static readonly instance: WorldManager;
|
5937
|
+
|
5938
|
+
|
5939
|
+
/**
|
5940
|
+
* Creates a new world.
|
5941
|
+
* @param options - The options for the world.
|
5942
|
+
* @param start - Whether to start the world immediately, defaults to true.
|
5943
|
+
* @returns The created world.
|
5944
|
+
*/
|
5945
|
+
createWorld(options: Omit<WorldOptions, 'id'>): World;
|
5946
|
+
/**
|
5947
|
+
* Gets all worlds.
|
5948
|
+
* @returns All worlds.
|
5949
|
+
*/
|
5950
|
+
getAllWorlds(): World[];
|
5951
|
+
/**
|
5952
|
+
* Gets the default world.
|
5953
|
+
* @returns The default world.
|
5954
|
+
*/
|
5955
|
+
getDefaultWorld(): World;
|
5956
|
+
/**
|
5957
|
+
* Gets all worlds with a specific tag.
|
5958
|
+
* @param tag - The tag to get the worlds for.
|
5959
|
+
* @returns All worlds with the provided tag.
|
5960
|
+
*/
|
5961
|
+
getWorldsByTag(tag: string): World[];
|
5962
|
+
/**
|
5963
|
+
* Gets a world by its id.
|
5964
|
+
* @param id - The id of the world to get.
|
5965
|
+
* @returns The world with the provided id, or undefined if no world is found.
|
5966
|
+
*/
|
5967
|
+
getWorld(id: number): World | undefined;
|
5968
|
+
}
|
5969
|
+
|
5970
|
+
/** Event types a WorldManager instance can emit to the global event router. See {@link WorldManagerEventPayloads} for the payloads. @public */
|
5971
|
+
export declare enum WorldManagerEvent {
|
5972
|
+
WORLD_CREATED = "WORLD_MANAGER.WORLD_CREATED"
|
5973
|
+
}
|
5974
|
+
|
5975
|
+
/** Event payloads for WorldManager emitted events. @public */
|
5976
|
+
export declare interface WorldManagerEventPayloads {
|
5977
|
+
/** Emitted when a world is created. */
|
5978
|
+
[WorldManagerEvent.WORLD_CREATED]: {
|
5979
|
+
world: World;
|
5980
|
+
};
|
5981
|
+
}
|
5982
|
+
|
5868
5983
|
/** A map representation for a world. @public */
|
5869
5984
|
export declare interface WorldMap {
|
5870
5985
|
/** The block types in the map. */
|
@@ -5903,6 +6018,8 @@ export declare interface WorldOptions {
|
|
5903
6018
|
name: string;
|
5904
6019
|
/** The URI of the skybox cubemap for the world. */
|
5905
6020
|
skyboxUri: string;
|
6021
|
+
/** An arbitrary identifier tag of the world. Useful for your own logic */
|
6022
|
+
tag?: string;
|
5906
6023
|
/** The tick rate for the world. */
|
5907
6024
|
tickRate?: number;
|
5908
6025
|
/** The gravity vector for the world. */
|