diff --git a/src/ts/client/game.ts b/src/ts/client/game.ts index f0d3f18..306c31a 100644 --- a/src/ts/client/game.ts +++ b/src/ts/client/game.ts @@ -175,6 +175,7 @@ export class PonyTownGame implements Game { shadowColor = SHADOW_COLOR; onChat = new Subject(); onToggleChat = new Subject(); + onSearch = new Subject(); onCommand = new Subject(); onCancel = () => false; onClock = new BehaviorSubject(''); @@ -458,7 +459,16 @@ export class PonyTownGame implements Game { interact(this, this.input.isPressed(Key.SHIFT)); }); this.input.onPressed([Key.KEY_X, Key.GAMEPAD_BUTTON_DOWN], () => downAction(this)); - this.input.onPressed([Key.KEY_C, Key.GAMEPAD_BUTTON_UP], () => upAction(this)); + this.input.onPressed([Key.KEY_C, Key.GAMEPAD_BUTTON_UP], () => { + if (!this.input.isPressed(Key.CTRL)) { + upAction(this); + } + }); + this.input.onPressed(Key.KEY_F, () => { + if (this.input.isPressed(Key.CTRL)) { + this.onSearch.next(); + } + }); this.input.onPressed(Key.F2, () => { if (!this.settings.browser.disableFKeys) { this.hideText = !this.hideText; diff --git a/src/ts/client/input/keyboard.ts b/src/ts/client/input/keyboard.ts index 4962d1b..fb477ce 100644 --- a/src/ts/client/input/keyboard.ts +++ b/src/ts/client/input/keyboard.ts @@ -9,7 +9,7 @@ function isKeyEventInvalid(e: KeyboardEvent) { } function allowKey(key: number) { - return key === Key.ESCAPE || key === Key.F5 || key === Key.F12 || key === Key.F11 || key === Key.TAB; + return key === Key.ESCAPE || key === Key.F5 || key === Key.F12 || key === Key.F11 || key === Key.TAB || key === Key.KEY_C || key === Key.KEY_I; } function fixKeyCode(key: number) { diff --git a/src/ts/components/shared/chat-log/chat-log.ts b/src/ts/components/shared/chat-log/chat-log.ts index b0edb1c..9993474 100644 --- a/src/ts/components/shared/chat-log/chat-log.ts +++ b/src/ts/components/shared/chat-log/chat-log.ts @@ -281,6 +281,9 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck { updateEntityId(this.party, update.old, update.new); updateEntityId(this.whisper, update.old, update.new); }), + this.game.onSearch.subscribe(() => { + this.focus(); + }), ); } get linesElement() { @@ -457,7 +460,6 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck { let value = this.filterInput.nativeElement.value; if (!value) { this.clearTimeOutAutoClear(); - this.unFocus(); this.filterChatLogLines('', false); return; } else {