hytopia 0.1.53 → 0.1.54

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.
@@ -0,0 +1,55 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [Block](./server.block.md) &gt; [getNeighborGlobalCoordinateFromHitPoint](./server.block.getneighborglobalcoordinatefromhitpoint.md)
4
+
5
+ ## Block.getNeighborGlobalCoordinateFromHitPoint() method
6
+
7
+ Gets the most adjacent neighbor global coordinate of this block based on a relative hit point, typically from a raycast.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ getNeighborGlobalCoordinateFromHitPoint(hitPoint: Vector3Like): Vector3Like;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ hitPoint
36
+
37
+
38
+ </td><td>
39
+
40
+ [Vector3Like](./server.vector3like.md)
41
+
42
+
43
+ </td><td>
44
+
45
+ The hit point on this block to get the neighbor coordinate from.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ [Vector3Like](./server.vector3like.md)
53
+
54
+ A neighbor global coordinate of this block based on the hit point.
55
+
@@ -82,5 +82,39 @@ The block type of the block.
82
82
  The global coordinate of the block.
83
83
 
84
84
 
85
+ </td></tr>
86
+ </tbody></table>
87
+
88
+ ## Methods
89
+
90
+ <table><thead><tr><th>
91
+
92
+ Method
93
+
94
+
95
+ </th><th>
96
+
97
+ Modifiers
98
+
99
+
100
+ </th><th>
101
+
102
+ Description
103
+
104
+
105
+ </th></tr></thead>
106
+ <tbody><tr><td>
107
+
108
+ [getNeighborGlobalCoordinateFromHitPoint(hitPoint)](./server.block.getneighborglobalcoordinatefromhitpoint.md)
109
+
110
+
111
+ </td><td>
112
+
113
+
114
+ </td><td>
115
+
116
+ Gets the most adjacent neighbor global coordinate of this block based on a relative hit point, typically from a raycast.
117
+
118
+
85
119
  </td></tr>
86
120
  </tbody></table>
package/docs/server.md CHANGED
@@ -472,6 +472,8 @@ Event types a PlayerCamera can emit.
472
472
 
473
473
  </td><td>
474
474
 
475
+ The mode of the camera.
476
+
475
477
 
476
478
  </td></tr>
477
479
  <tr><td>
@@ -492,7 +494,7 @@ Event types a Player can emit.
492
494
 
493
495
  </td><td>
494
496
 
495
- Event types a
497
+ Event types a PlayerUI can emit.
496
498
 
497
499
 
498
500
  </td></tr>
@@ -1095,6 +1097,8 @@ A raw set of collision groups represented as a 32-bit number.
1095
1097
 
1096
1098
  </td><td>
1097
1099
 
1100
+ A hit result from a raycast.
1101
+
1098
1102
 
1099
1103
  </td></tr>
1100
1104
  <tr><td>
@@ -61,27 +61,6 @@ Description
61
61
  The camera for the player.
62
62
 
63
63
 
64
- </td></tr>
65
- <tr><td>
66
-
67
- [cameraOrientation](./server.player.cameraorientation.md)
68
-
69
-
70
- </td><td>
71
-
72
- `readonly`
73
-
74
-
75
- </td><td>
76
-
77
- Readonly&lt;[PlayerCameraOrientation](./server.playercameraorientation.md)<!-- -->&gt;
78
-
79
-
80
- </td><td>
81
-
82
- The current [PlayerCameraOrientation](./server.playercameraorientation.md) of the player.
83
-
84
-
85
64
  </td></tr>
86
65
  <tr><td>
