From 1f2f83858c81b251d015d0a80e9816ea40384b93 Mon Sep 17 00:00:00 2001 From: SirLynix Date: Wed, 11 Dec 2024 22:54:07 +0100 Subject: [PATCH] Server: Make environment switching activate the entity so it's able to perform actions after activation --- src/ServerLib/Components/ServerEnvironmentSwitchComponent.cpp | 2 -- src/ServerLib/Entities/ServerClassLibrary.cpp | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ServerLib/Components/ServerEnvironmentSwitchComponent.cpp b/src/ServerLib/Components/ServerEnvironmentSwitchComponent.cpp index 5019e5e..14f51f5 100644 --- a/src/ServerLib/Components/ServerEnvironmentSwitchComponent.cpp +++ b/src/ServerLib/Components/ServerEnvironmentSwitchComponent.cpp @@ -51,8 +51,6 @@ namespace tsom } handleEnvironmentSwitch(oldEntity, newEntity, relativeTransform); - newEntity.get().GetClass()->ActivateEntity(newEntity); - OnEntitySwitchedEnvironment(oldEntity, newEntity, newEnvironment, relativeTransform); oldEntity.destroy(); } diff --git a/src/ServerLib/Entities/ServerClassLibrary.cpp b/src/ServerLib/Entities/ServerClassLibrary.cpp index ffe9a1a..90279ee 100644 --- a/src/ServerLib/Entities/ServerClassLibrary.cpp +++ b/src/ServerLib/Entities/ServerClassLibrary.cpp @@ -71,6 +71,8 @@ namespace tsom newEntity.emplace(player->CreateHandle()); + newEntity.get().GetClass()->ActivateEntity(newEntity); + if (newEnvironment->IsRoot()) player->UpdateRootEnvironment(newEnvironment); }; @@ -148,6 +150,8 @@ namespace tsom newEntity.emplace(physicsSettings); newEntity.emplace().ownerShip = shipEnvironment; + newEntity.get().GetClass()->ActivateEntity(newEntity); + // Change the root environment of players in the ship as well if (newEnvironment->IsRoot()) {