hytopia 0.1.49 → 0.1.51
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 +2623 -0
- package/docs/server.basecharactercontroller.md +4 -4
- package/docs/server.basecharactercontroller.ontickwithplayerinput.md +13 -0
- package/docs/{server.basecharactercontroller.tickplayermovement.md → server.basecharactercontroller.tickwithplayerinput.md} +8 -8
- package/docs/server.defaultcharactercontroller.md +1 -1
- package/docs/{server.defaultcharactercontroller.tickplayermovement.md → server.defaultcharactercontroller.tickwithplayerinput.md} +8 -8
- package/docs/server.md +5 -5
- package/docs/server.player.cameraorientation.md +13 -0
- package/docs/server.player.input.md +13 -0
- package/docs/server.player.md +9 -9
- package/docs/server.playercameraorientation.md +16 -0
- package/docs/server.playerinput.md +13 -0
- package/docs/server.simulation.enabledebugraycasting.md +53 -0
- package/docs/server.simulation.enabledebugrendering.md +1 -1
- package/docs/server.simulation.isdebugraycastingenabled.md +13 -0
- package/docs/server.simulation.md +36 -1
- package/docs/server.supported_input_keys.md +1 -1
- package/examples/big-world/README.md +4 -0
- package/examples/big-world/package.json +14 -0
- package/examples/block-entity/README.md +3 -0
- package/examples/block-entity/assets/map.json +2623 -0
- package/examples/block-entity/package.json +15 -0
- package/examples/character-controller/MyCharacterController.ts +8 -8
- package/examples/character-controller/README.md +4 -0
- package/examples/character-controller/assets/map.json +2623 -0
- package/examples/character-controller/package.json +15 -0
- package/examples/custom-ui/README.md +4 -0
- package/examples/custom-ui/assets/map.json +2623 -0
- package/examples/custom-ui/package.json +15 -0
- package/examples/entity-spawn/README.md +3 -0
- package/examples/entity-spawn/assets/map.json +2623 -0
- package/examples/entity-spawn/package.json +15 -0
- package/examples/payload-game/README.md +8 -0
- package/examples/payload-game/assets/ui/index.html +42 -0
- package/examples/payload-game/index.ts +24 -18
- package/examples/payload-game/package.json +15 -0
- package/package.json +1 -1
- package/server.api.json +191 -113
- package/server.d.ts +34 -23
- package/server.js +80 -80
- package/docs/server.basecharactercontroller.ontickplayermovement.md +0 -13
- package/docs/server.player.inputstate.md +0 -13
- package/docs/server.player.orientationstate.md +0 -13
- package/docs/server.playerinputstate.md +0 -13
- package/docs/server.playerorientationstate.md +0 -16
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"name": "block-entity",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"keywords": [],
|
10
|
+
"author": "",
|
11
|
+
"license": "ISC",
|
12
|
+
"devDependencies": {
|
13
|
+
"@hytopia.com/assets": "^0.1.6"
|
14
|
+
}
|
15
|
+
}
|
@@ -10,8 +10,8 @@ import {
|
|
10
10
|
} from 'hytopia';
|
11
11
|
|
12
12
|
import type {
|
13
|
-
|
14
|
-
|
13
|
+
PlayerInput,
|
14
|
+
PlayerCameraOrientation,
|
15
15
|
Vector3,
|
16
16
|
} from 'hytopia';
|
17
17
|
|
@@ -123,13 +123,13 @@ export default class MyCharacterController extends BaseCharacterController {
|
|
123
123
|
* each tick. tickPlayerMovement is called internally if the entity
|
124
124
|
* is of the PlayerEntity class.
|
125
125
|
*/
|
126
|
-
public
|
126
|
+
public tickWithPlayerInput(input: PlayerInput, cameraOrientation: PlayerCameraOrientation, deltaTimeMs: number) {
|
127
127
|
if (!this.entity.isSpawned || !this.entity.world) return; // type guard.
|
128
128
|
|
129
|
-
super.
|
129
|
+
super.tickWithPlayerInput(input, cameraOrientation, deltaTimeMs);
|
130
130
|
|
131
|
-
const { w, a, s, d, sp, sh, ml, mr } =
|
132
|
-
const { yaw } =
|
131
|
+
const { w, a, s, d, sp, sh, ml, mr } = input; // See PlayerInput type for all possible inputs.
|
132
|
+
const { yaw } = cameraOrientation; // Camera/perspectie orientation of player.
|
133
133
|
const currentVelocity = this.entity.getLinearVelocity();
|
134
134
|
const targetVelocities = { x: 0, y: 0, z: 0 };
|
135
135
|
const isRunning = sh;
|
@@ -159,13 +159,13 @@ export default class MyCharacterController extends BaseCharacterController {
|
|
159
159
|
// Play a simple interact animation on left mouse click then clear the input.
|
160
160
|
if (ml) {
|
161
161
|
this.entity.startModelOneshotAnimations([ 'simple_interact' ]);
|
162
|
-
|
162
|
+
input.ml = false;
|
163
163
|
}
|
164
164
|
|
165
165
|
// Rocket the player up on mouse right click.
|
166
166
|
if (mr) {
|
167
167
|
targetVelocities.y = 20;
|
168
|
-
|
168
|
+
input.mr = false;
|
169
169
|
}
|
170
170
|
|
171
171
|
// Calculate target horizontal velocities (run/walk)
|