hytopia 0.1.95 → 0.1.96

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,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [PlayerEntityController](./server.playerentitycontroller.md) &gt; [idleLoopedAnimations](./server.playerentitycontroller.idleloopedanimations.md)
4
+
5
+ ## PlayerEntityController.idleLoopedAnimations property
6
+
7
+ The looped animation(s) that will play when the entity is idle.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ idleLoopedAnimations: string[];
13
+ ```
@@ -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; [PlayerEntityController](./server.playerentitycontroller.md) &gt; [interactOneshotAnimations](./server.playerentitycontroller.interactoneshotanimations.md)
4
+
5
+ ## PlayerEntityController.interactOneshotAnimations property
6
+
7
+ The oneshot animation(s) that will play when the entity interacts (left click)
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ interactOneshotAnimations: string[];
13
+ ```
@@ -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; [PlayerEntityController](./server.playerentitycontroller.md) &gt; [jumpOneshotAnimations](./server.playerentitycontroller.jumponeshotanimations.md)
4
+
5
+ ## PlayerEntityController.jumpOneshotAnimations property
6
+
7
+ The oneshot animation(s) that will play when the entity is jumping.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ jumpOneshotAnimations: string[];
13
+ ```
@@ -145,6 +145,44 @@ A function allowing custom logic to determine if the entity can run.
145
145
  A function allowing custom logic to determine if the entity can walk.
146
146
 
147
147
 
148
+ </td></tr>
149
+ <tr><td>
150
+
151
+ [idleLoopedAnimations](./server.playerentitycontroller.idleloopedanimations.md)
152
+
153
+
154
+ </td><td>
155
+
156
+
157
+ </td><td>
158
+
159
+ string\[\]
160
+
161
+
162
+ </td><td>
163
+
164
+ The looped animation(s) that will play when the entity is idle.
165
+
166
+
167
+ </td></tr>
168
+ <tr><td>
169
+
170
+ [interactOneshotAnimations](./server.playerentitycontroller.interactoneshotanimations.md)
171
+
172
+
173
+ </td><td>
174
+
175
+
176
+ </td><td>
177
+
178
+ string\[\]
179
+
180
+
181
+ </td><td>
182
+
183
+ The oneshot animation(s) that will play when the entity interacts (left click)
184
+
185
+
148
186
  </td></tr>
149
187
  <tr><td>
150
188
 
@@ -187,6 +225,25 @@ boolean
187
225
  Whether the entity is on a platform, a platform is any entity with a kinematic rigid body.
188
226
 
189
227
 
228
+ </td></tr>
229
+ <tr><td>
230
+
231
+ [jumpOneshotAnimations](./server.playerentitycontroller.jumponeshotanimations.md)
232
+
233
+
234
+ </td><td>
235
+
236
+
237
+ </td><td>
238
+
239
+ string\[\]
240
+
241
+
242
+ </td><td>
243
+
244
+ The oneshot animation(s) that will play when the entity is jumping.
245
+
246
+
190
247
  </td></tr>
191
248
  <tr><td>
192
249
 
@@ -227,6 +284,25 @@ The upward velocity applied to the entity when it jumps.
227
284
  The platform the entity is on, if any.
228
285
 
229
286
 
287
+ </td></tr>
288
+ <tr><td>
289
+
290
+ [runLoopedAnimations](./server.playerentitycontroller.runloopedanimations.md)
291
+
292
+
293
+ </td><td>
294
+
295
+
296
+ </td><td>
297
+
298
+ string\[\]
299
+
300
+
301
+ </td><td>
302
+
303
+ The looped animation(s) that will play when the entity is running.
304
+
305
+
230
306
  </td></tr>
231
307
  <tr><td>
232
308
 
@@ -265,6 +341,25 @@ boolean
265
341
  Whether the entity sticks to platforms.
266
342
 
267
343
 
344
+ </td></tr>
345
+ <tr><td>
346
+
347
+ [walkLoopedAnimations](./server.playerentitycontroller.walkloopedanimations.md)
348
+
349
+
350
+ </td><td>
351
+
352
+
353
+ </td><td>
354
+
355
+ string\[\]
356
+
357
+
358
+ </td><td>
359
+
360
+ The looped animation(s) that will play when the entity is walking.
361
+
362
+
268
363
  </td></tr>
269
364
  <tr><td>
270
365
 
@@ -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; [PlayerEntityController](./server.playerentitycontroller.md) &gt; [runLoopedAnimations](./server.playerentitycontroller.runloopedanimations.md)
4
+
5
+ ## PlayerEntityController.runLoopedAnimations property
6
+
7
+ The looped animation(s) that will play when the entity is running.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ runLoopedAnimations: string[];
13
+ ```
@@ -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; [PlayerEntityController](./server.playerentitycontroller.md) &gt; [walkLoopedAnimations](./server.playerentitycontroller.walkloopedanimations.md)
4
+
5
+ ## PlayerEntityController.walkLoopedAnimations property
6
+
7
+ The looped animation(s) that will play when the entity is walking.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ walkLoopedAnimations: string[];
13
+ ```
@@ -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; [PlayerEntityControllerOptions](./server.playerentitycontrolleroptions.md) &gt; [idleLoopedAnimations](./server.playerentitycontrolleroptions.idleloopedanimations.md)
4
+
5
+ ## PlayerEntityControllerOptions.idleLoopedAnimations property
6
+
7
+ Overrides the animation(s) that will play when the entity is idle.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ idleLoopedAnimations?: string[];
13
+ ```
@@ -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; [PlayerEntityControllerOptions](./server.playerentitycontrolleroptions.md) &gt; [interactOneshotAnimations](./server.playerentitycontrolleroptions.interactoneshotanimations.md)
4
+
5
+ ## PlayerEntityControllerOptions.interactOneshotAnimations property
6
+
7
+ Overrides the animation(s) that will play when the entity interacts (left click)
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ interactOneshotAnimations?: string[];
13
+ ```
@@ -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; [PlayerEntityControllerOptions](./server.playerentitycontrolleroptions.md) &gt; [jumpOneshotAnimations](./server.playerentitycontrolleroptions.jumponeshotanimations.md)
4
+
5
+ ## PlayerEntityControllerOptions.jumpOneshotAnimations property
6
+
7
+ Overrides the animation(s) that will play when the entity is jumping.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ jumpOneshotAnimations?: string[];
13
+ ```
@@ -91,6 +91,63 @@ _(Optional)_ A function allowing custom logic to determine if the entity can run
91
91
  _(Optional)_ A function allowing custom logic to determine if the entity can walk.
