Fix agent-less pets

This commit is contained in:
Joshua Barretto 2021-08-03 23:04:23 +00:00
parent f4e04ecefc
commit 38d2ba5d84

View File

@ -49,7 +49,10 @@ fn tame_pet_internal(ecs: &specs::World, pet_entity: Entity, owner: Entity, pet:
.write_storage() .write_storage()
.insert(pet_entity, pet.unwrap_or_default()); .insert(pet_entity, pet.unwrap_or_default());
if let Some(agent) = ecs.write_storage::<Agent>().get_mut(pet_entity) { if let Some(agent) = ecs
.write_storage::<Agent>()
.get_mut_or_default(pet_entity)
{
agent.set_no_flee(); agent.set_no_flee();
} }