[PR #2551] [CLOSED] Pandas: genes, sit, roll, lie on back, sneeze and unhappy states #4419

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2551
Author: @kacpherek
Created: 10/26/2026
Status: ❌ Closed

Base: main ← Head: feat/panda-states


📝 Commits (3)

  • 8c70420 Merge main into feat/panda-states
  • b874098 Merge main into feat/panda-states
  • 7a4c68c Merge main into feat/panda-states

📄 Description

What and why

Pandas had no behaviour of their own: they strolled like any animal, never bred or took bamboo, and all drew the plain coat (the model got a default Panda state). This adds the vanilla panda:

  • Genes. The main and hidden gene show as the lazy, worried, playful, brown, weak or aggressive coat (the baby coats too, and the baby model), pass to young the way setGeneFromParents does, are saved as MainGene and HiddenGene, and a weak panda has 10 health and a lazy one is slow.
  • States. Sitting, rolling, lying on the back and sneezing are flags, and the unhappy, sneeze and eat counters count, as entity data (indices 18 to 23). The server sets them, a client draws them: the three amounts that PandaModel.setupAnim reads, the roll, sit and lie-down rotations of PandaRenderer, the item in its mouth, the crumbs of a bite and the sneeze particle.
  • Goals, in registerGoals order. Sit to eat bamboo or cake it holds or finds on the ground (it also picks it up from the ground); lie on its back (lazy); roll (playful or a cub); sneeze (a cub, a weak one more often) with a start for grown pandas nearby and a slime ball now and then; panic at fire and the like, but not from a hit; breed only with bamboo about, else sulk; attack, avoid players and monsters (worried), look at the player, follow its parent. A bitten or bamboo-fed panda lets go of its target, and only aggressive pandas answer a call for help. A worried panda sits and shivers in a thunderstorm.
  • Feeding. Bamboo makes an adult fall in love, speeds up a cub, and when it cannot, makes it sit and eat from the hand; a click on a panda on its back gets it up.

Not done: the eat game event (sculk sensors do not hear a panda eat), and the client does not predict the first bite of a meal the way vanilla's client (which draws its own random) does; it follows the server.

#2540 also sends the two genes (same indices); the lines would merge.

Vanilla reference

Panda (tick, handleEating, handleRoll, afterSneeze, mobInteract, setGeneFromParents, Gene.getVariantFromGenes, setAttributes, canPerformAction, the data accessors), its goals PandaSitGoal, PandaLieOnBackGoal, PandaRollGoal, PandaSneezeGoal, PandaBreedGoal, PandaPanicGoal, PandaAttackGoal, PandaAvoidGoal, PandaHurtByTargetGoal, PandaLookAtPlayerGoal and PandaMoveControl; Mob.aiStep (picking up loot); PandaRenderer (textures, setupRotations), PandaHoldsItemLayer, PandaRenderState and PandaModel.setupAnim.

Self-check

cargo check -p horizon-client passes (clippy with -D warnings too, and the existing mobs:: and entity_nbt tests).

In game, offscreen, in single player (the window is a client of its server), and the sit, sneeze and love again with --in-frame: a fed panda sits with bamboo in its mouth and crumbs flying; a lazy panda lies on its back; a playful cub tumbles; a weak cub sneezes its green puff; a worried panda and cub sit scared in thunder; the aggressive coat shows with its angry eyes; two pandas fed with bamboo near a bamboo block bred a cub whose genes were one of each parent's.


🔄 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/2551 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/panda-states` --- ### 📝 Commits (3) - [`8c70420`](https://github.com/horizon-rust/horizon/commit/8c70420d1402bd404bf78aab2cc5c8a594d12ad1) Merge main into feat/panda-states - [`b874098`](https://github.com/horizon-rust/horizon/commit/b8740986f2c27f9b7766153945a97a6a02ac1af4) Merge main into feat/panda-states - [`7a4c68c`](https://github.com/horizon-rust/horizon/commit/7a4c68c01b5f5f61092b69bce20b672aa8ae3985) Merge main into feat/panda-states ### 📄 Description ## What and why Pandas had no behaviour of their own: they strolled like any animal, never bred or took bamboo, and all drew the plain coat (the model got a default `Panda` state). This adds the vanilla panda: - Genes. The main and hidden gene show as the lazy, worried, playful, brown, weak or aggressive coat (the baby coats too, and the baby model), pass to young the way `setGeneFromParents` does, are saved as `MainGene` and `HiddenGene`, and a weak panda has 10 health and a lazy one is slow. - States. Sitting, rolling, lying on the back and sneezing are flags, and the unhappy, sneeze and eat counters count, as entity data (indices 18 to 23). The server sets them, a client draws them: the three amounts that `PandaModel.setupAnim` reads, the roll, sit and lie-down rotations of `PandaRenderer`, the item in its mouth, the crumbs of a bite and the sneeze particle. - Goals, in `registerGoals` order. Sit to eat bamboo or cake it holds or finds on the ground (it also picks it up from the ground); lie on its back (lazy); roll (playful or a cub); sneeze (a cub, a weak one more often) with a start for grown pandas nearby and a slime ball now and then; panic at fire and the like, but not from a hit; breed only with bamboo about, else sulk; attack, avoid players and monsters (worried), look at the player, follow its parent. A bitten or bamboo-fed panda lets go of its target, and only aggressive pandas answer a call for help. A worried panda sits and shivers in a thunderstorm. - Feeding. Bamboo makes an adult fall in love, speeds up a cub, and when it cannot, makes it sit and eat from the hand; a click on a panda on its back gets it up. Not done: the eat game event (sculk sensors do not hear a panda eat), and the client does not predict the first bite of a meal the way vanilla's client (which draws its own random) does; it follows the server. #2540 also sends the two genes (same indices); the lines would merge. ## Vanilla reference `Panda` (`tick`, `handleEating`, `handleRoll`, `afterSneeze`, `mobInteract`, `setGeneFromParents`, `Gene.getVariantFromGenes`, `setAttributes`, `canPerformAction`, the data accessors), its goals `PandaSitGoal`, `PandaLieOnBackGoal`, `PandaRollGoal`, `PandaSneezeGoal`, `PandaBreedGoal`, `PandaPanicGoal`, `PandaAttackGoal`, `PandaAvoidGoal`, `PandaHurtByTargetGoal`, `PandaLookAtPlayerGoal` and `PandaMoveControl`; `Mob.aiStep` (picking up loot); `PandaRenderer` (textures, `setupRotations`), `PandaHoldsItemLayer`, `PandaRenderState` and `PandaModel.setupAnim`. ## Self-check `cargo check -p horizon-client` passes (clippy with `-D warnings` too, and the existing `mobs::` and `entity_nbt` tests). In game, offscreen, in single player (the window is a client of its server), and the sit, sneeze and love again with `--in-frame`: a fed panda sits with bamboo in its mouth and crumbs flying; a lazy panda lies on its back; a playful cub tumbles; a weak cub sneezes its green puff; a worried panda and cub sit scared in thunder; the aggressive coat shows with its angry eyes; two pandas fed with bamboo near a bamboo block bred a cub whose genes were one of each parent's. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:17:00 +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#4419
No description provided.