Skip to content

feat: add player 3 and 4 as coin input options#859

Open
mogorman wants to merge 2 commits into
ZaparooProject:mainfrom
mogorman:multi_coin
Open

feat: add player 3 and 4 as coin input options#859
mogorman wants to merge 2 commits into
ZaparooProject:mainfrom
mogorman:multi_coin

Conversation

@mogorman
Copy link
Copy Markdown

@mogorman mogorman commented May 28, 2026

wanted to call from zapscript players 3 and 4 for insert coin

Summary by CodeRabbit

  • New Features

    • Added coin-insertion support for players 3 and 4 via new input commands in the command palette, enabling credit insertion for additional players.
  • Tests

    • Added test cases verifying command-blocking and handling for the new player 3 and player 4 coin insertion commands.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

This PR adds coin insertion support for players 3 and 4: new ZapScript handlers call insertCoin with keys "7" and "8", the taptui command palette exposes input.coinp3/input.coinp4, and tests assert these commands are not media-launching.

Changes

Player 3 and 4 Coin Insertion

Layer / File(s) Summary
P3/P4 Coin Insertion Handlers and Command Palette
pkg/zapscript/input.go, scripts/taptui/taptui.sh, pkg/zapscript/commands_test.go
Adds cmdCoinP3 and cmdCoinP4 handlers that log env.Cmd.Args and call insertCoin with keys "7" (P3) and "8" (P4); updates cmdPalette to include input.coinp3 and input.coinp4; adds tests asserting these commands are not classified as media-launching.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

🐰 Hop-hop, I nudge the arcade door ajar,
P3 and P4 get coins — seven and eight, hurrah!
I log the clicks and shuffle them through,
Small hops, bright lights, one-two-three-woo!
A tiny rabbit cheer for the new player bar.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title 'feat: add player 3 and 4 as coin input options' accurately and concisely describes the main change across all three modified files, matching the PR's core objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/zapscript/input.go`:
- Around line 266-276: Add unit tests that exercise the new command handlers
cmdCoinP3 and cmdCoinP4 to verify they map and execute correctly (not just
classification). Specifically, write tests that invoke the command
dispatch/mapping used in the package (the code path that resolves
"input.coinp3"/"input.coinp4" to handlers) and assert that cmdCoinP3 and
cmdCoinP4 call insertCoin with the expected player ID ("6") and propagate the
platforms.CmdResult/error behavior; reuse existing test helpers for creating a
mock platforms.Platform and platforms.CmdEnv and assert side effects/log output
as used by other handler tests in the package.
- Around line 267-276: cmdCoinP3 and cmdCoinP4 both call insertCoin with the
same key string "6", causing P3/P4 to behave like P2; update the calls in
functions cmdCoinP3 and cmdCoinP4 to pass distinct key identifiers for player 3
and player 4 (e.g., replace the "6" argument with the appropriate key codes such
as "7" for cmdCoinP3 and "8" for cmdCoinP4) so each handler forwards the correct
input to insertCoin.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1b875e71-7c2d-458a-a2e8-b1b2db952a5b

📥 Commits

Reviewing files that changed from the base of the PR and between 7570989 and 5129640.

📒 Files selected for processing (3)
  • pkg/zapscript/commands_test.go
  • pkg/zapscript/input.go
  • scripts/taptui/taptui.sh

Comment thread pkg/zapscript/input.go
Comment on lines +266 to +276
//nolint:gocritic // single-use parameter in command handler
func cmdCoinP3(pl platforms.Platform, env platforms.CmdEnv) (platforms.CmdResult, error) {
log.Info().Msgf("inserting coin for player 3: %v", env.Cmd.Args)
return insertCoin(pl, env, "6")
}

//nolint:gocritic // single-use parameter in command handler
func cmdCoinP4(pl platforms.Platform, env platforms.CmdEnv) (platforms.CmdResult, error) {
log.Info().Msgf("inserting coin for player 4: %v", env.Cmd.Args)
return insertCoin(pl, env, "6")
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Add handler behavior tests for the new Go command paths.

The new handlers are added, but this PR only extends command classification tests; it does not validate handler execution/mapping behavior for input.coinp3/input.coinp4.

As per coding guidelines, **/*.go: "Write tests for all new code — see TESTING.md and pkg/testing/README.md".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/zapscript/input.go` around lines 266 - 276, Add unit tests that exercise
the new command handlers cmdCoinP3 and cmdCoinP4 to verify they map and execute
correctly (not just classification). Specifically, write tests that invoke the
command dispatch/mapping used in the package (the code path that resolves
"input.coinp3"/"input.coinp4" to handlers) and assert that cmdCoinP3 and
cmdCoinP4 call insertCoin with the expected player ID ("6") and propagate the
platforms.CmdResult/error behavior; reuse existing test helpers for creating a
mock platforms.Platform and platforms.CmdEnv and assert side effects/log output
as used by other handler tests in the package.

Comment thread pkg/zapscript/input.go
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@wizzomafizzo wizzomafizzo changed the title add player 3 and 4 as coin input options feat: add player 3 and 4 as coin input options May 29, 2026
@wizzomafizzo
Copy link
Copy Markdown
Member

I'm happy to add this but it will need a little coordination with the go-zapscript repo which is where the command names are formally defined.

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