From 8822c6409eda70ef3458b025d62f533c879d2e89 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Wed, 4 Aug 2021 00:22:03 +0100 Subject: [PATCH] Fix pets without agency --- server/src/pet.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/src/pet.rs b/server/src/pet.rs index ffef6cc3d9..cead1eb894 100644 --- a/server/src/pet.rs +++ b/server/src/pet.rs @@ -49,8 +49,11 @@ fn tame_pet_internal(ecs: &specs::World, pet_entity: Entity, owner: Entity, pet: .write_storage() .insert(pet_entity, pet.unwrap_or_default()); - if let Some(agent) = ecs.write_storage::().get_mut(pet_entity) { - agent.set_no_flee(); + // Create an agent for this entity using its body + if let Some(body) = ecs.read_storage().get(pet_entity) { + let _ = ecs + .write_storage() + .insert(pet_entity, Agent::from_body(body)); } // Add to group system