hytopia 0.1.97 → 0.1.99
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/docs/server.entity.height.md +13 -0
- package/docs/server.entity.md +22 -1
- package/docs/server.entity.opacity.md +1 -1
- package/docs/server.modelregistry.getheight.md +55 -0
- package/docs/server.modelregistry.md +14 -0
- package/examples/ai-agents/package.json +2 -2
- package/examples/big-world/package.json +2 -2
- package/examples/block-entity/package.json +2 -2
- package/examples/child-entity/package.json +2 -2
- package/examples/custom-ui/package.json +2 -2
- package/examples/entity-spawn/package.json +1 -1
- package/examples/hole-in-wall-game/package.json +2 -2
- package/examples/lighting/package.json +3 -2
- package/examples/pathfinding/index.ts +4 -4
- package/examples/pathfinding/package.json +2 -2
- package/examples/payload-game/index.ts +12 -10
- package/examples/payload-game/package.json +3 -2
- package/examples/wall-dodge-game/package.json +2 -2
- package/examples/zombies-fps/assets/audio/music/bg.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/pistol-reload.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/pistol-shoot.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/player-hurt.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/purchase.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/rifle-reload.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/rifle-shoot.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/ripper-idle.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/roulette.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/shotgun-reload.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/shotgun-shoot.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/wave-start.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/zombie-idle.mp3 +0 -0
- package/examples/zombies-fps/assets/icons/ak-47.png +0 -0
- package/examples/zombies-fps/assets/icons/ar-15.png +0 -0
- package/examples/zombies-fps/assets/icons/auto-pistol.png +0 -0
- package/examples/zombies-fps/assets/icons/auto-shotgun.png +0 -0
- package/examples/zombies-fps/assets/icons/heart.png +0 -0
- package/examples/zombies-fps/assets/icons/pistol.png +0 -0
- package/examples/zombies-fps/assets/icons/shotgun.png +0 -0
- package/examples/zombies-fps/assets/models/environment/bombbox.gltf +1 -0
- package/examples/zombies-fps/assets/models/environment/bullet-hole.gltf +1 -0
- package/examples/zombies-fps/assets/models/environment/healthkit.gltf +1 -0
- package/examples/zombies-fps/assets/models/environment/muzzle-flash.gltf +1 -0
- package/examples/zombies-fps/assets/models/items/ak-47.glb +0 -0
- package/examples/zombies-fps/assets/models/items/ar-15.glb +0 -0
- package/examples/zombies-fps/assets/models/items/auto-pistol.glb +0 -0
- package/examples/zombies-fps/assets/models/items/auto-shotgun.glb +0 -0
- package/examples/zombies-fps/assets/models/items/shotgun.glb +0 -0
- package/examples/zombies-fps/assets/models/npcs/ripper-boss.gltf +1 -0
- package/examples/zombies-fps/assets/models/players/soldier-player.gltf +1 -1
- package/examples/zombies-fps/assets/models/projectiles/bullet-trace.gltf +1 -0
- package/examples/zombies-fps/assets/ui/index.html +620 -27
- package/examples/zombies-fps/classes/EnemyEntity.ts +183 -4
- package/examples/zombies-fps/classes/GameManager.ts +165 -0
- package/examples/zombies-fps/classes/GamePlayerEntity.ts +263 -14
- package/examples/zombies-fps/classes/GunEntity.ts +225 -13
- package/examples/zombies-fps/classes/InteractableEntity.ts +9 -0
- package/examples/zombies-fps/classes/PurchaseBarrierEntity.ts +70 -17
- package/examples/zombies-fps/classes/WeaponCrateEntity.ts +173 -0
- package/examples/zombies-fps/classes/enemies/RipperEntity.ts +67 -0
- package/examples/zombies-fps/classes/enemies/ZombieEntity.ts +30 -0
- package/examples/zombies-fps/classes/guns/AK47Entity.ts +43 -0
- package/examples/zombies-fps/classes/guns/AR15Entity.ts +32 -0
- package/examples/zombies-fps/classes/guns/AutoPistolEntity.ts +36 -0
- package/examples/zombies-fps/classes/guns/AutoShotgunEntity.ts +37 -0
- package/examples/zombies-fps/classes/guns/PistolEntity.ts +23 -15
- package/examples/zombies-fps/classes/guns/ShotgunEntity.ts +92 -0
- package/examples/zombies-fps/gameConfig.ts +125 -21
- package/examples/zombies-fps/index.ts +14 -31
- package/examples/zombies-fps/package.json +2 -2
- package/package.json +1 -1
- package/server.api.json +79 -1
- package/server.d.ts +12 -1
- package/server.js +91 -89
- package/examples/zombies-fps/assets/audio/sfx/pistol-shoot-1.mp3 +0 -0
- package/examples/zombies-fps/assets/audio/sfx/pistol-shoot-2.mp3 +0 -0
- package/examples/zombies-fps/classes/guns/BulletEntity.ts +0 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [server](./server.md) > [Entity](./server.entity.md) > [height](./server.entity.height.md)
|
4
|
+
|
5
|
+
## Entity.height property
|
6
|
+
|
7
|
+
The height of the entity's model or block entity's y\*2 half extents.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
get height(): number;
|
13
|
+
```
|
package/docs/server.entity.md
CHANGED
@@ -164,6 +164,27 @@ The URI or path to the texture to be used, if this is set, the entity is a block
|
|
164
164
|
The controller for the entity.
|
165
165
|
|
166
166
|
|
167
|
+
</td></tr>
|
168
|
+
<tr><td>
|
169
|
+
|
170
|
+
[height](./server.entity.height.md)
|
171
|
+
|
172
|
+
|
173
|
+
</td><td>
|
174
|
+
|
175
|
+
`readonly`
|
176
|
+
|
177
|
+
|
178
|
+
</td><td>
|
179
|
+
|
180
|
+
number
|
181
|
+
|
182
|
+
|
183
|
+
</td><td>
|
184
|
+
|
185
|
+
The height of the entity's model or block entity's y\*2 half extents.
|
186
|
+
|
187
|
+
|
167
188
|
</td></tr>
|
168
189
|
<tr><td>
|
169
190
|
|
@@ -520,7 +541,7 @@ _(Optional)_ A function that is called every tick.
|
|
520
541
|
|
521
542
|
</td><td>
|
522
543
|
|
523
|
-
number
|
544
|
+
number
|
524
545
|
|
525
546
|
|
526
547
|
</td><td>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [server](./server.md) > [ModelRegistry](./server.modelregistry.md) > [getHeight](./server.modelregistry.getheight.md)
|
4
|
+
|
5
|
+
## ModelRegistry.getHeight() method
|
6
|
+
|
7
|
+
Retrieves the Y-axis height of a model for a scale of 1.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
getHeight(modelUri: string): number;
|
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
|
+
modelUri
|
36
|
+
|
37
|
+
|
38
|
+
</td><td>
|
39
|
+
|
40
|
+
string
|
41
|
+
|
42
|
+
|
43
|
+
</td><td>
|
44
|
+
|
45
|
+
The URI of the model to retrieve the height for.
|
46
|
+
|
47
|
+
|
48
|
+
</td></tr>
|
49
|
+
</tbody></table>
|
50
|
+
**Returns:**
|
51
|
+
|
52
|
+
number
|
53
|
+
|
54
|
+
The height of the model.
|
55
|
+
|
@@ -107,6 +107,20 @@ Description
|
|
107
107
|
Retrieves the bounding box of a model.
|
108
108
|
|
109
109
|
|
110
|
+
</td></tr>
|
111
|
+
<tr><td>
|
112
|
+
|
113
|
+
[getHeight(modelUri)](./server.modelregistry.getheight.md)
|
114
|
+
|
115
|
+
|
116
|
+
</td><td>
|
117
|
+
|
118
|
+
|
119
|
+
</td><td>
|
120
|
+
|
121
|
+
Retrieves the Y-axis height of a model for a scale of 1.
|
122
|
+
|
123
|
+
|
110
124
|
</td></tr>
|
111
125
|
<tr><td>
|
112
126
|
|
@@ -47,9 +47,9 @@ startServer(world => {
|
|
47
47
|
// .pathfind() is synchronous and returns immediately soon as a path is found or not, but before the entity has reached the target.
|
48
48
|
const succeeded = pathfindingController.pathfind(playerPosition, 3, { // all possible options for example
|
49
49
|
debug: true, // Setting true will console log pathfinding result info
|
50
|
-
maxFall:
|
51
|
-
maxJump:
|
52
|
-
maxOpenSetIterations:
|
50
|
+
maxFall: 5, // The maximum fall distance (in blocks) the entity can fall when considering a path.
|
51
|
+
maxJump: 2, // The maximum height (in blocks) the entity will jump when considering a path, the controller will apply the jumps automatically while pathfinding.
|
52
|
+
maxOpenSetIterations: 400, // A performance optimization value. A lower value will make pathfinding faster but may fail for longer paths, a higher value can make pathfinding take longer but will work better for longer paths.
|
53
53
|
verticalPenalty: -1, // A behavior control. The more negative the value, the more the entity will prefer taking a route that requires jumping and falling, even going out of its way to do so. A more positive value will prefer avoiding jumps and falls unless absolutely necessary.
|
54
54
|
pathfindAbortCallback: () => { // Invoked when maxOpenSetIterations is reached and pathfinding aborts.
|
55
55
|
console.log('Pathfinding aborted');
|
@@ -85,7 +85,7 @@ startServer(world => {
|
|
85
85
|
},
|
86
86
|
});
|
87
87
|
|
88
|
-
pathfindMarker.spawn(world,
|
88
|
+
pathfindMarker.spawn(world, waypoint);
|
89
89
|
|
90
90
|
pathfindMarkers.push(pathfindMarker);
|
91
91
|
});
|
@@ -147,13 +147,8 @@ startServer(world => { // Perform our game setup logic in the startServer init c
|
|
147
147
|
|
148
148
|
// Setup Player Leave & Despawn Controlled Entity
|
149
149
|
world.onPlayerLeave = player => {
|
150
|
-
// Despawn all player entities for the player that left
|
151
|
-
// We apply a translation prior to despawn because of a bug in the RAPIER
|
152
|
-
// physics engine we use where entities despawned to not trigger a collision
|
153
|
-
// event for leaving a sensor. This is a workaround till a better solution is found.
|
154
150
|
world.entityManager.getPlayerEntitiesByPlayer(player).forEach(entity => {
|
155
|
-
entity.
|
156
|
-
setTimeout(() => entity.despawn(), 50); // Despawn after a short delay so we step the physics after translating it so leaving the sensor registers.
|
151
|
+
entity.despawn();
|
157
152
|
});
|
158
153
|
|
159
154
|
playerCount--;
|
@@ -225,6 +220,12 @@ function spawnBullet(world: World, coordinate: Vector3Like, direction: Vector3Li
|
|
225
220
|
z: direction.z * BULLET_SPEED,
|
226
221
|
},
|
227
222
|
rotation: getRotationFromDirection(direction), // Get the rotation from the direction vector so it's facing the right way we shot it
|
223
|
+
colliders: [
|
224
|
+
{
|
225
|
+
...Collider.optionsFromModelUri('models/bullet.gltf', 0.3),
|
226
|
+
isSensor: true,
|
227
|
+
}
|
228
|
+
]
|
228
229
|
},
|
229
230
|
});
|
230
231
|
|
@@ -255,9 +256,8 @@ function spawnBullet(world: World, coordinate: Vector3Like, direction: Vector3Li
|
|
255
256
|
});
|
256
257
|
|
257
258
|
if (enemyHealth[otherEntity.id!] <= 0) {
|
258
|
-
|
259
|
-
otherEntity.
|
260
|
-
setTimeout(() => { otherEntity.despawn(); }, 50); // Despawn after a short delay so we step the physics after translating it so leaving the sensor registers.
|
259
|
+
console.log('bullet killed spider, despawning spider..');
|
260
|
+
otherEntity.despawn();
|
261
261
|
}
|
262
262
|
|
263
263
|
bullet.despawn();
|
@@ -306,8 +306,10 @@ function spawnPayloadEntity(world: World) {
|
|
306
306
|
onCollision: (other: BlockType | Entity, started: boolean) => {
|
307
307
|
if (other instanceof PlayerEntity) {
|
308
308
|
started ? payloadPlayerEntityCount++ : payloadPlayerEntityCount--;
|
309
|
-
|
309
|
+
console.log('player count change', payloadPlayerEntityCount, started, other.name);
|
310
|
+
} else if (other instanceof Entity && other.name === 'Spider') {
|
310
311
|
started ? payloadPlayerEntityCount-- : payloadPlayerEntityCount++;
|
312
|
+
console.log('ENTITY count change', payloadPlayerEntityCount, started, other.name);
|
311
313
|
}
|
312
314
|
},
|
313
315
|
},
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|