Name the cat relax goal's owner check is_owner_of

The tame mob goals (#2382, #2399) add an is_owner(m, w) to this module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-27 15:11:34 +01:00
parent af548f5ae8
commit d5aa3f6e42
+3 -3
View File
@@ -795,7 +795,7 @@ fn empty_above(w: &MobWorld, p: [i32; 3]) -> bool {
}
/// Whether `p` is the player that owns `m` (a cat without a recorded owner
/// belongs to whoever it sees).
pub fn is_owner(m: &Mob, p: &super::PlayerView) -> bool {
pub fn is_owner_of(m: &Mob, p: &super::PlayerView) -> bool {
m.extra.owner.is_none_or(|o| o == p.uuid)
}
/// `Cat.CatRelaxOnOwnerGoal`: while the owner sleeps, the cat lies down beside
@@ -830,7 +830,7 @@ impl CatRelaxOnOwner {
fn sleeping_owner<'w>(m: &Mob, w: &'w MobWorld) -> Option<&'w super::PlayerView> {
w.player
.as_ref()
.filter(|p| m.extra.tame && !m.extra.sitting && p.sleeping && is_owner(m, p))
.filter(|p| m.extra.tame && !m.extra.sitting && p.sleeping && is_owner_of(m, p))
}
}
impl Goal for CatRelaxOnOwner {
@@ -894,7 +894,7 @@ impl Goal for CatRelaxOnOwner {
.w
.player
.as_ref()
.is_some_and(|p| is_owner(m, p) && p.sleep_timer >= 100)
.is_some_and(|p| is_owner_of(m, p) && p.sleep_timer >= 100)
&& m.random.next_float() < chance
{
give_morning_gift(m, cx);