mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-15 16:27:14 +00:00
refactor(component): physics components load in the client's phases
The physics row's collision group in LoadDataFromTemplate and the level's CollisionGroupID in LoadConfigData; each physics type then reads its own level keys and makes its physics after that, in the same order as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -52,18 +52,24 @@ PhysicsComponent::PhysicsComponent(Entity* parent, const int32_t componentID) :
|
||||
m_Rotation = QuatUtils::IDENTITY;
|
||||
m_DirtyPosition = false;
|
||||
|
||||
RegisterMsg(&PhysicsComponent::OnGetPosition);
|
||||
}
|
||||
|
||||
// The PhysicsComponent row's collision group
|
||||
void PhysicsComponent::LoadDataFromTemplate() {
|
||||
CDPhysicsComponentTable* physicsComponentTable = CDClientManager::GetTable<CDPhysicsComponentTable>();
|
||||
|
||||
if (physicsComponentTable) {
|
||||
auto* info = physicsComponentTable->GetByID(componentID);
|
||||
auto* info = physicsComponentTable->GetByID(m_ComponentID);
|
||||
if (info) {
|
||||
m_CollisionGroup = info->collisionGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The level config's CollisionGroupID, when there, replaces it
|
||||
void PhysicsComponent::LoadConfigData() {
|
||||
if (m_Parent->HasVar(u"CollisionGroupID")) m_CollisionGroup = m_Parent->GetVar<int32_t>(u"CollisionGroupID");
|
||||
|
||||
RegisterMsg(&PhysicsComponent::OnGetPosition);
|
||||
}
|
||||
|
||||
PhysicsComponent::~PhysicsComponent() {
|
||||
|
||||
Reference in New Issue
Block a user