Skip to content

Commit

Permalink
Server: Make environment switching activate the entity
Browse files Browse the repository at this point in the history
so it's able to perform actions after activation
  • Loading branch information
SirLynix committed Dec 11, 2024
1 parent f9e879d commit 1f2f838
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/ServerLib/Components/ServerEnvironmentSwitchComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ namespace tsom
}

handleEnvironmentSwitch(oldEntity, newEntity, relativeTransform);
newEntity.get<ClassInstanceComponent>().GetClass()->ActivateEntity(newEntity);

OnEntitySwitchedEnvironment(oldEntity, newEntity, newEnvironment, relativeTransform);
oldEntity.destroy();
}
Expand Down
4 changes: 4 additions & 0 deletions src/ServerLib/Entities/ServerClassLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ namespace tsom

newEntity.emplace<ServerPlayerControlledComponent>(player->CreateHandle());

newEntity.get<ClassInstanceComponent>().GetClass()->ActivateEntity(newEntity);

if (newEnvironment->IsRoot())
player->UpdateRootEnvironment(newEnvironment);
};
Expand Down Expand Up @@ -148,6 +150,8 @@ namespace tsom
newEntity.emplace<Nz::RigidBody3DComponent>(physicsSettings);
newEntity.emplace<ShipExteriorComponent>().ownerShip = shipEnvironment;

newEntity.get<ClassInstanceComponent>().GetClass()->ActivateEntity(newEntity);

// Change the root environment of players in the ship as well
if (newEnvironment->IsRoot())
{
Expand Down

0 comments on commit 1f2f838

Please sign in to comment.