Skip to content

Conversation

@makitalo
Copy link
Collaborator

@makitalo makitalo commented Mar 9, 2025

Fixes many edge cases (such as finishing with flower + apple, or escing/dying at flower), and improves multi rec handling.

Added new tests with recs featuring these edge cases.

Closes #382.

makitalo added 4 commits March 9, 2025 17:12
Fixes many edge cases (such as finishing with flower + apple,
or escing/dying at flower), and improves multi rec handling.

Added new tests with recs featuring these edge cases.
Due to handling flower+apple finishes properly now, EventType.Apple
as last event doesn't count as NoTouch anymore for these cases.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the finish detection logic for replays by refining event parsing and using more robust time calculations, while also adding tests to cover various edge cases.

  • Revised event parsing in Replay.ts to use an Event instance rather than raw object literals.
  • Updated the finish detection logic in getTime to consider multi-rec edge cases and frame tolerances.
  • Added new tests to validate singleplayer and multiplayer scenarios with edge conditions.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

File Description
src/rec/Replay.ts Updated event parsing and finish detection logic in getTime.
tests/rec.int.test.ts Added tests covering new edge case scenarios.
src/rec/Event.ts Introduced a getter for converting event time to milliseconds.
Comments suppressed due to low confidence (1)

src/rec/Event.ts:14

  • [nitpick] Extract the magic constant used for converting event time to milliseconds into a well-named constant to improve code clarity and maintainability.
get timeInMilliseconds(): number {

@hexjelly hexjelly merged commit 86abf39 into master Mar 12, 2025
2 checks passed
@hexjelly hexjelly deleted the finish-detection branch March 12, 2025 08:43
github-actions bot pushed a commit that referenced this pull request Mar 12, 2025
## [1.2.4](v1.2.3...v1.2.4) (2025-03-12)

### Bug Fixes

* **Replay:** improve finish detection ([#425](#425)) ([86abf39](86abf39))
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.

Flower and apple at same time counts as NoTouch

3 participants