[PR #4784] [MERGED] Port OptimizeWorldScreen and the Edit World flow into it #5849

Closed
opened 2026-11-03 05:15:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4784
Author: @levzzz5154
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @levzzz5154

Base: main ← Head: parity/L2-screen


📝 Commits (2)

  • 4bbd8f3 Port OptimizeWorldScreen and the Edit World flow into it
  • d3a5cf3 Merge hr/main into parity/L2-screen

📊 Changes

3 files changed (+547 additions, -6 deletions)

View changed files

📝 crates/horizon-client/src/game/agent.rs (+8 -0)
📝 crates/horizon-client/src/title.rs (+339 -3)
📝 crates/horizon-client/src/title/tests.rs (+200 -3)

📄 Description

🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally.

Part of #3518

Second of two PRs for Optimize World (the worker, WorldUpgrader, merged in #4774).

Rows

  • OptimizeWorldScreen.create: Edit World's Optimize World button is enabled; it opens BackupConfirmScreen (title, description, "Create Backup and Optimize" / "I Know What I'm Doing!" / Cancel, plus the Erase Cached Data box, promptForCacheErase). Backup makes the backup and toast first, then create: a world that still needs file fixes or whose level data does not read gives no screen (vanilla's null, the main menu). Otherwise it starts a WorldUpgrader over the world's dimensions (erase cache from the box, no region recreation).
  • OptimizeWorldScreen.extractRenderState: the title, status line, Upgraded/Skipped/Total chunks, black-bordered bar with one coloured slice per dimension (DIMENSION_COLORS), the converted + skipped / total counter and the percentage, at vanilla's positions.
  • OptimizeWorldScreen.init: the Cancel button at (w/2-100, h/4+150, 200, 20): upgrader.cancel() then back to the world list. Also tick (a finished upgrader returns to the refreshed list), shouldCloseOnEsc false, and BackupConfirmScreen's Escape = Cancel back to the Edit World screen (name kept).

Deviation

Vanilla's create saves level.dat at the current version before the run. Horizon converts a whole world when it opens one whose level.dat is older, so level.dat is stamped when the run finishes (fix_world_files) instead; a cancelled run leaves the old version and the next open converts as before.

Vanilla followed

EditWorldScreen (Optimize button, conditionallyMakeBackupAndShowToast), BackupConfirmScreen.{init,extractRenderState,keyPressed}, OptimizeWorldScreen.{create,init,tick,onClose,removed,extractRenderState}.

Tests

6 new tests in title/tests.rs (confirm layout and Cancel, run without backup, run after backup, cancel, file-fix refusal, level.dat stamping) on temp dirs; two existing ones updated for the enabled button. fmt, clippy -D warnings, cargo test -p horizon-client --lib title:: pass. Not run: the game (machine limits).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/4784 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `parity/L2-screen` --- ### 📝 Commits (2) - [`4bbd8f3`](https://github.com/horizon-rust/horizon/commit/4bbd8f3e8e05e06c9ee8c8b3835d8bc0354002ff) Port OptimizeWorldScreen and the Edit World flow into it - [`d3a5cf3`](https://github.com/horizon-rust/horizon/commit/d3a5cf392541474934a6d8fa19733bc20faed7bc) Merge hr/main into parity/L2-screen ### 📊 Changes **3 files changed** (+547 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/agent.rs` (+8 -0) 📝 `crates/horizon-client/src/title.rs` (+339 -3) 📝 `crates/horizon-client/src/title/tests.rs` (+200 -3) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #3518 Second of two PRs for Optimize World (the worker, `WorldUpgrader`, merged in #4774). ## Rows - `OptimizeWorldScreen.create`: Edit World's Optimize World button is enabled; it opens `BackupConfirmScreen` (title, description, "Create Backup and Optimize" / "I Know What I'm Doing!" / Cancel, plus the Erase Cached Data box, `promptForCacheErase`). Backup makes the backup and toast first, then `create`: a world that still needs file fixes or whose level data does not read gives no screen (vanilla's `null`, the main menu). Otherwise it starts a `WorldUpgrader` over the world's dimensions (erase cache from the box, no region recreation). - `OptimizeWorldScreen.extractRenderState`: the title, status line, Upgraded/Skipped/Total chunks, black-bordered bar with one coloured slice per dimension (`DIMENSION_COLORS`), the `converted + skipped / total` counter and the percentage, at vanilla's positions. - `OptimizeWorldScreen.init`: the Cancel button at `(w/2-100, h/4+150, 200, 20)`: `upgrader.cancel()` then back to the world list. Also `tick` (a finished upgrader returns to the refreshed list), `shouldCloseOnEsc` false, and BackupConfirmScreen's Escape = Cancel back to the Edit World screen (name kept). ## Deviation Vanilla's `create` saves level.dat at the current version before the run. Horizon converts a whole world when it opens one whose level.dat is older, so level.dat is stamped when the run finishes (`fix_world_files`) instead; a cancelled run leaves the old version and the next open converts as before. ## Vanilla followed `EditWorldScreen` (Optimize button, `conditionallyMakeBackupAndShowToast`), `BackupConfirmScreen.{init,extractRenderState,keyPressed}`, `OptimizeWorldScreen.{create,init,tick,onClose,removed,extractRenderState}`. ## Tests 6 new tests in `title/tests.rs` (confirm layout and Cancel, run without backup, run after backup, cancel, file-fix refusal, level.dat stamping) on temp dirs; two existing ones updated for the enabled button. fmt, clippy `-D warnings`, `cargo test -p horizon-client --lib title::` pass. Not run: the game (machine limits). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:15:25 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5849
No description provided.