hytopia 0.1.30 → 0.1.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. package/README.md +3 -26
  2. package/bin/scripts.js +14 -8
  3. package/boilerplate/assets/map.json +2 -2
  4. package/docs/server.entity.md +2 -2
  5. package/docs/server.entity.onblockcollision.md +1 -1
  6. package/docs/server.entity.onblockcontactforce.md +1 -1
  7. package/docs/server.hytopia.entity.md +2 -2
  8. package/docs/server.hytopia.entity.onblockcollision.md +1 -1
  9. package/docs/server.hytopia.entity.onblockcontactforce.md +1 -1
  10. package/docs/server.hytopia.md +42 -0
  11. package/docs/server.hytopia.player.camera.md +13 -0
  12. package/docs/server.hytopia.player.md +21 -0
  13. package/docs/server.hytopia.playercamera.attachedtoentity.md +13 -0
  14. package/docs/server.hytopia.playercamera.attachedtoposition.md +13 -0
  15. package/docs/server.hytopia.playercamera.filmoffset.md +13 -0
  16. package/docs/server.hytopia.playercamera.forwardoffset.md +13 -0
  17. package/docs/server.hytopia.playercamera.fov.md +13 -0
  18. package/docs/server.hytopia.playercamera.hiddenmodelnodes.md +13 -0
  19. package/docs/server.hytopia.playercamera.lookatentity.md +53 -0
  20. package/docs/server.hytopia.playercamera.lookatposition.md +53 -0
  21. package/docs/server.hytopia.playercamera.md +506 -0
  22. package/docs/server.hytopia.playercamera.mode.md +13 -0
  23. package/docs/server.hytopia.playercamera.offset.md +13 -0
  24. package/docs/server.hytopia.playercamera.player.md +13 -0
  25. package/docs/server.hytopia.playercamera.setattachedtoentity.md +53 -0
  26. package/docs/server.hytopia.playercamera.setattachedtoposition.md +53 -0
  27. package/docs/server.hytopia.playercamera.setfilmoffset.md +53 -0
  28. package/docs/server.hytopia.playercamera.setforwardoffset.md +53 -0
  29. package/docs/server.hytopia.playercamera.setfov.md +53 -0
  30. package/docs/server.hytopia.playercamera.sethiddenmodelnodes.md +53 -0
  31. package/docs/server.hytopia.playercamera.setmode.md +53 -0
  32. package/docs/server.hytopia.playercamera.setoffset.md +53 -0
  33. package/docs/server.hytopia.playercamera.settrackedentity.md +53 -0
  34. package/docs/server.hytopia.playercamera.settrackedposition.md +53 -0
  35. package/docs/server.hytopia.playercamera.setzoom.md +53 -0
  36. package/docs/server.hytopia.playercamera.trackedentity.md +13 -0
  37. package/docs/server.hytopia.playercamera.trackedposition.md +13 -0
  38. package/docs/server.hytopia.playercamera.zoom.md +13 -0
  39. package/docs/server.hytopia.playercameraeventpayload.lookatentity.entity.md +11 -0
  40. package/docs/server.hytopia.playercameraeventpayload.lookatentity.md +70 -0
  41. package/docs/server.hytopia.playercameraeventpayload.lookatentity.playercamera.md +11 -0
  42. package/docs/server.hytopia.playercameraeventpayload.lookatposition.md +70 -0
  43. package/docs/server.hytopia.playercameraeventpayload.lookatposition.playercamera.md +11 -0
  44. package/docs/server.hytopia.playercameraeventpayload.lookatposition.position.md +11 -0
  45. package/docs/server.hytopia.playercameraeventpayload.md +145 -0
  46. package/docs/server.hytopia.playercameraeventpayload.setattachedtoentity.entity.md +11 -0
  47. package/docs/server.hytopia.playercameraeventpayload.setattachedtoentity.md +70 -0
  48. package/docs/server.hytopia.playercameraeventpayload.setattachedtoentity.playercamera.md +11 -0
  49. package/docs/server.hytopia.playercameraeventpayload.setattachedtoposition.md +70 -0
  50. package/docs/server.hytopia.playercameraeventpayload.setattachedtoposition.playercamera.md +11 -0
  51. package/docs/server.hytopia.playercameraeventpayload.setattachedtoposition.position.md +11 -0
  52. package/docs/server.hytopia.playercameraeventpayload.setfilmoffset.filmoffset.md +11 -0
  53. package/docs/server.hytopia.playercameraeventpayload.setfilmoffset.md +70 -0
  54. package/docs/server.hytopia.playercameraeventpayload.setfilmoffset.playercamera.md +11 -0
  55. package/docs/server.hytopia.playercameraeventpayload.setforwardoffset.forwardoffset.md +11 -0
  56. package/docs/server.hytopia.playercameraeventpayload.setforwardoffset.md +70 -0
  57. package/docs/server.hytopia.playercameraeventpayload.setforwardoffset.playercamera.md +11 -0
  58. package/docs/server.hytopia.playercameraeventpayload.setfov.fov.md +11 -0
  59. package/docs/server.hytopia.playercameraeventpayload.setfov.md +70 -0
  60. package/docs/server.hytopia.playercameraeventpayload.setfov.playercamera.md +11 -0
  61. package/docs/server.hytopia.playercameraeventpayload.sethiddenmodelnodes.hiddenmodelnodes.md +11 -0
  62. package/docs/server.hytopia.playercameraeventpayload.sethiddenmodelnodes.md +70 -0
  63. package/docs/server.hytopia.playercameraeventpayload.sethiddenmodelnodes.playercamera.md +11 -0
  64. package/docs/server.hytopia.playercameraeventpayload.setmode.md +70 -0
  65. package/docs/server.hytopia.playercameraeventpayload.setmode.mode.md +11 -0
  66. package/docs/server.hytopia.playercameraeventpayload.setmode.playercamera.md +11 -0
  67. package/docs/server.hytopia.playercameraeventpayload.setoffset.md +70 -0
  68. package/docs/server.hytopia.playercameraeventpayload.setoffset.offset.md +11 -0
  69. package/docs/server.hytopia.playercameraeventpayload.setoffset.playercamera.md +11 -0
  70. package/docs/server.hytopia.playercameraeventpayload.settrackedentity.entity.md +11 -0
  71. package/docs/server.hytopia.playercameraeventpayload.settrackedentity.md +70 -0
  72. package/docs/server.hytopia.playercameraeventpayload.settrackedentity.playercamera.md +11 -0
  73. package/docs/server.hytopia.playercameraeventpayload.settrackedposition.md +70 -0
  74. package/docs/server.hytopia.playercameraeventpayload.settrackedposition.playercamera.md +11 -0
  75. package/docs/server.hytopia.playercameraeventpayload.settrackedposition.position.md +11 -0
  76. package/docs/server.hytopia.playercameraeventpayload.setzoom.md +70 -0
  77. package/docs/server.hytopia.playercameraeventpayload.setzoom.playercamera.md +11 -0
  78. package/docs/server.hytopia.playercameraeventpayload.setzoom.zoom.md +11 -0
  79. package/docs/server.hytopia.playercameraeventtype.md +215 -0
  80. package/docs/server.hytopia.playercameramode.md +59 -0
  81. package/docs/server.md +42 -0
  82. package/docs/server.player.camera.md +13 -0
  83. package/docs/server.player.md +21 -0
  84. package/docs/server.playercamera.attachedtoentity.md +13 -0
  85. package/docs/server.playercamera.attachedtoposition.md +13 -0
  86. package/docs/server.playercamera.filmoffset.md +13 -0
  87. package/docs/server.playercamera.forwardoffset.md +13 -0
  88. package/docs/server.playercamera.fov.md +13 -0
  89. package/docs/server.playercamera.hiddenmodelnodes.md +13 -0
  90. package/docs/server.playercamera.lookatentity.md +53 -0
  91. package/docs/server.playercamera.lookatposition.md +53 -0
  92. package/docs/server.playercamera.md +506 -0
  93. package/docs/server.playercamera.mode.md +13 -0
  94. package/docs/server.playercamera.offset.md +13 -0
  95. package/docs/server.playercamera.player.md +13 -0
  96. package/docs/server.playercamera.setattachedtoentity.md +53 -0
  97. package/docs/server.playercamera.setattachedtoposition.md +53 -0
  98. package/docs/server.playercamera.setfilmoffset.md +53 -0
  99. package/docs/server.playercamera.setforwardoffset.md +53 -0
  100. package/docs/server.playercamera.setfov.md +53 -0
  101. package/docs/server.playercamera.sethiddenmodelnodes.md +53 -0
  102. package/docs/server.playercamera.setmode.md +53 -0
  103. package/docs/server.playercamera.setoffset.md +53 -0
  104. package/docs/server.playercamera.settrackedentity.md +53 -0
  105. package/docs/server.playercamera.settrackedposition.md +53 -0
  106. package/docs/server.playercamera.setzoom.md +53 -0
  107. package/docs/server.playercamera.trackedentity.md +13 -0
  108. package/docs/server.playercamera.trackedposition.md +13 -0
  109. package/docs/server.playercamera.zoom.md +13 -0
  110. package/docs/server.playercameraeventpayload.lookatentity.entity.md +11 -0
  111. package/docs/server.playercameraeventpayload.lookatentity.md +70 -0
  112. package/docs/server.playercameraeventpayload.lookatentity.playercamera.md +11 -0
  113. package/docs/server.playercameraeventpayload.lookatposition.md +70 -0
  114. package/docs/server.playercameraeventpayload.lookatposition.playercamera.md +11 -0
  115. package/docs/server.playercameraeventpayload.lookatposition.position.md +11 -0
  116. package/docs/server.playercameraeventpayload.md +145 -0
  117. package/docs/server.playercameraeventpayload.setattachedtoentity.entity.md +11 -0
  118. package/docs/server.playercameraeventpayload.setattachedtoentity.md +70 -0
  119. package/docs/server.playercameraeventpayload.setattachedtoentity.playercamera.md +11 -0
  120. package/docs/server.playercameraeventpayload.setattachedtoposition.md +70 -0
  121. package/docs/server.playercameraeventpayload.setattachedtoposition.playercamera.md +11 -0
  122. package/docs/server.playercameraeventpayload.setattachedtoposition.position.md +11 -0
  123. package/docs/server.playercameraeventpayload.setfilmoffset.filmoffset.md +11 -0
  124. package/docs/server.playercameraeventpayload.setfilmoffset.md +70 -0
  125. package/docs/server.playercameraeventpayload.setfilmoffset.playercamera.md +11 -0
  126. package/docs/server.playercameraeventpayload.setforwardoffset.forwardoffset.md +11 -0
  127. package/docs/server.playercameraeventpayload.setforwardoffset.md +70 -0
  128. package/docs/server.playercameraeventpayload.setforwardoffset.playercamera.md +11 -0
  129. package/docs/server.playercameraeventpayload.setfov.fov.md +11 -0
  130. package/docs/server.playercameraeventpayload.setfov.md +70 -0
  131. package/docs/server.playercameraeventpayload.setfov.playercamera.md +11 -0
  132. package/docs/server.playercameraeventpayload.sethiddenmodelnodes.hiddenmodelnodes.md +11 -0
  133. package/docs/server.playercameraeventpayload.sethiddenmodelnodes.md +70 -0
  134. package/docs/server.playercameraeventpayload.sethiddenmodelnodes.playercamera.md +11 -0
  135. package/docs/server.playercameraeventpayload.setmode.md +70 -0
  136. package/docs/server.playercameraeventpayload.setmode.mode.md +11 -0
  137. package/docs/server.playercameraeventpayload.setmode.playercamera.md +11 -0
  138. package/docs/server.playercameraeventpayload.setoffset.md +70 -0
  139. package/docs/server.playercameraeventpayload.setoffset.offset.md +11 -0
  140. package/docs/server.playercameraeventpayload.setoffset.playercamera.md +11 -0
  141. package/docs/server.playercameraeventpayload.settrackedentity.entity.md +11 -0
  142. package/docs/server.playercameraeventpayload.settrackedentity.md +70 -0
  143. package/docs/server.playercameraeventpayload.settrackedentity.playercamera.md +11 -0
  144. package/docs/server.playercameraeventpayload.settrackedposition.md +70 -0
  145. package/docs/server.playercameraeventpayload.settrackedposition.playercamera.md +11 -0
  146. package/docs/server.playercameraeventpayload.settrackedposition.position.md +11 -0
  147. package/docs/server.playercameraeventpayload.setzoom.md +70 -0
  148. package/docs/server.playercameraeventpayload.setzoom.playercamera.md +11 -0
  149. package/docs/server.playercameraeventpayload.setzoom.zoom.md +11 -0
  150. package/docs/server.playercameraeventtype.md +215 -0
  151. package/docs/server.playercameramode.md +59 -0
  152. package/examples/payload-game/index.ts +1 -1
  153. package/package.json +1 -1
  154. package/server.api.json +9023 -4203
  155. package/server.d.ts +222 -4
  156. package/server.js +118 -61
  157. package/examples/character-controller/package.json +0 -14
  158. package/examples/entity-spawn/package.json +0 -14
  159. package/examples/payload-game/package.json +0 -14
