Skip to content

feat: make suspend persist on controller edit#659

Merged
utkarshdalal merged 1 commit intoutkarshdalal:masterfrom
xXJSONDeruloXx:sus-more-plz
Mar 2, 2026
Merged

feat: make suspend persist on controller edit#659
utkarshdalal merged 1 commit intoutkarshdalal:masterfrom
xXJSONDeruloXx:sus-more-plz

Conversation

@xXJSONDeruloXx
Copy link
Contributor

@xXJSONDeruloXx xXJSONDeruloXx commented Feb 27, 2026

makes game stay suspended when edit on screen controls view is up, so sockpuppet stops dying.

verified other cases where we do not want suspend to persist do not regress: invoke keyboard (primary or ext screen like thor), show/hide controller states, invoke overlay and dismiss while in already suspended state of edit controller overlay does not resume in undesired way.


Summary by cubic

Keep the game suspended while editing on-screen or physical controller settings so gameplay doesn’t resume unexpectedly. The game resumes only after the editor is closed, saved, or dismissed.

  • New Features
    • Added a flag to persist suspension during control editors (on-screen and physical).
    • Resume is triggered only on editor close/save/dismiss; other flows (keyboard, overlay toggle) remain unchanged.

Written for commit 4c1c38d. Summary will update on new commits.

Summary by CodeRabbit

Bug Fixes

  • Fixed overlay pause state management when using the in-game editor. The overlay now properly maintains its paused state while editing controls or settings and correctly resumes when you exit the editor.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2026

📝 Walkthrough

Walkthrough

This PR introduces a keepPausedForEditor state flag to XServerScreen to prevent automatic overlay resumption while the in-game editor is active. When users enter edit modes, the flag is set to suppress auto-resume; upon exiting editors or dialogs, the flag resets and conditional resume logic applies if needed.

Changes

Cohort / File(s) Summary
Overlay Pause State Management
app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt
Introduces keepPausedForEditor flag to conditionally prevent automatic overlay resumption during editor/dialog interactions. Modified navigation handlers for edit control and physical controller modes set the flag; onDismiss/onSave paths reset it and reapply pause/resume logic based on overlay state.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • #583: Establishes foundational overlay pause/resume behavior that this PR extends with editor-specific state management to prevent unwanted auto-resume.

Poem

🐰 A pause that persists when the editor takes hold,
No premature resuming, the overlay stays cold,
Until edits are done and the dialog dismisses,
Then conditionally waking—the perfect fix this is!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: implementing logic to keep the game suspended when the controller edit overlay is active, preventing character death.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
Contributor

@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.

🧹 Nitpick comments (1)
app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt (1)

1241-1246: Consider extracting the resume logic into a helper function.

This 5-line resume pattern is repeated 5 times throughout the file (lines 1241-1246, 1267-1272, 1377-1382, 1394-1399, 1420-1425). Extracting it into a local function would improve maintainability and reduce the risk of inconsistent updates.

♻️ Suggested refactor

Add a helper function at the beginning of XServerScreen:

// Inside XServerScreen composable, after state declarations
fun resumeFromEditor() {
    keepPausedForEditor = false
    if (PluviaApp.isOverlayPaused) {
        PluviaApp.xEnvironment?.onResume()
        isOverlayPaused = false
        PluviaApp.isOverlayPaused = false
    }
}

Then replace each occurrence with a single call to resumeFromEditor().

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt` around
lines 1241 - 1246, Extract the repeated 5-line resume pattern into a local
helper function (e.g., resumeFromEditor) inside the XServerScreen composable:
move the logic that sets keepPausedForEditor = false, checks
PluviaApp.isOverlayPaused, calls PluviaApp.xEnvironment?.onResume(), and clears
isOverlayPaused and PluviaApp.isOverlayPaused into that function, then replace
each repeated block with a single call to resumeFromEditor(); ensure the helper
is visible to the scope where keepPausedForEditor and isOverlayPaused are
defined so the function can update those variables directly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt`:
- Around line 1241-1246: Extract the repeated 5-line resume pattern into a local
helper function (e.g., resumeFromEditor) inside the XServerScreen composable:
move the logic that sets keepPausedForEditor = false, checks
PluviaApp.isOverlayPaused, calls PluviaApp.xEnvironment?.onResume(), and clears
isOverlayPaused and PluviaApp.isOverlayPaused into that function, then replace
each repeated block with a single call to resumeFromEditor(); ensure the helper
is visible to the scope where keepPausedForEditor and isOverlayPaused are
defined so the function can update those variables directly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 761d93b and 4c1c38d.

📒 Files selected for processing (1)
  • app/src/main/java/app/gamenative/ui/screen/xserver/XServerScreen.kt

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

var showPhysicalControllerDialog by remember { mutableStateOf(false) }
var isOverlayPaused by remember { mutableStateOf(false) }
var keyboardRequestedFromOverlay by remember { mutableStateOf(false) }
var keepPausedForEditor by remember { mutableStateOf(false) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Small idea, would it not be best to pause the game when we bring up the menu regardless?

Also, do we need a separate bool for this considering we have a paused bool already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When osc editor is up, overlay is not which is why in target it's not staying suspended in first place right?

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose so.

Overall think this is a good change, just a question of if there's a nice way to apply it to all the options without much hassle

@utkarshdalal utkarshdalal merged commit 8b54b9a into utkarshdalal:master Mar 2, 2026
3 checks passed
@utkarshdalal utkarshdalal deleted the sus-more-plz branch March 2, 2026 03:05
ObfuscatedVoid pushed a commit to ObfuscatedVoid/GameNative that referenced this pull request Mar 4, 2026
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.

3 participants