Skip to content

feat(interface): add mashGame minigame - #829

Open
DhikaNino wants to merge 1 commit into
overextended:mainfrom
DhikaNino:main
Open

DhikaNino wants to merge 1 commit into
overextended:mainfrom
DhikaNino:main

Conversation

@DhikaNino

@DhikaNino DhikaNino commented Oct 8, 2026 •

Copy link
Copy Markdown

Summary

Adds lib.mashGame, a key-holding minigame where players must hold a randomly chosen key until the progress bar reaches 100%. Releasing the key decays progress over time. Supports multiple consecutive stages with different hold durations and randomized keys.

API Reference

lib.mashGame

local success = lib.mashGame(durations, keys, options)
  • durations (number | number[]): Hold duration in milliseconds for each stage.
  • keys (string | string[], optional): Keys to randomly choose from per stage (defaults to {'e'}).
  • options (table, optional):
    • decayRate (number): Progress decay percentage per second when released (defaults to 25).
    • failOnWrongKey (boolean): Fails the attempt immediately on an incorrect key press (defaults to true).
    • timeout (number | number[]): Maximum allowed duration in milliseconds per stage or total.

Returns true when all stages are completed, or false on failure/cancellation.

Additional Methods

  • lib.cancelMashGame(): Cancels the active game and resolves false.
  • lib.mashGameActive(): Returns whether a game is currently running.

Usage Example

-- 3 stages with decreasing durations and random keys
local success = lib.mashGame({4000, 2000, 1000}, {'e', 'a', 's', 'd'})

if success then
    print('Minigame passed')
else
    print('Minigame failed')
end

Changes

  • Client (resource/interface/client/mashgame.lua): Added promise-based wrapper, NUI focus management, and export registration matching skillCheck.
  • UI (web/src/features/mashgame/): Added horizontal progress bar matching ox_lib:progressBar dimensions (350x45px) and skillCheck-style keycap hints (25x25px).
  • Input handling:
    • Filtered OS key-repeat events for non-target keys.
    • Added a grace window and previous-key ignore guard during stage transitions so holding the old key does not fail the next round.
    • Locked percentage text to tabular numbers with fixed width to eliminate layout shift across 1 to 3 digits.
  • Dev drawer: Added standalone mock trigger in the developer drawer for browser testing.

Testing

  • Tested single-stage and multi-stage configurations.
  • Tested release decay mechanics, wrong-key failure, and Escape key cancellation.
  • Verified smooth stage transitions without premature failures while holding the previous key.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 11:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants