From 4aa9712bfe87bdde4c1c493e34fa54e470cc507c Mon Sep 17 00:00:00 2001 From: Jared Dunbar Date: Fri, 29 Mar 2024 00:16:45 -0400 Subject: [PATCH] Changed default key from W to P for wiki and fixed double-open --- src/main/kotlin/mods/eln/client/ClientKeyHandler.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/mods/eln/client/ClientKeyHandler.kt b/src/main/kotlin/mods/eln/client/ClientKeyHandler.kt index 0dd4d9bc..0fa4d78e 100644 --- a/src/main/kotlin/mods/eln/client/ClientKeyHandler.kt +++ b/src/main/kotlin/mods/eln/client/ClientKeyHandler.kt @@ -23,7 +23,7 @@ class ClientKeyHandler { // Note: C is the default wrench key, but it can be changed with the GUI in-game. This is override with the value stored in options.txt private val keyboardKeys = listOf( ElectricalAgeKey(Keyboard.KEY_C, ServerKeyHandler.WRENCH), - ElectricalAgeKey(Keyboard.KEY_W, ServerKeyHandler.WIKI) + ElectricalAgeKey(Keyboard.KEY_P, ServerKeyHandler.WIKI) ) init { @@ -45,7 +45,9 @@ class ClientKeyHandler { if (entry.lastState != state) { entry.lastState = state // Be sure to set the state so that it calls again when key released - if (entry.name == ServerKeyHandler.WIKI) { + if (entry.name == ServerKeyHandler.WIKI && state) { + // Only trigger if state = true (ie, when pressed, not when released) + // TODO: Add latch feature to allow closing of the UI by pressing again. clientOpenGui(Root(null)) }