92
92
 
93
93
 
94
+ </td></tr>
95
+ <tr><td>
96
+
97
+ [idleLoopedAnimations?](./server.playerentitycontrolleroptions.idleloopedanimations.md)
98
+
99
+
100
+ </td><td>
101
+
102
+
103
+ </td><td>
104
+
105
+ string\[\]
106
+
107
+
108
+ </td><td>
109
+
110
+ _(Optional)_ Overrides the animation(s) that will play when the entity is idle.
111
+
112
+
113
+ </td></tr>
114
+ <tr><td>
115
+
116
+ [interactOneshotAnimations?](./server.playerentitycontrolleroptions.interactoneshotanimations.md)
117
+
118
+
119
+ </td><td>
120
+
121
+
122
+ </td><td>
123
+
124
+ string\[\]
125
+
126
+
127
+ </td><td>
128
+
129
+ _(Optional)_ Overrides the animation(s) that will play when the entity interacts (left click)
130
+
131
+
132
+ </td></tr>
133
+ <tr><td>
134
+
135
+ [jumpOneshotAnimations?](./server.playerentitycontrolleroptions.jumponeshotanimations.md)
136
+
137
+
138
+ </td><td>
139
+
140
+
141
+ </td><td>
142
+
143
+ string\[\]
144
+
145
+
146
+ </td><td>
147
+
148
+ _(Optional)_ Overrides the animation(s) that will play when the entity is jumping.
149
+
150
+
94
151
  </td></tr>
95
152
  <tr><td>
96
153
 
@@ -110,6 +167,25 @@ number
110
167
  _(Optional)_ The upward velocity applied to the entity when it jumps.
111
168
 
112
169
 