package/server.d.ts CHANGED
@@ -1209,17 +1209,17 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
1209
1209
  /**
1210
1210
  * A function that is called when the entity collides with a block.
1211
1211
  * @param entity - The Entity instance the collision is for.
1212
- * @param block - The block that the entity collided with.
1212
+ * @param blockType - The block type that the entity collided with.
1213
1213
  * @param started - Whether the collision started or ended.
1214
1214
  */
1215
- onBlockCollision?: (entity: Entity, block: BlockType, started: boolean) => void;
1215
+ onBlockCollision?: (entity: Entity, blockType: BlockType, started: boolean) => void;
1216
1216
  /**
1217
1217
  * A function that is called when the entity collides with a block.
1218
1218
  * @param entity - The Entity instance the collision is for.
1219
- * @param block - The block that the entity collided with.
1219
+ * @param blockType - The block type that the entity collided with.
1220
1220
  * @param contactForceData - The contact force data.
1221
1221
  */
1222
- onBlockContactForce?: (entity: Entity, block: BlockType, contactForceData: ContactForceData) => void;
1222
+ onBlockContactForce?: (entity: Entity, blockType: BlockType, contactForceData: ContactForceData) => void;
1223
1223
  /**
1224
1224
  * A function that is called when the entity collides with another entity.
1225
1225
  * @param entity - The Entity instance the collision is for.
@@ -1634,6 +1634,10 @@ declare namespace HYTOPIA {
1634
1634
  PlayerInputState,
1635
1635
  PlayerOrientationState,
1636
1636
  PlayerEventPayload,
1637
+ PlayerCamera,
1638
+ PlayerCameraMode,
1639
+ PlayerCameraEventType,
1640
+ PlayerCameraEventPayload,
1637
1641
  PlayerEntity,
1638
1642
  PlayerEntityOptions,
1639
1643
  PlayerManager,
@@ -1712,6 +1716,8 @@ export declare class Player {
1712
1716
  readonly id: number;
1713
1717
  /** The username for the player. */
