@@ -7,7 +7,7 @@ import { ControMax } from 'contro-max/build/controMax'
7
7
import { CommandEventArgument , SchemaCommandInput } from 'contro-max/build/types'
8
8
import { stringStartsWith } from 'contro-max/build/stringUtils'
9
9
import { UserOverrideCommand , UserOverridesConfig } from 'contro-max/build/types/store'
10
- import { isGameActive , showModal , gameAdditionalState , activeModalStack , hideCurrentModal , miscUiState , loadedGameState , hideModal , hideAllModals } from './globalState'
10
+ import { isGameActive , showModal , gameAdditionalState , activeModalStack , hideCurrentModal , miscUiState , hideModal , hideAllModals } from './globalState'
11
11
import { goFullscreen , pointerLock , reloadChunks } from './utils'
12
12
import { options } from './optionsStorage'
13
13
import { openPlayerInventory } from './inventoryWindows'
@@ -19,7 +19,7 @@ import { showOptionsModal } from './react/SelectOption'
19
19
import widgets from './react/widgets'
20
20
import { getItemFromBlock } from './chatUtils'
21
21
import { gamepadUiCursorState , moveGamepadCursorByPx } from './react/GamepadUiCursor'
22
- import { completeTexturePackInstall , resourcePackState } from './resourcePack'
22
+ import { completeTexturePackInstall , copyServerResourcePackToRegular , resourcePackState } from './resourcePack'
23
23
import { showNotification } from './react/NotificationProvider'
24
24
import { lastConnectOptions } from './react/AppStatusProvider'
25
25
@@ -450,7 +450,12 @@ contro.on('release', ({ command }) => {
450
450
451
451
// hard-coded keybindings
452
452
453
- export const f3Keybinds = [
453
+ export const f3Keybinds : Array < {
454
+ key ?: string ,
455
+ action : ( ) => void ,
456
+ mobileTitle : string
457
+ enabled ?: ( ) => boolean
458
+ } > = [
454
459
{
455
460
key : 'KeyA' ,
456
461
action ( ) {
@@ -496,9 +501,9 @@ export const f3Keybinds = [
496
501
key : 'KeyT' ,
497
502
async action ( ) {
498
503
// TODO!
499
- if ( resourcePackState . resourcePackInstalled || loadedGameState . usingServerResourcePack ) {
504
+ if ( resourcePackState . resourcePackInstalled || gameAdditionalState . usingServerResourcePack ) {
500
505
showNotification ( 'Reloading textures...' )
501
- await completeTexturePackInstall ( 'default' , 'default' , loadedGameState . usingServerResourcePack )
506
+ await completeTexturePackInstall ( 'default' , 'default' , gameAdditionalState . usingServerResourcePack )
502
507
}
503
508
} ,
504
509
mobileTitle : 'Reload Textures'
@@ -539,7 +544,15 @@ export const f3Keybinds = [
539
544
const proxyPing = await bot [ 'pingProxy' ] ( )
540
545
void showOptionsModal ( `${ username } : last known total latency (ping): ${ playerPing } . Connected to ${ lastConnectOptions . value ?. proxy } with current ping ${ proxyPing } . Player UUID: ${ uuid } ` , [ ] )
541
546
} ,
542
- mobileTitle : 'Show Proxy & Ping Details'
547
+ mobileTitle : 'Show Proxy & Ping Details' ,
548
+ enabled : ( ) => ! ! lastConnectOptions . value ?. proxy
549
+ } ,
550
+ {
551
+ action ( ) {
552
+ void copyServerResourcePackToRegular ( )
553
+ } ,
554
+ mobileTitle : 'Copy Server Resource Pack' ,
555
+ enabled : ( ) => ! ! gameAdditionalState . usingServerResourcePack
543
556
}
544
557
]
545
558
@@ -548,7 +561,7 @@ document.addEventListener('keydown', (e) => {
548
561
if ( ! isGameActive ( false ) ) return
549
562
if ( hardcodedPressedKeys . has ( 'F3' ) ) {
550
563
const keybind = f3Keybinds . find ( ( v ) => v . key === e . code )
551
- if ( keybind ) {
564
+ if ( keybind && ( keybind . enabled ?. ( ) ?? true ) ) {
552
565
keybind . action ( )
553
566
e . stopPropagation ( )
554
567
}
0 commit comments