hytopia 0.1.33 → 0.1.34

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.
Files changed (129) hide show
  1. package/docs/server.collider.md +21 -0
  2. package/docs/server.collider.shape.md +13 -0
  3. package/docs/server.default_block_entity_rigid_body_options.md +13 -0
  4. package/docs/server.default_entity_rigid_body_options.md +1 -1
  5. package/docs/server.entity.blockhalfextents.md +13 -0
  6. package/docs/server.entity.blocktextureuri.md +13 -0
  7. package/docs/server.entity.md +63 -0
  8. package/docs/server.entity.tag.md +13 -0
  9. package/docs/server.entitymanager.getentitiesbytag.md +55 -0
  10. package/docs/server.entitymanager.getentitiesbytagsubstring.md +55 -0
  11. package/docs/server.entitymanager.md +28 -0
  12. package/docs/server.entityoptions.blockhalfextents.md +13 -0
  13. package/docs/server.entityoptions.blocktextureuri.md +13 -0
  14. package/docs/server.entityoptions.md +57 -0
  15. package/docs/server.entityoptions.tag.md +13 -0
  16. package/docs/server.hytopia.collider.md +21 -0
  17. package/docs/server.hytopia.collider.shape.md +13 -0
  18. package/docs/server.hytopia.default_block_entity_rigid_body_options.md +13 -0
  19. package/docs/server.hytopia.default_entity_rigid_body_options.md +1 -1
  20. package/docs/server.hytopia.entity.blockhalfextents.md +13 -0
  21. package/docs/server.hytopia.entity.blocktextureuri.md +13 -0
  22. package/docs/server.hytopia.entity.md +63 -0
  23. package/docs/server.hytopia.entity.tag.md +13 -0
  24. package/docs/server.hytopia.entitymanager.getentitiesbytag.md +55 -0
  25. package/docs/server.hytopia.entitymanager.getentitiesbytagsubstring.md +55 -0
  26. package/docs/server.hytopia.entitymanager.md +28 -0
  27. package/docs/server.hytopia.entityoptions.blockhalfextents.md +13 -0
  28. package/docs/server.hytopia.entityoptions.blocktextureuri.md +13 -0
  29. package/docs/server.hytopia.entityoptions.md +57 -0
  30. package/docs/server.hytopia.entityoptions.tag.md +13 -0
  31. package/docs/server.hytopia.md +12 -1
  32. package/docs/server.hytopia.rigidbody.md +0 -35
  33. package/docs/server.hytopia.rigidbodyoptions.md +0 -19
  34. package/docs/server.hytopia.webserver.md +1 -2
  35. package/docs/server.md +12 -1
  36. package/docs/server.rigidbody.md +0 -35
  37. package/docs/server.rigidbodyoptions.md +0 -19
  38. package/docs/server.webserver.md +1 -2
  39. package/examples/block-entity/README.md +15 -0
  40. package/examples/block-entity/assets/audio/music/cave.mp3 +0 -0
  41. package/examples/block-entity/assets/audio/music/desert.mp3 +0 -0
  42. package/examples/block-entity/assets/audio/music/end.mp3 +0 -0
  43. package/examples/block-entity/assets/audio/music/jungle.mp3 +0 -0
  44. package/examples/block-entity/assets/audio/music/nether.mp3 +0 -0
  45. package/examples/block-entity/assets/audio/music/night.mp3 +0 -0
  46. package/examples/block-entity/assets/audio/music/night2.mp3 +0 -0
  47. package/examples/block-entity/assets/audio/music/overworld.mp3 +0 -0
  48. package/examples/block-entity/assets/audio/music/snow.mp3 +0 -0
  49. package/examples/block-entity/assets/audio/sfx/damage.wav +0 -0
  50. package/examples/block-entity/assets/audio/sfx/step.wav +0 -0
  51. package/examples/block-entity/assets/certs/README.md +10 -0
  52. package/examples/block-entity/assets/certs/localhost.crt +20 -0
  53. package/examples/block-entity/assets/certs/localhost.key +27 -0
  54. package/examples/block-entity/assets/cubemaps/skybox/+x.png +0 -0
  55. package/examples/block-entity/assets/cubemaps/skybox/+y.png +0 -0
  56. package/examples/block-entity/assets/cubemaps/skybox/+z.png +0 -0
  57. package/examples/block-entity/assets/cubemaps/skybox/-x.png +0 -0
  58. package/examples/block-entity/assets/cubemaps/skybox/-y.png +0 -0
  59. package/examples/block-entity/assets/cubemaps/skybox/-z.png +0 -0
  60. package/examples/block-entity/assets/map.json +2623 -0
  61. package/examples/block-entity/assets/models/bat.gltf +1 -0
  62. package/examples/block-entity/assets/models/chicken.gltf +1 -0
  63. package/examples/block-entity/assets/models/cow.gltf +1 -0
  64. package/examples/block-entity/assets/models/donkey.gltf +1 -0
  65. package/examples/block-entity/assets/models/horse.gltf +1 -0
  66. package/examples/block-entity/assets/models/mindflayer.gltf +1 -0
  67. package/examples/block-entity/assets/models/pig.gltf +1 -0
  68. package/examples/block-entity/assets/models/player.gltf +1 -0
  69. package/examples/block-entity/assets/models/rabbit.gltf +1 -0
  70. package/examples/block-entity/assets/models/sheep.gltf +1 -0
  71. package/examples/block-entity/assets/models/skeleton.gltf +1 -0
  72. package/examples/block-entity/assets/models/spider.gltf +1 -0
  73. package/examples/block-entity/assets/models/squid.gltf +1 -0
  74. package/examples/block-entity/assets/models/stalker.gltf +1 -0
  75. package/examples/block-entity/assets/models/zombie.gltf +1 -0
  76. package/examples/block-entity/assets/textures/bricks.png +0 -0
  77. package/examples/block-entity/assets/textures/clay.png +0 -0
  78. package/examples/block-entity/assets/textures/cobblestone.png +0 -0
  79. package/examples/block-entity/assets/textures/diamond_ore.png +0 -0
  80. package/examples/block-entity/assets/textures/dirt.png +0 -0
  81. package/examples/block-entity/assets/textures/dragons_stone.png +0 -0
  82. package/examples/block-entity/assets/textures/emerald_ore.png +0 -0
  83. package/examples/block-entity/assets/textures/glass.png +0 -0
  84. package/examples/block-entity/assets/textures/gold_ore.png +0 -0
  85. package/examples/block-entity/assets/textures/grass/+x.png +0 -0
  86. package/examples/block-entity/assets/textures/grass/+y.png +0 -0
  87. package/examples/block-entity/assets/textures/grass/+z.png +0 -0
  88. package/examples/block-entity/assets/textures/grass/-x.png +0 -0
  89. package/examples/block-entity/assets/textures/grass/-y.png +0 -0
  90. package/examples/block-entity/assets/textures/grass/-z.png +0 -0
  91. package/examples/block-entity/assets/textures/gravel.png +0 -0
  92. package/examples/block-entity/assets/textures/ice.png +0 -0
  93. package/examples/block-entity/assets/textures/infected_shadowrock.png +0 -0
  94. package/examples/block-entity/assets/textures/iron_ore.png +0 -0
  95. package/examples/block-entity/assets/textures/lava.png +0 -0
  96. package/examples/block-entity/assets/textures/log_side.png +0 -0
  97. package/examples/block-entity/assets/textures/log_top.png +0 -0
  98. package/examples/block-entity/assets/textures/mossy_coblestone.png +0 -0
  99. package/examples/block-entity/assets/textures/nuit.png +0 -0
  100. package/examples/block-entity/assets/textures/oak_leaves.png +0 -0
  101. package/examples/block-entity/assets/textures/oak_planks.png +0 -0
  102. package/examples/block-entity/assets/textures/sand.png +0 -0
  103. package/examples/block-entity/assets/textures/sandstone.png +0 -0
  104. package/examples/block-entity/assets/textures/shadowrock.png +0 -0
  105. package/examples/block-entity/assets/textures/snow.png +0 -0
  106. package/examples/block-entity/assets/textures/stone.png +0 -0
  107. package/examples/block-entity/assets/textures/stone_bricks.png +0 -0
  108. package/examples/block-entity/assets/textures/void_grass/+x.png +0 -0
  109. package/examples/block-entity/assets/textures/void_grass/+y.png +0 -0
  110. package/examples/block-entity/assets/textures/void_grass/+z.png +0 -0
  111. package/examples/block-entity/assets/textures/void_grass/-x.png +0 -0
  112. package/examples/block-entity/assets/textures/void_grass/-y.png +0 -0
  113. package/examples/block-entity/assets/textures/void_grass/-z.png +0 -0
  114. package/examples/block-entity/assets/textures/void_sand.png +0 -0
  115. package/examples/block-entity/assets/textures/water.png +0 -0
  116. package/examples/block-entity/index.ts +173 -0
  117. package/examples/block-entity/package.json +14 -0
  118. package/examples/payload-game/index.ts +7 -0
  119. package/package.json +1 -1
  120. package/server.api.json +948 -510
  121. package/server.d.ts +38 -17
  122. package/server.js +80 -80
  123. package/docs/server.hytopia.rigidbody.settag.md +0 -53
  124. package/docs/server.hytopia.rigidbody.tag.md +0 -13
  125. package/docs/server.hytopia.rigidbodyoptions.tag.md +0 -13
  126. package/docs/server.rigidbody.settag.md +0 -53
  127. package/docs/server.rigidbody.tag.md +0 -13
  128. package/docs/server.rigidbodyoptions.tag.md +0 -13
  129. package/examples/README.md +0 -22
