hytopia 0.3.9 → 0.3.11
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.ballcollideroptions.md +75 -0
- package/docs/server.ballcollideroptions.radius.md +13 -0
- package/docs/server.ballcollideroptions.shape.md +11 -0
- package/docs/server.basecollideroptions.bounciness.md +13 -0
- package/docs/server.basecollideroptions.bouncinesscombinerule.md +13 -0
- package/docs/server.basecollideroptions.collisiongroups.md +13 -0
- package/docs/server.basecollideroptions.enabled.md +13 -0
- package/docs/server.basecollideroptions.flags.md +13 -0
- package/docs/server.basecollideroptions.friction.md +13 -0
- package/docs/server.basecollideroptions.frictioncombinerule.md +13 -0
- package/docs/server.basecollideroptions.issensor.md +13 -0
- package/docs/server.basecollideroptions.mass.md +13 -0
- package/docs/server.basecollideroptions.md +342 -0
- package/docs/server.basecollideroptions.oncollision.md +13 -0
- package/docs/server.basecollideroptions.parentrigidbody.md +13 -0
- package/docs/server.basecollideroptions.relativeposition.md +13 -0
- package/docs/server.basecollideroptions.relativerotation.md +13 -0
- package/docs/server.basecollideroptions.shape.md +13 -0
- package/docs/{server.collideroptions.simulation.md → server.basecollideroptions.simulation.md} +2 -2
- package/docs/{server.collideroptions.tag.md → server.basecollideroptions.tag.md} +2 -2
- package/docs/{server.rigidbodyoptions.colliders.md → server.baserigidbodyoptions.colliders.md} +2 -2
- package/docs/server.baserigidbodyoptions.enabled.md +13 -0
- package/docs/server.baserigidbodyoptions.md +152 -0
- package/docs/server.baserigidbodyoptions.position.md +13 -0
- package/docs/server.baserigidbodyoptions.rotation.md +13 -0
- package/docs/{server.rigidbodyoptions.simulation.md → server.baserigidbodyoptions.simulation.md} +2 -2
- package/docs/server.baserigidbodyoptions.type.md +13 -0
- package/docs/server.blockcollideroptions.halfextents.md +13 -0
- package/docs/server.blockcollideroptions.md +75 -0
- package/docs/server.blockcollideroptions.shape.md +11 -0
- package/docs/server.blocktype.collideroptions.md +1 -1
- package/docs/server.blocktype.md +1 -1
- package/docs/server.blocktypeoptions.customcollideroptions.md +1 -1
- package/docs/server.blocktypeoptions.md +1 -1
- package/docs/server.capsulecollideroptions.halfheight.md +13 -0
- package/docs/server.capsulecollideroptions.md +94 -0
- package/docs/server.capsulecollideroptions.radius.md +13 -0
- package/docs/server.capsulecollideroptions.shape.md +11 -0
- package/docs/server.collideroptions.md +4 -445
- package/docs/server.collidershape.md +14 -0
- package/docs/server.conecollideroptions.halfheight.md +13 -0
- package/docs/server.conecollideroptions.md +94 -0
- package/docs/server.conecollideroptions.radius.md +13 -0
- package/docs/server.conecollideroptions.shape.md +11 -0
- package/docs/server.cylindercollideroptions.halfheight.md +13 -0
- package/docs/server.cylindercollideroptions.md +94 -0
- package/docs/server.cylindercollideroptions.radius.md +13 -0
- package/docs/server.cylindercollideroptions.shape.md +11 -0
- package/docs/server.dynamicrigidbodyoptions.additionalmass.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.additionalmassproperties.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.additionalsolveriterations.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.angulardamping.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.angularvelocity.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.ccdenabled.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.dominancegroup.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.enabledpositions.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.enabledrotations.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.gravityscale.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.lineardamping.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.linearvelocity.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.md +324 -0
- package/docs/server.dynamicrigidbodyoptions.sleeping.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.softccdprediction.md +13 -0
- package/docs/server.dynamicrigidbodyoptions.type.md +11 -0
- package/docs/server.errorhandler.error.md +69 -0
- package/docs/server.errorhandler.fatalerror.md +73 -0
- package/docs/server.errorhandler.md +81 -0
- package/docs/server.errorhandler.warning.md +69 -0
- package/docs/server.fixedrigidbodyoptions.md +56 -0
- package/docs/server.fixedrigidbodyoptions.type.md +11 -0
- package/docs/server.kinematicpositionrigidbodyoptions.md +56 -0
- package/docs/server.kinematicpositionrigidbodyoptions.type.md +11 -0
- package/docs/server.kinematicvelocityrigidbodyoptions.angularvelocity.md +13 -0
- package/docs/server.kinematicvelocityrigidbodyoptions.linearvelocity.md +13 -0
- package/docs/server.kinematicvelocityrigidbodyoptions.md +94 -0
- package/docs/server.kinematicvelocityrigidbodyoptions.type.md +11 -0
- package/docs/server.md +169 -4
- package/docs/server.nonecollideroptions.md +56 -0
- package/docs/server.nonecollideroptions.shape.md +11 -0
- package/docs/server.rigidbody.createandaddchildcollider.md +3 -3
- package/docs/server.rigidbodyoptions.md +4 -407
- package/docs/server.roundcylindercollideroptions.borderradius.md +13 -0
- package/docs/server.roundcylindercollideroptions.halfheight.md +13 -0
- package/docs/server.roundcylindercollideroptions.md +113 -0
- package/docs/server.roundcylindercollideroptions.radius.md +13 -0
- package/docs/server.roundcylindercollideroptions.shape.md +11 -0
- package/docs/server.trimeshcollideroptions.indices.md +13 -0
- package/docs/server.trimeshcollideroptions.md +94 -0
- package/docs/server.trimeshcollideroptions.shape.md +11 -0
- package/docs/server.trimeshcollideroptions.vertices.md +13 -0
- package/examples/hygrounds/assets/icons/mobile-jump.png +0 -0
- package/examples/hygrounds/assets/icons/mobile-place-block.png +0 -0
- package/examples/hygrounds/assets/icons/mobile-reload.png +0 -0
- package/examples/hygrounds/assets/icons/mobile-shoot.png +0 -0
- package/examples/hygrounds/assets/ui/index.html +219 -3
- package/examples/hygrounds/classes/ChestEntity.ts +2 -1
- package/examples/hygrounds/classes/GamePlayerEntity.ts +10 -0
- package/examples/hygrounds/classes/GunEntity.ts +4 -0
- package/examples/hygrounds/classes/ItemEntity.ts +4 -1
- package/examples/hygrounds/classes/weapons/PistolEntity.ts +2 -2
- package/examples/hygrounds/classes/weapons/RevolverEntity.ts +1 -1
- package/examples/hygrounds/classes/weapons/RocketLauncherEntity.ts +1 -1
- package/examples/hygrounds/classes/weapons/ShotgunEntity.ts +2 -2
- package/examples/hygrounds/gameConfig.ts +11 -11
- package/examples/hygrounds/hygrounds-10.zip +0 -0
- package/examples/zombies-fps/classes/PurchaseBarrierEntity.ts +2 -2
- package/examples/zombies-fps/classes/WeaponCrateEntity.ts +2 -1
- package/package.json +1 -1
- package/server.api.json +5787 -4442
- package/server.d.ts +211 -96
- package/server.js +118 -113
- package/docs/server.collideroptions.borderradius.md +0 -13
- package/docs/server.collideroptions.bounciness.md +0 -13
- package/docs/server.collideroptions.bouncinesscombinerule.md +0 -13
- package/docs/server.collideroptions.collisiongroups.md +0 -13
- package/docs/server.collideroptions.enabled.md +0 -13
- package/docs/server.collideroptions.flags.md +0 -13
- package/docs/server.collideroptions.friction.md +0 -13
- package/docs/server.collideroptions.frictioncombinerule.md +0 -13
- package/docs/server.collideroptions.halfextents.md +0 -13
- package/docs/server.collideroptions.halfheight.md +0 -13
- package/docs/server.collideroptions.indices.md +0 -13
- package/docs/server.collideroptions.issensor.md +0 -13
- package/docs/server.collideroptions.mass.md +0 -13
- package/docs/server.collideroptions.oncollision.md +0 -13
- package/docs/server.collideroptions.parentrigidbody.md +0 -13
- package/docs/server.collideroptions.radius.md +0 -13
- package/docs/server.collideroptions.relativeposition.md +0 -13
- package/docs/server.collideroptions.relativerotation.md +0 -13
- package/docs/server.collideroptions.shape.md +0 -13
- package/docs/server.collideroptions.vertices.md +0 -13
- package/docs/server.rigidbodyoptions.additionalmass.md +0 -13
- package/docs/server.rigidbodyoptions.additionalmassproperties.md +0 -13
- package/docs/server.rigidbodyoptions.additionalsolveriterations.md +0 -13
- package/docs/server.rigidbodyoptions.angulardamping.md +0 -13
- package/docs/server.rigidbodyoptions.angularvelocity.md +0 -13
- package/docs/server.rigidbodyoptions.ccdenabled.md +0 -13
- package/docs/server.rigidbodyoptions.dominancegroup.md +0 -13
- package/docs/server.rigidbodyoptions.enabled.md +0 -13
- package/docs/server.rigidbodyoptions.enabledpositions.md +0 -13
- package/docs/server.rigidbodyoptions.enabledrotations.md +0 -13
- package/docs/server.rigidbodyoptions.gravityscale.md +0 -13
- package/docs/server.rigidbodyoptions.lineardamping.md +0 -13
- package/docs/server.rigidbodyoptions.linearvelocity.md +0 -13
- package/docs/server.rigidbodyoptions.position.md +0 -13
- package/docs/server.rigidbodyoptions.rotation.md +0 -13
- package/docs/server.rigidbodyoptions.sleeping.md +0 -13
- package/docs/server.rigidbodyoptions.softccdprediction.md +0 -13
- package/docs/server.rigidbodyoptions.type.md +0 -13
Binary file
|
Binary file
|
Binary file
|
@@ -25,7 +25,7 @@
|
|
25
25
|
|
26
26
|
<!-- Leaderboard -->
|
27
27
|
<div class="leaderboard">
|
28
|
-
<div class="leaderboard-title">
|
28
|
+
<div class="leaderboard-title">Deathmatch</div>
|
29
29
|
<div class="leaderboard-timer">0:00</div>
|
30
30
|
<div class="leaderboard-players-count">Players: 0</div>
|
31
31
|
<div class="leaderboard-header">
|
@@ -61,6 +61,26 @@
|
|
61
61
|
</div>
|
62
62
|
</div>
|
63
63
|
|
64
|
+
<div class="mobile-buttons-container">
|
65
|
+
<div id="mobile-reload-button" class="mobile-button">
|
66
|
+
<img src="{{CDN_ASSETS_URL}}/icons/mobile-reload.png" />
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<div id="mobile-interact-button" class="mobile-button">E</div>
|
70
|
+
|
71
|
+
<div id="mobile-jump-button" class="mobile-button">
|
72
|
+
<img src="{{CDN_ASSETS_URL}}/icons/mobile-jump.png" />
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<div id="mobile-attack-button" class="mobile-button">
|
76
|
+
<img src="{{CDN_ASSETS_URL}}/icons/mobile-shoot.png" />
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="mobile-place-block-button" class="mobile-button">
|
80
|
+
<img src="{{CDN_ASSETS_URL}}/icons/mobile-place-block.png" />
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
|
64
84
|
<div class="materials-counter">
|
65
85
|
<img src="{{CDN_ASSETS_URL}}/icons/block.png" alt="Materials Icon" class="materials-icon">
|
66
86
|
<span class="materials-amount">0</span>
|
@@ -504,6 +524,73 @@
|
|
504
524
|
timerInterval = setInterval(updateTimer, 1000);
|
505
525
|
}
|
506
526
|
});
|
527
|
+
|
528
|
+
// Mobile UI Controls
|
529
|
+
const inventorySlots = document.querySelectorAll('.inventory-slot');
|
530
|
+
|
531
|
+
inventorySlots.forEach((slot, index) => {
|
532
|
+
slot.addEventListener('click', () => {
|
533
|
+
hytopia.sendData({
|
534
|
+
type: 'inventory-select',
|
535
|
+
index: index,
|
536
|
+
})
|
537
|
+
});
|
538
|
+
});
|
539
|
+
|
540
|
+
const mobileInteractButton = document.getElementById('mobile-interact-button');
|
541
|
+
mobileInteractButton.addEventListener('touchstart', () => {
|
542
|
+
mobileInteractButton.classList.add('active');
|
543
|
+
hytopia.pressInput('e', true);
|
544
|
+
});
|
545
|
+
|
546
|
+
mobileInteractButton.addEventListener('touchend', () => {
|
547
|
+
mobileInteractButton.classList.remove('active');
|
548
|
+
hytopia.pressInput('e', false);
|
549
|
+
});
|
550
|
+
|
551
|
+
const mobileReloadButton = document.getElementById('mobile-reload-button');
|
552
|
+
mobileReloadButton.addEventListener('touchstart', () => {
|
553
|
+
mobileReloadButton.classList.add('active');
|
554
|
+
hytopia.pressInput('r', true);
|
555
|
+
});
|
556
|
+
|
557
|
+
mobileReloadButton.addEventListener('touchend', () => {
|
558
|
+
mobileReloadButton.classList.remove('active');
|
559
|
+
hytopia.pressInput('r', false);
|
560
|
+
});
|
561
|
+
|
562
|
+
const mobileJumpButton = document.getElementById('mobile-jump-button');
|
563
|
+
mobileJumpButton.addEventListener('touchstart', () => {
|
564
|
+
mobileJumpButton.classList.add('active');
|
565
|
+
hytopia.pressInput(' ', true);
|
566
|
+
});
|
567
|
+
|
568
|
+
mobileJumpButton.addEventListener('touchend', () => {
|
569
|
+
mobileJumpButton.classList.remove('active');
|
570
|
+
hytopia.pressInput(' ', false);
|
571
|
+
});
|
572
|
+
|
573
|
+
const mobileAttackButton = document.getElementById('mobile-attack-button');
|
574
|
+
mobileAttackButton.addEventListener('touchstart', () => {
|
575
|
+
mobileAttackButton.classList.add('active');
|
576
|
+
hytopia.pressInput('ml', true);
|
577
|
+
}, { passive: true });
|
578
|
+
|
579
|
+
mobileAttackButton.addEventListener('touchend', () => {
|
580
|
+
mobileAttackButton.classList.remove('active');
|
581
|
+
hytopia.pressInput('ml', false);
|
582
|
+
}, { passive: true });
|
583
|
+
|
584
|
+
const mobilePlaceBlockButton = document.getElementById('mobile-place-block-button');
|
585
|
+
mobilePlaceBlockButton.addEventListener('touchstart', () => {
|
586
|
+
mobilePlaceBlockButton.classList.add('active');
|
587
|
+
hytopia.pressInput('mr', true);
|
588
|
+
});
|
589
|
+
|
590
|
+
mobilePlaceBlockButton.addEventListener('touchend', () => {
|
591
|
+
mobilePlaceBlockButton.classList.remove('active');
|
592
|
+
hytopia.pressInput('mr', false);
|
593
|
+
});
|
507
594
|
</script>
|
508
595
|
|
509
596
|
<!-- UI Styles -->
|
@@ -737,7 +824,7 @@
|
|
737
824
|
right: 20px;
|
738
825
|
display: flex;
|
739
826
|
gap: 10px;
|
740
|
-
z-index:
|
827
|
+
z-index: 999;
|
741
828
|
}
|
742
829
|
|
743
830
|
.inventory-slot {
|
@@ -1028,7 +1115,9 @@
|
|
1028
1115
|
background: rgba(0, 0, 0, 0.7);
|
1029
1116
|
border-radius: 5px;
|
1030
1117
|
padding: 10px;
|
1031
|
-
width:
|
1118
|
+
width: 15%;
|
1119
|
+
max-width: 200px;
|
1120
|
+
max-height: 40%;
|
1032
1121
|
font-family: 'Arial', sans-serif;
|
1033
1122
|
color: white;
|
1034
1123
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
|
@@ -1119,4 +1208,131 @@
|
|
1119
1208
|
max-width: 160px;
|
1120
1209
|
text-overflow: ellipsis;
|
1121
1210
|
}
|
1211
|
+
|
1212
|
+
.mobile-buttons-container {
|
1213
|
+
display: none;
|
1214
|
+
}
|
1215
|
+
|
1216
|
+
/* Mobile UI */
|
1217
|
+
body.mobile .hud {
|
1218
|
+
left: 50%;
|
1219
|
+
transform: translateX(-50%);
|
1220
|
+
bottom: 35px;
|
1221
|
+
right: auto;
|
1222
|
+
}
|
1223
|
+
|
1224
|
+
body.mobile .inventory-hud {
|
1225
|
+
bottom: 30px;
|
1226
|
+
}
|
1227
|
+
|
1228
|
+
body.mobile .inventory-slot {
|
1229
|
+
width: 45px;
|
1230
|
+
height: 45px;
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
body.mobile .slot-number {
|
1234
|
+
font-size: 12px;
|
1235
|
+
top: -16px;
|
1236
|
+
}
|
1237
|
+
|
1238
|
+
body.mobile .slot-name {
|
1239
|
+
font-size: 8px;
|
1240
|
+
bottom: -14px;
|
1241
|
+
}
|
1242
|
+
|
1243
|
+
body.mobile .slot-quantity {
|
1244
|
+
font-size: 10px;
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
body.mobile .shield-bar,
|
1248
|
+
body.mobile .health-bar {
|
1249
|
+
width: 120px;
|
1250
|
+
height: 16px;
|
1251
|
+
}
|
1252
|
+
|
1253
|
+
body.mobile .shield-text,
|
1254
|
+
body.mobile .health-text {
|
1255
|
+
font-size: 0.7em;
|
1256
|
+
}
|
1257
|
+
|
1258
|
+
body.mobile .shield-icon,
|
1259
|
+
body.mobile .health-icon {
|
1260
|
+
width: 10px;
|
1261
|
+
height: 10px;
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
body.mobile .leaderboard-title {
|
1265
|
+
font-size: 14px;
|
1266
|
+
}
|
1267
|
+
|
1268
|
+
body.mobile .leaderboard-timer {
|
1269
|
+
font-size: 12px;
|
1270
|
+
}
|
1271
|
+
|
1272
|
+
body.mobile .leaderboard-players-count {
|
1273
|
+
font-size: 12px;
|
1274
|
+
}
|
1275
|
+
|
1276
|
+
body.mobile .leaderboard-header {
|
1277
|
+
font-size: 10px;
|
1278
|
+
}
|
1279
|
+
|
1280
|
+
body.mobile .leaderboard-player {
|
1281
|
+
font-size: 10px;
|
1282
|
+
}
|
1283
|
+
|
1284
|
+
body.mobile .materials-counter {
|
1285
|
+
right: 20px;
|
1286
|
+
bottom: 115px;
|
1287
|
+
font-size: 12px;
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
body.mobile .floating-number {
|
1291
|
+
font-size: 14px;
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
body.mobile div > canvas { /* hide three debugger panels */
|
1295
|
+
display: none !important;
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
body.mobile .mobile-buttons-container {
|
1299
|
+
display: flex;
|
1300
|
+
gap: 10px;
|
1301
|
+
position: fixed;
|
1302
|
+
bottom: 113px;
|
1303
|
+
right: 118px;
|
1304
|
+
user-select: none;
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
body.mobile .mobile-button {
|
1308
|
+
background-color: rgba(0, 0, 0, 0.5);
|
1309
|
+
border-radius: 50%;
|
1310
|
+
align-items: center;
|
1311
|
+
justify-content: center;
|
1312
|
+
display: flex;
|
1313
|
+
width: 45px;
|
1314
|
+
height: 45px;
|
1315
|
+
-webkit-tap-highlight-color: transparent;
|
1316
|
+
touch-action: manipulation;
|
1317
|
+
user-select: none;
|
1318
|
+
transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
|
1319
|
+
will-change: transform, background-color;
|
1320
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
1321
|
+
font-family: 'Inter', sans-serif;
|
1322
|
+
font-size: 14px;
|
1323
|
+
font-weight: bold;
|
1324
|
+
color: rgba(255, 255, 255, 0.8);
|
1325
|
+
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
body.mobile .mobile-button.active {
|
1329
|
+
transform: scale(0.92);
|
1330
|
+
background-color: rgba(0, 0, 0, 0.75);
|
1331
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
|
1332
|
+
}
|
1333
|
+
|
1334
|
+
body.mobile .mobile-button img {
|
1335
|
+
width: 25px;
|
1336
|
+
height: 25px;
|
1337
|
+
}
|
1122
1338
|
</style>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
Audio,
|
3
|
+
BallColliderOptions,
|
3
4
|
Collider,
|
4
5
|
Entity,
|
5
6
|
EntityOptions,
|
@@ -30,7 +31,7 @@ export default class ChestEntity extends Entity {
|
|
30
31
|
gravityScale: 0.3, // we want it to drop slow when spawned mid-game in the sky randomly.
|
31
32
|
colliders: [
|
32
33
|
{
|
33
|
-
...Collider.optionsFromModelUri('models/environment/chest.gltf'),
|
34
|
+
...Collider.optionsFromModelUri('models/environment/chest.gltf') as BallColliderOptions,
|
34
35
|
radius: 0.45, // collider isn't calculating perfect because of the coin positions in the model.
|
35
36
|
bounciness: 0.25,
|
36
37
|
}
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
QuaternionLike,
|
10
10
|
World,
|
11
11
|
PlayerEntityController,
|
12
|
+
PlayerUIEvent,
|
12
13
|
} from 'hytopia';
|
13
14
|
|
14
15
|
import ChestEntity from './ChestEntity';
|
@@ -337,6 +338,15 @@ export default class GamePlayerEntity extends PlayerEntity {
|
|
337
338
|
private _setupPlayerUI(): void {
|
338
339
|
this.nametagSceneUI.setViewDistance(8); // lessen view distance so you only see player names when close
|
339
340
|
this.player.ui.load('ui/index.html');
|
341
|
+
|
342
|
+
// Handle inventory selection from mobile UI
|
343
|
+
this.player.ui.on(PlayerUIEvent.DATA, (payload) => {
|
344
|
+
const { data } = payload;
|
345
|
+
|
346
|
+
if (data.type === 'inventory-select') {
|
347
|
+
this.setActiveInventorySlotIndex(data.index);
|
348
|
+
}
|
349
|
+
});
|
340
350
|
}
|
341
351
|
|
342
352
|
private _setupPlayerCamera(): void {
|
@@ -244,6 +244,10 @@ export default abstract class GunEntity extends ItemEntity {
|
|
244
244
|
}
|
245
245
|
|
246
246
|
public updateAmmoIndicatorUI(reloading: boolean = false): void {
|
247
|
+
if (!this.parent) {
|
248
|
+
return;
|
249
|
+
}
|
250
|
+
|
247
251
|
const player = this.parent as GamePlayerEntity;
|
248
252
|
|
249
253
|
player.player.ui.sendData(reloading ? {
|
@@ -90,6 +90,7 @@ export default class ItemEntity extends Entity {
|
|
90
90
|
this.parent.dropActiveInventoryItem();
|
91
91
|
setTimeout(() => {
|
92
92
|
this.despawn();
|
93
|
+
this.stopDespawnTimer();
|
93
94
|
}, 0);
|
94
95
|
}
|
95
96
|
|
@@ -167,7 +168,9 @@ export default class ItemEntity extends Entity {
|
|
167
168
|
if (this._despawnTimer) return;
|
168
169
|
|
169
170
|
this._despawnTimer = setTimeout(() => {
|
170
|
-
this.
|
171
|
+
if (this.isSpawned) {
|
172
|
+
this.despawn();
|
173
|
+
}
|
171
174
|
}, ITEM_DESPAWN_TIME_MS);
|
172
175
|
}
|
173
176
|
|
@@ -6,7 +6,7 @@ import type GamePlayerEntity from '../GamePlayerEntity';
|
|
6
6
|
const DEFAULT_PISTOL_OPTIONS: GunEntityOptions = {
|
7
7
|
ammo: 15,
|
8
8
|
damage: 18,
|
9
|
-
fireRate:
|
9
|
+
fireRate: 4,
|
10
10
|
heldHand: 'right',
|
11
11
|
iconImageUri: 'icons/pistol.png',
|
12
12
|
idleAnimation: 'idle_gun_right',
|
@@ -33,7 +33,7 @@ export default class PistolEntity extends GunEntity {
|
|
33
33
|
super.shoot();
|
34
34
|
|
35
35
|
// Cancel input since pistol requires click-to-shoot
|
36
|
-
(this.parent as GamePlayerEntity).player.input.ml = false;
|
36
|
+
// (this.parent as GamePlayerEntity).player.input.ml = false;
|
37
37
|
}
|
38
38
|
|
39
39
|
public override getMuzzleFlashPositionRotation(): { position: Vector3Like, rotation: QuaternionLike } {
|
@@ -33,7 +33,7 @@ export default class RevolverEntity extends GunEntity {
|
|
33
33
|
super.shoot();
|
34
34
|
|
35
35
|
// Cancel input since pistol requires click-to-shoot
|
36
|
-
(this.parent as GamePlayerEntity).player.input.ml = false;
|
36
|
+
// (this.parent as GamePlayerEntity).player.input.ml = false;
|
37
37
|
}
|
38
38
|
|
39
39
|
public override getMuzzleFlashPositionRotation(): { position: Vector3Like, rotation: QuaternionLike } {
|
@@ -36,7 +36,7 @@ export default class RocketLauncherEntity extends GunEntity {
|
|
36
36
|
super.shoot();
|
37
37
|
|
38
38
|
// Cancel input since rocket launcher requires click-to-shoot
|
39
|
-
(this.parent as GamePlayerEntity).player.input.ml = false;
|
39
|
+
// (this.parent as GamePlayerEntity).player.input.ml = false;
|
40
40
|
}
|
41
41
|
|
42
42
|
public override getMuzzleFlashPositionRotation(): { position: Vector3Like, rotation: QuaternionLike } {
|
@@ -6,7 +6,7 @@ import type GamePlayerEntity from '../GamePlayerEntity';
|
|
6
6
|
const DEFAULT_SHOTGUN_OPTIONS: GunEntityOptions = {
|
7
7
|
ammo: 4,
|
8
8
|
damage: 13,
|
9
|
-
fireRate:
|
9
|
+
fireRate: 1.3,
|
10
10
|
heldHand: 'both',
|
11
11
|
iconImageUri: 'icons/shotgun.png',
|
12
12
|
idleAnimation: 'idle_gun_both',
|
@@ -33,7 +33,7 @@ export default class ShotgunEntity extends GunEntity {
|
|
33
33
|
super.shoot();
|
34
34
|
|
35
35
|
// Cancel input since shotgun requires click-to-shoot
|
36
|
-
(this.parent as GamePlayerEntity).player.input.ml = false;
|
36
|
+
// (this.parent as GamePlayerEntity).player.input.ml = false;
|
37
37
|
}
|
38
38
|
|
39
39
|
public override getMuzzleFlashPositionRotation(): { position: Vector3Like, rotation: QuaternionLike } {
|
@@ -60,11 +60,11 @@ export const CHEST_OPEN_DESPAWN_MS = 20 * 1000; // 20 seconds
|
|
60
60
|
export const CHEST_DROP_ITEMS = [
|
61
61
|
{
|
62
62
|
itemId: 'ak47',
|
63
|
-
pickWeight: 0.
|
63
|
+
pickWeight: 0.7,
|
64
64
|
},
|
65
65
|
{
|
66
66
|
itemId: 'auto-shotgun',
|
67
|
-
pickWeight: 0.
|
67
|
+
pickWeight: 0.6,
|
68
68
|
},
|
69
69
|
{
|
70
70
|
itemId: 'auto-sniper',
|
@@ -76,15 +76,15 @@ export const CHEST_DROP_ITEMS = [
|
|
76
76
|
},
|
77
77
|
{
|
78
78
|
itemId: 'gravity-potion',
|
79
|
-
pickWeight: 0.
|
79
|
+
pickWeight: 0.3,
|
80
80
|
},
|
81
81
|
{
|
82
82
|
itemId: 'light-machine-gun',
|
83
|
-
pickWeight: 0.
|
83
|
+
pickWeight: 0.6,
|
84
84
|
},
|
85
85
|
{
|
86
86
|
itemId: 'medpack',
|
87
|
-
pickWeight: 1,
|
87
|
+
pickWeight: 1.2,
|
88
88
|
},
|
89
89
|
{
|
90
90
|
itemId: 'mining-drill',
|
@@ -92,27 +92,27 @@ export const CHEST_DROP_ITEMS = [
|
|
92
92
|
},
|
93
93
|
{
|
94
94
|
itemId: 'pistol',
|
95
|
-
pickWeight: 1,
|
95
|
+
pickWeight: 1.5,
|
96
96
|
},
|
97
97
|
{
|
98
98
|
itemId: 'revolver',
|
99
|
-
pickWeight: 0.
|
99
|
+
pickWeight: 0.9,
|
100
100
|
},
|
101
101
|
{
|
102
102
|
itemId: 'rocket-launcher',
|
103
|
-
pickWeight: 0.
|
103
|
+
pickWeight: 0.3,
|
104
104
|
},
|
105
105
|
{
|
106
106
|
itemId: 'shotgun',
|
107
|
-
pickWeight: 0.
|
107
|
+
pickWeight: 0.8,
|
108
108
|
},
|
109
109
|
{
|
110
110
|
itemId: 'shield-potion',
|
111
|
-
pickWeight: 1,
|
111
|
+
pickWeight: 1.2,
|
112
112
|
},
|
113
113
|
{
|
114
114
|
itemId: 'submachine-gun',
|
115
|
-
pickWeight: 0
|
115
|
+
pickWeight: 1.0,
|
116
116
|
},
|
117
117
|
]
|
118
118
|
|
Binary file
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import {
|
2
|
-
|
2
|
+
BlockColliderOptions,
|
3
3
|
ColliderShape,
|
4
4
|
CollisionGroup,
|
5
5
|
Entity,
|
@@ -14,7 +14,7 @@ import GameManager from './GameManager';
|
|
14
14
|
import GamePlayerEntity from './GamePlayerEntity';
|
15
15
|
import InteractableEntity from './InteractableEntity';
|
16
16
|
|
17
|
-
const WALL_COLLIDER_OPTIONS:
|
17
|
+
const WALL_COLLIDER_OPTIONS: BlockColliderOptions = {
|
18
18
|
shape: ColliderShape.BLOCK,
|
19
19
|
collisionGroups: {
|
20
20
|
belongsTo: [ CollisionGroup.BLOCK ],
|
@@ -6,6 +6,7 @@ import {
|
|
6
6
|
Vector3Like,
|
7
7
|
World,
|
8
8
|
SceneUI,
|
9
|
+
ColliderShape,
|
9
10
|
} from 'hytopia';
|
10
11
|
|
11
12
|
import GamePlayerEntity from './GamePlayerEntity';
|
@@ -70,7 +71,7 @@ export default class WeaponCrateEntity extends InteractableEntity {
|
|
70
71
|
public constructor(options: WeaponCrateEntityOptions) {
|
71
72
|
const colliderOptions = Collider.optionsFromModelUri('models/environment/weaponbox.gltf');
|
72
73
|
|
73
|
-
if (colliderOptions.halfExtents) { // make it taller for better interact area
|
74
|
+
if (colliderOptions.shape === ColliderShape.BLOCK && colliderOptions.halfExtents) { // make it taller for better interact area
|
74
75
|
colliderOptions.halfExtents.y = 3;
|
75
76
|
}
|
76
77
|
|