Skip to content

Commit

Permalink
hotfix: disable fly after going out of spectator mode
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Nov 5, 2024
1 parent 0f2bc5c commit ab3174a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ const endFlying = (sendAbilities = true) => {
let allowFlying = false

export const onBotCreate = () => {
let wasSpectatorFlying = false
bot._client.on('abilities', ({ flags }) => {
if (flags & 2) { // flying
toggleFly(true, false)
Expand All @@ -649,6 +650,10 @@ export const onBotCreate = () => {
const gamemodeCheck = () => {
if (bot.game.gameMode === 'spectator') {
toggleFly(true, false)
wasSpectatorFlying = true
} else if (wasSpectatorFlying) {
toggleFly(false, false)
wasSpectatorFlying = false
}
}
bot.on('game', () => {
Expand Down

0 comments on commit ab3174a

Please sign in to comment.