mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
fix: Implement proper Sound trigger component serialization (#1160)
* cleanup * more cleanup and fully implement the sound trigger and racing sound trigger * more cleanup, and better defaults * fixes and tested * update initializor for guid and when to load sound guids * make racing sound trigger it's own component * fix type * Remove global move serializes --------- Co-authored-by: David Markowitz <EmosewaMC@gmail.com>
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
#include "ShootingGalleryComponent.h"
|
||||
#include "RailActivatorComponent.h"
|
||||
#include "LUPExhibitComponent.h"
|
||||
#include "RacingSoundTriggerComponent.h"
|
||||
#include "TriggerComponent.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
@@ -318,6 +319,9 @@ void Entity::Initialize() {
|
||||
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SOUND_TRIGGER, -1) != -1) {
|
||||
auto* comp = new SoundTriggerComponent(this);
|
||||
m_Components.insert(std::make_pair(eReplicaComponentType::SOUND_TRIGGER, comp));
|
||||
} else if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_SOUND_TRIGGER, -1) != -1) {
|
||||
auto* comp = new RacingSoundTriggerComponent(this);
|
||||
m_Components.insert(std::make_pair(eReplicaComponentType::RACING_SOUND_TRIGGER, comp));
|
||||
}
|
||||
|
||||
//Also check for the collectible id:
|
||||
@@ -1060,6 +1064,11 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
|
||||
soundTriggerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
RacingSoundTriggerComponent* racingSoundTriggerComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::RACING_SOUND_TRIGGER, racingSoundTriggerComponent)) {
|
||||
racingSoundTriggerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
}
|
||||
|
||||
BuffComponent* buffComponent;
|
||||
if (TryGetComponent(eReplicaComponentType::BUFF, buffComponent)) {
|
||||
buffComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
|
||||
|
Reference in New Issue
Block a user