mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 17:21:49 -10:00
Merge pull request #3773 from xFedeT/fix/cat-goals
🤖 Agent: Ludovic's AI agent (Claude), proof. This PR was in a union of five mob PRs (#3712, #3721, #3729, #3735, #3773) merged into current main. `parity.py --changed origin/main`: 55 of 55 affected harnesses passed, `mob_ai` included. `horizon-client` lib tests: 726 passed. clippy `-D warnings` is clean. The only conflicts were the new cases in `tools/test_mob_ai_parity.py`, as resolved on your branch. Queued.
This commit is contained in:
3 files changed
+12
-5
No files matched your search
@@ -225,6 +225,8 @@ fn goal_name(m: &Mob, name: &str) -> String {
|
||||
"MoveThroughVillage" => "MoveThroughVillageGoal",
|
||||
"RestrictSun" => "RestrictSunGoal",
|
||||
"FleeSun" => "FleeSunGoal",
|
||||
// `Cat.CatAvoidEntityGoal`, `Fox.FoxAvoidEntityGoal`... name their subclass.
|
||||
"AvoidEntity" if m.species() == Species::Cat => "CatAvoidEntityGoal",
|
||||
"AvoidEntity" => "AvoidEntityGoal",
|
||||
"BowAttack" => "RangedBowAttackGoal",
|
||||
"Swell" => "SwellGoal",
|
||||
|
||||
@@ -839,11 +839,6 @@ pub fn register_cat(m: &mut Mob) {
|
||||
g.add(2, SitWhenOrdered);
|
||||
g.add(3, CatRelaxOnOwner::default());
|
||||
g.add(4, CatTempt(super::goals::Tempt::new(0.6, food, true)));
|
||||
g.add(
|
||||
4,
|
||||
super::goals::AvoidEntity::new(super::goals::Avoid::Player, 16.0, 0.8, 1.33)
|
||||
.when(|m| !m.extra.tame),
|
||||
);
|
||||
g.add(
|
||||
5,
|
||||
CatLieOnBlock(super::goals::MoveToBlock {
|
||||
@@ -858,6 +853,13 @@ pub fn register_cat(m: &mut Mob) {
|
||||
g.add(10, Breed::new(0.8));
|
||||
g.add(11, Stroll::avoiding_water(0.8));
|
||||
g.add(12, LookAtPlayer::new(10.0));
|
||||
// `reassessTameGoals` adds the avoidance after `registerGoals`: goals run
|
||||
// in insertion order, so it comes last.
|
||||
g.add(
|
||||
4,
|
||||
super::goals::AvoidEntity::new(super::goals::Avoid::Player, 16.0, 0.8, 1.33)
|
||||
.when(|m| !m.extra.tame),
|
||||
);
|
||||
m.ai.targets.add(
|
||||
1,
|
||||
NearestTarget::species(&[Species::Rabbit], false).when(|m, _| !m.extra.tame),
|
||||
|
||||
@@ -335,6 +335,9 @@ def scenarios():
|
||||
+ [f'hurt {t} 0' for t in range(5, 60, 30)])
|
||||
add('chicken_panic_dry', 60, ['player 12.5 -60 0.5', 'mob minecraft:chicken 0.5 -60 0.5 0 195 persistent', 'hurt 5 0'])
|
||||
add('pig_panic_dry', 60, ['player 12.5 -60 0.5', 'mob minecraft:pig 0.5 -60 0.5 0 196 persistent', 'hurt 5 0'])
|
||||
# A wild cat avoids the player it sees (Cat.reassessTameGoals adds that goal last) and sprints while
|
||||
# it dashes at 1.33 (Cat.customServerAiStep).
|
||||
add('cat_player', 120, ['player 6.5 -60 0.5', 'mob minecraft:cat 0.5 -60 0.5 0 261 persistent'])
|
||||
# Axolotls (#64): idle swimming, hunting a cod, and playing dead after hits, in a pool sunk into
|
||||
# the ground so no water flows out of it (the probe doesn't tick fluids).
|
||||
POOL = 'fill -5 -63 -5 5 -61 5 minecraft:water'
|
||||
|
||||
Reference in new issue
Block a user