|
2 | 2 | --- MOD_NAME: Better Mouse And Gamepad |
3 | 3 | --- MOD_ID: BetterMouseAndGamepad |
4 | 4 | --- MOD_AUTHOR: [Kooluve] |
5 | | ---- MOD_DESCRIPTION: V1.0.3 Make mouse and gamepad more efficient and easier to use. View "README.md" and "*.lua" file for all functions and settings. |
| 5 | +--- MOD_DESCRIPTION: [V1.0.4] Make mouse and gamepad more efficient and easier to use. View "README.md" and "*.lua" file for all functions and settings. https://github.com/Kooluve/Better-Mouse-And-Gamepad |
6 | 6 | ---------------------------------------------- |
7 | 7 | ------------MOD CODE ------------------------- |
8 | 8 |
|
@@ -91,6 +91,8 @@ R_cursor_up = {T = {x=0, y=0}, target = nil, time = 0.1, handled = true} |
91 | 91 | M_clicked = {handled = true} |
92 | 92 | M_cursor_down = {handled = true} |
93 | 93 | M_cursor_up = {handled = true} |
| 94 | +Game_last_state = G.STATES.SPLASH |
| 95 | +Game_state_change_to_selecting_hand = false --prevent repetitive playing card and discarding |
94 | 96 |
|
95 | 97 | -------------------------------------------------- |
96 | 98 | ------------LOVE2D FUNCTION REWRITING------------- |
@@ -169,6 +171,14 @@ local update_ref = Controller.update |
169 | 171 | function Controller.update(self, dt) |
170 | 172 | update_ref(self, dt) |
171 | 173 |
|
| 174 | + if Game_last_state ~= G.STATES.SELECTING_HAND and G.STATE == G.STATES.SELECTING_HAND then |
| 175 | + Game_state_change_to_selecting_hand = true |
| 176 | + end |
| 177 | + if Game_last_state == G.STATES.SELECTING_HAND and G.STATE ~= G.STATES.SELECTING_HAND then |
| 178 | + Game_state_change_to_selecting_hand = false |
| 179 | + end |
| 180 | + Game_last_state = G.STATE |
| 181 | + |
172 | 182 | if R_cursor_queue then |
173 | 183 | R_cursor_press(R_cursor_queue.x, R_cursor_queue.y) |
174 | 184 | R_cursor_queue = nil |
@@ -427,20 +437,22 @@ end |
427 | 437 |
|
428 | 438 | function queue_U_wheel_press() |
429 | 439 | if C.locks.frame or not mod_functions_can["middle_mouse_button_up"] then return end |
430 | | - if not G.SETTINGS.paused and G.STATE == G.STATES.SELECTING_HAND then |
| 440 | + if not G.SETTINGS.paused and G.STATE == G.STATES.SELECTING_HAND and Game_state_change_to_selecting_hand and C.cursor_down.target.states.drag.is == false then |
431 | 441 | local play_button = G.buttons:get_UIE_by_ID('play_button') |
432 | 442 | if play_button and play_button.config.button then |
433 | 443 | G.FUNCS.play_cards_from_highlighted() |
| 444 | + Game_state_change_to_selecting_hand = false |
434 | 445 | end |
435 | 446 | end |
436 | 447 | end |
437 | 448 |
|
438 | 449 | function queue_D_wheel_press() |
439 | 450 | if C.locks.frame or not mod_functions_can["middle_mouse_button_down"] then return end |
440 | | - if not G.SETTINGS.paused and G.STATE == G.STATES.SELECTING_HAND then |
| 451 | + if not G.SETTINGS.paused and G.STATE == G.STATES.SELECTING_HAND and Game_state_change_to_selecting_hand and C.cursor_down.target.states.drag.is == false then |
441 | 452 | local discard_button = G.buttons:get_UIE_by_ID('discard_button') |
442 | 453 | if discard_button and discard_button.config.button then |
443 | 454 | G.FUNCS.discard_cards_from_highlighted() |
| 455 | + Game_state_change_to_selecting_hand = false |
444 | 456 | end |
445 | 457 | end |
446 | 458 | end |
|
0 commit comments