Skip to content

Add ordered mouse press drain API#118

Merged
ogyrec-o merged 1 commit into
mainfrom
feat/issue-386-ordered-mouse-press-drain-api
May 27, 2026
Merged

Add ordered mouse press drain API#118
ogyrec-o merged 1 commit into
mainfrom
feat/issue-386-ordered-mouse-press-drain-api

Conversation

@ogyrec-o

Copy link
Copy Markdown
Member

Summary

Adds a bounded ordered mouse press drain API to ClientInputProvider.

Why

frevenengine/freven-engine#386 smoke found that rapid terrain interactions still miss actions after the prediction/reconciliation fixes:

  • double RMB can produce only one submitted action
  • LMB -> RMB in the same tick can miss RMB
  • Vanilla currently consumes Left first and Right only through else if
  • existing SDK input API exposes per-button boolean/consume semantics, not ordered press events

Engine investigation showed this cannot be fixed correctly with a private engine-only API because Vanilla/mods need the public SDK trait.

What changed

  • Adds ClientMouseButtonPress.
  • Adds ClientInputProvider::drain_mouse_button_presses(owner, limit).
  • Documents ordered, bounded drain semantics:
    • preserves cross-button order
    • preserves repeated same-button clicks
    • respects caller-provided limit
    • keeps owner/binding guard semantics
  • Keeps existing mouse_button_just_pressed and consume_mouse_button_press APIs unchanged.
  • Default implementation returns an empty vector for source compatibility with existing providers.
  • Updates WASM authoring docs to mention the new ordered drain API.

Tests

Adds coverage for:

  • double RMB represented as two press events
  • LMB then RMB order
  • RMB then LMB order
  • explicit drain limit
  • owner/binding guard behavior
  • legacy consume API compatibility
  • legacy consume API limitation for ordered multi-button drains

Boundaries

  • no engine changes
  • no Vanilla changes
  • no Boot changes
  • no server authority changes
  • no client prediction as authority
  • no held-button spam substitute

Validation

  • cargo +stable fmt --all -- --check
  • cargo +stable test --locked -p freven_avatar_sdk_types input
  • cargo +stable test --locked --workspace
  • cargo +stable clippy --locked --workspace --all-targets -- -D warnings
  • cargo +stable clippy --locked --workspace --all-targets --all-features -- -D warnings
  • git --no-pager diff --check

Related:

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.

1 participant