Skip to content

Commit 01a4065

Browse files
feat: add gamer alternative to konami
1 parent 9a05a2b commit 01a4065

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

src/main/kotlin/gg/skytils/skytilsmod/gui/OptionsGui.kt

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,7 @@ class OptionsGui(val parent: GuiScreen? = null) :
4949
y = RelativeConstraint(0.075f)
5050
textScale = basicTextScaleConstraint { window.getHeight() / 40 }
5151
}
52-
private val order = arrayOf(
53-
UKeyboard.KEY_UP,
54-
UKeyboard.KEY_UP,
55-
UKeyboard.KEY_DOWN,
56-
UKeyboard.KEY_DOWN,
57-
UKeyboard.KEY_LEFT,
58-
UKeyboard.KEY_RIGHT,
59-
UKeyboard.KEY_LEFT,
60-
UKeyboard.KEY_RIGHT,
61-
UKeyboard.KEY_B,
62-
UKeyboard.KEY_A
63-
)
52+
6453
private var orderIndex = 0
6554

6655
init {
@@ -188,7 +177,7 @@ class OptionsGui(val parent: GuiScreen? = null) :
188177

189178
override fun onKeyPressed(keyCode: Int, typedChar: Char, modifiers: UKeyboard.Modifiers?) {
190179
super.onKeyPressed(keyCode, typedChar, modifiers)
191-
if (keyCode == order[orderIndex]) orderIndex++
180+
if (keyCode == order[orderIndex] || keyCode == gamerOrder[orderIndex]) orderIndex++
192181
else orderIndex = 0
193182
if (orderIndex == order.size) {
194183
orderIndex = 0
@@ -213,4 +202,31 @@ class OptionsGui(val parent: GuiScreen? = null) :
213202
}
214203
super.setWorldAndResolution(mc, width, height)
215204
}
205+
206+
companion object {
207+
private val order = arrayOf(
208+
UKeyboard.KEY_UP,
209+
UKeyboard.KEY_UP,
210+
UKeyboard.KEY_DOWN,
211+
UKeyboard.KEY_DOWN,
212+
UKeyboard.KEY_LEFT,
213+
UKeyboard.KEY_RIGHT,
214+
UKeyboard.KEY_LEFT,
215+
UKeyboard.KEY_RIGHT,
216+
UKeyboard.KEY_B,
217+
UKeyboard.KEY_A
218+
)
219+
private val gamerOrder = arrayOf(
220+
UKeyboard.KEY_W,
221+
UKeyboard.KEY_W,
222+
UKeyboard.KEY_S,
223+
UKeyboard.KEY_S,
224+
UKeyboard.KEY_A,
225+
UKeyboard.KEY_D,
226+
UKeyboard.KEY_A,
227+
UKeyboard.KEY_D,
228+
UKeyboard.KEY_B,
229+
UKeyboard.KEY_A
230+
)
231+
}
216232
}

0 commit comments

Comments
 (0)