[PR #2133] [MERGED] Make the fall, drowning, fire and freeze damage game rules work #4036

Closed
opened 2026-11-03 04:14:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2133
Author: @kacpherek
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/damage-gamerules


📝 Commits (1)

  • 30fa41d Make the fall, drowning, fire and freeze damage game rules work

📊 Changes

3 files changed (+23 additions, -2 deletions)

View changed files

📝 crates/horizon-client/examples/probe/scene_motion_probe.rs (+1 -0)
📝 crates/horizon-client/src/game/chat.rs (+5 -0)
📝 crates/horizon-client/src/health.rs (+17 -2)

📄 Description

What and why

The game rules fall_damage, drowning_damage, fire_damage and freeze_damage were stored and saved but nothing read them, so turning one off changed nothing.

The shared player_immunity check in horizon-world already asks for these rules through ImmunityWorld::damage_rule, but the client's implementation always answered true. HealthRules now carries the four rules, damage_rule returns them, and sync_rules copies them from the game rules (the same way natural_health_regeneration is synced). Every player hurt goes through that check, so fall, drowning, fire and freeze damage are refused when their rule is off. This covers the local player, LAN guests and other dimensions (they share health_rules). Mobs are not affected, as in vanilla.

The scene motion probe built HealthRules field by field, so it now fills the new fields with ..Default::default().

Vanilla reference

  • Player.isInvulnerableTo: after the living checks, a source tagged is_drowning, is_fall, is_fire or is_freezing is refused when GameRules.DROWNING_DAMAGE, FALL_DAMAGE, FIRE_DAMAGE or FREEZE_DAMAGE is false.
  • Server players add their dimension-change and client-loaded checks on top (ServerPlayer.isInvulnerableTo), which Horizon already has.

Self-check

cargo check -p horizon-client passes.


🔄 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/2133 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/damage-gamerules` --- ### 📝 Commits (1) - [`30fa41d`](https://github.com/horizon-rust/horizon/commit/30fa41ddbd4e85258e36a00f75e692976b7f3775) Make the fall, drowning, fire and freeze damage game rules work ### 📊 Changes **3 files changed** (+23 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/scene_motion_probe.rs` (+1 -0) 📝 `crates/horizon-client/src/game/chat.rs` (+5 -0) 📝 `crates/horizon-client/src/health.rs` (+17 -2) </details> ### 📄 Description ## What and why The game rules `fall_damage`, `drowning_damage`, `fire_damage` and `freeze_damage` were stored and saved but nothing read them, so turning one off changed nothing. The shared `player_immunity` check in `horizon-world` already asks for these rules through `ImmunityWorld::damage_rule`, but the client's implementation always answered `true`. `HealthRules` now carries the four rules, `damage_rule` returns them, and `sync_rules` copies them from the game rules (the same way `natural_health_regeneration` is synced). Every player hurt goes through that check, so fall, drowning, fire and freeze damage are refused when their rule is off. This covers the local player, LAN guests and other dimensions (they share `health_rules`). Mobs are not affected, as in vanilla. The scene motion probe built `HealthRules` field by field, so it now fills the new fields with `..Default::default()`. ## Vanilla reference - `Player.isInvulnerableTo`: after the living checks, a source tagged `is_drowning`, `is_fall`, `is_fire` or `is_freezing` is refused when `GameRules.DROWNING_DAMAGE`, `FALL_DAMAGE`, `FIRE_DAMAGE` or `FREEZE_DAMAGE` is false. - Server players add their dimension-change and client-loaded checks on top (`ServerPlayer.isInvulnerableTo`), which Horizon already has. ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:14:12 +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#4036
No description provided.