Merge branch 'zesterer/fix-pets' into 'master'

Fix pets without agency

See merge request veloren/veloren!2728
This commit is contained in:
Joshua Barretto 2021-08-04 00:25:04 +00:00
commit 33e9bc79e3

View File

@ -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::<Agent>().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