mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-14 07:47:13 +00:00
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:
1186
dGame/Entity.cpp
1186
dGame/Entity.cpp
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user