2021-12-05 17:54:36 +00:00
|
|
|
#pragma once
|
|
|
|
#include "dCommonVars.h"
|
|
|
|
#include "Entity.h"
|
|
|
|
#include "GUID.h"
|
|
|
|
#include "Component.h"
|
2023-03-04 07:16:37 +00:00
|
|
|
#include "eReplicaComponentType.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Music that should be played by the client
|
|
|
|
*/
|
|
|
|
struct MusicCue {
|
|
|
|
std::string name;
|
|
|
|
uint32_t result;
|
|
|
|
float boredomTime;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles specific music triggers like the instruments in Red Block
|
|
|
|
* Credits to https://github.com/SimonNitzsche/OpCrux-Server/blob/master/src/Entity/Components/SoundTriggerComponent.hpp
|
|
|
|
*/
|
|
|
|
class SoundTriggerComponent : public Component {
|
|
|
|
public:
|
2023-06-09 08:22:45 +00:00
|
|
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SOUND_TRIGGER;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
explicit SoundTriggerComponent(Entity* parent);
|
|
|
|
~SoundTriggerComponent() override;
|
|
|
|
|
|
|
|
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Activates a music cue, making it played by any client in range
|
|
|
|
* @param name the name of the music to play
|
|
|
|
*/
|
|
|
|
void ActivateMusicCue(const std::string& name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deactivates a music cue (if active)
|
|
|
|
* @param name name of the music to deactivate
|
|
|
|
*/
|
|
|
|
void DeactivateMusicCue(const std::string& name);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Currently active cues
|
|
|
|
*/
|
|
|
|
std::vector<MusicCue> musicCues = {};
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
/**
|
|
|
|
* Currently active mixer programs
|
|
|
|
*/
|
|
|
|
std::vector<std::string> mixerPrograms = {};
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
/**
|
|
|
|
* GUID found in the LDF
|
|
|
|
*/
|
|
|
|
std::vector<GUID> guids = {};
|
|
|
|
bool dirty = false;
|
|
|
|
};
|