fix: write a trigger object's trigger component as live did

The client makes the trigger component of an object whose header sets
the trigger bit after all the others, and reads it last:
LWOTriggerComponent::Deserialize (0x00bd78c0) takes a flag bit and a
32-bit pick type. Every live construction of a trigger object ended with
the flag and -1 (4,533 of 4,533); DLU wrote nothing, which the client
read as no flag. Nothing changes for the player: -1 is the client's
default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 13:22:59 -06:00
parent 8dd279cb45
commit 7893185cad

View File

@@ -810,6 +810,16 @@ void Entity::WriteComponents(RakNet::BitStream& outBitStream, eReplicaPacketType
}
component->Serialize(outBitStream, bIsInitialUpdate);
}
// The client makes the trigger component of an object whose header sets the trigger bit after the others, so it is
// read last. LWOTriggerComponent::Deserialize (0x00bd78c0): a flag and the pick type; live constructions carried
// the flag and -1 (no pick type).
const auto* const triggerComponent = GetComponent<TriggerComponent>();
const auto* const trigger = triggerComponent ? triggerComponent->GetTrigger() : nullptr;
if (trigger && !trigger->events.empty()) {
outBitStream.Write(bIsInitialUpdate);
if (bIsInitialUpdate) outBitStream.Write<int32_t>(-1);
}
}
void Entity::UpdateXMLDoc(tinyxml2::XMLDocument& doc) {