hytopia 0.1.29 → 0.1.30
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/scripts.js +1 -0
- package/docs/server.blocktype.md +2 -2
- package/docs/server.blocktype.onentitycollision.md +1 -1
- package/docs/server.blocktype.onentitycontactforce.md +1 -1
- package/docs/server.defaultcharactercontroller.canjump.md +1 -1
- package/docs/server.defaultcharactercontroller.canrun.md +1 -1
- package/docs/server.defaultcharactercontroller.canwalk.md +1 -1
- package/docs/server.defaultcharactercontroller.md +3 -3
- package/docs/server.entity.createcustomcharactercontroller.md +2 -2
- package/docs/server.entity.md +9 -9
- package/docs/server.entity.onblockcollision.md +1 -1
- package/docs/server.entity.onblockcontactforce.md +1 -1
- package/docs/server.entity.ondespawn.md +1 -1
- package/docs/server.entity.onentitycollision.md +1 -1
- package/docs/server.entity.onentitycontactforce.md +1 -1
- package/docs/server.entity.onspawn.md +1 -1
- package/docs/server.entity.ontick.md +1 -1
- package/docs/server.entityoptions.createcustomcharactercontroller.md +13 -0
- package/docs/server.entityoptions.md +19 -0
- package/docs/server.hytopia.blocktype.md +2 -2
- package/docs/server.hytopia.blocktype.onentitycollision.md +1 -1
- package/docs/server.hytopia.blocktype.onentitycontactforce.md +1 -1
- package/docs/server.hytopia.defaultcharactercontroller.canjump.md +1 -1
- package/docs/server.hytopia.defaultcharactercontroller.canrun.md +1 -1
- package/docs/server.hytopia.defaultcharactercontroller.canwalk.md +1 -1
- package/docs/server.hytopia.defaultcharactercontroller.md +3 -3
- package/docs/server.hytopia.entity.createcustomcharactercontroller.md +2 -2
- package/docs/server.hytopia.entity.md +9 -9
- package/docs/server.hytopia.entity.onblockcollision.md +1 -1
- package/docs/server.hytopia.entity.onblockcontactforce.md +1 -1
- package/docs/server.hytopia.entity.ondespawn.md +1 -1
- package/docs/server.hytopia.entity.onentitycollision.md +1 -1
- package/docs/server.hytopia.entity.onentitycontactforce.md +1 -1
- package/docs/server.hytopia.entity.onspawn.md +1 -1
- package/docs/server.hytopia.entity.ontick.md +1 -1
- package/docs/server.hytopia.entityoptions.createcustomcharactercontroller.md +13 -0
- package/docs/server.hytopia.entityoptions.md +19 -0
- package/docs/server.hytopia.moveoptions.md +5 -0
- package/docs/server.hytopia.simplecharactercontroller.md +1 -1
- package/docs/server.moveoptions.md +5 -0
- package/docs/server.simplecharactercontroller.md +1 -1
- package/examples/entity-spawn/index.ts +1 -1
- package/examples/payload-game/index.ts +46 -104
- package/package.json +1 -1
- package/server.api.json +142 -60
- package/server.d.ts +51 -33
- package/server.js +25 -25
- package/tsconfig.json +4 -1
- package/examples/character-controller/tsconfig.json +0 -27
- package/examples/entity-spawn/tsconfig.json +0 -27
- package/examples/payload-game/tsconfig.json +0 -27
package/server.d.ts
CHANGED
@@ -378,16 +378,18 @@ export declare class Block {
|
|
378
378
|
export declare class BlockType implements protocol.Serializable {
|
379
379
|
/**
|
380
380
|
* A callback function that is invoked when an entity collides with blocks of this type.
|
381
|
-
* @param
|
381
|
+
* @param blockType - The block type the collision is for.
|
382
|
+
* @param entity - The entity that collided with the block type.
|
382
383
|
* @param started - Whether the collision started.
|
383
384
|
*/
|
384
|
-
onEntityCollision?: (
|
385
|
+
onEntityCollision?: (blockType: BlockType, entity: Entity, started: boolean) => void;
|
385
386
|
/**
|
386
387
|
* A callback function that is invoked when an entity contacts a block of this type.
|
387
|
-
* @param
|
388
|
+
* @param blockType - The block type the contact is for.
|
389
|
+
* @param entity - The entity that contacted the block type.
|
388
390
|
* @param contactForceData - The contact force data.
|
389
391
|
*/
|
390
|
-
onEntityContactForce?: (
|
392
|
+
onEntityContactForce?: (blockType: BlockType, entity: Entity, contactForceData: ContactForceData) => void;
|
391
393
|
|
392
394
|
|
393
395
|
|
@@ -1100,22 +1102,22 @@ export declare class DefaultCharacterController extends BaseCharacterController
|
|
1100
1102
|
walkVelocity: number;
|
1101
1103
|
/**
|
1102
1104
|
* A function allowing custom logic to determine if the entity can walk.
|
1103
|
-
* @param
|
1104
|
-
* @returns Whether the entity can walk.
|
1105
|
+
* @param defaultCharacterController - The character controller instance.
|
1106
|
+
* @returns Whether the entity of the character controller can walk.
|
1105
1107
|
*/
|
1106
|
-
canWalk: (
|
1108
|
+
canWalk: (defaultCharacterController: DefaultCharacterController) => boolean;
|
1107
1109
|
/**
|
1108
1110
|
* A function allowing custom logic to determine if the entity can run.
|
1109
|
-
* @param
|
1110
|
-
* @returns Whether the entity can run.
|
1111
|
+
* @param defaultCharacterController - The character controller instance.
|
1112
|
+
* @returns Whether the entity of the character controller can run.
|
1111
1113
|
*/
|
1112
|
-
canRun: (
|
1114
|
+
canRun: (defaultCharacterController: DefaultCharacterController) => boolean;
|
1113
1115
|
/**
|
1114
1116
|
* A function allowing custom logic to determine if the entity can jump.
|
1115
|
-
* @param
|
1116
|
-
* @returns Whether the entity can jump.
|
1117
|
+
* @param defaultCharacterController - The character controller instance.
|
1118
|
+
* @returns Whether the entity of the character controller can jump.
|
1117
1119
|
*/
|
1118
|
-
canJump: (
|
1120
|
+
canJump: (defaultCharacterController: DefaultCharacterController) => boolean;
|
1119
1121
|
|
1120
1122
|
|
1121
1123
|
|
@@ -1199,55 +1201,55 @@ export declare interface DefaultCharacterControllerOptions {
|
|
1199
1201
|
*/
|
1200
1202
|
export declare class Entity extends RigidBody implements protocol.Serializable {
|
1201
1203
|
/**
|
1202
|
-
* A function that creates a custom character controller for the entity.
|
1203
|
-
* @param
|
1204
|
+
* A function that creates a custom character controller for the entity when it spawns.
|
1205
|
+
* @param entity - The Entity instance the character controller is created for.
|
1204
1206
|
* @returns A character controller that extends {@link BaseCharacterController}.
|
1205
1207
|
*/
|
1206
|
-
createCustomCharacterController?: (
|
1208
|
+
createCustomCharacterController?: (entity: Entity) => BaseCharacterController;
|
1207
1209
|
/**
|
1208
1210
|
* A function that is called when the entity collides with a block.
|
1209
|
-
* @param
|
1211
|
+
* @param entity - The Entity instance the collision is for.
|
1210
1212
|
* @param block - The block that the entity collided with.
|
1211
1213
|
* @param started - Whether the collision started or ended.
|
1212
1214
|
*/
|
1213
|
-
onBlockCollision?: (
|
1215
|
+
onBlockCollision?: (entity: Entity, block: BlockType, started: boolean) => void;
|
1214
1216
|
/**
|
1215
1217
|
* A function that is called when the entity collides with a block.
|
1216
|
-
* @param
|
1218
|
+
* @param entity - The Entity instance the collision is for.
|
1217
1219
|
* @param block - The block that the entity collided with.
|
1218
1220
|
* @param contactForceData - The contact force data.
|
1219
1221
|
*/
|
1220
|
-
onBlockContactForce?: (
|
1222
|
+
onBlockContactForce?: (entity: Entity, block: BlockType, contactForceData: ContactForceData) => void;
|
1221
1223
|
/**
|
1222
1224
|
* A function that is called when the entity collides with another entity.
|
1223
|
-
* @param
|
1224
|
-
* @param
|
1225
|
+
* @param entity - The Entity instance the collision is for.
|
1226
|
+
* @param otherEntity - The other entity that the entity collided with.
|
1225
1227
|
* @param started - Whether the collision started or ended.
|
1226
1228
|
*/
|
1227
|
-
onEntityCollision?: (
|
1229
|
+
onEntityCollision?: (entity: Entity, otherEntity: Entity, started: boolean) => void;
|
1228
1230
|
/**
|
1229
1231
|
* A function that is called when the entity contacts another entity.
|
1230
|
-
* @param
|
1231
|
-
* @param
|
1232
|
+
* @param entity - The Entity instance the collision is for.
|
1233
|
+
* @param otherEntity - The other entity that the entity collided with.
|
1232
1234
|
* @param contactForceData - The contact force data.
|
1233
1235
|
*/
|
1234
|
-
onEntityContactForce?: (
|
1236
|
+
onEntityContactForce?: (entity: Entity, otherEntity: Entity, contactForceData: ContactForceData) => void;
|
1235
1237
|
/**
|
1236
1238
|
* A function that is called when the entity is spawned.
|
1237
|
-
* @param
|
1239
|
+
* @param entity - The Entity instance that spawned.
|
1238
1240
|
*/
|
1239
|
-
onSpawn?: (
|
1241
|
+
onSpawn?: (entity: Entity) => void;
|
1240
1242
|
/**
|
1241
1243
|
* A function that is called when the entity is despawned.
|
1242
|
-
* @param
|
1244
|
+
* @param entity - The Entity instance that despawned.
|
1243
1245
|
*/
|
1244
|
-
onDespawn?: (
|
1246
|
+
onDespawn?: (entity: Entity) => void;
|
1245
1247
|
/**
|
1246
1248
|
* A function that is called every tick.
|
1247
|
-
* @param
|
1249
|
+
* @param entity - The Entity instance that ticked.
|
1248
1250
|
* @param tickDeltaMs - The delta time in milliseconds since the last tick.
|
1249
1251
|
*/
|
1250
|
-
onTick?: (
|
1252
|
+
onTick?: (entity: Entity, tickDeltaMs: number) => void;
|
1251
1253
|
|
1252
1254
|
|
1253
1255
|
|
@@ -1410,6 +1412,12 @@ export declare class EntityManager {
|
|
1410
1412
|
|
1411
1413
|
/** Options for creating an Entity instance. @public */
|
1412
1414
|
export declare interface EntityOptions {
|
1415
|
+
/**
|
1416
|
+
* A function that creates a custom character controller for the entity when it spawns.
|
1417
|
+
* @param entity - The Entity instance.
|
1418
|
+
* @returns A character controller that extends {@link BaseCharacterController}.
|
1419
|
+
*/
|
1420
|
+
createCustomCharacterController?: (entity: Entity) => BaseCharacterController;
|
1413
1421
|
/** The URI or path to the .gltf model asset to be used for the entity. */
|
1414
1422
|
modelUri?: string;
|
1415
1423
|
/** The looped animations to start when the entity is spawned. */
|
@@ -1677,8 +1685,16 @@ export declare type MoveCompleteCallback = (endTranslation: Vector3) => void;
|
|
1677
1685
|
* @public
|
1678
1686
|
*/
|
1679
1687
|
export declare type MoveOptions = {
|
1688
|
+
/** Callback called each tick movement of the character controller's entity. */
|
1680
1689
|
moveCallback?: MoveCallback;
|
1690
|
+
/** Callback called when the character controller's entity has finished moving. */
|
1681
1691
|
moveCompleteCallback?: MoveCompleteCallback;
|
1692
|
+
/** Axes to ignore when moving the character controller's entity. Also ignored for determining completion. */
|
1693
|
+
moveIgnoreAxes?: {
|
1694
|
+
x?: boolean;
|
1695
|
+
y?: boolean;
|
1696
|
+
z?: boolean;
|
1697
|
+
};
|
1682
1698
|
};
|
1683
1699
|
|
1684
1700
|
/**
|
@@ -2354,7 +2370,8 @@ export declare interface Rotation {
|
|
2354
2370
|
* as a way to add realistic movement and rotational facing
|
2355
2371
|
* functionality to an entity. This is also a great base to
|
2356
2372
|
* extend for your own more complex character controller
|
2357
|
-
* that implements things like pathfinding.
|
2373
|
+
* that implements things like pathfinding. Compatible with
|
2374
|
+
* entities that have kinematic or dynamic rigid body types.
|
2358
2375
|
*
|
2359
2376
|
* @example
|
2360
2377
|
* ```typescript
|
@@ -2387,6 +2404,7 @@ export declare class SimpleCharacterController extends BaseCharacterController {
|
|
2387
2404
|
|
2388
2405
|
|
2389
2406
|
|
2407
|
+
|
2390
2408
|
/**
|
2391
2409
|
* Rotates the entity at a given speed to face a target coordinate.
|
2392
2410
|
*
|