87
66
 
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [PlayerCamera](./server.playercamera.md) &gt; [facingDirection](./server.playercamera.facingdirection.md)
4
+
5
+ ## PlayerCamera.facingDirection property
6
+
7
+ The facing direction vector of the camera based on its current orientation.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ get facingDirection(): Vector3Like;
13
+ ```
@@ -90,6 +90,27 @@ The entity the camera is attached to.
90
90
  The position the camera is attached to.
91
91
 
92
92
 
93
+ </td></tr>
94
+ <tr><td>
95
+
96
+ [facingDirection](./server.playercamera.facingdirection.md)
97
+
98
+
99
+ </td><td>
100
+
101
+ `readonly`
102
+
103
+
104
+ </td><td>
105
+
106
+ [Vector3Like](./server.vector3like.md)
107
+
108
+
109
+ </td><td>
110
+
111
+ The facing direction vector of the camera based on its current orientation.
112
+
113
+
93
114
  </td></tr>
94
115
  <tr><td>
95
116
 
@@ -216,6 +237,27 @@ The nodes of the model the camera is attached to that will not be rendered for t
216
237
  The relative offset of the camera from the entity or position it is attached to.
217
238
 
218
239
 
240
+ </td></tr>
241
+ <tr><td>
242
+
243
+ [orientation](./server.playercamera.orientation.md)
244
+
245
+
246
+ </td><td>
247
+
248
+ `readonly`
249
+
250
+
251
+ </td><td>
252
+
253
+ [PlayerCameraOrientation](./server.playercameraorientation.md)
254
+
255
+
256
+ </td><td>
257
+
258
+ The current orientation of the camera.
259
+
260
+
219
261
  </td></tr>
220
262
  <tr><td>
221
263
 
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [PlayerCamera](./server.playercamera.md) &gt; [orientation](./server.playercamera.orientation.md)
4
+
5
+ ## PlayerCamera.orientation property
6
+
7
+ The current orientation of the camera.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ get orientation(): PlayerCameraOrientation;
13
+ ```
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## PlayerCameraMode enum
6
6
 
7
+ The mode of the camera.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## PlayerUIEventType enum
6
6
 
7
- Event types a
7
+ Event types a PlayerUI can emit.
8
8
 
9
9
  **Signature:**
10
10
 
@@ -4,11 +4,14 @@
4
4
 
5
5
  ## RaycastHit type
6
6
 
7
+ A hit result from a raycast.
8
+
7
9
  **Signature:**
8
10
 
