hytopia 0.3.6 → 0.3.8
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 +191 -43
- package/docs/server.playercameramode.md +14 -0
- package/examples/hygrounds/README.md +0 -0
- package/examples/hygrounds/assets/audio/sfx/chest-open-1.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/chest-open-2.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/machine-gun-reload.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/machine-gun-shoot.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/medpack-consume.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/mining-drill-drilling.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/pistol-reload.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/pistol-shoot.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/player-hurt.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/potion-consume.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/rifle-reload.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/rifle-shoot.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/rocket-launcher-explosion.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/rocket-launcher-reload.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/rocket-launcher-shoot.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/shield.png +0 -0
- package/examples/hygrounds/assets/audio/sfx/shotgun-reload.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/shotgun-shoot.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/sniper-reload.mp3 +0 -0
- package/examples/hygrounds/assets/audio/sfx/sniper-shoot.mp3 +0 -0
- package/examples/hygrounds/assets/icons/ak-47.png +0 -0
- package/examples/hygrounds/assets/icons/ammo.png +0 -0
- package/examples/hygrounds/assets/icons/auto-shotgun.png +0 -0
- package/examples/hygrounds/assets/icons/auto-sniper.png +0 -0
- package/examples/hygrounds/assets/icons/block.png +0 -0
- package/examples/hygrounds/assets/icons/bolt-action-sniper.png +0 -0
- package/examples/hygrounds/assets/icons/crown-bronze.png +0 -0
- package/examples/hygrounds/assets/icons/crown-gold.png +0 -0
- package/examples/hygrounds/assets/icons/crown-silver.png +0 -0
- package/examples/hygrounds/assets/icons/gravity-potion.png +0 -0
- package/examples/hygrounds/assets/icons/heart.png +0 -0
- package/examples/hygrounds/assets/icons/light-machine-gun.png +0 -0
- package/examples/hygrounds/assets/icons/medpack.png +0 -0
- package/examples/hygrounds/assets/icons/mining-drill.png +0 -0
- package/examples/hygrounds/assets/icons/pickaxe.png +0 -0
- package/examples/hygrounds/assets/icons/pistol.png +0 -0
- package/examples/hygrounds/assets/icons/revolver.png +0 -0
- package/examples/hygrounds/assets/icons/rocket-launcher.png +0 -0
- package/examples/hygrounds/assets/icons/shield-potion.png +0 -0
- package/examples/hygrounds/assets/icons/shield.png +0 -0
- package/examples/hygrounds/assets/icons/shotgun.png +0 -0
- package/examples/hygrounds/assets/icons/submachine-gun.png +0 -0
- package/examples/hygrounds/assets/map.json +31796 -0
- package/examples/hygrounds/assets/models/environment/.optimized/explosion/explosion-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/environment/.optimized/explosion/explosion.glb +0 -0
- package/examples/hygrounds/assets/models/environment/.optimized/explosion/explosion.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/environment/.optimized/explosion-2/explosion-2-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/environment/.optimized/explosion-2/explosion-2.glb +0 -0
- package/examples/hygrounds/assets/models/environment/.optimized/explosion-2/explosion-2.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/environment/.optimized/explosion-3/explosion-3-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/environment/.optimized/explosion-3/explosion-3.glb +0 -0
- package/examples/hygrounds/assets/models/environment/.optimized/explosion-3/explosion-3.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/environment/.optimized/helicopter/helicopter-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/environment/.optimized/helicopter/helicopter.glb +0 -0
- package/examples/hygrounds/assets/models/environment/.optimized/helicopter/helicopter.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/environment/chest.gltf +1 -0
- package/examples/hygrounds/assets/models/environment/explosion.glb +0 -0
- package/examples/hygrounds/assets/models/environment/muzzle-flash.gltf +1 -0
- package/examples/hygrounds/assets/models/items/.optimized/auto-sniper/auto-sniper-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/auto-sniper/auto-sniper.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/auto-sniper/auto-sniper.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/items/.optimized/gravity-potion/gravity-potion-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/gravity-potion/gravity-potion.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/gravity-potion/gravity-potion.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/items/.optimized/medkit/medkit-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/medkit/medkit.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/medkit/medkit.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/items/.optimized/medpack/medpack-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/medpack/medpack.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/medpack/medpack.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/items/.optimized/mining-drill/mining-drill-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/mining-drill/mining-drill.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/mining-drill/mining-drill.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/items/.optimized/revolver/revolver-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/revolver/revolver.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/revolver/revolver.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/items/.optimized/rocket-missile/rocket-missile-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/rocket-missile/rocket-missile.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/rocket-missile/rocket-missile.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/items/.optimized/shield-potion/shield-potion-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/shield-potion/shield-potion.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/shield-potion/shield-potion.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/items/.optimized/shield-potion-2/shield-potion-2-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/shield-potion-2/shield-potion-2.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/shield-potion-2/shield-potion-2.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/items/.optimized/submachine-gun/submachine-gun-named-nodes.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/submachine-gun/submachine-gun.glb +0 -0
- package/examples/hygrounds/assets/models/items/.optimized/submachine-gun/submachine-gun.glb.md5 +1 -0
- package/examples/hygrounds/assets/models/items/ak-47.glb +0 -0
- package/examples/hygrounds/assets/models/items/auto-shotgun.glb +0 -0
- package/examples/hygrounds/assets/models/items/auto-sniper.glb +0 -0
- package/examples/hygrounds/assets/models/items/bolt-action-sniper.glb +0 -0
- package/examples/hygrounds/assets/models/items/gravity-potion.glb +0 -0
- package/examples/hygrounds/assets/models/items/light-machine-gun.glb +0 -0
- package/examples/hygrounds/assets/models/items/medpack.glb +0 -0
- package/examples/hygrounds/assets/models/items/mining-drill.glb +0 -0
- package/examples/hygrounds/assets/models/items/pickaxe.gltf +1 -0
- package/examples/hygrounds/assets/models/items/pistol.glb +0 -0
- package/examples/hygrounds/assets/models/items/revolver.glb +0 -0
- package/examples/hygrounds/assets/models/items/rocket-launcher.glb +0 -0
- package/examples/hygrounds/assets/models/items/rocket-missile.glb +0 -0
- package/examples/hygrounds/assets/models/items/shield-potion.glb +0 -0
- package/examples/hygrounds/assets/models/items/shotgun.glb +0 -0
- package/examples/hygrounds/assets/models/items/submachine-gun.glb +0 -0
- package/examples/hygrounds/assets/models/players/soldier-player.gltf +1 -0
- package/examples/hygrounds/assets/ui/images/scope.png +0 -0
- package/examples/hygrounds/assets/ui/index.html +1122 -0
- package/examples/hygrounds/bun.lock +503 -0
- package/examples/hygrounds/classes/ChestEntity.ts +133 -0
- package/examples/hygrounds/classes/GameManager.ts +422 -0
- package/examples/hygrounds/classes/GamePlayerEntity.ts +595 -0
- package/examples/hygrounds/classes/GunEntity.ts +259 -0
- package/examples/hygrounds/classes/ItemEntity.ts +225 -0
- package/examples/hygrounds/classes/ItemFactory.ts +61 -0
- package/examples/hygrounds/classes/MeleeWeaponEntity.ts +138 -0
- package/examples/hygrounds/classes/TerrainDamageManager.ts +56 -0
- package/examples/hygrounds/classes/items/GravityPotionEntity.ts +48 -0
- package/examples/hygrounds/classes/items/MedPackEntity.ts +43 -0
- package/examples/hygrounds/classes/items/ShieldPotionEntity.ts +43 -0
- package/examples/hygrounds/classes/weapons/AK47Entity.ts +43 -0
- package/examples/hygrounds/classes/weapons/AutoShotgunEntity.ts +80 -0
- package/examples/hygrounds/classes/weapons/AutoSniperEntity.ts +43 -0
- package/examples/hygrounds/classes/weapons/BoltActionSniperEntity.ts +46 -0
- package/examples/hygrounds/classes/weapons/LightMachineGunEntity.ts +43 -0
- package/examples/hygrounds/classes/weapons/MiningDrillEntity.ts +38 -0
- package/examples/hygrounds/classes/weapons/PickaxeEntity.ts +38 -0
- package/examples/hygrounds/classes/weapons/PistolEntity.ts +46 -0
- package/examples/hygrounds/classes/weapons/RevolverEntity.ts +46 -0
- package/examples/hygrounds/classes/weapons/RocketLauncherEntity.ts +195 -0
- package/examples/hygrounds/classes/weapons/ShotgunEntity.ts +84 -0
- package/examples/hygrounds/classes/weapons/SubmachineGunEntity.ts +43 -0
- package/examples/hygrounds/gameConfig.ts +430 -0
- package/examples/hygrounds/index.ts +41 -0
- package/examples/hygrounds/package.json +16 -0
- package/examples/player-persistence/README.md +3 -0
- package/examples/player-persistence/assets/map.json +2623 -0
- package/examples/player-persistence/dev/persistence/player-player-1.json +6 -0
- package/examples/player-persistence/dev/persistence/test.json +3 -0
- package/examples/player-persistence/index.ts +126 -0
- package/examples/player-persistence/package.json +16 -0
- package/package.json +1 -1
- package/server.api.json +21 -0
- package/server.d.ts +2 -1
- package/server.js +113 -113
@@ -0,0 +1,430 @@
|
|
1
|
+
import { Quaternion } from 'hytopia';
|
2
|
+
|
3
|
+
export const BEDROCK_BLOCK_ID = 2;
|
4
|
+
|
5
|
+
export const BLOCK_ID_BREAK_DAMAGE: Record<string | number, number> = {
|
6
|
+
1: 50, // bricks
|
7
|
+
4: 50, // cobblestone
|
8
|
+
6: 70, // diamond block
|
9
|
+
7: 70, // diamond ore
|
10
|
+
8: 10, // dirt
|
11
|
+
14: 10, // glass
|
12
|
+
15: 70, // gold ore
|
13
|
+
16: 10, // grass
|
14
|
+
17: 10, // gravel
|
15
|
+
19: 100, // infected shadowrock core
|
16
|
+
20: 100, // infected shadowrock
|
17
|
+
24: 50, // mossy cobblestone
|
18
|
+
27: 10, // oak leaves
|
19
|
+
30: 10, // sand
|
20
|
+
36: 100, // stone bricks
|
21
|
+
37: 40, // stone (also build block)
|
22
|
+
default: 30, // default for all other blocks
|
23
|
+
}
|
24
|
+
|
25
|
+
export const BLOCK_ID_MATERIALS: Record<string | number, number> = {
|
26
|
+
1: 4, // bricks
|
27
|
+
2: 0, // bedrock
|
28
|
+
6: 10, // diamond block
|
29
|
+
7: 10, // diamond ore,
|
30
|
+
8: 0, // dirt
|
31
|
+
14: 0, // glass
|
32
|
+
15: 8, // gold ore,
|
33
|
+
16: 0, // grass
|
34
|
+
19: 8, // infected shadowrock core
|
35
|
+
20: 8, // infected shadowrock
|
36
|
+
22: 0, // lava
|
37
|
+
23: 2, // log
|
38
|
+
28: 2, // oak planks
|
39
|
+
36: 5, // stone bricks
|
40
|
+
42: 0, // water flow
|
41
|
+
43: 0, // water still
|
42
|
+
default: 1, // default for all other blocks
|
43
|
+
};
|
44
|
+
|
45
|
+
export const BUILD_BLOCK_ID = 37; // stone
|
46
|
+
|
47
|
+
export const CHEST_DROP_INTERVAL_MS = 15 * 1000; // 20 seconds
|
48
|
+
|
49
|
+
export const CHEST_DROP_REGION_AABB = {
|
50
|
+
min: { x: -45, y: 100, z: -45 },
|
51
|
+
max: { x: 45, y: 100, z: 45 },
|
52
|
+
};
|
53
|
+
|
54
|
+
export const CHEST_SPAWNS_AT_START = 15;
|
55
|
+
|
56
|
+
export const CHEST_MAX_DROP_ITEMS = 2;
|
57
|
+
|
58
|
+
export const CHEST_OPEN_DESPAWN_MS = 20 * 1000; // 20 seconds
|
59
|
+
|
60
|
+
export const CHEST_DROP_ITEMS = [
|
61
|
+
{
|
62
|
+
itemId: 'ak47',
|
63
|
+
pickWeight: 0.5,
|
64
|
+
},
|
65
|
+
{
|
66
|
+
itemId: 'auto-shotgun',
|
67
|
+
pickWeight: 0.5,
|
68
|
+
},
|
69
|
+
{
|
70
|
+
itemId: 'auto-sniper',
|
71
|
+
pickWeight: 0.5,
|
72
|
+
},
|
73
|
+
{
|
74
|
+
itemId: 'bolt-action-sniper',
|
75
|
+
pickWeight: 0.5,
|
76
|
+
},
|
77
|
+
{
|
78
|
+
itemId: 'gravity-potion',
|
79
|
+
pickWeight: 0.4,
|
80
|
+
},
|
81
|
+
{
|
82
|
+
itemId: 'light-machine-gun',
|
83
|
+
pickWeight: 0.5,
|
84
|
+
},
|
85
|
+
{
|
86
|
+
itemId: 'medpack',
|
87
|
+
pickWeight: 1,
|
88
|
+
},
|
89
|
+
{
|
90
|
+
itemId: 'mining-drill',
|
91
|
+
pickWeight: 0.5,
|
92
|
+
},
|
93
|
+
{
|
94
|
+
itemId: 'pistol',
|
95
|
+
pickWeight: 1,
|
96
|
+
},
|
97
|
+
{
|
98
|
+
itemId: 'revolver',
|
99
|
+
pickWeight: 0.5,
|
100
|
+
},
|
101
|
+
{
|
102
|
+
itemId: 'rocket-launcher',
|
103
|
+
pickWeight: 0.4,
|
104
|
+
},
|
105
|
+
{
|
106
|
+
itemId: 'shotgun',
|
107
|
+
pickWeight: 0.5,
|
108
|
+
},
|
109
|
+
{
|
110
|
+
itemId: 'shield-potion',
|
111
|
+
pickWeight: 1,
|
112
|
+
},
|
113
|
+
{
|
114
|
+
itemId: 'submachine-gun',
|
115
|
+
pickWeight: 0.5,
|
116
|
+
},
|
117
|
+
]
|
118
|
+
|
119
|
+
export const CHEST_SPAWNS = [
|
120
|
+
{
|
121
|
+
position: { x: -14, y: 2, z: -16 },
|
122
|
+
rotation: Quaternion.fromEuler(0, -90, 0),
|
123
|
+
},
|
124
|
+
{
|
125
|
+
position: { x: -14, y: 2, z: -25 },
|
126
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
127
|
+
},
|
128
|
+
{
|
129
|
+
position: { x: -36, y: 2, z: -34.5},
|
130
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
131
|
+
},
|
132
|
+
{
|
133
|
+
position: { x: -30.5, y: 6, z: -33 },
|
134
|
+
rotation: Quaternion.fromEuler(0, -90, 0),
|
135
|
+
},
|
136
|
+
{
|
137
|
+
position: { x: -8, y: 2, z: -40 },
|
138
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
139
|
+
},
|
140
|
+
{
|
141
|
+
position: { x: 38, y: 2, z: -18 },
|
142
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
143
|
+
},
|
144
|
+
{
|
145
|
+
position: { x: 47, y: 2, z: -33 },
|
146
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
147
|
+
},
|
148
|
+
{
|
149
|
+
position: { x: 41, y: 5, z: -46.5 },
|
150
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
151
|
+
},
|
152
|
+
{
|
153
|
+
position: { x: 39.5, y: 4, z: 9 },
|
154
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
155
|
+
},
|
156
|
+
{
|
157
|
+
position: { x: -2.5, y: 3, z: 13 },
|
158
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
159
|
+
},
|
160
|
+
{
|
161
|
+
position: { x: 5.5, y: 3, z: 13 },
|
162
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
163
|
+
},
|
164
|
+
{
|
165
|
+
position: { x: -2.5, y: 3, z: 8 },
|
166
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
167
|
+
},
|
168
|
+
{
|
169
|
+
position: { x: 5.5, y: 3, z: 8 },
|
170
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
171
|
+
},
|
172
|
+
{
|
173
|
+
position: { x: 35, y: 15, z: 34.5 },
|
174
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
175
|
+
},
|
176
|
+
{
|
177
|
+
position: { x: 33.5, y: 3, z: 29 },
|
178
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
179
|
+
},
|
180
|
+
{
|
181
|
+
position: { x: 40.5, y: 3, z: 31 },
|
182
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
183
|
+
},
|
184
|
+
{
|
185
|
+
position: { x: 45, y: 3, z: 45 },
|
186
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
187
|
+
},
|
188
|
+
{
|
189
|
+
position: { x: 9, y: 3, z: 40 },
|
190
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
191
|
+
},
|
192
|
+
{
|
193
|
+
position: { x: -22.5, y: 3, z: 44 },
|
194
|
+
rotation: Quaternion.fromEuler(0, -90, 0),
|
195
|
+
},
|
196
|
+
{
|
197
|
+
position: { x: -14, y: 3, z: 42.5 },
|
198
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
199
|
+
},
|
200
|
+
{
|
201
|
+
position: { x: -18, y: 8, z: 45 },
|
202
|
+
rotation: Quaternion.fromEuler(0, -90, 0),
|
203
|
+
},
|
204
|
+
{
|
205
|
+
position: { x: -22.5, y: 8, z: 46 },
|
206
|
+
rotation: Quaternion.fromEuler(0, -90, 0),
|
207
|
+
},
|
208
|
+
{
|
209
|
+
position: { x: -33.5, y: 3, z: 47 },
|
210
|
+
rotation: Quaternion.fromEuler(0, -90, 0),
|
211
|
+
},
|
212
|
+
{
|
213
|
+
position: { x: -44.5, y: 3, z: 23.5 },
|
214
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
215
|
+
},
|
216
|
+
{
|
217
|
+
position: { x: -29, y: 3, z: 14 },
|
218
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
219
|
+
},
|
220
|
+
{
|
221
|
+
position: { x: -32, y: 3, z: 21 },
|
222
|
+
rotation: Quaternion.fromEuler(0, -90, 0),
|
223
|
+
},
|
224
|
+
{
|
225
|
+
position: { x: -36, y: 3, z: 5.5 },
|
226
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
227
|
+
},
|
228
|
+
{
|
229
|
+
position: { x: -12, y: 15, z: 27 },
|
230
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
231
|
+
},
|
232
|
+
{
|
233
|
+
position: { x: -33.5, y: 20, z: 5.5 },
|
234
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
235
|
+
},
|
236
|
+
{
|
237
|
+
position: { x: -24, y: 3, z: -8 },
|
238
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
239
|
+
},
|
240
|
+
{
|
241
|
+
position: { x: -15.5, y: 3, z: 0 },
|
242
|
+
rotation: Quaternion.fromEuler(0, -90, 0),
|
243
|
+
},
|
244
|
+
{
|
245
|
+
position: { x: -14, y: 3, z: 5 },
|
246
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
247
|
+
},
|
248
|
+
{
|
249
|
+
position: { x: 10, y: 3, z: -16 },
|
250
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
251
|
+
},
|
252
|
+
{
|
253
|
+
position: { x: 18, y: 15, z: 4 },
|
254
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
255
|
+
},
|
256
|
+
{
|
257
|
+
position: { x: -5.5, y: 3, z: 11.5 },
|
258
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
259
|
+
},
|
260
|
+
{
|
261
|
+
position: { x: -12, y: 9, z: 3.5 },
|
262
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
263
|
+
},
|
264
|
+
{
|
265
|
+
position: { x: 4, y: 9, z: 8 },
|
266
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
267
|
+
},
|
268
|
+
{
|
269
|
+
position: { x: 17, y: 3, z: 16.5 },
|
270
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
271
|
+
},
|
272
|
+
{
|
273
|
+
position: { x: 25, y: 3, z: 3.5 },
|
274
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
275
|
+
},
|
276
|
+
{
|
277
|
+
position: { x: 24, y: 3, z: -13.5 },
|
278
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
279
|
+
},
|
280
|
+
{
|
281
|
+
position: { x: 26.5, y: 3, z: -46.5 },
|
282
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
283
|
+
},
|
284
|
+
{
|
285
|
+
position: { x: -44, y: 3, z: -46 },
|
286
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
287
|
+
},
|
288
|
+
{
|
289
|
+
position: { x: 11, y: 9, z: -40 },
|
290
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
291
|
+
},
|
292
|
+
{
|
293
|
+
position: { x: 3, y: 6, z: -19 },
|
294
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
295
|
+
},
|
296
|
+
{
|
297
|
+
position: { x: 0.5, y: 3, z: -43.5 },
|
298
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
299
|
+
},
|
300
|
+
{
|
301
|
+
position: { x: -42.5, y: 3, z: -18.5 },
|
302
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
303
|
+
},
|
304
|
+
{
|
305
|
+
position: { x: -32.5, y: 3, z: -46.5 },
|
306
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
307
|
+
},
|
308
|
+
{
|
309
|
+
position: { x: 40, y: 15, z: -18 },
|
310
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
311
|
+
},
|
312
|
+
{
|
313
|
+
position: { x: 13, y: 3, z: 1 },
|
314
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
315
|
+
},
|
316
|
+
{
|
317
|
+
position: { x: 7, y: 5, z: 36.5 },
|
318
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
319
|
+
},
|
320
|
+
{
|
321
|
+
position: { x: -14, y: 9, z: -21 },
|
322
|
+
rotation: Quaternion.fromEuler(0, 0, 0),
|
323
|
+
},
|
324
|
+
{
|
325
|
+
position: { x: -33, y: 15, z: -35.5 },
|
326
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
327
|
+
},
|
328
|
+
{
|
329
|
+
position: { x: -28, y: 15, z: -35.5 },
|
330
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
331
|
+
},
|
332
|
+
{
|
333
|
+
position: { x: -23, y: 3, z: 2.5 },
|
334
|
+
rotation: Quaternion.fromEuler(0, 90, 0),
|
335
|
+
},
|
336
|
+
{
|
337
|
+
position: { x: -6, y: 5, z: 22 },
|
338
|
+
rotation: Quaternion.fromEuler(0, 180, 0),
|
339
|
+
},
|
340
|
+
];
|
341
|
+
|
342
|
+
export const GAME_DURATION_MS = 10 * 60 * 1000; // 10 minutes
|
343
|
+
|
344
|
+
export const ITEM_DESPAWN_TIME_MS = 30 * 1000; // 30 seconds
|
345
|
+
|
346
|
+
export const ITEM_SPAWNS = [
|
347
|
+
{ position: { x: -21.5, y: 2, z: -17 } },
|
348
|
+
{ position: { x: -28.5, y: 7, z: -35.5 } },
|
349
|
+
{ position: { x: -19.5, y: 2, z: -46.5 } },
|
350
|
+
{ position: { x: -37.5, y: 2, z: -3.5 } },
|
351
|
+
{ position: { x: -31.5, y: 2, z: 16.5 } },
|
352
|
+
{ position: { x: -18.5, y: 2, z: 40.5 } },
|
353
|
+
{ position: { x: 1.5, y: 2, z: 11.5 } },
|
354
|
+
{ position: { x: 7.5, y: 10, z: 36.5 } },
|
355
|
+
{ position: { x: 20.5, y: 2, z: 44.5 } },
|
356
|
+
{ position: { x: 37.5, y: 2, z: 38.5 } },
|
357
|
+
{ position: { x: 44.5, y: 2, z: -3.5 } },
|
358
|
+
{ position: { x: 37.5, y: 2, z: -17.5 } },
|
359
|
+
{ position: { x: 40.5, y: 10, z: -41.5 } },
|
360
|
+
{ position: { x: 3.5, y: 10, z: -31.5 } },
|
361
|
+
{ position: { x: -30.5, y: 10, z: 41.5 } },
|
362
|
+
];
|
363
|
+
|
364
|
+
export const ITEM_SPAWN_ITEMS = [
|
365
|
+
{
|
366
|
+
itemId: 'ak47',
|
367
|
+
pickWeight: 0.05,
|
368
|
+
},
|
369
|
+
{
|
370
|
+
itemId: 'auto-shotgun',
|
371
|
+
pickWeight: 0.05,
|
372
|
+
},
|
373
|
+
{
|
374
|
+
itemId: 'auto-sniper',
|
375
|
+
pickWeight: 0.05,
|
376
|
+
},
|
377
|
+
{
|
378
|
+
itemId: 'bolt-action-sniper',
|
379
|
+
pickWeight: 0.05,
|
380
|
+
},
|
381
|
+
{
|
382
|
+
itemId: 'gravity-potion',
|
383
|
+
pickWeight: 0.05,
|
384
|
+
},
|
385
|
+
{
|
386
|
+
itemId: 'light-machine-gun',
|
387
|
+
pickWeight: 0.05,
|
388
|
+
},
|
389
|
+
{
|
390
|
+
itemId: 'medpack',
|
391
|
+
pickWeight: 1,
|
392
|
+
},
|
393
|
+
{
|
394
|
+
itemId: 'mining-drill',
|
395
|
+
pickWeight: 0.05,
|
396
|
+
},
|
397
|
+
{
|
398
|
+
itemId: 'pistol',
|
399
|
+
pickWeight: 1,
|
400
|
+
},
|
401
|
+
{
|
402
|
+
itemId: 'revolver',
|
403
|
+
pickWeight: 0.1,
|
404
|
+
},
|
405
|
+
{
|
406
|
+
itemId: 'rocket-launcher',
|
407
|
+
pickWeight: 0.03,
|
408
|
+
},
|
409
|
+
{
|
410
|
+
itemId: 'shotgun',
|
411
|
+
pickWeight: 0.08,
|
412
|
+
},
|
413
|
+
{
|
414
|
+
itemId: 'shield-potion',
|
415
|
+
pickWeight: 1,
|
416
|
+
},
|
417
|
+
{
|
418
|
+
itemId: 'submachine-gun',
|
419
|
+
pickWeight: 0.05,
|
420
|
+
},
|
421
|
+
];
|
422
|
+
|
423
|
+
export const ITEM_SPAWNS_AT_START = 8;
|
424
|
+
|
425
|
+
export const MINIMUM_PLAYERS_TO_START = 2;
|
426
|
+
|
427
|
+
export const SPAWN_REGION_AABB = {
|
428
|
+
min: { x: -45, y: 30, z: -45 },
|
429
|
+
max: { x: 45, y: 35, z: 45 },
|
430
|
+
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import {
|
2
|
+
startServer,
|
3
|
+
PlayerEvent,
|
4
|
+
} from 'hytopia';
|
5
|
+
|
6
|
+
import GameManager from './classes/GameManager';
|
7
|
+
|
8
|
+
import worldMap from './assets/map.json';
|
9
|
+
|
10
|
+
startServer(world => {
|
11
|
+
// Load the game map
|
12
|
+
world.loadMap(worldMap);
|
13
|
+
|
14
|
+
// Set lighting
|
15
|
+
world.setAmbientLightIntensity(0.8);
|
16
|
+
world.setDirectionalLightIntensity(5);
|
17
|
+
|
18
|
+
GameManager.instance.setupGame(world);
|
19
|
+
|
20
|
+
// Handle player joining the game
|
21
|
+
world.on(PlayerEvent.JOINED_WORLD, ({ player }) => {
|
22
|
+
GameManager.instance.spawnPlayerEntity(player);
|
23
|
+
GameManager.instance.playerCount++;
|
24
|
+
});
|
25
|
+
|
26
|
+
// Handle player leaving the game
|
27
|
+
world.on(PlayerEvent.LEFT_WORLD, ({ player }) => {
|
28
|
+
// Clean up player entities
|
29
|
+
world.entityManager
|
30
|
+
.getPlayerEntitiesByPlayer(player)
|
31
|
+
.forEach(entity => entity.despawn());
|
32
|
+
|
33
|
+
GameManager.instance.playerCount--;
|
34
|
+
});
|
35
|
+
});
|
36
|
+
|
37
|
+
|
38
|
+
/*
|
39
|
+
- raycasts from weapons need to ignore other items
|
40
|
+
- Fix players stuck in placed blocks
|
41
|
+
*/
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"name": "zombies-fps",
|
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
|
+
"dependencies": {
|
13
|
+
"@hytopia.com/assets": "latest",
|
14
|
+
"hytopia": "latest"
|
15
|
+
}
|
16
|
+
}
|