DarkflameServer/dGame/dComponents/RailActivatorComponent.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

146 lines
3.0 KiB
C
Raw Normal View History

#pragma once
#include <vector>
#include <string>
#include "dCommonVars.h"
#include "Component.h"
#include "eReplicaComponentType.h"
/**
* Component that handles the traveling using rails, e.g. the ninjago posts that can be used to travel using Spinjitzu.
* Credits to https://github.com/UchuServer/Uchu/blob/dev/Uchu.World/Objects/Components/ReplicaComponents/RailActivatorComponent.cs
*/
class RailActivatorComponent final : public Component {
public:
explicit RailActivatorComponent(Entity* parent, int32_t componentID);
~RailActivatorComponent() override;
2022-07-28 13:39:57 +00:00
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RAIL_ACTIVATOR;
2022-07-28 13:39:57 +00:00
/**
* Handles the OnUse event from some entity, initiates the rail movement
* @param originator the entity that triggered the event
*/
void OnUse(Entity* originator) override;
2022-07-28 13:39:57 +00:00
/**
* Event handler that's called when some entity has played the start animation for rail movement and now wants to
* start the actual movement.
* @param originator the entity that triggered the event
*/
void OnRailMovementReady(Entity* originator) const;
2022-07-28 13:39:57 +00:00
/**
* Event handler that's called when some entity has finished traversing the rail and wants to end its interaction
* with it
* @param originator the entity that triggered the event
*/
void OnCancelRailMovement(Entity* originator);
private:
/**
* The ID of this component in the components database
*/
int32_t m_ComponentID;
2022-07-28 13:39:57 +00:00
/**
* The entities that are currently traversing the rail
*/
std::vector<LWOOBJID> m_EntitiesOnRail{};
2022-07-28 13:39:57 +00:00
/**
* The path the entities will follow when traversing the rail
*/
std::u16string m_Path;
2022-07-28 13:39:57 +00:00
/**
* The index of the path that is the start
*/
uint32_t m_PathStart;
2022-07-28 13:39:57 +00:00
/**
* The direction on the path
*/
bool m_PathDirection;
2022-07-28 13:39:57 +00:00
/**
* The animation that plays when starting the rail
*/
std::u16string m_StartAnimation;
2022-07-28 13:39:57 +00:00
/**
* The animation that plays during the rail
*/
std::u16string m_LoopAnimation;
2022-07-28 13:39:57 +00:00
/**
* The animation that plays after the rail
*/
std::u16string m_StopAnimation;
2022-07-28 13:39:57 +00:00
/**
* The sound that plays at the start of the rail
*/
std::u16string m_StartSound;
2022-07-28 13:39:57 +00:00
/**
* The sound that plays during the rail
*/
std::u16string m_loopSound;
2022-07-28 13:39:57 +00:00
/**
* The sound that plays at the end of the rail
*/
std::u16string m_StopSound;
2022-07-28 13:39:57 +00:00
/**
* The effects that play at the start of the rail
*/
std::pair<uint32_t, std::u16string> m_StartEffect;
2022-07-28 13:39:57 +00:00
/**
* The effects that play during the rail
*/
std::pair<uint32_t, std::u16string> m_LoopEffect;
2022-07-28 13:39:57 +00:00
/**
* The effects that play at the end of the rail
*/
std::pair<uint32_t, std::u16string> m_StopEffect;
2022-07-28 13:39:57 +00:00
/**
* Client flag
*/
bool m_DamageImmune;
2022-07-28 13:39:57 +00:00
/**
* Client flag
*/
bool m_NoAggro;
2022-07-28 13:39:57 +00:00
/**
* Client flag
*/
bool m_UseDB;
2022-07-28 13:39:57 +00:00
/**
* Client flag
*/
bool m_CameraLocked;
2022-07-28 13:39:57 +00:00
/**
* Client flag
*/
bool m_CollisionEnabled;
2022-07-28 13:39:57 +00:00
/**
* Client flag, notifies the server when the player finished the rail
*/
bool m_NotifyArrived;
2022-07-28 13:39:57 +00:00
/**
* Client flag
*/
bool m_ShowNameBillboard;
};