Files
DarkflameServer/dGame/dComponents/RailActivatorComponent.h
Aaron Kimbrell 7440e5744d fix(rails): rider flags default to the RailActivatorComponent row
StartRailMovement's bDamageImmune, bNoAggro and bShowNameBillboard came
only from the level keys rail_activator_damage_immune, rail_no_aggro and
rail_show_name_billboard, which 23 of the 80 level rails do not have, so
those rails sent false. The client reads the same flags from the
RailActivatorComponent row (DamageImmune, NoAggro, ShowNameBillboard; all
11 rows are 1) in LWOPlayerForcedMovementComponent::LoadRailData
(0x00c85dc0), and the message's values replace the row's unless bUseDB
(msgStartRailMovement 0x00ccd9c0). The server now takes the row's value
and lets a level key replace it when the key is there. Wire format is
unchanged; only the flag values sent for the 23 rails change (to true,
matching the 5 live samples).

In game: ride the 23 rails without the keys, all in the Ninjago earth gauntlet
(earthgauntlet levels: dart spinners, 8 spinners, millstones, boss) near enemies: you are not
damaged or targeted while riding, and name billboards behave as on the
other rails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 23:34:55 -05:00

144 lines
3.1 KiB
C++

#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, const int32_t componentID);
~RailActivatorComponent() override;
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::RAIL_ACTIVATOR;
/**
* Handles the OnUse event from some entity, initiates the rail movement
* @param originator the entity that triggered the event
*/
void OnUse(Entity* originator) override;
/**
* 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;
/**
* 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);
bool GetDamageImmune() const { return m_DamageImmune; }
bool GetNoAggro() const { return m_NoAggro; }
bool GetShowNameBillboard() const { return m_ShowNameBillboard; }
private:
/**
* The entities that are currently traversing the rail
*/
std::vector<LWOOBJID> m_EntitiesOnRail{};
/**
* The path the entities will follow when traversing the rail
*/
std::u16string m_Path;
/**
* The index of the path that is the start
*/
uint32_t m_PathStart;
/**
* The direction on the path
*/
bool m_PathDirection;
/**
* The animation that plays when starting the rail
*/
std::u16string m_StartAnimation;
/**
* The animation that plays during the rail
*/
std::u16string m_LoopAnimation;
/**
* The animation that plays after the rail
*/
std::u16string m_StopAnimation;
/**
* The sound that plays at the start of the rail
*/
std::u16string m_StartSound;
/**
* The sound that plays during the rail
*/
std::u16string m_loopSound;
/**
* The sound that plays at the end of the rail
*/
std::u16string m_StopSound;
/**
* The effects that play at the start of the rail
*/
std::pair<uint32_t, std::u16string> m_StartEffect;
/**
* The effects that play during the rail
*/
std::pair<uint32_t, std::u16string> m_LoopEffect;
/**
* The effects that play at the end of the rail
*/
std::pair<uint32_t, std::u16string> m_StopEffect;
/**
* Client flag
*/
bool m_DamageImmune;
/**
* Client flag
*/
bool m_NoAggro;
/**
* Client flag
*/
bool m_UseDB;
/**
* Client flag
*/
bool m_CameraLocked;
/**
* Client flag
*/
bool m_CollisionEnabled;
/**
* Client flag, notifies the server when the player finished the rail
*/
bool m_NotifyArrived;
/**
* Client flag
*/
bool m_ShowNameBillboard;
};