Merge pull request #1159 from ludovic111/fix/axolotl-idle-swim

🤖 Agent: merged. Verify passes; local parity --changed origin/main passes (101 harnesses; #1159's one online_mode diff reran clean and passes on main). Screenshots and tick-by-tick results in the body.
This commit is contained in:
Ludovic Marie
2026-10-22 06:25:18 +02:00
committed by GitHub
3 changed files with 18 additions and 2 deletions
+8 -2
View File
@@ -1240,10 +1240,10 @@ pub fn walk_target_value(m: &Mob, w: &MobWorld, p: [i32; 3]) -> f32 {
0.0
};
}
// AbstractNautilus and Creaking.getWalkTargetValue: everywhere alike.
// AbstractNautilus, Axolotl and Creaking.getWalkTargetValue: everywhere alike.
if matches!(
m.species(),
Species::Nautilus | Species::ZombieNautilus | Species::Creaking
Species::Nautilus | Species::ZombieNautilus | Species::Axolotl | Species::Creaking
) {
return 0.0;
}
@@ -1406,6 +1406,12 @@ pub fn do_hurt_target(m: &mut Mob, who: Who, cx: &mut Cx) {
if super::creaking::is_creaking(m) {
m.voice("entity.creaking.attack", cx.events);
}
// Axolotl.playAttackSound: playSound(AXOLOTL_ATTACK, 1.0, 1.0).
if m.species() == Species::Axolotl {
let at = [m.position.x, m.position.y, m.position.z];
cx.events
.push(MobEvent::Sound("entity.axolotl.attack", at, 1.0, 1.0));
}
let _ = Fluid::None;
}
/// Mob.ate (sheep regrow wool, babies grow).
@@ -46,6 +46,9 @@ pub fn register(m: &mut Mob) {
};
m.ai.look.kind = super::control::LookKind::SmoothSwimming(20.0);
m.ai.nav.kind = NavKind::Amphibious;
// `Axolotl()`: water costs nothing, so swim targets in water pass
// DefaultRandomPos's malus check.
m.set_malus(super::path::PathType::Water, 0.0);
super::animal_brain::init(m, i64::from(m.id));
}
S::Tadpole => {
+7
View File
@@ -268,6 +268,13 @@ def scenarios():
('witch', 176), ('vindicator', 177), ('zombie', 178)]:
add(f'{species}_deep_water', 160, ['fill -4 -64 -4 4 -61 4 minecraft:water',
f'mob minecraft:{species} 0.5 -62 0.5 0 {seed} 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'
add('axolotl_hunting', 45, [POOL, 'player 12.5 -60 0.5', 'mob minecraft:axolotl 0.5 -62 0.5 0 12 persistent',
'mob minecraft:cod 2.5 -62 0.5 0 13 persistent noai'])
add('axolotl_play_dead', 300, [POOL, 'player 12.5 -60 0.5', 'mob minecraft:axolotl 0.5 -62 0.5 0 28 persistent']
+ [f'hurt {t} 0' for t in range(4, 160, 12)])
return s