From e7d04de1a8d296433df3dd71ab2333ae6102a57d Mon Sep 17 00:00:00 2001 From: SirLynix Date: Mon, 9 Dec 2024 21:51:33 +0100 Subject: [PATCH] Server/EnvironmentSwitch: Fix when switching planet while in a ship --- src/ServerLib/Components/ServerEnvironmentSwitchComponent.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ServerLib/Components/ServerEnvironmentSwitchComponent.cpp b/src/ServerLib/Components/ServerEnvironmentSwitchComponent.cpp index 22d6179..5019e5e 100644 --- a/src/ServerLib/Components/ServerEnvironmentSwitchComponent.cpp +++ b/src/ServerLib/Components/ServerEnvironmentSwitchComponent.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -15,6 +16,9 @@ namespace tsom { void ServerEnvironmentSwitchComponent::Switch(entt::handle oldEntity, ServerEnvironment* previousEnvironment, ServerEnvironment* newEnvironment, const EnvironmentTransform& relativeTransform) { + // Disable old entity to not take it into account in the callbacks (for example when changing root environment) + oldEntity.emplace(); + auto& previousNode = oldEntity.get(); auto& previousClassInstance = oldEntity.get();