feat(entity): the object's interaction distance, preconditions and world state, as the client

LWOGameObject loads these itself: interactionDistance from its Objects row
(16 without one) and the level's interaction_distance over it,
CheckPrecondition and objectWorldState from the level config, before its
components load theirs. The quickbuild, the pet and the race instancer read
them from the object; the race instancer now uses the Objects row's
distance like the client does, instead of a fixed 16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-02 08:44:53 -05:00
parent 0c215de446
commit 6f4fd4054a
10 changed files with 47 additions and 7 deletions

View File

@@ -105,6 +105,7 @@ TEST_F(ClientMessagesTests, CasterDeadMatchesLiveCapture) {
TEST_F(ClientMessagesTests, CasterDeadEndsTheDeadCastersSkill) {
CDClientDatabase::Connect(":memory:"); // the entity manager looks the new entity up
CDClientDatabase::ExecuteDML("CREATE TABLE ComponentsRegistry (id INTEGER, component_type INTEGER, component_id INTEGER);");
CDClientDatabase::ExecuteDML("CREATE TABLE Objects (id INTEGER, name TEXT, type TEXT, interactionDistance REAL);");
auto* const caster = Game::entityManager->CreateEntity(info, nullptr, nullptr, false, 0x40040000000bdb5LL);
ASSERT_NE(caster, nullptr);
auto* const destroyable = caster->AddComponent<DestroyableComponent>(-1);
@@ -130,6 +131,7 @@ TEST_F(ClientMessagesTests, ResyncEquipmentResendsTheEquipment) {
auto msg = FromLiveClientCapture<GameMessages::ResyncEquipment>(std::string(PLAYER_HEADER) + "d604");
CDClientDatabase::Connect(":memory:"); // the inventory looks its component up
CDClientDatabase::ExecuteDML("CREATE TABLE ComponentsRegistry (id INTEGER, component_type INTEGER, component_id INTEGER);");
CDClientDatabase::ExecuteDML("CREATE TABLE Objects (id INTEGER, name TEXT, type TEXT, interactionDistance REAL);");
auto* const inventory = player->AddComponent<InventoryComponent>(-1);
RakNet::BitStream first;
inventory->Serialize(first, false); // clears the dirty flag it starts with