From 6a080c242c0f50d9b73a01d2c4940a4da9e4685b Mon Sep 17 00:00:00 2001 From: TelepathicWalrus Date: Sat, 6 May 2023 10:38:40 +0100 Subject: [PATCH] Add server side check to stop stay when mounted Add filter to allow telling other pets to stay when mounted --- server/src/events/interaction.rs | 3 ++- voxygen/src/session/mod.rs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/events/interaction.rs b/server/src/events/interaction.rs index b6862f7130..73489bd566 100755 --- a/server/src/events/interaction.rs +++ b/server/src/events/interaction.rs @@ -230,7 +230,8 @@ pub fn handle_toggle_stay(server: &mut Server, command_giver: EcsEntity, pet: Ec if prev_pet_pos.is_none() { new_pet_pos = state.ecs().read_storage::().get(pet).copied(); } - if is_owner && within_mounting_range(positions.get(command_giver), positions.get(pet)) { + if is_owner && within_mounting_range(positions.get(command_giver), positions.get(pet)) + && state.ecs().read_storage::>().get(pet).is_none() { let _ = state .ecs() .write_storage::() diff --git a/voxygen/src/session/mod.rs b/voxygen/src/session/mod.rs index 2a0f656c51..4d6e552c83 100644 --- a/voxygen/src/session/mod.rs +++ b/voxygen/src/session/mod.rs @@ -958,6 +958,9 @@ impl PlayState for SessionState { matches!(client.state().ecs().read_storage::().get(*e), Some(comp::Alignment::Owned(owner)) if Some(*owner) == client.uid()) ) + .filter(|e| + client.state().ecs().read_storage::>().get(*e).is_none() + ) .min_by_key(|e| { OrderedFloat(client .state()