mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
format codebase
This commit is contained in:
@@ -18,35 +18,35 @@ class Entity;
|
||||
struct Effect {
|
||||
Effect() { scale = 1.0f; }
|
||||
|
||||
/**
|
||||
* The ID of the effect
|
||||
*/
|
||||
int32_t effectID = 0;
|
||||
/**
|
||||
* The ID of the effect
|
||||
*/
|
||||
int32_t effectID = 0;
|
||||
|
||||
/**
|
||||
* The name of the effect
|
||||
*/
|
||||
std::string name = "";
|
||||
/**
|
||||
* The name of the effect
|
||||
*/
|
||||
std::string name = "";
|
||||
|
||||
/**
|
||||
* The type of the effect
|
||||
*/
|
||||
std::u16string type = u"";
|
||||
/**
|
||||
* The type of the effect
|
||||
*/
|
||||
std::u16string type = u"";
|
||||
|
||||
/**
|
||||
* How scaled (enlarged) the effect is
|
||||
*/
|
||||
float scale = 1.0f;
|
||||
/**
|
||||
* How scaled (enlarged) the effect is
|
||||
*/
|
||||
float scale = 1.0f;
|
||||
|
||||
/**
|
||||
* Some related entity that casted the effect
|
||||
*/
|
||||
uint64_t secondary = 0;
|
||||
/**
|
||||
* Some related entity that casted the effect
|
||||
*/
|
||||
uint64_t secondary = 0;
|
||||
|
||||
/**
|
||||
* The time that this effect plays for
|
||||
*/
|
||||
float time = 0;
|
||||
/**
|
||||
* The time that this effect plays for
|
||||
*/
|
||||
float time = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -55,65 +55,65 @@ struct Effect {
|
||||
*/
|
||||
class RenderComponent : public Component {
|
||||
public:
|
||||
static const uint32_t ComponentType = COMPONENT_TYPE_RENDER;
|
||||
|
||||
RenderComponent(Entity* entity);
|
||||
~RenderComponent() override;
|
||||
|
||||
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
||||
void Update(float deltaTime) override;
|
||||
static const uint32_t ComponentType = COMPONENT_TYPE_RENDER;
|
||||
|
||||
/**
|
||||
* Adds an effect to this entity, if successful the effect is returned
|
||||
* @param effectId the ID of the effect
|
||||
* @param name the name of the effect
|
||||
* @param type the type of the effect
|
||||
* @return if successful, the effect that was created
|
||||
*/
|
||||
Effect* AddEffect(int32_t effectId, const std::string& name, const std::u16string& type);
|
||||
RenderComponent(Entity* entity);
|
||||
~RenderComponent() override;
|
||||
|
||||
/**
|
||||
* Removes an effect for this entity
|
||||
* @param name the name of the effect to remove
|
||||
*/
|
||||
void RemoveEffect(const std::string& name);
|
||||
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
||||
void Update(float deltaTime) override;
|
||||
|
||||
/**
|
||||
* Plays an effect, removes any effects under this name and plays the one according to these params
|
||||
* @param effectId the ID of the effect
|
||||
* @param effectType the type of the effect
|
||||
* @param name the name of the effect
|
||||
* @param secondary some entity that cast the effect
|
||||
* @param priority effect priority (determines if the client will play it over other effects)
|
||||
* @param scale effect scale
|
||||
* @param serialize whether to serialize the change or not
|
||||
*/
|
||||
void PlayEffect(int32_t effectId, const std::u16string& effectType, const std::string& name, LWOOBJID secondary = LWOOBJID_EMPTY, float priority = 1, float scale = 1, bool serialize = true);
|
||||
/**
|
||||
* Adds an effect to this entity, if successful the effect is returned
|
||||
* @param effectId the ID of the effect
|
||||
* @param name the name of the effect
|
||||
* @param type the type of the effect
|
||||
* @return if successful, the effect that was created
|
||||
*/
|
||||
Effect* AddEffect(int32_t effectId, const std::string& name, const std::u16string& type);
|
||||
|
||||
/**
|
||||
* Removes and stops the effect for a certain name
|
||||
* @param name name of the effect to stop
|
||||
* @param killImmediate whether ot not to immediately stop playing the effect or phase it out
|
||||
*/
|
||||
void StopEffect(const std::string& name, bool killImmediate = true);
|
||||
/**
|
||||
* Removes an effect for this entity
|
||||
* @param name the name of the effect to remove
|
||||
*/
|
||||
void RemoveEffect(const std::string& name);
|
||||
|
||||
/**
|
||||
* Plays an effect, removes any effects under this name and plays the one according to these params
|
||||
* @param effectId the ID of the effect
|
||||
* @param effectType the type of the effect
|
||||
* @param name the name of the effect
|
||||
* @param secondary some entity that cast the effect
|
||||
* @param priority effect priority (determines if the client will play it over other effects)
|
||||
* @param scale effect scale
|
||||
* @param serialize whether to serialize the change or not
|
||||
*/
|
||||
void PlayEffect(int32_t effectId, const std::u16string& effectType, const std::string& name, LWOOBJID secondary = LWOOBJID_EMPTY, float priority = 1, float scale = 1, bool serialize = true);
|
||||
|
||||
/**
|
||||
* Removes and stops the effect for a certain name
|
||||
* @param name name of the effect to stop
|
||||
* @param killImmediate whether ot not to immediately stop playing the effect or phase it out
|
||||
*/
|
||||
void StopEffect(const std::string& name, bool killImmediate = true);
|
||||
|
||||
/**
|
||||
* Returns the list of currently active effects
|
||||
* @return
|
||||
*/
|
||||
std::vector<Effect*>& GetEffects();
|
||||
|
||||
/**
|
||||
* Returns the list of currently active effects
|
||||
* @return
|
||||
*/
|
||||
std::vector<Effect*>& GetEffects();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* List of currently active effects
|
||||
*/
|
||||
std::vector<Effect*> m_Effects;
|
||||
/**
|
||||
* List of currently active effects
|
||||
*/
|
||||
std::vector<Effect*> m_Effects;
|
||||
|
||||
/**
|
||||
* Cache of queries that look for the length of each effect, indexed by effect ID
|
||||
*/
|
||||
static std::unordered_map<int32_t , float> m_DurationCache;
|
||||
/**
|
||||
* Cache of queries that look for the length of each effect, indexed by effect ID
|
||||
*/
|
||||
static std::unordered_map<int32_t, float> m_DurationCache;
|
||||
};
|
||||
|
||||
#endif // RENDERCOMPONENT_H
|
||||
|
Reference in New Issue
Block a user