package/server.d.ts CHANGED
@@ -769,6 +769,7 @@ export declare class Collider {
769
769
 
770
770
 
771
771
 
772
+
772
773
  /**
773
774
  * @param colliderOptions - The options for the collider instance.
774
775
  */
@@ -785,6 +786,8 @@ export declare class Collider {
785
786
  get parentRigidBody(): RigidBody | undefined;
786
787
  /** The raw collider object from the Rapier physics engine. */
787
788
  get rawCollider(): RAPIER.Collider | undefined;
789
+ /** The shape of the collider. */
790
+ get shape(): ColliderShape;
788
791
  /** An arbitrary identifier tag of the collider. Useful for your own logic. */
789
792
  get tag(): string | undefined;
790
793
  /**
@@ -1062,7 +1065,10 @@ export declare type DecodedCollisionGroups = {
1062
1065
  collidesWith: string[];
1063
1066
  };
1064
1067
 
1065
- /** The default rigid body options when EntityOptions.rigidBodyOptions is not provided. @public */
1068
+ /** The default rigid body options for a block entity when EntityOptions.rigidBodyOptions is not provided. @public */
1069
+ export declare const DEFAULT_BLOCK_ENTITY_RIGID_BODY_OPTIONS: RigidBodyOptions;
1070
+
1071
+ /** The default rigid body options for a model entity when EntityOptions.rigidBodyOptions is not provided. @public */
1066
1072
  export declare const DEFAULT_ENTITY_RIGID_BODY_OPTIONS: RigidBodyOptions;
1067
1073
 
1068
1074
  /**
@@ -1260,12 +1266,21 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
1260
1266
 
1261
1267
 
1262
1268
 
1269
+
1270
+
1271
+
1263
1272
  /**
1264
1273
  * @param options - The options for the entity.
1265
1274
  */
1266
1275
  constructor(options: EntityOptions);
1267
1276
  /** The unique identifier for the entity. */
1268
1277
  get id(): number | undefined;
1278
+ /** The character controller for the entity. */
1279
+ get characterController(): BaseCharacterController | undefined;
1280
+ /** The half extends of the visual size of the block entity when blockTextureUri is set. */
1281
+ get blockHalfExtents(): Vector3 | undefined;
1282
+ /** The URI or path to the texture to be used, if this is set, the entity is a block entity. */
1283
+ get blockTextureUri(): string | undefined;
1269
1284
  /** The URI or path to the .gltf model asset to be used for the entity. */
1270
1285
  get modelUri(): string | undefined;
1271
1286
  /** The looped animations to start when the entity is spawned. */
@@ -1274,8 +1289,8 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
1274
1289
  get modelScale(): number | undefined;
1275
1290
  /** The name of the entity. */
1276
1291
  get name(): string;
1277
- /** The character controller for the entity. */
1278
- get characterController(): BaseCharacterController | undefined;
1292
+ /** An arbitrary identifier tag of the entity. Useful for your own logic. */
1293
+ get tag(): string | undefined;
1279
1294
  /** Whether the entity is spawned. */
1280
1295
  get isSpawned(): boolean;
1281
1296
  /** The world the entity is in. */
@@ -1406,12 +1421,28 @@ export declare class EntityManager {
1406
1421
  * @returns The spawned entity with the provided id, or undefined if no entity is found.
1407
1422
  */
1408
1423
  getEntity<T extends Entity>(id: number): T | undefined;
1424
+ /**
1425
+ * Gets all spawned entities in the world with a specific tag.
1426
+ * @param tag - The tag to get the entities for.
1427
+ * @returns All spawned entities in the world with the provided tag.
1428
+ */
1429
+ getEntitiesByTag(tag: string): Entity[];
1430
+ /**
1431
+ * Gets all spawned entities in the world with a tag that includes a specific substring.
1432
+ * @param tagSubstring - The tag substring to get the entities for.
1433
+ * @returns All spawned entities in the world with a tag that includes the provided substring.
1434
+ */
1435
+ getEntitiesByTagSubstring(tagSubstring: string): Entity[];
1409
1436
 
1410
1437
 
1411
1438
  }
1412
1439
 
1413
1440
  /** Options for creating an Entity instance. @public */
1414
1441
  export declare interface EntityOptions {
1442
+ /** The half extents of the visual size of the block entity when blockTextureUri is set. If no rigidBodyOptions.colliders are provided, a block collider with the size of the half extents will be created. */
1443
+ blockHalfExtents?: Vector3;
1444
+ /** The texture uri of a entity if the entity is a block entity, if set rigidBodyOptions collider shape [0] must be a block */
1445
+ blockTextureUri?: string;
1415
1446
  /**
1416
1447
  * A function that creates a custom character controller for the entity when it spawns.
1417
1448
  * @param entity - The Entity instance.
@@ -1428,6 +1459,8 @@ export declare interface EntityOptions {
1428
1459
  name?: string;
1429
1460
  /** The rigid body options for the entity. */
1430
1461
  rigidBodyOptions?: RigidBodyOptions;
1462
+ /** An arbitrary identifier tag of the entity. Useful for your own logic. */
1463
+ tag?: string;
1431
1464
  }
1432
1465
 
1433
1466
  /** An EventRouter event. @public */
@@ -1614,6 +1647,7 @@ declare namespace HYTOPIA {
1614
1647
  DefaultCharacterControllerOptions,
1615
1648
  Entity,
1616
1649
  EntityEventType,
1650
+ DEFAULT_BLOCK_ENTITY_RIGID_BODY_OPTIONS,
1617
1651
  DEFAULT_ENTITY_RIGID_BODY_OPTIONS,
1618
1652
  EntityOptions,
1619
1653
  EntityEventPayload,
@@ -2138,7 +2172,6 @@ export declare class RigidBody {
2138
2172
 
2139
2173
 
2140
2174
 
2141
-
2142
2175
  /**
2143
2176
  * @param options - The options for the rigid body instance.
2144
2177
  */
@@ -2171,8 +2204,6 @@ export declare class RigidBody {
2171
2204
  get numColliders(): number;
2172
2205
  /** The raw RAPIER rigid body instance. */
2173
2206
  get rawRigidBody(): RAPIER.RigidBody | undefined;
2174
- /** An arbitrary identifier tag of the rigid body. Useful for your own logic. */
2175
- get tag(): string | undefined;
2176
2207
  /**
2177
2208
  * Gets the additional mass of the rigid body.
2178
2209
  * @returns The additional mass of the rigid body.
@@ -2409,11 +2440,6 @@ export declare class RigidBody {
2409
2440
  * @param collisionGroups - The collision groups for solid colliders of the rigid body.
2410
2441
  */
2411
2442
  setCollisionGroupsForSolidColliders(collisionGroups: CollisionGroups): void;
2412
- /**
2413
- * Sets the tag of the rigid body.
2414
- * @param tag - The tag of the rigid body.
2415
- */
2416
- setTag(tag: string): void;
2417
2443
  /**
2418
2444
  * Sets the translation of the rigid body.
2419
2445
  * @param translation - The translation of the rigid body.
@@ -2558,8 +2584,6 @@ export declare interface RigidBodyOptions {
2558
2584
  sleeping?: boolean;
2559
2585
  /** The soft continuous collision detection prediction of the rigid body. */
2560
2586
  softCcdPrediction?: number;
2561
- /** The tag of the rigid body. */
2562
- tag?: string;
2563
2587
  /** The translation of the rigid body. */
2564
2588
  translation?: Vector3;
2565
2589
  }
@@ -2751,10 +2775,7 @@ export declare interface Vector3Boolean {
2751
2775
  *
2752
2776
  * @public
2753
2777
  */
2754
- export declare class WebServer implements Readyable {
2755
-
2756
-
2757
-
2778
+ export declare class WebServer {
2758
2779
 
2759
2780
 
2760
2781