hytopia 0.1.59 → 0.1.61
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/boilerplate/assets/map.json +2 -1
- package/docs/server.audio._constructor_.md +2 -0
- package/docs/server.audio.setattachedtoentity.md +1 -1
- package/docs/server.audiomanager.unregisteraudio.md +1 -1
- package/docs/server.audiomanager.unregisterentityattachedaudios.md +1 -1
- package/docs/server.blocktypeoptions.customcollideroptions.md +2 -0
- package/docs/server.blocktypeoptions.id.md +2 -0
- package/docs/server.blocktypeoptions.isliquid.md +2 -0
- package/docs/server.blocktypeoptions.md +8 -2
- package/docs/server.blocktypeoptions.name.md +2 -0
- package/docs/server.blocktypeoptions.textureuri.md +2 -0
- package/docs/server.collisiongroup.md +168 -0
- package/docs/server.entity.md +35 -0
- package/docs/server.entity.opacity.md +13 -0
- package/docs/server.entity.setopacity.md +53 -0
- package/docs/server.entityeventpayload.md +9 -0
- package/docs/server.entityeventpayload.setopacity.entity.md +11 -0
- package/docs/server.entityeventpayload.setopacity.md +70 -0
- package/docs/server.entityeventpayload.setopacity.opacity.md +11 -0
- package/docs/server.entityeventtype.md +14 -0
- package/docs/server.entityoptions.md +19 -0
- package/docs/server.entityoptions.opacity.md +13 -0
- package/docs/server.md +33 -0
- package/docs/server.playerentitycontroller.md +19 -0
- package/docs/server.playerentitycontroller.stickstoplatforms.md +13 -0
- package/docs/server.playerentitycontrolleroptions.md +19 -0
- package/docs/server.playerentitycontrolleroptions.stickstoplatforms.md +13 -0
- package/docs/server.sceneui._constructor_.md +49 -0
- package/docs/server.sceneui.attachedtoentity.md +11 -0
- package/docs/server.sceneui.id.md +11 -0
- package/docs/server.sceneui.isloaded.md +11 -0
- package/docs/server.sceneui.load.md +53 -0
- package/docs/server.sceneui.md +344 -0
- package/docs/server.sceneui.offset.md +11 -0
- package/docs/server.sceneui.position.md +11 -0
- package/docs/server.sceneui.setattachedtoentity.md +53 -0
- package/docs/server.sceneui.setoffset.md +53 -0
- package/docs/server.sceneui.setposition.md +53 -0
- package/docs/server.sceneui.setstate.md +53 -0
- package/docs/server.sceneui.state.md +11 -0
- package/docs/server.sceneui.templateid.md +11 -0
- package/docs/server.sceneui.unload.md +17 -0
- package/docs/server.sceneui.world.md +11 -0
- package/docs/server.sceneuimanager.getallentityattachedsceneuis.md +55 -0
- package/docs/server.sceneuimanager.getallsceneuis.md +19 -0
- package/docs/server.sceneuimanager.md +127 -0
- package/docs/server.sceneuimanager.unloadentityattachedsceneuis.md +53 -0
- package/docs/server.sceneuimanager.world.md +13 -0
- package/docs/server.sceneuioptions.attachedtoentity.md +13 -0
- package/docs/server.sceneuioptions.md +133 -0
- package/docs/server.sceneuioptions.offset.md +13 -0
- package/docs/server.sceneuioptions.position.md +13 -0
- package/docs/server.sceneuioptions.state.md +13 -0
- package/docs/server.sceneuioptions.templateid.md +13 -0
- package/docs/server.world.md +21 -0
- package/docs/server.world.sceneuimanager.md +13 -0
- package/examples/wall-dodge-game/assets/map.json +3995 -0
- package/examples/wall-dodge-game/assets/textures/water.png +0 -0
- package/examples/wall-dodge-game/assets/ui/index.html +249 -0
- package/examples/wall-dodge-game/index.ts +336 -0
- package/examples/wall-dodge-game/package.json +15 -0
- package/package.json +1 -1
- package/server.api.json +1534 -45
- package/server.d.ts +188 -16
- package/server.js +83 -83
package/server.d.ts
CHANGED
@@ -47,7 +47,7 @@ export declare class Audio implements protocol.Serializable {
|
|
47
47
|
|
48
48
|
|
49
49
|
/**
|
50
|
-
* @param
|
50
|
+
* @param options - The options for the Audio instance.
|
51
51
|
*/
|
52
52
|
constructor(options: AudioOptions);
|
53
53
|
/** The unique identifier for the audio. */
|
@@ -98,7 +98,7 @@ export declare class Audio implements protocol.Serializable {
|
|
98
98
|
/**
|
99
99
|
* Sets the entity to which the audio is attached, following its position.
|
100
100
|
*
|
101
|
-
* @param entity - The entity to attach the
|
101
|
+
* @param entity - The entity to attach the Audio to.
|
102
102
|
*/
|
103
103
|
setAttachedToEntity(entity: Entity): void;
|
104
104
|
/**
|
@@ -250,13 +250,13 @@ export declare class AudioManager {
|
|
250
250
|
/**
|
251
251
|
* Unregisters and stops an audio instance from the audio manager.
|
252
252
|
*
|
253
|
-
* @param audio - The audio instance to unregister.
|
253
|
+
* @param audio - The audio instance to pause and unregister.
|
254
254
|
*/
|
255
255
|
unregisterAudio(audio: Audio): void;
|
256
256
|
/**
|
257
257
|
* Unregisters and stops all audio instances attached to a specific entity.
|
258
258
|
*
|
259
|
-
* @param entity - The entity to unregister audio instances for.
|
259
|
+
* @param entity - The entity to pause and unregister audio instances for.
|
260
260
|
*/
|
261
261
|
unregisterEntityAttachedAudios(entity: Entity): void;
|
262
262
|
}
|
@@ -489,10 +489,15 @@ export declare class BlockType implements protocol.Serializable {
|
|
489
489
|
|
490
490
|
/** Options for creating a block type instance. @public */
|
491
491
|
export declare interface BlockTypeOptions {
|
492
|
+
/** The unique numeric identifier for the block type. */
|
492
493
|
id: number;
|
494
|
+
/** The custom collider options for the block type. */
|
493
495
|
customColliderOptions?: ColliderOptions;
|
496
|
+
/** Whether the block type is a liquid. */
|
494
497
|
isLiquid?: boolean;
|
498
|
+
/** The name of the block type. */
|
495
499
|
name: string;
|
500
|
+
/** The URI of the texture asset for the block type. */
|
496
501
|
textureUri: string;
|
497
502
|
}
|
498
503
|
|
@@ -1100,6 +1105,18 @@ export declare enum CollisionGroup {
|
|
1100
1105
|
ENTITY = 2,
|
1101
1106
|
ENTITY_SENSOR = 4,
|
1102
1107
|
PLAYER = 8,
|
1108
|
+
GROUP_1 = 16,
|
1109
|
+
GROUP_2 = 32,
|
1110
|
+
GROUP_3 = 64,
|
1111
|
+
GROUP_4 = 128,
|
1112
|
+
GROUP_5 = 256,
|
1113
|
+
GROUP_6 = 512,
|
1114
|
+
GROUP_7 = 1024,
|
1115
|
+
GROUP_8 = 2048,
|
1116
|
+
GROUP_9 = 4096,
|
1117
|
+
GROUP_10 = 8192,
|
1118
|
+
GROUP_11 = 16384,
|
1119
|
+
GROUP_12 = 32768,
|
1103
1120
|
ALL = 65535
|
1104
1121
|
}
|
1105
1122
|
|
@@ -1312,6 +1329,7 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
|
|
1312
1329
|
|
1313
1330
|
|
1314
1331
|
|
1332
|
+
|
1315
1333
|
/**
|
1316
1334
|
* @param options - The options for the entity.
|
1317
1335
|
*/
|
@@ -1336,6 +1354,8 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
|
|
1336
1354
|
get modelUri(): string | undefined;
|
1337
1355
|
/** The name of the entity. */
|
1338
1356
|
get name(): string;
|
1357
|
+
/** The opacity of the entity between 0 and 1. 0 is fully transparent, 1 is fully opaque. */
|
1358
|
+
get opacity(): number | undefined;
|
1339
1359
|
/** An arbitrary identifier tag of the entity. Useful for your own logic. */
|
1340
1360
|
get tag(): string | undefined;
|
1341
1361
|
/** The tint color of the entity. */
|
@@ -1381,6 +1401,11 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
|
|
1381
1401
|
* @param modelHiddenNodes - The nodes to hide on the entity's model.
|
1382
1402
|
*/
|
1383
1403
|
setModelHiddenNodes(modelHiddenNodes: string[]): void;
|
1404
|
+
/**
|
1405
|
+
* Sets the opacity of the entity.
|
1406
|
+
* @param opacity - The opacity of the entity between 0 and 1. 0 is fully transparent, 1 is fully opaque.
|
1407
|
+
*/
|
1408
|
+
setOpacity(opacity: number): void;
|
1384
1409
|
/**
|
1385
1410
|
* Sets the tint color of the entity.
|
1386
1411
|
* @param tintColor - The tint color of the entity.
|
@@ -1439,6 +1464,10 @@ export declare namespace EntityEventPayload {
|
|
1439
1464
|
entity: Entity;
|
1440
1465
|
modelHiddenNodes: Set<string>;
|
1441
1466
|
}
|
1467
|
+
export interface SetOpacity {
|
1468
|
+
entity: Entity;
|
1469
|
+
opacity: number;
|
1470
|
+
}
|
1442
1471
|
export interface SetTintColor {
|
1443
1472
|
entity: Entity;
|
1444
1473
|
tintColor: RgbColor | undefined;
|
@@ -1473,6 +1502,7 @@ export declare enum EntityEventType {
|
|
1473
1502
|
DESPAWN = "ENTITY.DESPAWN",
|
1474
1503
|
SET_MODEL_ANIMATIONS_PLAYBACK_RATE = "ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",
|
1475
1504
|
SET_MODEL_HIDDEN_NODES = "ENTITY.SET_MODEL_HIDDEN_NODES",
|
1505
|
+
SET_OPACITY = "ENTITY.SET_OPACITY",
|
1476
1506
|
SET_TINT_COLOR = "ENTITY.SET_TINT_COLOR",
|
1477
1507
|
SPAWN = "ENTITY.SPAWN",
|
1478
1508
|
START_MODEL_LOOPED_ANIMATIONS = "ENTITY.START_MODEL_LOOPED_ANIMATIONS",
|
@@ -1562,6 +1592,8 @@ export declare interface EntityOptions {
|
|
1562
1592
|
modelUri?: string;
|
1563
1593
|
/** The name of the entity. */
|
1564
1594
|
name?: string;
|
1595
|
+
/** The opacity of the entity between 0 and 1. 0 is fully transparent, 1 is fully opaque. */
|
1596
|
+
opacity?: number;
|
1565
1597
|
/** The rigid body options for the entity. */
|
1566
1598
|
rigidBodyOptions?: RigidBodyOptions;
|
1567
1599
|
/** An arbitrary identifier tag of the entity. Useful for your own logic. */
|
@@ -2100,12 +2132,6 @@ export declare class PlayerEntity extends Entity {
|
|
2100
2132
|
* @public
|
2101
2133
|
*/
|
2102
2134
|
export declare class PlayerEntityController extends BaseEntityController {
|
2103
|
-
/** The upward velocity applied to the entity when it jumps. */
|
2104
|
-
jumpVelocity: number;
|
2105
|
-
/** The normalized horizontal velocity applied to the entity when it runs. */
|
2106
|
-
runVelocity: number;
|
2107
|
-
/** The normalized horizontal velocity applied to the entity when it walks. */
|
2108
|
-
walkVelocity: number;
|
2109
2135
|
/**
|
2110
2136
|
* A function allowing custom logic to determine if the entity can walk.
|
2111
2137
|
* @param playerEntityController - The entity controller instance.
|
@@ -2124,6 +2150,14 @@ export declare class PlayerEntityController extends BaseEntityController {
|
|
2124
2150
|
* @returns Whether the entity of the entity controller can jump.
|
2125
2151
|
*/
|
2126
2152
|
canJump: (playerEntityController: PlayerEntityController) => boolean;
|
2153
|
+
/** The upward velocity applied to the entity when it jumps. */
|
2154
|
+
jumpVelocity: number;
|
2155
|
+
/** The normalized horizontal velocity applied to the entity when it runs. */
|
2156
|
+
runVelocity: number;
|
2157
|
+
/** Whether the entity sticks to platforms. */
|
2158
|
+
sticksToPlatforms: boolean;
|
2159
|
+
/** The normalized horizontal velocity applied to the entity when it walks. */
|
2160
|
+
walkVelocity: number;
|
2127
2161
|
|
2128
2162
|
|
2129
2163
|
|
@@ -2163,18 +2197,20 @@ export declare class PlayerEntityController extends BaseEntityController {
|
|
2163
2197
|
|
2164
2198
|
/** Options for creating a PlayerEntityController instance. @public */
|
2165
2199
|
export declare interface PlayerEntityControllerOptions {
|
2166
|
-
/** The upward velocity applied to the entity when it jumps. */
|
2167
|
-
jumpVelocity?: number;
|
2168
|
-
/** The normalized horizontal velocity applied to the entity when it runs. */
|
2169
|
-
runVelocity?: number;
|
2170
|
-
/** The normalized horizontal velocity applied to the entity when it walks. */
|
2171
|
-
walkVelocity?: number;
|
2172
2200
|
/** A function allowing custom logic to determine if the entity can jump. */
|
2173
2201
|
canJump?: () => boolean;
|
2174
2202
|
/** A function allowing custom logic to determine if the entity can walk. */
|
2175
2203
|
canWalk?: () => boolean;
|
2176
2204
|
/** A function allowing custom logic to determine if the entity can run. */
|
2177
2205
|
canRun?: () => boolean;
|
2206
|
+
/** The upward velocity applied to the entity when it jumps. */
|
2207
|
+
jumpVelocity?: number;
|
2208
|
+
/** The normalized horizontal velocity applied to the entity when it runs. */
|
2209
|
+
runVelocity?: number;
|
2210
|
+
/** Whether the entity sticks to platforms, defaults to true. */
|
2211
|
+
sticksToPlatforms?: boolean;
|
2212
|
+
/** The normalized horizontal velocity applied to the entity when it walks. */
|
2213
|
+
walkVelocity?: number;
|
2178
2214
|
}
|
2179
2215
|
|
2180
2216
|
/** Options for creating a PlayerEntity instance. @public */
|
@@ -2908,6 +2944,139 @@ export declare enum RigidBodyType {
|
|
2908
2944
|
KINEMATIC_VELOCITY = "kinematic_velocity"
|
2909
2945
|
}
|
2910
2946
|
|
2947
|
+
/**
|
2948
|
+
* UI rendered within the 3D space of a world's
|
2949
|
+
* game scene.
|
2950
|
+
*
|
2951
|
+
* @remarks
|
2952
|
+
* SceneUI instances are created directly as instances.
|
2953
|
+
* They support a variety of configuration options through
|
2954
|
+
* the {@link SceneUIOptions} constructor argument.
|
2955
|
+
*
|
2956
|
+
* @example
|
2957
|
+
* ```typescript
|
2958
|
+
* const sceneUI = new SceneUI({
|
2959
|
+
* templateId: 'player-health-bar',
|
2960
|
+
* attachedToEntity: playerEntity,
|
2961
|
+
* offset: { x: 0, y: 1, z: 0 },
|
2962
|
+
* });
|
2963
|
+
* ```
|
2964
|
+
*
|
2965
|
+
* @public
|
2966
|
+
*/
|
2967
|
+
export declare class SceneUI implements protocol.Serializable {
|
2968
|
+
|
2969
|
+
|
2970
|
+
|
2971
|
+
|
2972
|
+
|
2973
|
+
|
2974
|
+
|
2975
|
+
/**
|
2976
|
+
* @param options - The options for the SceneUI instance.
|
2977
|
+
*/
|
2978
|
+
constructor(options: SceneUIOptions);
|
2979
|
+
get id(): number | undefined;
|
2980
|
+
get attachedToEntity(): Entity | undefined;
|
2981
|
+
get isLoaded(): boolean;
|
2982
|
+
get offset(): Vector3Like | undefined;
|
2983
|
+
get position(): Vector3Like | undefined;
|
2984
|
+
get state(): Readonly<object>;
|
2985
|
+
get templateId(): string;
|
2986
|
+
get world(): World | undefined;
|
2987
|
+
/**
|
2988
|
+
* Loads the SceneUI into the world.
|
2989
|
+
*
|
2990
|
+
* @param world - The world to load the SceneUI into.
|
2991
|
+
*/
|
2992
|
+
load(world: World): void;
|
2993
|
+
/**
|
2994
|
+
* Sets the entity to which the SceneUI is attached, following its position.
|
2995
|
+
*
|
2996
|
+
* @param entity - The entity to attach the SceneUI to.
|
2997
|
+
*/
|
2998
|
+
setAttachedToEntity(entity: Entity): void;
|
2999
|
+
/**
|
3000
|
+
* Sets the spatial offset of the SceneUI relative to the attached entity or position.
|
3001
|
+
*
|
3002
|
+
* @param offset - The offset in the world.
|
3003
|
+
*/
|
3004
|
+
setOffset(offset: Vector3Like): void;
|
3005
|
+
/**
|
3006
|
+
* Sets the position of the SceneUI. Will detach from entity if attached.
|
3007
|
+
*
|
3008
|
+
* @param position - The position in the world.
|
3009
|
+
*/
|
3010
|
+
setPosition(position: Vector3Like): void;
|
3011
|
+
/**
|
3012
|
+
* Sets the state of the SceneUI by performing a shallow merge with existing state.
|
3013
|
+
*
|
3014
|
+
* @param state - The state to set.
|
3015
|
+
*/
|
3016
|
+
setState(state: object): void;
|
3017
|
+
/**
|
3018
|
+
* Unloads the SceneUI from the world.
|
3019
|
+
*/
|
3020
|
+
unload(): void;
|
3021
|
+
|
3022
|
+
}
|
3023
|
+
|
3024
|
+
/**
|
3025
|
+
* Manages SceneUI instances in a world.
|
3026
|
+
*
|
3027
|
+
* @remarks
|
3028
|
+
* The SceneUIManager is created internally as a singleton
|
3029
|
+
* for each {@link World} instance in a game server.
|
3030
|
+
* It allows retrieval of all loaded SceneUI instances,
|
3031
|
+
* entity attached SceneUI instances, and more.
|
3032
|
+
*
|
3033
|
+
* @public
|
3034
|
+
*/
|
3035
|
+
export declare class SceneUIManager {
|
3036
|
+
|
3037
|
+
|
3038
|
+
|
3039
|
+
|
3040
|
+
/** The world the SceneUIManager is for. */
|
3041
|
+
get world(): World;
|
3042
|
+
/**
|
3043
|
+
* Retrieves all loaded SceneUI instances for the world.
|
3044
|
+
*
|
3045
|
+
* @returns An array of SceneUI instances.
|
3046
|
+
*/
|
3047
|
+
getAllSceneUIs(): SceneUI[];
|
3048
|
+
/**
|
3049
|
+
* Retrieves all loaded SceneUI instances attached to a specific entity.
|
3050
|
+
*
|
3051
|
+
* @param entity - The entity to get attached SceneUI instances for.
|
3052
|
+
* @returns An array of SceneUI instances.
|
3053
|
+
*/
|
3054
|
+
getAllEntityAttachedSceneUIs(entity: Entity): SceneUI[];
|
3055
|
+
|
3056
|
+
/**
|
3057
|
+
* Unloads and unregisters all SceneUI instances attached to a specific entity.
|
3058
|
+
*
|
3059
|
+
* @param entity - The entity to unload and unregister SceneUI instances for.
|
3060
|
+
*/
|
3061
|
+
unloadEntityAttachedSceneUIs(entity: Entity): void;
|
3062
|
+
|
3063
|
+
|
3064
|
+
}
|
3065
|
+
|
3066
|
+
/** Options for creating a SceneUI instance. @public */
|
3067
|
+
export declare interface SceneUIOptions {
|
3068
|
+
/** If set, SceneUI will follow the entity's position */
|
3069
|
+
attachedToEntity?: Entity;
|
3070
|
+
/** The offset of the SceneUI from the attached entity or position */
|
3071
|
+
offset?: Vector3Like;
|
3072
|
+
/** If set, SceneUI will be attached at this position */
|
3073
|
+
position?: Vector3Like;
|
3074
|
+
/** The state of the SceneUI */
|
3075
|
+
state?: object;
|
3076
|
+
/** The template ID to use for this SceneUI */
|
3077
|
+
templateId: string;
|
3078
|
+
}
|
3079
|
+
|
2911
3080
|
/**
|
2912
3081
|
* A simple entity controller with basic movement functions.
|
2913
3082
|
*
|
@@ -3348,6 +3517,7 @@ export declare class World implements protocol.Serializable {
|
|
3348
3517
|
|
3349
3518
|
|
3350
3519
|
|
3520
|
+
|
3351
3521
|
/**
|
3352
3522
|
* @param options - The options for the world.
|
3353
3523
|
*/
|
@@ -3373,6 +3543,8 @@ export declare class World implements protocol.Serializable {
|
|
3373
3543
|
/** The world loop for the world. */
|
3374
3544
|
get loop(): WorldLoop;
|
3375
3545
|
|
3546
|
+
/** The scene UI manager for the world. */
|
3547
|
+
get sceneUIManager(): SceneUIManager;
|
3376
3548
|
/** The simulation for the world. */
|
3377
3549
|
get simulation(): Simulation;
|
3378
3550
|
/**
|