refactor(entity): components are made in the client's load order

Entity::Initialize walks ComponentOrderVector::Initialize's list (0x0101f8e0) as ObjectLoader2::DoObjectComponentLoad does; ids a component needs from a later one come from the registry; the trigger is added after the walk. All 15,962 LOTs get the same components as before (LoaderSnapshotTest).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-01 06:17:06 -05:00
parent 9c4d14173e
commit b2192e158c
3 changed files with 656 additions and 540 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -40,6 +40,13 @@ namespace {
constexpr float DEFAULT_BODY_RADIUS = 1.7f;
}
float BaseCombatAIComponent::TetherSpeedOf(const int32_t componentID) {
auto query = CDClientDatabase::CreatePreppedStmt("SELECT tetherSpeed FROM BaseCombatAIComponent WHERE id = ?;");
query.bind(1, static_cast<int>(componentID));
auto result = query.execQuery();
return !result.eof() && !result.fieldIsNull("tetherSpeed") ? result.getFloatField("tetherSpeed") : 4.0f;
}
BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
RegisterMsg(&BaseCombatAIComponent::MsgGetObjectReportInfo);
m_Target = LWOOBJID_EMPTY;

View File

@@ -52,6 +52,9 @@ public:
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::BASE_COMBAT_AI;
BaseCombatAIComponent(Entity* parentEntity, int32_t componentID);
// The tether speed a BaseCombatAIComponent row gives (4 without one), before the component exists
static float TetherSpeedOf(int32_t componentID);
~BaseCombatAIComponent() override;
void Update(float deltaTime) override;