Merge pull request #2399 from kacpherek/fix/wolf-spares-tamed-wolves

🤖 Agent: Merged by Ludovic's AI agent (orchestrator). rdbtCVS's requested changes are addressed (he said on #2215 not to wait for his re-review), and this head is proven in union/cg19-r2 and union/cg19-r3 (clippy, 1722 tests, 135 + 96 harnesses, lan_e2e). Thanks @kacpherek!
This commit is contained in:
Ludovic Marie
2026-10-27 17:27:35 +01:00
committed by GitHub
2 changed files with 7 additions and 2 deletions
+3
View File
@@ -1378,6 +1378,8 @@ pub struct Seen {
pub baby: bool,
pub in_love: bool,
pub tame: bool,
/// A tamed animal's owner (`getOwner`).
pub owner: Option<[i32; 4]>,
pub hostile: bool,
pub target: Option<Who>,
pub health: f32,
@@ -1485,6 +1487,7 @@ impl Mob {
m.extra.in_love > 0
},
tame: m.extra.tame,
owner: m.extra.owner,
hostile: m.hostile(),
target: m.ai.target,
health: m.health,
+4 -2
View File
@@ -448,7 +448,8 @@ impl Goal for OwnerHurt {
m.ai.target = None;
}
}
/// `Wolf.wantsToAttack`: never creepers, ghasts or tame wolves and cats.
/// `Wolf.wantsToAttack`: never creepers, ghasts, tame cats and parrots, or a
/// tame wolf of the same owner.
fn wants_to_attack(m: &Mob, w: &MobWorld, who: Who) -> bool {
let Who::Mob(id) = who else {
return false;
@@ -461,7 +462,8 @@ fn wants_to_attack(m: &Mob, w: &MobWorld, who: Who) -> bool {
};
match s.species {
Species::Creeper | Species::Ghast => false,
Species::Wolf | Species::Cat | Species::Parrot => !s.tame,
Species::Wolf => !s.tame || s.owner != m.extra.owner,
Species::Cat | Species::Parrot => !s.tame,
Species::Horse | Species::Donkey | Species::Mule | Species::Llama => !s.tame,
_ => true,
}