170
+ </td></tr>
171
+ <tr><td>
172
+
173
+ [runLoopedAnimations?](./server.playerentitycontrolleroptions.runloopedanimations.md)
174
+
175
+
176
+ </td><td>
177
+
178
+
179
+ </td><td>
180
+
181
+ string\[\]
182
+
183
+
184
+ </td><td>
185
+
186
+ _(Optional)_ Overrides the animation(s) that will play when the entity is running.
187
+
188
+
113
189
  </td></tr>
114
190
  <tr><td>
115
191
 
@@ -148,6 +224,25 @@ boolean
148
224
  _(Optional)_ Whether the entity sticks to platforms, defaults to true.
149
225
 
150
226
 
227
+ </td></tr>
228
+ <tr><td>
229
+
230
+ [walkLoopedAnimations?](./server.playerentitycontrolleroptions.walkloopedanimations.md)
231
+
232
+
233
+ </td><td>
234
+
235
+
236
+ </td><td>
237
+
238
+ string\[\]
239
+
240
+
241
+ </td><td>
242
+
243
+ _(Optional)_ Overrides the animation(s) that will play when the entity is walking.
244
+
245
+
151
246
  </td></tr>
152
247
  <tr><td>
153
248
 
@@ -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; [PlayerEntityControllerOptions](./server.playerentitycontrolleroptions.md) &gt; [runLoopedAnimations](./server.playerentitycontrolleroptions.runloopedanimations.md)
4
+
5
+ ## PlayerEntityControllerOptions.runLoopedAnimations property
6
+
7
+ Overrides the animation(s) that will play when the entity is running.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ runLoopedAnimations?: string[];
13
+ ```
@@ -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; [PlayerEntityControllerOptions](./server.playerentitycontrolleroptions.md) &gt; [walkLoopedAnimations](./server.playerentitycontrolleroptions.walkloopedanimations.md)
4
+
5
+ ## PlayerEntityControllerOptions.walkLoopedAnimations property
6
+
7
+ Overrides the animation(s) that will play when the entity is walking.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ walkLoopedAnimations?: string[];
13
+ ```
@@ -2,8 +2,14 @@ import {
2
2
  Player,
3
3
  PlayerEntity,
4
4
  PlayerCameraMode,
5
+ Vector3Like,
6
+ QuaternionLike,
7
+ World,
8
+ Quaternion,
5
9
  } from 'hytopia';
6
10
 
11
+ import WeaponEntity from './WeaponEntity';
12
+
7
13
  const BASE_HEALTH = 100;
8
14
 
9
15
  export default class GamePlayerEntity extends PlayerEntity {
@@ -15,7 +21,7 @@ export default class GamePlayerEntity extends PlayerEntity {
15
21
  player,
16
22
  name: 'Player',
17
23
  modelUri: 'models/players/soldier-player.gltf',
18
- modelLoopedAnimations: [ 'idle' ],
24
+ modelLoopedAnimations: [ 'idle_gun_right', 'shoot_gun_right' ],
19
25
  modelScale: 0.5,
20
26
  });
21
27
 
@@ -27,4 +33,22 @@ export default class GamePlayerEntity extends PlayerEntity {
27
33
  this.health = BASE_HEALTH;
28
34
  this.maxHealth = BASE_HEALTH;
29
35
  }
36
+
37
+ public override spawn(world: World, position: Vector3Like, rotation?: QuaternionLike): void {
38
+ super.spawn(world, position, rotation);
39
+
40
+ const weapon = new WeaponEntity({
41
+ name: 'Pistol',
42
+ modelUri: 'models/items/pistol.glb',
43
+ modelScale: 1.3,
44
+ damage: 10,
45
+ ammo: 10,
46
+ maxAmmo: 10,
47
+ parent: this,
48
+ parentNodeName: 'hand_right_anchor',
49
+ });
50
+
51
+ weapon.spawn(world, { x: 0, y: 0, z: 0 }, Quaternion.fromEuler(-90, 0, 0));
52
+ }
30
53
  }
54
+
@@ -12,7 +12,7 @@ const WALL_COLLIDER_OPTIONS: ColliderOptions = {
12
12
  shape: ColliderShape.BLOCK,
13
13
  halfExtents: {
14
14
  x: 0.5,
15
- y: 0, //5,
15
+ y: 5,
16
16
  z: 0.5,
17
17
  },
18
18
  };
