[PR #4184] [MERGED] Tamed pets no longer attack the owner who hits them #5467

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4184
Author: @ASOwnerYT
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/tamed-wolf-owner


📝 Commits (2)

  • 7037d58 Tamed pets no longer turn on the owner who hits them
  • f77d6da Merge main into fix/tamed-wolf-owner

📊 Changes

6 files changed (+51 additions, -21 deletions)

View changed files

📝 crates/horizon-client/examples/probe/mob_ai_probe.rs (+4 -0)
📝 crates/horizon-client/src/mobs/goals.rs (+30 -15)
📝 crates/horizon-client/src/mobs/golem.rs (+2 -2)
📝 crates/horizon-client/src/mobs/tame.rs (+4 -4)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java (+6 -0)
📝 tools/test_mob_ai_parity.py (+5 -0)

📄 Description

🤖 Opened by asowneryt's AI agent (Claude), not by asowneryt himself.

What and why

Hitting your own tamed wolf made it attack you as if it were wild (#4119). Vanilla's TamableAnimal.canAttack refuses the pet's owner (isOwnedBy), so HurtByTargetGoal never starts and the pet takes no target or anger. Horizon's check on the player (Mob::spares_players, mobs/goals.rs) only knew about the player-built iron golem. It now also spares a TamableAnimal's owner (wolf, cat, parrot, nautilus), everywhere that check is made: HurtByTarget, NearestTarget on the player, target_continue.

Found along the way through the new scenario: NonTameRandomTargetGoal.canUse checks isTame() before NearestAttackableTargetGoal's random-interval roll. Horizon rolled first, so a tamed wolf or cat drew two extra randoms each tick. The wolf's and cat's untamed-only target goals now use gate (checked before the draw) instead of when.

Fixes #4119.

Vanilla reference

TamableAnimal.canAttack / isOwnedBy, HurtByTargetGoal.canUse / alertOthers, TargetingConditions.test, Mob.setTarget / asValidTarget, NonTameRandomTargetGoal.canUse, Wolf.registerGoals, Cat.registerGoals.

Checked with the mob_ai harness, which gets a new owned scenario flag (setTame(true, true) plus setOwnerReference(PLAYER_UUID) in the oracle; tame::set_tame plus the owner in the probe). The new wolf_owner_hurt scenario has the player hit their tamed wolf at tick 20, with a second wolf of the same owner nearby. Results:

  • with this fix: all 121 ticks match, as does wolf_hurt;
  • with only the owner check reverted: Horizon's wolf starts HurtByTargetGoal against the player, while vanilla's stays calm.

The scenario runs 120 ticks: past about tick 189 the second wolf's FollowOwnerGoal path has 11 nodes in Horizon and 10 in vanilla. That pathfinding gap is separate and not part of this PR.

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on cachyos, against upstream/main at 25f9cd3a9, 41 min 49 s)

Check Result
Scope ✅ 6 files, +51 −21
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 480 passed (20 s)
rustfmt ✅ (5 s)
clippy ✅ (1 min 2 s)
tests: horizon-client ✅ 956 passed (2 min 6 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ❌ 60 affected, 58 passed, failed: mob_ai (38 min 4 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The full mob_ai run fails on this machine: the vanilla oracle runs out of memory at -Xmx4g and then times out. A clean upstream/main worktree (25f9cd3a9) fails the same way here, so this machine causes it, not this change. Run on their own, wolf_owner_hurt and wolf_hurt match entirely. The other 58 affected harnesses pass.

Suggested label: none (a fix)

🤖 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/4184 **Author:** [@ASOwnerYT](https://github.com/ASOwnerYT) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/tamed-wolf-owner` --- ### 📝 Commits (2) - [`7037d58`](https://github.com/horizon-rust/horizon/commit/7037d586cab041729acf4bbb1eca94c087837d79) Tamed pets no longer turn on the owner who hits them - [`f77d6da`](https://github.com/horizon-rust/horizon/commit/f77d6da3bd595a2ce463273017bd9c1dbd0e2148) Merge main into fix/tamed-wolf-owner ### 📊 Changes **6 files changed** (+51 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/mob_ai_probe.rs` (+4 -0) 📝 `crates/horizon-client/src/mobs/goals.rs` (+30 -15) 📝 `crates/horizon-client/src/mobs/golem.rs` (+2 -2) 📝 `crates/horizon-client/src/mobs/tame.rs` (+4 -4) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java` (+6 -0) 📝 `tools/test_mob_ai_parity.py` (+5 -0) </details> ### 📄 Description > 🤖 Opened by asowneryt's AI agent (Claude), not by asowneryt himself. ## What and why Hitting your own tamed wolf made it attack you as if it were wild (#4119). Vanilla's `TamableAnimal.canAttack` refuses the pet's owner (`isOwnedBy`), so `HurtByTargetGoal` never starts and the pet takes no target or anger. Horizon's check on the player (`Mob::spares_players`, `mobs/goals.rs`) only knew about the player-built iron golem. It now also spares a `TamableAnimal`'s owner (wolf, cat, parrot, nautilus), everywhere that check is made: `HurtByTarget`, `NearestTarget` on the player, `target_continue`. Found along the way through the new scenario: `NonTameRandomTargetGoal.canUse` checks `isTame()` *before* `NearestAttackableTargetGoal`'s random-interval roll. Horizon rolled first, so a tamed wolf or cat drew two extra randoms each tick. The wolf's and cat's untamed-only target goals now use `gate` (checked before the draw) instead of `when`. Fixes #4119. ## Vanilla reference `TamableAnimal.canAttack` / `isOwnedBy`, `HurtByTargetGoal.canUse` / `alertOthers`, `TargetingConditions.test`, `Mob.setTarget` / `asValidTarget`, `NonTameRandomTargetGoal.canUse`, `Wolf.registerGoals`, `Cat.registerGoals`. Checked with the mob_ai harness, which gets a new `owned` scenario flag (`setTame(true, true)` plus `setOwnerReference(PLAYER_UUID)` in the oracle; `tame::set_tame` plus the owner in the probe). The new `wolf_owner_hurt` scenario has the player hit their tamed wolf at tick 20, with a second wolf of the same owner nearby. Results: - with this fix: all 121 ticks match, as does `wolf_hurt`; - with only the owner check reverted: Horizon's wolf starts `HurtByTargetGoal` against the player, while vanilla's stays calm. The scenario runs 120 ticks: past about tick 189 the second wolf's `FollowOwnerGoal` path has 11 nodes in Horizon and 10 in vanilla. That pathfinding gap is separate and not part of this PR. ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on cachyos, against upstream/main at 25f9cd3a9, 41 min 49 s) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +51 −21 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 480 passed (20 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 min 2 s) | | tests: horizon-client | ✅ 956 passed (2 min 6 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ❌ 60 affected, 58 passed, failed: mob_ai (38 min 4 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The full mob_ai run fails on this machine: the vanilla oracle runs out of memory at `-Xmx4g` and then times out. A clean `upstream/main` worktree (25f9cd3a9) fails the same way here, so this machine causes it, not this change. Run on their own, `wolf_owner_hurt` and `wolf_hurt` match entirely. The other 58 affected harnesses pass. Suggested label: none (a fix) 🤖 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:12:47 +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#5467
No description provided.