Skip to content

Surgery: switch penalty, old RPCharacters warning and physician failure report - #31

Merged
ryanbarlow97 merged 2 commits into
mainfrom
fix/switch-applies-failure-penalty
Oct 12, 2026
Merged

ryanbarlow97 merged 2 commits into
mainfrom
fix/switch-applies-failure-penalty

Conversation

@ryanbarlow97

@ryanbarlow97 ryanbarlow97 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

A patient who quit after sedation or cutting got the healing penalty, but one who switched character didn't, so switching was a free way out of a failing operation. Healing counts down in real time, so the switch cost them nothing.

The session end fires while the outgoing character is still loaded, before RPCharacters saves or deactivates it, so the penalty now lands on that character for a switch exactly as for a quit. A permakill and shutdown still apply none, and completion commands still never run on a session end.

With TLibs 2.3.0 but RPCharacters older than 2.16.0 there is no character provider, so every offer failed with "Both characters must be ready" and nothing in the log. On the first tick after startup, Surgery now logs a warning naming RPCharacters 2.16.0 when RPCharacters is enabled but provides no character identity.

The failure report also required the physician's own session to be current, so a physician who switched character or was permakilled mid-operation heard nothing, where Stage 1 told them. The report is a message to the account, so it now reaches the physician whenever they are still online. Shutdown still sends nothing.

mvn clean verify passes: 165 tests, coverage gate met.

Docs: TF-Minecraft/Docs#171

🤖 Generated with Claude Code

… penalty

Switching after sedation or cutting ended the operation without the healing
penalty, while quitting applied it. The session end fires while the outgoing
character is still loaded, so the penalty now lands on it for both. A
permakill still applies none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size:S 10-29 effective changed lines (tests excluded in mixed PRs). label Oct 12, 2026
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c190a86c-fd7d-4dbf-9b69-5feb1fca3057

📥 Commits

Reviewing files that changed from the base of the PR and between f31edd7 and 6a946b5.


📒 Files selected for processing (4)
  • src/main/java/net/tfminecraft/surgery/SurgeryPlugin.java
  • src/main/java/net/tfminecraft/surgery/managers/SurgeryCompletionHandler.java
  • src/test/java/net/tfminecraft/surgery/SurgeryLifecycleTest.java
  • src/test/java/net/tfminecraft/surgery/managers/SurgeryCompletionTest.java

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 01df3ecd-ec77-4b91-bc67-06df45d0caf1


📥 Commits

Reviewing files that changed from the base of the PR and between abab42e and f31edd7.



📒 Files selected for processing (3)
  • src/main/java/net/tfminecraft/surgery/managers/SurgeryCompletionHandler.java
  • src/test/java/net/tfminecraft/surgery/SurgeryLifecycleTest.java
  • src/test/java/net/tfminecraft/surgery/managers/SurgeryCompletionTest.java


Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.




📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Healing penalties now apply when an operated patient ends their session by quitting or switching characters. Deaths and shutdowns remain exempt.
📝 Summary

Walkthrough

The handler broadens healing penalty handling for operated patients whose sessions end. It uses the outgoing session to locate the player. Tests update coverage for QUIT, SWITCH, replacement sessions, DEATH, and SHUTDOWN.

Changes

Patient session-end handling

Layer / File(s) Summary
Patient penalty handling and tests
src/main/java/net/tfminecraft/surgery/managers/SurgeryCompletionHandler.java, src/test/java/net/tfminecraft/surgery/SurgeryLifecycleTest.java, src/test/java/net/tfminecraft/surgery/managers/SurgeryCompletionTest.java
The handler broadens patient penalty handling beyond QUIT and uses the outgoing session to locate the player. Tests cover QUIT and SWITCH, replacement sessions, and DEATH and SHUTDOWN end reasons.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix



Merge Risk: 🟡 Moderate · up to f31ed

If the production SWITCH event arrives before the outgoing session is removed from the current-session lookup, the intended healing penalty may not apply. Confirm RPCharacters event ordering before relying on this behavior.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 12, 2026
… surgery failed

With TLibs 2.3.0 but RPCharacters older than 2.16.0 there is no character
provider, so every offer failed as "Both characters must be ready" with
nothing logged. Surgery now warns on the first tick when RPCharacters is
enabled but provides no character identity.

The failure report required the physician's session to be current, so a
physician who switched character or was permakilled heard nothing. It is an
account message, so it now reaches the physician whenever they are online.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ryanbarlow97 ryanbarlow97 changed the title A patient who switches character mid-operation takes the failure penalty Surgery: switch penalty, old RPCharacters warning and physician failure report Oct 12, 2026
@github-actions github-actions Bot added size:M 30-99 effective changed lines (tests excluded in mixed PRs). and removed size:S 10-29 effective changed lines (tests excluded in mixed PRs). labels Oct 12, 2026
@ryanbarlow97
ryanbarlow97 merged commit 9462c28 into main Oct 12, 2026
3 checks passed
@ryanbarlow97
ryanbarlow97 deleted the fix/switch-applies-failure-penalty branch October 12, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant