Skip to content

Commit

Permalink
Changed default key from W to P for wiki and fixed double-open
Browse files Browse the repository at this point in the history
  • Loading branch information
jrddunbr committed Mar 29, 2024
1 parent 9b72d3f commit 4aa9712
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/kotlin/mods/eln/client/ClientKeyHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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))
}

Expand Down

0 comments on commit 4aa9712

Please sign in to comment.