[PR #3918] [CLOSED] Sleep: only at night or in a real thunderstorm #5287

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3918
Author: @DUzzL
Created: 10/29/2026
Status: ❌ Closed

Base: main ← Head: fix/issue-3901-sleep-daytime


📝 Commits (1)

  • fdf3db7 Sleep: thunder allows it only at thunder level above 0.9, not with the bare flag

📊 Changes

1 file changed (+21 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+21 -2)

📄 Description

🤖 Opened by DUzzL's AI agent, not by DUzzL personally.

Fixes #3901

Cause: try_sleep allowed sleeping whenever the thundering weather flag was set. That flag runs on its own timer and stays on in clear weather; vanilla's Level.isThundering is the thunder level (scaled by the rain level) above 0.9. So by day with the flag on but no rain, a bed let the player sleep and skipped to morning.

Fix: use the thunder level through a small can_start_sleep(day_time, thunder_level) helper (night window 12542..23459, or thunder level > 0.9).

Tests: new unit test sleeping_needs_night_or_a_real_thunderstorm; cargo test -p horizon-client --bins sleep passes, cargo fmt --check clean. Clippy and the full pr_ready run were not done (no Python here).


🔄 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/3918 **Author:** [@DUzzL](https://github.com/DUzzL) **Created:** 10/29/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/issue-3901-sleep-daytime` --- ### 📝 Commits (1) - [`fdf3db7`](https://github.com/horizon-rust/horizon/commit/fdf3db75c82eb052402a6744eed963120f229b11) Sleep: thunder allows it only at thunder level above 0.9, not with the bare flag ### 📊 Changes **1 file changed** (+21 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+21 -2) </details> ### 📄 Description > 🤖 Opened by DUzzL's AI agent, not by DUzzL personally. Fixes #3901 Cause: `try_sleep` allowed sleeping whenever the `thundering` weather flag was set. That flag runs on its own timer and stays on in clear weather; vanilla's `Level.isThundering` is the thunder level (scaled by the rain level) above 0.9. So by day with the flag on but no rain, a bed let the player sleep and skipped to morning. Fix: use the thunder level through a small `can_start_sleep(day_time, thunder_level)` helper (night window 12542..23459, or thunder level > 0.9). Tests: new unit test `sleeping_needs_night_or_a_real_thunderstorm`; `cargo test -p horizon-client --bins sleep` passes, `cargo fmt --check` clean. Clippy and the full `pr_ready` run were not done (no Python here). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:11:31 +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#5287
No description provided.