fix: dont activate fly mode when double pressed space not that fast

This commit is contained in:
Vitaly 2023-09-27 06:25:41 +03:00
commit 7a33e619df

View file

@ -101,7 +101,7 @@ contro.on('movementUpdate', ({ vector, gamepadIndex }) => {
let lastCommandTrigger = null as { command: string, time: number } | null
const secondActionActivationTimeout = 600
const secondActionActivationTimeout = 300
const secondActionCommands = {
'general.jump'() {
toggleFly()
@ -155,6 +155,9 @@ const onTriggerOrReleased = (command: Command, pressed: boolean) => {
case 'general.attackDestroy':
document.dispatchEvent(new MouseEvent(pressed ? 'mousedown' : 'mouseup', { button: 0 }))
break
case 'general.interactPlace':
document.dispatchEvent(new MouseEvent(pressed ? 'mousedown' : 'mouseup', { button: 2 }))
break
}
}
}
@ -205,13 +208,6 @@ contro.on('trigger', ({ command }) => {
case 'general.command':
document.getElementById('hud').shadowRoot.getElementById('chat').enableChat('/')
break
case 'general.interactPlace':
document.dispatchEvent(new MouseEvent('mousedown', { button: 2 }))
setTimeout(() => {
// todo cleanup
document.dispatchEvent(new MouseEvent('mouseup', { button: 2 }))
})
break
}
}
})