[PR #2223] [MERGED] Invisible players are harder for mobs to notice #4116

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

📋 Pull Request Information

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

Base: main ← Head: fix/invisibility-mob-detection


📝 Commits (3)

  • 2a0824c Invisible players are harder for mobs to notice
  • 0300ad8 Keep the current attack target regardless of invisibility
  • bbc1ffb Merge main into fix/invisibility-mob-detection

📊 Changes

8 files changed (+43 additions, -12 deletions)

View changed files

📝 crates/horizon-client/examples/probe/mob_ai_probe.rs (+1 -0)
📝 crates/horizon-client/src/game/creatures.rs (+1 -0)
📝 crates/horizon-client/src/game/lan_mobs.rs (+1 -0)
📝 crates/horizon-client/src/mobs.rs (+13 -0)
📝 crates/horizon-client/src/mobs/animal_brain.rs (+1 -2)
📝 crates/horizon-client/src/mobs/goals.rs (+22 -8)
📝 crates/horizon-client/src/mobs/happy_ghast.rs (+1 -2)
📝 crates/horizon-client/src/mobs/monster_brain.rs (+3 -0)

📄 Description

What and why

Drinking a potion of Invisibility did not make mobs notice the player later. Mobs only looked at sneaking and worn skulls when scaling their detection range. PlayerView carried the armor fraction (armor_cover) but nothing read it, and it had no invisibility flag.

PlayerView now has an invisible flag (set from the player's Invisibility effect, in the same place for the host and LAN guests) and a visibility_percent() that follows vanilla: 0.8 when sneaking, and 0.7 times the worn armor fraction (at least 0.1) when invisible. The generic targeting check, the animal sensor and the happy ghast tempt check use it. Skull scaling stays where it was.

Vanilla reference

  • LivingEntity.getVisibilityPercent and getArmorCoverPercentage
  • TargetingConditions.test (range times visibility, at least 2.0)

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/2223 **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/invisibility-mob-detection` --- ### 📝 Commits (3) - [`2a0824c`](https://github.com/horizon-rust/horizon/commit/2a0824cf5f532d1671e71b878dd03673be6ec0a2) Invisible players are harder for mobs to notice - [`0300ad8`](https://github.com/horizon-rust/horizon/commit/0300ad8922780e964b1bab11488aed8b6bdb77f1) Keep the current attack target regardless of invisibility - [`bbc1ffb`](https://github.com/horizon-rust/horizon/commit/bbc1ffb4084947e2badcc47d004acedcbb858d44) Merge main into fix/invisibility-mob-detection ### 📊 Changes **8 files changed** (+43 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/mob_ai_probe.rs` (+1 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan_mobs.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs.rs` (+13 -0) 📝 `crates/horizon-client/src/mobs/animal_brain.rs` (+1 -2) 📝 `crates/horizon-client/src/mobs/goals.rs` (+22 -8) 📝 `crates/horizon-client/src/mobs/happy_ghast.rs` (+1 -2) 📝 `crates/horizon-client/src/mobs/monster_brain.rs` (+3 -0) </details> ### 📄 Description ## What and why Drinking a potion of Invisibility did not make mobs notice the player later. Mobs only looked at sneaking and worn skulls when scaling their detection range. `PlayerView` carried the armor fraction (`armor_cover`) but nothing read it, and it had no invisibility flag. `PlayerView` now has an `invisible` flag (set from the player's Invisibility effect, in the same place for the host and LAN guests) and a `visibility_percent()` that follows vanilla: 0.8 when sneaking, and 0.7 times the worn armor fraction (at least 0.1) when invisible. The generic targeting check, the animal sensor and the happy ghast tempt check use it. Skull scaling stays where it was. ## Vanilla reference - `LivingEntity.getVisibilityPercent` and `getArmorCoverPercentage` - `TargetingConditions.test` (range times visibility, at least 2.0) ## 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:48 +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#4116
No description provided.