yolkbot 0.1.0-alpha.6 → 0.1.0-alpha.60

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.
Files changed (59) hide show
  1. package/build/browser.js +6 -6
  2. package/package.json +15 -5
  3. package/src/api.js +97 -23
  4. package/src/bot/GamePlayer.js +3 -3
  5. package/src/bot.js +851 -484
  6. package/src/constants/index.js +23 -1
  7. package/src/constants/items.js +372 -173
  8. package/src/constants/maps.js +51 -12
  9. package/src/dispatches/BootPlayerDispatch.js +1 -1
  10. package/src/dispatches/ChatDispatch.js +1 -1
  11. package/src/dispatches/GameOptionsDispatch.js +1 -1
  12. package/src/dispatches/GoToAmmoDispatch.js +44 -0
  13. package/src/dispatches/GoToCoopDispatch.js +44 -0
  14. package/src/dispatches/GoToGrenadeDispatch.js +44 -0
  15. package/src/dispatches/GoToPlayerDispatch.js +5 -1
  16. package/src/dispatches/GoToSpatulaDispatch.js +5 -1
  17. package/src/dispatches/MeleeDispatch.js +1 -1
  18. package/src/dispatches/PauseDispatch.js +1 -1
  19. package/src/dispatches/ReloadDispatch.js +14 -2
  20. package/src/dispatches/ReportPlayerDispatch.js +1 -1
  21. package/src/dispatches/SaveLoadoutDispatch.js +11 -34
  22. package/src/dispatches/SpawnDispatch.js +1 -1
  23. package/src/dispatches/SwapWeaponDispatch.js +1 -1
  24. package/src/dispatches/SwitchTeamDispatch.js +1 -1
  25. package/src/dispatches/ThrowGrenadeDispatch.js +1 -1
  26. package/src/dispatches/index.js +9 -0
  27. package/src/matchmaker.js +11 -2
  28. package/src/pathing/mapnode.js +83 -250
  29. package/src/socket.js +1 -1
  30. package/src/types/api.d.ts +2 -16
  31. package/src/types/bot/GamePlayer.d.ts +26 -22
  32. package/src/types/bot.d.ts +118 -30
  33. package/src/types/constants/guns.d.ts +240 -0
  34. package/src/types/constants/index.d.ts +100 -0
  35. package/src/types/constants/items.d.ts +21 -0
  36. package/src/types/constants/maps.d.ts +15 -0
  37. package/src/types/dispatches/BootPlayerDispatch.d.ts +4 -2
  38. package/src/types/dispatches/ChatDispatch.d.ts +1 -1
  39. package/src/types/dispatches/FireDispatch.d.ts +2 -0
  40. package/src/types/dispatches/GameOptionsDispatch.d.ts +1 -1
  41. package/src/types/dispatches/GoToAmmoDispatch.d.ts +8 -0
  42. package/src/types/dispatches/GoToCoopDispatch.d.ts +8 -0
  43. package/src/types/dispatches/GoToGrenadeDispatch.d.ts +8 -0
  44. package/src/types/dispatches/GoToPlayerDispatch.d.ts +2 -1
  45. package/src/types/dispatches/GoToSpatulaDispatch.d.ts +1 -1
  46. package/src/types/dispatches/LookAtPosDispatch.d.ts +2 -0
  47. package/src/types/dispatches/MeleeDispatch.d.ts +2 -0
  48. package/src/types/dispatches/MovementDispatch.d.ts +2 -0
  49. package/src/types/dispatches/PauseDispatch.d.ts +2 -0
  50. package/src/types/dispatches/ReloadDispatch.d.ts +2 -0
  51. package/src/types/dispatches/ReportPlayerDispatch.d.ts +10 -1
  52. package/src/types/dispatches/SaveLoadoutDispatch.d.ts +2 -0
  53. package/src/types/dispatches/SpawnDispatch.d.ts +2 -0
  54. package/src/types/dispatches/SwapWeaponDispatch.d.ts +2 -0
  55. package/src/types/dispatches/SwitchTeamDispatch.d.ts +2 -0
  56. package/src/types/dispatches/ThrowGrenadeDispatch.d.ts +3 -0
  57. package/src/types/dispatches/index.d.ts +45 -1
  58. package/src/types/matchmaker.d.ts +19 -14
  59. package/src/types/socket.d.ts +7 -0
@@ -23,7 +23,7 @@ export const Maps = [
23
23
  "Spatula": true,
24
24
  "King": true
25
25
  },