@@ -0,0 +1,32 @@
1
+ import {
2
+ Entity,
3
+ EntityOptions,
4
+ } from 'hytopia';
5
+
6
+ export interface WeaponEntityOptions extends EntityOptions {
7
+ damage: number;
8
+ ammo: number;
9
+ maxAmmo: number;
10
+ }
11
+
12
+ export default class WeaponEntity extends Entity {
13
+ public damage: number;
14
+ public ammo: number;
15
+ public maxAmmo: number;
16
+
17
+ public constructor(options: WeaponEntityOptions) {
18
+ super(options);
19
+
20
+ this.damage = options.damage;
21
+ this.ammo = options.ammo;
22
+ this.maxAmmo = options.maxAmmo;
23
+ }
24
+
25
+ public shoot() {
26
+ if (this.ammo <= 0) {
27
+ return;
28
+ }
29
+
30
+ this.ammo--;
31
+ }
32
+ }
@@ -49,28 +49,27 @@ export const INVISIBLE_WALLS = [
49
49
  position: { x: -29, y: 1, z: -23 },
50
50
  halfExtents: { x: 0.5, y: 5, z: 1.5 },
51
51
  }
52
-
53
52
  ]
54
53
 
55
54
  export const PURCHASE_BARRIERS = [
56
55
  {
57
56
  name: 'Unlock Theater Room (South)',
58
57
  removalPrice: 100,
59
- position: { x: 2, y: 1.5, z: 15 },
58
+ position: { x: 2.5, y: 1.5, z: 15 },
60
59
  rotation: Quaternion.fromEuler(0, 0, 0),
61
60
  width: 5,
62
61
  },
63
62
  {
64
63
  name: 'Unlock Parlor (South)',
65
64
  removalPrice: 25,
66
- position: { x: -8, y: 1.5, z: 19 },
65
+ position: { x: -8, y: 1.5, z: 18.5 },
67
66
  rotation: Quaternion.fromEuler(0, 90, 0),
68
67
  width: 3,
69
68
  },
70
69
  {
71
70
  name: 'Unlock Dining Hall (South)',
72
71
  removalPrice: 50,
73
- position: { x: 12, y: 1.5, z: 19 },
72
+ position: { x: 13, y: 1.5, z: 18.5 },
74
73
  rotation: Quaternion.fromEuler(0, 90, 0),
75
74
  width: 3,
76
75
  },
@@ -91,35 +90,35 @@ export const PURCHASE_BARRIERS = [
91
90
  {
92
91
  name: 'Unlock Art Gallery (South)',
93
92
  removalPrice: 200,
94
- position: { x: 26, y: 1.5, z: -2 },
93
+ position: { x: 26.5, y: 1.5, z: -2 },
95
94
  rotation: Quaternion.fromEuler(0, 0, 0),
96
95
  width: 5,
97
96
  },
98
97
  {
99
98
  name: 'Unlock Kitchen (South)',
100
99
  removalPrice: 200,
101
- position: { x: -23, y: 1.5, z: -2 },
100
+ position: { x: -22, y: 1.5, z: -2 },
102
101
  rotation: Quaternion.fromEuler(0, 0, 0),
103
102
  width: 5,
104
103
  },
105
104
  {
106
105
  name: 'Unlock Vault',
107
106
  removalPrice: 200,
108
- position: { x: 0, y: 1.5, z: -26 },
107
+ position: { x: 0.5, y: 1.5, z: -26 },
109
108
  rotation: Quaternion.fromEuler(0, 0, 0),
110
109
  width: 3,
111
110
  },
112
111
  {
113
112
  name: 'Unlock Treasure Room (West)',
114
113
  removalPrice: 75,
115
- position: { x: -16, y: 1.5, z: -18 },
114
+ position: { x: -15, y: 1.5, z: -19 },
116
115
  rotation: Quaternion.fromEuler(0, 90, 0),
117
116
  width: 5,
118
117
  },
119
118
  {
120
119
  name: 'Unlock Treasure Room (East)',
121
120
  removalPrice: 75,
122
- position: { x: 20, y: 1.5, z: -18 },
121
+ position: { x: 20, y: 1.5, z: -19 },
123
122
  rotation: Quaternion.fromEuler(0, 90, 0),
124
123
  width: 5,
125
124
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.1.95",
3
+ "version": "0.1.96",
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": {