1714
1718
  readonly username: string;
1719
+ /** The camera for the player. */
1720
+ readonly camera: PlayerCamera;
1715
1721
 
1716
1722
 
1717
1723
 
@@ -1746,6 +1752,218 @@ export declare class Player {
1746
1752
 
1747
1753
 
1748
1754
 
1755
+ }
1756
+
1757
+ /**
1758
+ * The camera for a Player.
1759
+ *
1760
+ * @remarks
1761
+ * The camera is used to render the player's view of the
1762
+ * world. The player's camera exposes functionality to
1763
+ * control the camera of a player. All player objects
1764
+ * have a camera, accessible via {@link Player.camera}.
1765
+ *
1766
+ * @example
1767
+ * ```typescript
1768
+ * player.camera.setMode(PlayerCameraMode.FIRST_PERSON);
1769
+ * ```
1770
+ *
1771
+ * @public
1772
+ */
1773
+ export declare class PlayerCamera implements protocol.Serializable {
1774
+ /** The player that the camera belongs to. @readonly */
1775
+ readonly player: Player;
1776
+
1777
+
1778
+
1779
+
1780
+
1781
+
1782
+
1783
+
1784
+
1785
+
1786
+
1787
+
1788
+ /** The entity the camera is attached to. */
1789
+ get attachedToEntity(): Entity | undefined;
1790
+ /** The position the camera is attached to. */
1791
+ get attachedToPosition(): Vector3 | undefined;
1792
+ /** The film offset of the camera. A positive value shifts the camera right, a negative value shifts it left. */
1793
+ get filmOffset(): number;
1794
+ /** Only used in first-person mode. The forward offset of the camera. A positive number shifts the camera forward, a negative number shifts it backward. */
1795
+ get forwardOffset(): number;
1796
+ /** The field of view of the camera. */
1797
+ get fov(): number;
1798
+ /** The nodes of the model the camera is attached to that will not be rendered for the player. Uses case insensitive substring matching. */
1799
+ get hiddenModelNodes(): Set<string>;
1800
+ /** The mode of the camera. */
1801
+ get mode(): PlayerCameraMode;
1802
+ /** The relative offset of the camera from the entity or position it is attached to. */
1803
+ get offset(): Vector3;
1804
+ /** The entity the camera will constantly look at, even if the camera attached or tracked entity moves. */
1805
+ get trackedEntity(): Entity | undefined;
1806
+ /** The position the camera will constantly look at, even if the camera attached entity moves. */
1807
+ get trackedPosition(): Vector3 | undefined;
1808
+ /** The zoom of the camera. */
1809
+ get zoom(): number;
1810
+ /**
1811
+ * Makes the camera look at an entity. If the camera was
1812
+ * previously tracking an entity or position, it will
1813
+ * stop tracking.
1814
+ * @param entity - The entity to look at.
1815
+ */
1816
+ lookAtEntity(entity: Entity): void;
1817
+ /**
1818
+ * Makes the camera look at a position. If the camera was
1819
+ * previously tracking an entity or position, it will
1820
+ * stop tracking.
1821
+ * @param position - The position to look at.
1822
+ */
1823
+ lookAtPosition(position: Vector3): void;
1824
+ /**
1825
+ * Sets the entity the camera is attached to.
1826
+ * @param entity - The entity to attach the camera to.
1827
+ */
1828
+ setAttachedToEntity(entity: Entity): void;
1829
+ /**
1830
+ * Sets the position the camera is attached to.
1831
+ * @param position - The position to attach the camera to.
1832
+ */
1833
+ setAttachedToPosition(position: Vector3): void;
1834
+ /**
1835
+ * Sets the film offset of the camera. A positive value
1836
+ * shifts the camera right, a negative value shifts it left.
1837
+ * @param filmOffset - The film offset to set.
1838
+ */
1839
+ setFilmOffset(filmOffset: number): void;
1840
+ /**
1841
+ * Only used in first-person mode. Sets the forward offset
1842
+ * of the camera. A positive value shifts the camera forward,
1843
+ * a negative value shifts it backward.
1844
+ * @param forwardOffset - The forward offset to set.
1845
+ */
1846
+ setForwardOffset(forwardOffset: number): void;
1847
+ /**
1848
+ * Sets the field of view of the camera.
1849
+ * @param fov - The field of view to set.
1850
+ */
1851
+ setFov(fov: number): void;
1852
+ /**
1853
+ * Sets the nodes of the model the camera is attached to
1854
+ * that will not be rendered for the player. Uses case
1855
+ * insensitive substring matching.
1856
+ * @param hiddenModelNodes - Determines nodes to hide that match these case insensitive substrings.
1857
+ */
1858
+ setHiddenModelNodes(hiddenModelNodes: string[]): void;
1859
+ /**
1860
+ * Sets the mode of the camera.
1861
+ * @param mode - The mode to set.
1862
+ */
1863
+ setMode(mode: PlayerCameraMode): void;
1864
+ /**
1865
+ * Sets the relative offset of the camera from the
1866
+ * entity or position it is attached to.
1867
+ * @param offset - The offset to set.
1868
+ */
1869
+ setOffset(offset: Vector3): void;
1870
+ /**
1871
+ * Sets the entity the camera will constantly look at,
1872
+ * even if the camera attached or tracked entity moves.
1873
+ * @param entity - The entity to track or undefined to stop tracking.
1874
+ */
1875
+ setTrackedEntity(entity: Entity | undefined): void;
1876
+ /**
1877
+ * Sets the position the camera will constantly look at,
1878
+ * even if the camera attached entity moves.
1879
+ * @param position - The position to track or undefined to stop tracking.
1880
+ */
1881
+ setTrackedPosition(position: Vector3 | undefined): void;
1882
+ /**
1883
+ * Sets the zoom of the camera.
1884
+ * @param zoom - The zoom to set, 0 to infinity.
1885
+ */
1886
+ setZoom(zoom: number): void;
1887
+
1888
+
1889
+ }
1890
+
1891
+ /** Payloads for events a PlayerCamera can emit. @public */
1892
+ export declare namespace PlayerCameraEventPayload {
1893
+ export interface LookAtEntity {
1894
+ playerCamera: PlayerCamera;
1895
+ entity: Entity;
1896
+ }
1897
+ export interface LookAtPosition {
1898
+ playerCamera: PlayerCamera;
1899
+ position: Vector3;
1900
+ }
1901
+ export interface SetAttachedToEntity {
1902
+ playerCamera: PlayerCamera;
1903
+ entity: Entity;
1904
+ }
1905
+ export interface SetAttachedToPosition {
1906
+ playerCamera: PlayerCamera;
1907
+ position: Vector3;
1908
+ }
1909
+ export interface SetFilmOffset {
1910
+ playerCamera: PlayerCamera;
1911
+ filmOffset: number;
1912
+ }
1913
+ export interface SetForwardOffset {
1914
+ playerCamera: PlayerCamera;
1915
+ forwardOffset: number;
1916
+ }
1917
+ export interface SetFov {
1918
+ playerCamera: PlayerCamera;
1919
+ fov: number;
1920
+ }
1921
+ export interface SetHiddenModelNodes {
1922
+ playerCamera: PlayerCamera;
1923
+ hiddenModelNodes: string[];
1924
+ }
1925
+ export interface SetMode {
1926
+ playerCamera: PlayerCamera;
1927
+ mode: PlayerCameraMode;
1928
+ }
1929
+ export interface SetOffset {
1930
+ playerCamera: PlayerCamera;
1931
+ offset: Vector3;
1932
+ }
1933
+ export interface SetTrackedEntity {
1934
+ playerCamera: PlayerCamera;
1935
+ entity: Entity | undefined;
1936
+ }
1937
+ export interface SetTrackedPosition {
1938
+ playerCamera: PlayerCamera;
1939
+ position: Vector3 | undefined;
1940
+ }
1941
+ export interface SetZoom {
1942
+ playerCamera: PlayerCamera;
1943
+ zoom: number;
1944
+ }
1945
+ }
1946
+
1947
+ /** Event types a PlayerCamera can emit. @public */
1948
+ export declare enum PlayerCameraEventType {
1949
+ LOOK_AT_ENTITY = "PLAYER_CAMERA.LOOK_AT_ENTITY",
1950
+ LOOK_AT_POSITION = "PLAYER_CAMERA.LOOK_AT_POSITION",
1951
+ SET_ATTACHED_TO_ENTITY = "PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY",
1952
+ SET_ATTACHED_TO_POSITION = "PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",
1953
+ SET_FILM_OFFSET = "PLAYER_CAMERA.SET_FILM_OFFSET",
1954
+ SET_FORWARD_OFFSET = "PLAYER_CAMERA.SET_FORWARD_OFFSET",
1955
+ SET_FOV = "PLAYER_CAMERA.SET_FOV",
1956
+ SET_HIDDEN_MODEL_NODES = "PLAYER_CAMERA.SET_HIDDEN_MODEL_NODES",
1957
+ SET_MODE = "PLAYER_CAMERA.SET_MODE",
1958
+ SET_OFFSET = "PLAYER_CAMERA.SET_OFFSET",
1959
+ SET_TRACKED_ENTITY = "PLAYER_CAMERA.SET_TRACKED_ENTITY",
1960
+ SET_TRACKED_POSITION = "PLAYER_CAMERA.SET_TRACKED_POSITION",
1961
+ SET_ZOOM = "PLAYER_CAMERA.SET_ZOOM"
1962
+ }
1963
+
1964
+ export declare enum PlayerCameraMode {
1965
+ FIRST_PERSON = 0,
1966
+ THIRD_PERSON = 1
1749
1967
  }
1750
1968
 
1751
1969
  /**