[PR #6799] [MERGED] Iron golem stays on the guest it is angry at, not the nearest player #7103

Closed
opened 2026-11-03 06:33:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6799
Author: @ClickingMaster
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/golem-anger-stays-on-attacker


📝 Commits (1)

  • 6330a19 Iron golem stays on the guest it is angry at, not the nearest player

📊 Changes

1 file changed (+36 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_mobs.rs (+36 -0)

📄 Description

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

Fixes #6781

Cause

player_for in crates/horizon-client/src/game/lan_mobs.rs decides which player a mob sees when guests are on. It kept a mob on its bound guest only while ai.target == Player or the mob was hurt by a player in the last 100 ticks. An iron golem's anger (extra.anger, set in after_hurt) lasts 400–779 ticks. After the attacker ran off and the target and 100-tick window lapsed, the golem fell back to the nearest player, and its NearestTarget::player goal (active while anger > 0) attacked that bystander. Vanilla keeps the angry-at UUID per player (NeutralMob).

Fix

In player_for, an iron golem with anger > 0 counts as targeting, so it keeps its bound guest while they are a valid target. One condition, no other behaviour changed.

Test

New unit test game::lan_mobs::tests::an_angry_golem_keeps_the_player_who_hit_it: an angry golem bound to a far guest (conn 7) with a nearer bystander (conn 8), outside the 100-tick window.

  • Before the fix: fails, player_for returns Some(8) (the bystander), expected Some(7).
  • After the fix: passes. With anger = 0 it sees the nearest player again.

The test is a unit test of the choice logic; I did not add a lan_e2e.py check.

Self-check

  • tools/pr_ready.py --quick: ran, all pass (rustfmt, clippy -D warnings, 606 horizon-client tests, 602 Python tests, mod API). Harnesses not run (--quick); CI's parity job picks them.
  • port_ledger.py check: not run, no decompiled vanilla sources on this machine.
  • Not limited to the deprecated in-frame path; this is the server-thread / LAN path.

🤖 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/6799 **Author:** [@ClickingMaster](https://github.com/ClickingMaster) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/golem-anger-stays-on-attacker` --- ### 📝 Commits (1) - [`6330a19`](https://github.com/horizon-rust/horizon/commit/6330a192d68d8d96a5daff4bd77280241feeebac) Iron golem stays on the guest it is angry at, not the nearest player ### 📊 Changes **1 file changed** (+36 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_mobs.rs` (+36 -0) </details> ### 📄 Description > 🤖 Opened by ClickingMaster's AI agent (Claude Code, Claude Sonnet 5.5), not by ClickingMaster personally. Fixes #6781 ## Cause `player_for` in `crates/horizon-client/src/game/lan_mobs.rs` decides which player a mob sees when guests are on. It kept a mob on its bound guest only while `ai.target == Player` or the mob was hurt by a player in the last 100 ticks. An iron golem's anger (`extra.anger`, set in `after_hurt`) lasts 400–779 ticks. After the attacker ran off and the target and 100-tick window lapsed, the golem fell back to the nearest player, and its `NearestTarget::player` goal (active while `anger > 0`) attacked that bystander. Vanilla keeps the angry-at UUID per player (`NeutralMob`). ## Fix In `player_for`, an iron golem with `anger > 0` counts as targeting, so it keeps its bound guest while they are a valid target. One condition, no other behaviour changed. ## Test New unit test `game::lan_mobs::tests::an_angry_golem_keeps_the_player_who_hit_it`: an angry golem bound to a far guest (conn 7) with a nearer bystander (conn 8), outside the 100-tick window. - Before the fix: fails, `player_for` returns `Some(8)` (the bystander), expected `Some(7)`. - After the fix: passes. With `anger = 0` it sees the nearest player again. The test is a unit test of the choice logic; I did not add a `lan_e2e.py` check. ## Self-check - `tools/pr_ready.py --quick`: ran, all pass (rustfmt, clippy `-D warnings`, 606 horizon-client tests, 602 Python tests, mod API). Harnesses not run (`--quick`); CI's parity job picks them. - `port_ledger.py check`: not run, no decompiled vanilla sources on this machine. - Not limited to the deprecated in-frame path; this is the server-thread / LAN path. 🤖 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 06:33:54 +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#7103
No description provided.