[PR #2477] [MERGED] Give polar bears their attack AI and rearing pose #4350

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

📋 Pull Request Information

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

Base: main ← Head: fix/polar-bear-attack


📝 Commits (1)

  • c85f6f2 Give polar bears their attack AI and rearing pose

📊 Changes

8 files changed (+250 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game/lan.rs (+8 -0)
📝 crates/horizon-client/src/game/remote.rs (+4 -0)
📝 crates/horizon-client/src/game/remote_mob_data.rs (+2 -0)
📝 crates/horizon-client/src/mobs.rs (+1 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+4 -0)
📝 crates/horizon-client/src/mobs/body_anim.rs (+1 -1)
📝 crates/horizon-client/src/mobs/goals.rs (+39 -2)
➕ crates/horizon-client/src/mobs/polar_bear.rs (+191 -0)

📄 Description

What and why

Polar bears only panicked and strolled, so they never defended their cubs, never fought back and never stood up. They now use vanilla's PolarBear.registerGoals:

  • Goals: float, melee attack (speed 1.25), panic (speed 2.0, a cub at any panic cause, an adult only at fire, lava and cactus), follow parent, plain random stroll, look at player, look around.
  • Targets: hurt-by (a hurt cub alerts the adult bears and drops the target itself), players near a cub (adults only, half the follow range), the player it is angry at, and foxes (adults only).
  • Anger: the timer restarts to 20-39 seconds every tick a target is held and counts down after, as NeutralMob.updatePersistentAnger(level, true) does.
  • Standing: the melee goal rears the bear up in the last 10 ticks before a swing and plays the warning sound (40 tick delay). The flag goes out as DATA_STANDING_ID (index 18) from the server thread and the remote client reads it, runs the 0 to 6 tick stand animation and feeds the interpolated scale into the model.

MeleeAttack and HurtByTarget got a polar_bear switch, like the existing zombie and bee ones.

Vanilla reference

  • PolarBear.registerGoals, createAttributes, tick, setStanding, playWarningSound, getStandingAnimationScale
  • PolarBear.PolarBearMeleeAttackGoal.checkAndPerformAttack
  • PolarBear.PolarBearHurtByTargetGoal, PolarBear.PolarBearAttackPlayersGoal
  • NeutralMob.updatePersistentAnger

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/2477 **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/polar-bear-attack` --- ### 📝 Commits (1) - [`c85f6f2`](https://github.com/horizon-rust/horizon/commit/c85f6f2e398eb73ececd12a1dadf3c10383de945) Give polar bears their attack AI and rearing pose ### 📊 Changes **8 files changed** (+250 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan.rs` (+8 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+4 -0) 📝 `crates/horizon-client/src/game/remote_mob_data.rs` (+2 -0) 📝 `crates/horizon-client/src/mobs.rs` (+1 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+4 -0) 📝 `crates/horizon-client/src/mobs/body_anim.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs/goals.rs` (+39 -2) ➕ `crates/horizon-client/src/mobs/polar_bear.rs` (+191 -0) </details> ### 📄 Description ## What and why Polar bears only panicked and strolled, so they never defended their cubs, never fought back and never stood up. They now use vanilla's `PolarBear.registerGoals`: - Goals: float, melee attack (speed 1.25), panic (speed 2.0, a cub at any panic cause, an adult only at fire, lava and cactus), follow parent, plain random stroll, look at player, look around. - Targets: hurt-by (a hurt cub alerts the adult bears and drops the target itself), players near a cub (adults only, half the follow range), the player it is angry at, and foxes (adults only). - Anger: the timer restarts to 20-39 seconds every tick a target is held and counts down after, as `NeutralMob.updatePersistentAnger(level, true)` does. - Standing: the melee goal rears the bear up in the last 10 ticks before a swing and plays the warning sound (40 tick delay). The flag goes out as `DATA_STANDING_ID` (index 18) from the server thread and the remote client reads it, runs the 0 to 6 tick stand animation and feeds the interpolated scale into the model. `MeleeAttack` and `HurtByTarget` got a `polar_bear` switch, like the existing `zombie` and `bee` ones. ## Vanilla reference - `PolarBear.registerGoals`, `createAttributes`, `tick`, `setStanding`, `playWarningSound`, `getStandingAnimationScale` - `PolarBear.PolarBearMeleeAttackGoal.checkAndPerformAttack` - `PolarBear.PolarBearHurtByTargetGoal`, `PolarBear.PolarBearAttackPlayersGoal` - `NeutralMob.updatePersistentAnger` ## 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:16:32 +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#4350
No description provided.