26
- "availability": "private",
26
+ "availability": "both",
27
27
  "numPlayers": "14"
28
28
  },
29
29
  {
@@ -88,7 +88,7 @@ export const Maps = [
88
88
  "Spatula": true,
89
89
  "King": true
90
90
  },
91
- "availability": "private",
91
+ "availability": "both",
92
92
  "numPlayers": "14"
93
93
  },
94
94
  {
@@ -166,7 +166,7 @@ export const Maps = [
166
166
  "Spatula": true,
167
167
  "King": true
168
168
  },
169
- "availability": "private",
169
+ "availability": "both",
170
170
  "numPlayers": "18"
171
171
  },
172
172
  {
@@ -322,7 +322,7 @@ export const Maps = [
322
322
  "Spatula": true,
323
323
  "King": true
324
324
  },
325
- "availability": "both",
325
+ "availability": "private",
326
326
  "numPlayers": "16"
327
327
  },
328
328
  {
@@ -390,6 +390,19 @@ export const Maps = [
390
390
  "availability": "private",
391
391
  "numPlayers": "18"
392
392
  },
393
+ {
394
+ "filename": "foundation",
395
+ "hash": "1s6kfr5u037",
396
+ "name": "Foundation",
397
+ "modes": {
398
+ "FFA": true,
399
+ "Teams": true,
400
+ "Spatula": true,
401
+ "King": true
402
+ },
403
+ "availability": "both",
404
+ "numPlayers": "18"
405
+ },
393
406
  {
394
407
  "filename": "fourQuarters",
395
408
  "hash": "1a0w7vbz8is",
@@ -517,7 +530,7 @@ export const Maps = [
517
530
  "Spatula": true,
518
531
  "King": true
519
532
  },
520
- "availability": "both",
533
+ "availability": "private",
521
534
  "numPlayers": "18"
522
535
  },
523
536
  {
@@ -559,6 +572,19 @@ export const Maps = [
559
572
  "availability": "both",
560
573
  "numPlayers": "18"
561
574
  },
575
+ {
576
+ "filename": "metamorphosis",
577
+ "hash": "hlpma5zbhi",
578
+ "name": "Metamorphosis",
579
+ "modes": {
580
+ "FFA": true,
581
+ "Teams": true,
582
+ "Spatula": true,
583
+ "King": false
584
+ },
585
+ "availability": "both",
586
+ "numPlayers": "14"
587
+ },
562
588
  {
563
589
  "filename": "moonbase",
564
590
  "hash": "1yzocf1mex3",
@@ -595,7 +621,7 @@ export const Maps = [
595
621
  "Spatula": true,
596
622
  "King": true
597
623
  },
598
- "availability": "both",
624
+ "availability": "private",
599
625
  "numPlayers": "18"
600
626
  },
601
627
  {
@@ -738,7 +764,7 @@ export const Maps = [
738
764
  "Spatula": true,
739
765
  "King": true
740
766
  },
741
- "availability": "private",
767
+ "availability": "both",
742
768
  "numPlayers": "14"
743
769
  },
744
770
  {
@@ -790,7 +816,7 @@ export const Maps = [
790
816
  "Spatula": true,
791
817
  "King": true
792
818
  },
793
- "availability": "private",
819
+ "availability": "both",
794
820
  "numPlayers": "16"
795
821
  },
796
822
  {
@@ -803,7 +829,7 @@ export const Maps = [
803
829
  "Spatula": true,
804
830
  "King": true
805
831
  },
806
- "availability": "private",
832
+ "availability": "both",
807
833
  "numPlayers": "18"
808
834
  },
809
835
  {
@@ -868,7 +894,7 @@ export const Maps = [
868
894
  "Spatula": true,
869
895
  "King": true
870
896
  },
871
- "availability": "both",
897
+ "availability": "private",
872
898
  "numPlayers": "12"
873
899
  },
874
900
  {
@@ -881,7 +907,7 @@ export const Maps = [
881
907
  "Spatula": true,
882
908
  "King": true
883
909
  },
884
- "availability": "private",
910
+ "availability": "both",
885
911
  "numPlayers": "18"
886
912
  },
887
913
  {
@@ -920,7 +946,7 @@ export const Maps = [
920
946
  "Spatula": true,
921
947
  "King": true
922
948
  },
923
- "availability": "both",
949
+ "availability": "private",
924
950
  "numPlayers": "18"
925
951
  },
926
952
  {
@@ -988,6 +1014,19 @@ export const Maps = [
988
1014
  "availability": "private",
989
1015
  "numPlayers": "18"
990
1016
  },
1017
+ {
1018
+ "filename": "uncovered",
1019
+ "hash": "bxrd0zdvtn",
1020
+ "name": "Uncovered",
1021
+ "modes": {
1022
+ "FFA": true,
1023
+ "Teams": true,
1024
+ "Spatula": true,
1025
+ "King": true
1026
+ },
1027
+ "availability": "both",
1028
+ "numPlayers": "12"
1029
+ },
991
1030
  {
992
1031
  "filename": "vert",
993
1032
  "hash": "25a9ikled77",
@@ -10,7 +10,7 @@ export class BootPlayerDispatch {
10
10
  }
11
11
 
12
12
  execute(bot) {
13
- new packet.BootPacket(this.uniqueId).execute(bot.gameSocket);
13
+ new packet.BootPacket(this.uniqueId).execute(bot.game.socket);
14
14
  }
15
15
  }
16
16
 
@@ -17,7 +17,7 @@ export class ChatDispatch {
17
17
  }
18
18
 
19
19
  execute(bot) {
20
- new packet.ChatPacket(this.msg).execute(bot.gameSocket);
20
+ new packet.ChatPacket(this.msg).execute(bot.game.socket);
21
21
  bot.lastChatTime = Date.now();
22
22
  }
23
23
  }
@@ -21,7 +21,7 @@ export class GameOptionsDispatch {
21
21
  }
22
22
 
23
23
  execute(bot) {
24
- new packet.GameOptionsPacket(bot.game.options).execute(bot.gameSocket);
24
+ new packet.GameOptionsPacket(bot.game.options).execute(bot.game.socket);
25
25
  }
26
26
  }
27
27
 
@@ -0,0 +1,44 @@
1
+ import AStar from '../pathing/astar.js';
2
+
3
+ export class GoToAmmoDispatch {
4
+ check(bot) {
5
+ return bot.me.playing && bot.game.collectables[0].length && bot.intents.includes(bot.Intents.PATHFINDING);
6
+ }
7
+
8
+ execute(bot) {
9
+ this.pather = new AStar(bot.pathing.nodeList);
10
+
11
+ let minDistance = 200;
12
+ let closestAmmo = null;
13
+
14
+ for (const ammo of bot.game.collectables[0]) {
15
+ const dx = ammo.x - bot.me.position.x;
16
+ const dy = ammo.y - bot.me.position.y;
17
+ const dz = ammo.z - bot.me.position.z;
18
+
19
+ const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
20
+
21
+ if (distance < minDistance) {
22
+ minDistance = distance;
23
+ closestAmmo = ammo;
24
+ }
25
+ }
26
+
27
+ const position = Object.entries(bot.me.position).map(entry => Math.floor(entry[1]));
28
+ const targetPos = Object.entries(closestAmmo).map(entry => Math.floor(entry[1]));
29
+
30
+ const myNode = bot.pathing.nodeList.at(...position);
31
+ const targetNode = bot.pathing.nodeList.at(...targetPos);
32
+
33
+ bot.pathing.activePath = this.pather.path(myNode, targetNode);
34
+
35
+ if (!bot.pathing.activePath) return console.error('no path found');
36
+ if (bot.pathing.activePath.length < 2) return console.error('path too short');
37
+
38
+ bot.pathing.followingPath = true;
39
+ bot.pathing.activeNode = bot.pathing.activePath[1];
40
+ bot.pathing.activeNodeIdx = 1;
41
+ }
42
+ }
43
+
44
+ export default GoToAmmoDispatch;
@@ -0,0 +1,44 @@
1
+ import AStar from '../pathing/astar.js';
2
+
3
+ export class GoToCoopDispatch {
4
+ check(bot) {
5
+ return bot.me.playing && bot.game.zoneNumber && bot.game.activeZone && bot.intents.includes(bot.Intents.PATHFINDING);
6
+ }
7
+
8
+ execute(bot) {
9
+ this.pather = new AStar(bot.pathing.nodeList);
10
+
11
+ let minDistance = 200;
12
+ let closestZone = null;
13
+
14
+ for (const zone of bot.game.activeZone) {
15
+ const dx = zone.x - bot.me.position.x;
16
+ const dy = zone.y - bot.me.position.y;
17
+ const dz = zone.z - bot.me.position.z;
18
+
19
+ const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
20
+
21
+ if (distance < minDistance) {
22
+ minDistance = distance;
23
+ closestZone = zone;
24
+ }
25
+ }
26
+
27
+ const position = Object.entries(bot.me.position).map(entry => Math.floor(entry[1]));
28
+ const targetPos = Object.entries(closestZone).map(entry => Math.floor(entry[1]));
29
+
30
+ const myNode = bot.pathing.nodeList.at(...position);
31
+ const targetNode = bot.pathing.nodeList.at(...targetPos);
32
+
33
+ bot.pathing.activePath = this.pather.path(myNode, targetNode);
34
+
35
+ if (!bot.pathing.activePath) return console.error('no path found');
36
+ if (bot.pathing.activePath.length < 2) return console.error('path too short');
37
+
38
+ bot.pathing.followingPath = true;
39
+ bot.pathing.activeNode = bot.pathing.activePath[1];
40
+ bot.pathing.activeNodeIdx = 1;
41
+ }
42
+ }
43
+
44
+ export default GoToCoopDispatch;
@@ -0,0 +1,44 @@
1
+ import AStar from '../pathing/astar.js';
2
+
3
+ export class GoToGrenadeDispatch {
4
+ check(bot) {
5
+ return bot.me.playing && bot.game.collectables[1].length && bot.intents.includes(bot.Intents.PATHFINDING);
6
+ }
7
+
8
+ execute(bot) {
9
+ this.pather = new AStar(bot.pathing.nodeList);
10
+
11
+ let minDistance = 200;
12
+ let closestGrenade = null;
13
+
14
+ for (const grenade of bot.game.collectables[1]) {
15
+ const dx = grenade.x - bot.me.position.x;
16
+ const dy = grenade.y - bot.me.position.y;
17
+ const dz = grenade.z - bot.me.position.z;
18
+
19
+ const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
20
+
21
+ if (distance < minDistance) {
22
+ minDistance = distance;
23
+ closestGrenade = grenade;
24
+ }
25
+ }
26
+
27
+ const position = Object.entries(bot.me.position).map(entry => Math.floor(entry[1]));
28
+ const targetPos = Object.entries(closestGrenade).map(entry => Math.floor(entry[1]));
29
+
30
+ const myNode = bot.pathing.nodeList.at(...position);
31
+ const targetNode = bot.pathing.nodeList.at(...targetPos);
32
+
33
+ bot.pathing.activePath = this.pather.path(myNode, targetNode);
34
+
35
+ if (!bot.pathing.activePath) return console.error('no path found');
36
+ if (bot.pathing.activePath.length < 2) return console.error('path too short');
37
+
38
+ bot.pathing.followingPath = true;
39
+ bot.pathing.activeNode = bot.pathing.activePath[1];
40
+ bot.pathing.activeNodeIdx = 1;
41
+ }
42
+ }
43
+
44
+ export default GoToGrenadeDispatch;
@@ -6,7 +6,11 @@ export class GoToPlayerDispatch {
6
6
  }
7
7
 
8
8
  check(bot) {
9
- return bot.me.playing && this.target && this.target.playing && this.target.position && !bot.disablePathing;
9
+ return bot.me.playing &&
10
+ this.target &&
11
+ this.target.playing &&
12
+ this.target.position &&
13
+ bot.intents.includes(bot.Intents.PATHFINDING);
10
14
  }
11
15
 
12
16
  execute(bot) {
@@ -2,7 +2,11 @@ import AStar from '../pathing/astar.js';
2
2
 
3
3
  export class GoToSpatulaDispatch {
4
4
  check(bot) {
5
- return bot.me.playing && !bot.disablePathing && bot.game.spatula && bot.game.spatula.coords && bot.game.spatula.coords.x;
5
+ return bot.me.playing &&
6
+ bot.game.spatula &&
7
+ bot.game.spatula.coords &&
8
+ bot.game.spatula.coords.x &&
9
+ bot.intents.includes(bot.Intents.PATHFINDING);
6
10
  }
7
11
 
8
12
  execute(bot) {
@@ -6,7 +6,7 @@ export class MeleeDispatch {
6
6
  }
7
7
 
8
8
  execute(bot) {
9
- new packet.MeleePacket().execute(bot.gameSocket);
9
+ new packet.MeleePacket().execute(bot.game.socket);
10
10
  bot.usingMelee = true;
11
11
 
12
12
  // gameloop every 33.33 (repeating) ms, 17 ticks, so 566.61 is the closest you get
@@ -6,7 +6,7 @@ export class PauseDispatch {
6
6
  }
7
7
 
8
8
  execute(bot) {
9
- new packet.PausePacket().execute(bot.gameSocket);
9
+ new packet.PausePacket().execute(bot.game.socket);
10
10
  setTimeout(() => bot.me.playing = false, 3000);
11
11
  }
12
12
  }
@@ -6,9 +6,21 @@ export class ReloadDispatch {
6
6
  }
7
7
 
8
8
  execute(bot) {
9
- new packet.ReloadPacket().execute(bot.gameSocket);
9
+ new packet.ReloadPacket().execute(bot.game.socket);
10
10
 
11
- bot.processReloadPacket(bot.me.id, true);
11
+ const playerActiveWeapon = bot.me.weapons[bot.me.activeGun];
12
+
13
+ if (playerActiveWeapon.ammo) {
14
+ const newRounds = Math.min(
15
+ Math.min(playerActiveWeapon.ammo.capacity, playerActiveWeapon.ammo.reload) - playerActiveWeapon.ammo.rounds,
16
+ playerActiveWeapon.ammo.store
17
+ );
18
+
19
+ playerActiveWeapon.ammo.rounds += newRounds;
20
+ playerActiveWeapon.ammo.store -= newRounds;
21
+ }
22
+
23
+ bot.emit('playerReload', bot.me, playerActiveWeapon);
12
24
 
13
25
  const activeWeapon = bot.me.weapons[bot.me.activeGun];
14
26
  const isLongTime = activeWeapon.ammo.rounds < 1;
@@ -39,7 +39,7 @@ export class ReportPlayerDispatch {
39
39
 
40
40
  if (!target) throw new Error('target player for ReportPlayerDispatch not found')
41
41
 
42
- new packet.ReportPacket(target, this.reasonInt).execute(bot.gameSocket);
42
+ new packet.ReportPacket(target, this.reasonInt).execute(bot.game.socket);
43
43
  }
44
44
  }
45
45
 
@@ -90,43 +90,20 @@ export class SaveLoadoutDispatch {
90
90
 
91
91
  saveLoadout.then(() => {
92
92
  if (bot.state.joinedGame)
93
- new packet.ChangeCharacterPacket(this.changes?.classIdx || bot.me.selectedGun).execute(bot.gameSocket);
93
+ new packet.ChangeCharacterPacket(this.changes?.classIdx || bot.me.selectedGun).execute(bot.game.socket);
94
+
95
+ const findCosmetics = this.intents.includes(this.Intents.COSMETIC_DATA);
94
96
 
95
97
  // apply changes to the bot
96
98
  Object.entries(this.changes).forEach(([changeKey, changeValue]) => {
97
- switch (changeKey) {
98
- case 'classIdx':
99
- bot.me.selectedGun = changeValue;
100
- break;
101
-
102
- case 'hatId':
103
- bot.me.character.hat = findItemById(changeValue);
104
- break;
105
-
106
- case 'stampId':
107
- bot.me.character.stamp = findItemById(changeValue);
108
- break;
109
-
110
- case 'grenadeId':
111
- bot.me.character.grenade = findItemById(changeValue);
112
- break;
113
-
114
- case 'meleeId':
115
- bot.me.character.melee = findItemById(changeValue);
116
- break;
117
-
118
- case 'colorIdx':
119
- bot.me.character.eggColor = changeValue;
120
- break;
121
-
122
- case 'primaryId':
123
- bot.me.character.primaryGun = findItemById(changeValue[bot.me.selectedGun]);
124
- break;
125
-
126
- case 'secondaryId':
127
- bot.me.character.secondaryGun = findItemById(changeValue[bot.me.selectedGun]);
128
- break;
129
- }
99
+ if (changeKey === 'classIdx') bot.me.selectedGun = changeValue;
100
+ else if (changeKey === 'hatId') bot.me.character.hat = findCosmetics ? findItemById(changeValue) : changeValue;
101
+ else if (changeKey === 'stampId') bot.me.character.stamp = findCosmetics ? findItemById(changeValue) : changeValue;
102
+ else if (changeKey === 'grenadeId') bot.me.character.grenade = findCosmetics ? findItemById(changeValue) : changeValue;
103
+ else if (changeKey === 'meleeId') bot.me.character.melee = findCosmetics ? findItemById(changeValue) : changeValue;
104
+ else if (changeKey === 'colorIdx') bot.me.character.eggColor = changeValue;
105
+ else if (changeKey === 'primaryId') bot.me.character.primaryGun = findItemById(changeValue[bot.me.selectedGun]);
106
+ else if (changeKey === 'secondaryId') bot.me.character.secondaryGun = findCosmetics ? findItemById(changeValue[bot.me.selectedGun]) : changeValue;
130
107
  })
131
108
  })
132
109
  }
@@ -8,7 +8,7 @@ export class SpawnDispatch {
8
8
  }
9
9
 
10
10
  execute(bot) {
11
- new packet.RespawnPacket().execute(bot.gameSocket);
11
+ new packet.RespawnPacket().execute(bot.game.socket);
12
12
 
13
13
  bot.lastSpawnedTime = Date.now();
14
14
  bot.me.playing = true;
@@ -7,7 +7,7 @@ export class SwapWeaponDispatch {
7
7
 
8
8
  execute(bot) {
9
9
  bot.me.activeGun = +!bot.me.activeGun;
10
- new packet.SwapWeaponPacket(bot.me.activeGun).execute(bot.gameSocket);
10
+ new packet.SwapWeaponPacket(bot.me.activeGun).execute(bot.game.socket);
11
11
  }
12
12
  }
13
13
 
@@ -24,7 +24,7 @@ export class SwitchTeamDispatch {
24
24
  }
25
25
 
26
26
  execute(bot) {
27
- new packet.TeamSwitchingTraitorPacket().execute(bot.gameSocket);
27
+ new packet.TeamSwitchingTraitorPacket().execute(bot.game.socket);
28
28
  }
29
29
  }
30
30
 
@@ -15,7 +15,7 @@ export class ThrowGrenadeDispatch {
15
15
  }
16
16
 
17
17
  execute(bot) {
18
- new packet.ThrowGrenadePacket(this.power).execute(bot.gameSocket);
18
+ new packet.ThrowGrenadePacket(this.power).execute(bot.game.socket);
19
19
  }
20
20
  }
21
21
 
@@ -2,6 +2,9 @@ import BootPlayerDispatch from './BootPlayerDispatch.js';
2
2
  import ChatDispatch from './ChatDispatch.js';
3
3
  import FireDispatch from './FireDispatch.js';
4
4
  import GameOptionsDispatch from './GameOptionsDispatch.js';
5
+ import GoToAmmoDispatch from './GoToAmmoDispatch.js';
6
+ import GoToCoopDispatch from './GoToCoopDispatch.js';
7
+ import GoToGrenadeDispatch from './GoToGrenadeDispatch.js';
5
8
  import GoToPlayerDispatch from './GoToPlayerDispatch.js';
6
9
  import GoToSpatulaDispatch from './GoToSpatulaDispatch.js';
7
10
  import LookAtDispatch from './LookAtDispatch.js';
@@ -22,6 +25,9 @@ export {
22
25
  ChatDispatch,
23
26
  FireDispatch,
24
27
  GameOptionsDispatch,
28
+ GoToAmmoDispatch,
29
+ GoToCoopDispatch,
30
+ GoToGrenadeDispatch,
25
31
  GoToPlayerDispatch,
26
32
  GoToSpatulaDispatch,
27
33
  LookAtDispatch,
@@ -43,6 +49,9 @@ export default {
43
49
  ChatDispatch,
44
50
  FireDispatch,
45
51
  GameOptionsDispatch,
52
+ GoToAmmoDispatch,
53
+ GoToCoopDispatch,
54
+ GoToGrenadeDispatch,
46
55
  GoToPlayerDispatch,
47
56
  GoToSpatulaDispatch,
48
57
  LookAtDispatch,
package/src/matchmaker.js CHANGED
@@ -33,8 +33,17 @@ export class Matchmaker {
33
33
  this.#createSocket(params.instance);
34
34
  }
35
35
 
36
- #createSocket(instance) {
37
- this.ws = new yolkws(`wss://${instance}/matchmaker/`, this.proxy);
36
+ async #createSocket(instance) {
37
+ const attempt = async () => {
38
+ try {
39
+ this.ws = new yolkws(`wss://${instance}/matchmaker/`, this.proxy);
40
+ } catch {
41
+ await new Promise((resolve) => setTimeout(resolve, 100));
42
+ await attempt();
43
+ }
44
+ }
45
+
46
+ await attempt();
38
47
 
39
48
  this.ws.onopen = () => {
40
49
  this.connected = true;