VR-Engage  2.2
Loading...
Searching...
No Matches
disembarkControlLogic.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file disembarkControlLogic.h
7//! \brief Defines the DtDisembarkControlLogic component for handling entity disembarkation.
8//!
9//! This component provides functionality for disembarking (exiting) from a vehicle
10//! or other parent entity, handling both actual simulation disembarkation and role selection logic.
11//!
12//! \ingroup vreCommonComponents
13
14#pragma once
15
19
20namespace makVre
21{
22
23//! \brief Type identifier for DtDisembarkControlLogic component
24constexpr const char* DtDisembarkControlLogicType = "DtDisembarkControlLogic";
25
26//! \brief Component for handling entity disembarkation
27//!
28//! The DtDisembarkControlLogic component provides functionality for disembarking
29//! (exiting) from a vehicle or other parent entity. It handles the "disembark" action
30//! from the menu system and sends appropriate messages to either trigger actual
31//! disembarkation in the simulation or to return to the role selection screen.
32//!
33//! The behavior depends on whether the current role is stacked on another role
34//! (typically a Human role) or if it is a standalone role.
36{
37public:
38 //! \brief Constructor for DtDisembarkControlLogic
39 //!
40 //! Initializes the component with default values.
42
43 //! \brief Virtual destructor for DtDisembarkControlLogic
44 virtual ~DtDisembarkControlLogic() override;
45
46 //! \brief Initializes the component with configuration from Lua
47 //!
48 //! Sets up a message handler for the MenuActionMessage type and determines
49 //! whether this role is stacked on a base role or is standalone.
50 //!
51 //! \param player Pointer to the player station this component belongs to
52 //! \param config Configuration table containing initialization parameters
53 //! \return True if initialization succeeds, false otherwise
54 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
55
56 //! \brief Updates the component state (empty implementation)
57 //!
58 //! This method is called each frame but currently has no implementation.
59 //!
60 //! \param dt Delta time in seconds since the last tick
61 virtual void tick(double dt) override;
62
63 //! \brief Shuts down the component
64 //!
65 //! Removes the MenuActionMessage handler to prevent duplicate processing.
66 virtual void shutdown() override;
67
68 //! \brief Returns the type identifier for this component
69 //! \return The type string for DtDisembarkControlLogic
70 virtual const char* type() const override;
71
72 //! \brief Handles menu action messages
73 //!
74 //! Processes the "disembark" menu action. If this is a stacked role, sends a
75 //! VrfSetEmbarkMessage to disembark the base player from its parent entity.
76 //! If this is a standalone role, sends a UIChooseRoleButtonClickedMessage to
77 //! return to the role selection screen.
78 //!
79 //! After processing the disembark action, removes itself as a handler to
80 //! prevent duplicate processing.
81 //!
82 //! \param msg The message to process
83 //! \return HANDLED if the message was processed, IGNORED otherwise
85
86protected:
87 //! \brief Flag indicating if this role is stacked on another role
88 //!
89 //! True if this is a stacked role (typically stacked on a Human role),
90 //! false if this is a standalone role. Affects disembarkation behavior.
92};
93
94} // namespace makVre
DtDisembarkControlLogic()
Constructor for DtDisembarkControlLogic.
bool myIsStackedRole
Flag indicating if this role is stacked on another role.
Definition disembarkControlLogic.h:91
virtual DtVreMessageResult handleMenuMessage(makVre::DtVreMessage *msg)
Handles menu action messages.
virtual ~DtDisembarkControlLogic() override
Virtual destructor for DtDisembarkControlLogic.
virtual void shutdown() override
Shuts down the component.
virtual void tick(double dt) override
Updates the component state (empty implementation)
virtual const char * type() const override
Returns the type identifier for this component.
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the component with configuration from Lua.
Table-based access to Lua state for configuration data.
Definition initializer.h:38
virtual DtPlayerStation & player()
Gets the player station.
DtPlayerComponent()
Constructor.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Defines export/import macros for the vreCommonComponents library.
#define VRECOMMONCOMPONENTS_DLL
DLL export/import macro for the vreCommonComponents library.
Definition export.h:28
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
constexpr const char * DtDisembarkControlLogicType
Type identifier for DtDisembarkControlLogic component.
Definition disembarkControlLogic.h:24
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Defines the DtPlayerComponent base class for VR-Engage role components.
Defines the base class for all VREngage messages.