Skip to content

Commit ab3174a

Browse files
committed
hotfix: disable fly after going out of spectator mode
1 parent 0f2bc5c commit ab3174a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/controls.ts

+5
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ const endFlying = (sendAbilities = true) => {
638638
let allowFlying = false
639639

640640
export const onBotCreate = () => {
641+
let wasSpectatorFlying = false
641642
bot._client.on('abilities', ({ flags }) => {
642643
if (flags & 2) { // flying
643644
toggleFly(true, false)
@@ -649,6 +650,10 @@ export const onBotCreate = () => {
649650
const gamemodeCheck = () => {
650651
if (bot.game.gameMode === 'spectator') {
651652
toggleFly(true, false)
653+
wasSpectatorFlying = true
654+
} else if (wasSpectatorFlying) {
655+
toggleFly(false, false)
656+
wasSpectatorFlying = false
652657
}
653658
}
654659
bot.on('game', () => {

0 commit comments

Comments
 (0)