[PR #467] [MERGED] LAN guest: hurt by lava, fire, drowning, suffocation and the void; hungry from moving #2585

Closed
opened 2026-11-02 15:57:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/467
Author: @ludovic111
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @ludovic111

Base: main ← Head: fix/lan-guest-environment


📝 Commits (4)

  • dac18e8 LAN: mobs target and attack guests
  • 327aa5a tools/lan_e2e.py: a world with commands, so the guest's commands run again
  • 600bae5 LAN guest: hurt by lava, fire, drowning, suffocation and the void; hungry from moving
  • 2e12123 tools/lan_e2e.py: hazards counts the food spent from full health

📊 Changes

11 files changed (+545 additions, -21 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+1 -0)
📝 crates/horizon-client/src/game/creatures.rs (+66 -6)
📝 crates/horizon-client/src/game/lan.rs (+10 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+62 -9)
➕ crates/horizon-client/src/game/lan_mobs.rs (+263 -0)
📝 crates/horizon-client/src/game/remote.rs (+6 -0)
📝 crates/horizon-client/src/lan/guest.rs (+3 -0)
📝 crates/horizon-client/src/lan/hub.rs (+3 -0)
📝 crates/horizon-client/src/lan/playerdata.rs (+2 -1)
📝 crates/horizon-client/src/motion/environment.rs (+21 -1)
📝 tools/lan_e2e.py (+108 -4)

📄 Description

Part of #435 (second item: guests take no damage from lava, fire, drowning, suffocation or the void; no hunger from moving). Stacked on #466: merge that first.

What vanilla does

The server runs every player's body: LivingEntity.baseTick (suffocation isInWall 1/tick unless sleeping, drowning 2 after the air runs out, lava 4 and fire), fire blocks (in_fire), Entity.checkBelowWorld → onBelowWorld (4 a tick below minY - 64, creative players included). ServerGamePacketListenerImpl.handleMovePlayer calls ServerPlayer.jumpFromGround when a move leaves the ground going up (0.05 exhaustion, 0.2 sprinting) and checkMovementStatistics (0.1/m sprinting, 0.01/m swimming).

What this changes

guest_server_tick (game/lan_actions.rs) now also runs, as the guest: the jump and movement-statistics exhaustion per move, then tick_environment_damage (drowning, lava), apply_fire_contact, and a new MotionWorld::server_hazards_tick (void, suffocation). Suffocation uses the same block rule as the mobs' check (a full collision box that renders as a full cube) over vanilla's 0.48-wide box at the eyes.

  • The first move of a tick now starts from the ground state before it (Guest.moves_from_ground); before, it started from the latest packet's flag, so take-offs were never seen.
  • The guest's motion events no longer pile up: their hurt sounds play at the guest (everyone hears them), the rest is dropped.
  • horizon-ctl lan status lists each guest's health and [food, saturation, exhaustion] (for the test).

Not changed: the host itself still has no suffocation damage and dies in the void by health = 0 (game.rs); that's the host's own tick, outside this issue.

How it was verified

  • Two real clients on this Mac (host + guest, offscreen): new hazards check in tools/lan_e2e.py. The guest sprint-jumps 58 blocks (exhaustion 0 → 3.2), then inside a stone box: lava 20 → 16.8, stone at the eyes 14.8 → 13.8, water 13.8 → 12.8 after ~320 ticks (300 air + 20), the void 12.8 → 4.8. damage (fall) still passes.
  • fmt, cargo clippy -p horizon-client --all-targets -- -D warnings. Parity harnesses: one tools/parity.py --changed origin/main run on the branch combining this series (results on the last PR).

Follow-up (after a full 14-check run on the combined stack)

  • The hazards check now starts from a fresh life (kill @s, respawn), so regeneration doesn't eat food during the run.
  • It now counts all the food spent: 4 × (food + saturation) plus exhaustion. Before, it read only exhaustion, which wraps back below 4 as it turns into food loss.

🤖 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/467 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/lan-guest-environment` --- ### 📝 Commits (4) - [`dac18e8`](https://github.com/horizon-rust/horizon/commit/dac18e8350600d38c4c6b95d987d4738b802185f) LAN: mobs target and attack guests - [`327aa5a`](https://github.com/horizon-rust/horizon/commit/327aa5af6e710b1aa0e3e10652ce0453943b6710) tools/lan_e2e.py: a world with commands, so the guest's commands run again - [`600bae5`](https://github.com/horizon-rust/horizon/commit/600bae5703d222c7b1bd3c51ee8e72b3be12557e) LAN guest: hurt by lava, fire, drowning, suffocation and the void; hungry from moving - [`2e12123`](https://github.com/horizon-rust/horizon/commit/2e1212346f411c06657dec6a68b35ea853430502) tools/lan_e2e.py: hazards counts the food spent from full health ### 📊 Changes **11 files changed** (+545 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+1 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+66 -6) 📝 `crates/horizon-client/src/game/lan.rs` (+10 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+62 -9) ➕ `crates/horizon-client/src/game/lan_mobs.rs` (+263 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+6 -0) 📝 `crates/horizon-client/src/lan/guest.rs` (+3 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+3 -0) 📝 `crates/horizon-client/src/lan/playerdata.rs` (+2 -1) 📝 `crates/horizon-client/src/motion/environment.rs` (+21 -1) 📝 `tools/lan_e2e.py` (+108 -4) </details> ### 📄 Description Part of #435 (second item: guests take no damage from lava, fire, drowning, suffocation or the void; no hunger from moving). Stacked on #466: merge that first. ## What vanilla does The server runs every player's body: `LivingEntity.baseTick` (suffocation `isInWall` 1/tick unless sleeping, drowning 2 after the air runs out, lava 4 and fire), fire blocks (`in_fire`), `Entity.checkBelowWorld` → `onBelowWorld` (4 a tick below `minY - 64`, creative players included). `ServerGamePacketListenerImpl.handleMovePlayer` calls `ServerPlayer.jumpFromGround` when a move leaves the ground going up (0.05 exhaustion, 0.2 sprinting) and `checkMovementStatistics` (0.1/m sprinting, 0.01/m swimming). ## What this changes `guest_server_tick` (game/lan_actions.rs) now also runs, as the guest: the jump and movement-statistics exhaustion per move, then `tick_environment_damage` (drowning, lava), `apply_fire_contact`, and a new `MotionWorld::server_hazards_tick` (void, suffocation). Suffocation uses the same block rule as the mobs' check (a full collision box that renders as a full cube) over vanilla's 0.48-wide box at the eyes. - The first move of a tick now starts from the ground state before it (`Guest.moves_from_ground`); before, it started from the latest packet's flag, so take-offs were never seen. - The guest's motion events no longer pile up: their hurt sounds play at the guest (everyone hears them), the rest is dropped. - `horizon-ctl lan status` lists each guest's health and `[food, saturation, exhaustion]` (for the test). Not changed: the host itself still has no suffocation damage and dies in the void by health = 0 (game.rs); that's the host's own tick, outside this issue. ## How it was verified - **Two real clients on this Mac** (host + guest, offscreen): new `hazards` check in `tools/lan_e2e.py`. The guest sprint-jumps 58 blocks (exhaustion 0 → 3.2), then inside a stone box: lava 20 → 16.8, stone at the eyes 14.8 → 13.8, water 13.8 → 12.8 after ~320 ticks (300 air + 20), the void 12.8 → 4.8. `damage` (fall) still passes. - fmt, `cargo clippy -p horizon-client --all-targets -- -D warnings`. Parity harnesses: one `tools/parity.py --changed origin/main` run on the branch combining this series (results on the last PR). ## Follow-up (after a full 14-check run on the combined stack) - The `hazards` check now starts from a fresh life (`kill @s`, respawn), so regeneration doesn't eat food during the run. - It now counts all the food spent: 4 × (food + saturation) plus exhaustion. Before, it read only exhaustion, which wraps back below 4 as it turns into food loss. 🤖 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-02 15:57:23 +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#2585
No description provided.