9
11
  ```typescript
10
12
  export type RaycastHit = {
11
- hitObject: Block | Entity;
13
+ hitBlock?: Block;
14
+ hitEntity?: Entity;
12
15
  hitPoint: Vector3Like;
13
16
  hitDistance: number;
14
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.api.json CHANGED
@@ -3011,6 +3011,56 @@
3011
3011
  "isProtected": false,
3012
3012
  "isAbstract": false
3013
3013
  },
3014
+ {
3015
+ "kind": "Method",
3016
+ "canonicalReference": "server!Block#getNeighborGlobalCoordinateFromHitPoint:member(1)",
3017
+ "docComment": "/**\n * Gets the most adjacent neighbor global coordinate of this block based on a relative hit point, typically from a raycast.\n *\n * @param hitPoint - The hit point on this block to get the neighbor coordinate from.\n *\n * @returns A neighbor global coordinate of this block based on the hit point.\n */\n",
3018
+ "excerptTokens": [
3019
+ {
3020
+ "kind": "Content",
3021
+ "text": "getNeighborGlobalCoordinateFromHitPoint(hitPoint: "
3022
+ },
3023
+ {
3024
+ "kind": "Reference",
3025
+ "text": "Vector3Like",
3026
+ "canonicalReference": "server!Vector3Like:interface"
3027
+ },
3028
+ {
3029
+ "kind": "Content",
3030
+ "text": "): "
3031
+ },
3032
+ {
3033
+ "kind": "Reference",
3034
+ "text": "Vector3Like",
3035
+ "canonicalReference": "server!Vector3Like:interface"
3036
+ },
3037
+ {
3038
+ "kind": "Content",
3039
+ "text": ";"
3040
+ }
3041
+ ],
3042
+ "isStatic": false,
3043
+ "returnTypeTokenRange": {
3044
+ "startIndex": 3,
3045
+ "endIndex": 4
3046
+ },
3047
+ "releaseTag": "Public",
3048
+ "isProtected": false,
3049
+ "overloadIndex": 1,
3050
+ "parameters": [
3051
+ {
3052
+ "parameterName": "hitPoint",
3053
+ "parameterTypeTokenRange": {
3054
+ "startIndex": 1,
3055
+ "endIndex": 2
3056
+ },
3057
+ "isOptional": false
3058
+ }
3059
+ ],
3060
+ "isOptional": false,
3061
+ "isAbstract": false,
3062
+ "name": "getNeighborGlobalCoordinateFromHitPoint"
3063
+ },
3014
3064
  {
3015
3065
  "kind": "Property",
3016
3066
  "canonicalReference": "server!Block#globalCoordinate:member",
@@ -13329,50 +13379,6 @@
13329
13379
  "isProtected": false,
13330
13380
  "isAbstract": false
13331
13381
  },
13332
- {
13333
- "kind": "Property",
13334
- "canonicalReference": "server!Player#cameraOrientation:member",
13335
- "docComment": "/**\n * The current {@link PlayerCameraOrientation} of the player.\n */\n",
13336
- "excerptTokens": [
13337
- {
13338
- "kind": "Content",
13339
- "text": "get cameraOrientation(): "
13340
- },
13341
- {
13342
- "kind": "Reference",
13343
- "text": "Readonly",
13344
- "canonicalReference": "!Readonly:type"
13345
- },
13346
- {
13347
- "kind": "Content",
13348
- "text": "<"
13349
- },
13350
- {
13351
- "kind": "Reference",
13352
- "text": "PlayerCameraOrientation",
13353
- "canonicalReference": "server!PlayerCameraOrientation:type"
13354
- },
13355
- {
13356
- "kind": "Content",
13357
- "text": ">"
13358
- },
13359
- {
13360
- "kind": "Content",
13361
- "text": ";"
13362
- }
13363
- ],
13364
- "isReadonly": true,
13365
- "isOptional": false,
13366
- "releaseTag": "Public",
13367
- "name": "cameraOrientation",
13368
- "propertyTypeTokenRange": {
13369
- "startIndex": 1,
13370
- "endIndex": 5
13371
- },
13372
- "isStatic": false,
13373
- "isProtected": false,
13374
- "isAbstract": false
13375
- },
13376
13382
  {
13377
13383
  "kind": "Method",
13378
13384
  "canonicalReference": "server!Player#disconnect:member(1)",
@@ -13752,6 +13758,37 @@
13752
13758
  "isProtected": false,
13753
13759
  "isAbstract": false
13754
13760
  },
13761
+ {
13762
+ "kind": "Property",
13763
+ "canonicalReference": "server!PlayerCamera#facingDirection:member",
13764
+ "docComment": "/**\n * The facing direction vector of the camera based on its current orientation.\n */\n",
13765
+ "excerptTokens": [
13766
+ {
13767
+ "kind": "Content",
13768
+ "text": "get facingDirection(): "
13769
+ },
13770
+ {
13771
+ "kind": "Reference",
13772
+ "text": "Vector3Like",
13773
+ "canonicalReference": "server!Vector3Like:interface"
13774
+ },
13775
+ {
13776
+ "kind": "Content",
13777
+ "text": ";"
13778
+ }
13779
+ ],
13780
+ "isReadonly": true,
13781
+ "isOptional": false,
13782
+ "releaseTag": "Public",
13783
+ "name": "facingDirection",
13784
+ "propertyTypeTokenRange": {
13785
+ "startIndex": 1,
13786
+ "endIndex": 2
13787
+ },
13788
+ "isStatic": false,
13789
+ "isProtected": false,
13790
+ "isAbstract": false
13791
+ },
13755
13792
  {
13756
13793
  "kind": "Property",
13757
13794
  "canonicalReference": "server!PlayerCamera#filmOffset:member",
@@ -14037,6 +14074,37 @@
14037
14074
  "isProtected": false,
14038
14075
  "isAbstract": false
14039
14076
  },
14077
+ {
14078
+ "kind": "Property",
14079
+ "canonicalReference": "server!PlayerCamera#orientation:member",
14080
+ "docComment": "/**\n * The current orientation of the camera.\n */\n",
14081
+ "excerptTokens": [
14082
+ {
14083
+ "kind": "Content",
14084
+ "text": "get orientation(): "
14085
+ },
14086
+ {
14087
+ "kind": "Reference",
14088
+ "text": "PlayerCameraOrientation",
14089
+ "canonicalReference": "server!PlayerCameraOrientation:type"
14090
+ },
14091
+ {
14092
+ "kind": "Content",
14093
+ "text": ";"
14094
+ }
14095
+ ],
14096
+ "isReadonly": true,
14097
+ "isOptional": false,
14098
+ "releaseTag": "Public",
14099
+ "name": "orientation",
14100
+ "propertyTypeTokenRange": {
14101
+ "startIndex": 1,
14102
+ "endIndex": 2
14103
+ },
14104
+ "isStatic": false,
14105
+ "isProtected": false,
14106
+ "isAbstract": false
14107
+ },
14040
14108
  {
14041
14109
  "kind": "Property",
14042
14110
  "canonicalReference": "server!PlayerCamera#player:member",
@@ -15985,7 +16053,7 @@
15985
16053
  {
15986
16054
  "kind": "Enum",
15987
16055
  "canonicalReference": "server!PlayerCameraMode:enum",
15988
- "docComment": "",
16056
+ "docComment": "/**\n * The mode of the camera.\n *\n * @public\n */\n",
15989
16057
  "excerptTokens": [
15990
16058
  {
15991
16059
  "kind": "Content",
@@ -16059,7 +16127,7 @@
16059
16127
  "text": ";"
16060
16128
  }
16061
16129
  ],
16062
- "fileUrlPath": "src/networking/players/Player.ts",
16130
+ "fileUrlPath": "src/networking/players/PlayerCamera.ts",
16063
16131
  "releaseTag": "Public",
16064
16132
  "name": "PlayerCameraOrientation",
16065
16133
  "typeTokenRange": {
@@ -17196,7 +17264,7 @@
17196
17264
  {
17197
17265
  "kind": "Enum",
17198
17266
  "canonicalReference": "server!PlayerUIEventType:enum",
17199
- "docComment": "/**\n * Event types a\n */\n",
17267
+ "docComment": "/**\n * Event types a PlayerUI can emit.\n *\n * @public\n */\n",
17200
17268
  "excerptTokens": [
17201
17269
  {
17202
17270
  "kind": "Content",
@@ -18683,7 +18751,7 @@
18683
18751
  {
18684
18752
  "kind": "TypeAlias",
18685
18753
  "canonicalReference": "server!RaycastHit:type",
18686
- "docComment": "",
18754
+ "docComment": "/**\n * A hit result from a raycast.\n *\n * @public\n */\n",
18687
18755
  "excerptTokens": [
18688
18756
  {
18689
18757
  "kind": "Content",
@@ -18691,7 +18759,7 @@
18691
18759
  },
18692
18760
  {
18693
18761
  "kind": "Content",
18694
- "text": "{\n hitObject: "
18762
+ "text": "{\n hitBlock?: "
18695
18763
  },
18696
18764
  {
18697
18765
  "kind": "Reference",
@@ -18700,7 +18768,7 @@
18700
18768
  },
18701
18769
  {
18702
18770
  "kind": "Content",
18703
- "text": " | "
18771
+ "text": ";\n hitEntity?: "
18704
18772
  },
18705
18773
  {
18706
18774
  "kind": "Reference",
package/server.d.ts CHANGED
@@ -348,6 +348,14 @@ export declare class Block {
348
348
  readonly blockType: BlockType;
349
349
 
350
350
 
351
+ /**
352
+ * Gets the most adjacent neighbor global coordinate of this block
353
+ * based on a relative hit point, typically from a raycast.
354
+ *
355
+ * @param hitPoint - The hit point on this block to get the neighbor coordinate from.
356
+ * @returns A neighbor global coordinate of this block based on the hit point.
357
+ */
358
+ getNeighborGlobalCoordinateFromHitPoint(hitPoint: Vector3Like): Vector3Like;
351
359
  }
352
360
 
353
361
  /**
@@ -1820,11 +1828,8 @@ export declare class Player {
1820
1828
 
1821
1829
 
1822
1830
 
1823
-
1824
1831
  /** The current {@link PlayerInput} of the player. */
1825
1832
  get input(): Readonly<PlayerInput>;
1826
- /** The current {@link PlayerCameraOrientation} of the player. */
1827
- get cameraOrientation(): Readonly<PlayerCameraOrientation>;
1828
1833
  /** The current {@link World} the player is in. */
1829
1834
  get world(): World | undefined;
1830
1835
  /**
@@ -1884,10 +1889,13 @@ export declare class PlayerCamera implements protocol.Serializable {
1884
1889
 
1885
1890
 
1886
1891
 
1892
+
1887
1893
  /** The entity the camera is attached to. */
1888
1894
  get attachedToEntity(): Entity | undefined;
1889
1895
  /** The position the camera is attached to. */
1890
1896
  get attachedToPosition(): Vector3Like | undefined;
1897
+ /** The facing direction vector of the camera based on its current orientation. */
1898
+ get facingDirection(): Vector3Like;
1891
1899
  /** The film offset of the camera. A positive value shifts the camera right, a negative value shifts it left. */
1892
1900
  get filmOffset(): number;
1893
1901
  /** 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. */
@@ -1900,6 +1908,8 @@ export declare class PlayerCamera implements protocol.Serializable {
1900
1908
  get mode(): PlayerCameraMode;
1901
1909
  /** The relative offset of the camera from the entity or position it is attached to. */
1902
1910
  get offset(): Vector3Like;
1911
+ /** The current orientation of the camera. */
1912
+ get orientation(): PlayerCameraOrientation;
1903
1913
  /** The entity the camera will constantly look at, even if the camera attached or tracked entity moves. */
1904
1914
  get trackedEntity(): Entity | undefined;
1905
1915
  /** The position the camera will constantly look at, even if the camera attached entity moves. */
@@ -1966,6 +1976,8 @@ export declare class PlayerCamera implements protocol.Serializable {
1966
1976
  * @param offset - The offset to set.
1967
1977
  */
1968
1978
  setOffset(offset: Vector3Like): void;
1979
+
1980
+
1969
1981
  /**
1970
1982
  * Sets the entity the camera will constantly look at,
1971
1983
  * even if the camera attached or tracked entity moves.
@@ -2060,6 +2072,7 @@ export declare enum PlayerCameraEventType {
2060
2072
  SET_ZOOM = "PLAYER_CAMERA.SET_ZOOM"
2061
2073
  }
2062
2074
 
2075
+ /** The mode of the camera. @public */
2063
2076
  export declare enum PlayerCameraMode {
2064
2077
  FIRST_PERSON = 0,
2065
2078
  THIRD_PERSON = 1
@@ -2239,7 +2252,7 @@ export declare namespace PlayerUIEventPayload {
2239
2252
  }
2240
2253
  }
2241
2254
 
2242
- /** Event types a */
2255
+ /** Event types a PlayerUI can emit. @public */
2243
2256
  export declare enum PlayerUIEventType {
2244
2257
  LOAD = "PLAYER_UI.LOAD",
2245
2258
  SEND_DATA = "PLAYER_UI.SEND_DATA"
@@ -2433,9 +2446,12 @@ export declare interface QuaternionLike {
2433
2446
  /** A raw set of collision groups represented as a 32-bit number. @public */
2434
2447
  export declare type RawCollisionGroups = RAPIER.InteractionGroups;
2435
2448
 
2449
+ /** A hit result from a raycast. @public */
2436
2450
  export declare type RaycastHit = {
2437
- /** The block or entity the raycast hit. */
2438
- hitObject: Block | Entity;
2451
+ /** The block the raycast hit. */
2452
+ hitBlock?: Block;
2453
+ /** The entity the raycast hit */
2454
+ hitEntity?: Entity;
2439
2455
  /** The point in global coordinate space the raycast hit the object. */
2440
2456
  hitPoint: Vector3Like;
2441
2457
  /** The distance from origin where the raycast hit. */