VR-Engage  2.3
Loading...
Searching...
No Matches
humanMenuLogic.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file humanMenuLogic.h
7//! \brief Defines DtHumanMenuLogic for managing human-specific menu interactions
8//! \ingroup vreHumanFrontend
9
10#pragma once
11
13
16
17#include <string>
18
19namespace makVre
20{
21//! \brief Forward declaration of the action menu logic class
23
24//! \brief Forward declaration of the human control logic class
26
27//! \brief Forward declaration of the menu manager class
28class DtMenuManager;
29
31{
32//! \ingroup RoleConfigParams
33//! \defgroup HumanMenuLogicRoleParams Human Menu Logic Role Parameters
34//! \roleInherits{PlayerComponentRoleParams}
35//! Configuration Options for humanMenuLogic role.
36//! @{
37
38//! \vreRoleParam{shooteeName,string,"target",humanMenuLogic,Default name for entities to be used as shooting targets.}
39constexpr const char* shooteeName = "shooteeName";
40
41//! \vreRoleParam{taskeeName,string,"shooter",humanMenuLogic,Default name for entities to be assigned tasks.}
42constexpr const char* taskeeName = "taskeeName";
43
44//! \vreRoleParam{waypointName,string,"Waypoint 1",humanMenuLogic,Default name for waypoints in movement tasks.}
45constexpr const char* waypointName = "waypointName";
46
47//! @}
48} // namespace HumanMenuLogicConfig
49
50//! \brief Type identifier constant for DtHumanMenuLogic components
51//!
52//! This constant defines the string identifier used to identify DtHumanMenuLogic
53//! component types within the VR-Engage framework. It is used for component
54//! registration, type checking, and serialization operations.
55constexpr const char* DtHumanMenuLogicType = "DtHumanMenuLogic";
56
57//! \brief Menu logic component for the human role
58//!
59//! DtHumanMenuLogic manages context-sensitive menus and commands for the human
60//! entity, handling interactions with other entities, task selections, and special
61//! actions. It processes menu selections and converts them into appropriate
62//! simulation commands.
64{
65public:
66 //! \brief Default constructor
68
69 //! \brief Virtual destructor
70 virtual ~DtHumanMenuLogic() override;
71
72 //! \brief Initializes the menu logic component
73 //! \param player Pointer to the player station
74 //! \param config Configuration settings for initialization
75 //! \return True if initialization was successful, false otherwise
76 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
77
78 //! \brief Performs post-initialization setup
79 //! \return True if post-initialization was successful, false otherwise
80 virtual bool postInitialize() override;
81
82 //! \brief Updates menu logic for the current frame
83 //! \param dt Delta time since the last frame in seconds
84 virtual void tick(double dt) override;
85
86 //! \brief Cleans up resources when the component is being shut down
87 virtual void shutdown() override;
88
89 //! \brief Returns the component type identifier
90 //! \return String identifier for this component type
91 //!
92 //! Returns the type identifier string for this component, which is used
93 //! by the VR-Engage framework for component identification and management.
94 //! The returned value matches DtHumanMenuLogicType.
95 virtual const char* type() const override;
96
97 //! \brief Handles menu-related messages
98 //! \param msg Pointer to the message being processed
99 //! \return Message processing result
101
102protected:
103 //! \brief Handles entity realized messages
104 //! \param msg Pointer to the message being processed
105 //! \return Message processing result
107
108 //! \brief Handles entity removed messages
109 //! \param msg Pointer to the message being processed
110 //! \return Message processing result
112
113 //! \brief Initializes the list of available sensor views
114 virtual void initSensorViewsList();
115
116 //! \brief Checks if an entity is a sensor-capable aircraft
117 //! \param type Type of the entity to check
118 //! \return True if the entity is a sensor-capable aircraft, false otherwise
119 virtual bool isSensorCapableAircraft(const DtEntityType& type) const;
120
121 //! \brief Tasks an entity to move to the current view location
123
124 //! \brief Tasks an entity to move to the player's location
125 virtual void taskMoveToMyLocation();
126
127 //! \brief Tasks an entity to move to a specific waypoint
128 virtual void taskMoveToWaypoint();
129
130 //! \brief Tasks an entity to fire at a target
131 virtual void taskFireTarget();
132
133 //! \brief Tasks an entity to suppress fire
134 virtual void taskSupressFire();
135
136 //! \brief Tasks an entity to follow the player
137 virtual void taskFollowMe();
138
139 //! \brief Disembarks the player from the current vehicle
140 virtual void disembarkEntity();
141
142 //! \brief Tasks an entity to execute a DI-Guy animated gesture
143 //! \param gestureName Name of the gesture to execute
144 //!
145 //! Names of available gestures can be found in data\Lifeforms\diguy\gestures.cgf.
146 virtual void taskDiGuyGesture(const std::string& gestureName);
147
148 //! \brief Tasks an entity to execute a DI-Guy animated action
149 //! \param actionName Name of the action to execute
150 //!
151 //! Names of available actions can be found in the action table for
152 //! a given DI-Guy character, in data\Lifeforms\diguy.
153 virtual void taskDiGuyAction(const std::string& actionName);
154
155protected:
156 //! \brief Entity ID of the current taskee
157 std::string myTaskee;
158
159 //! \brief Entity ID of the current target
160 std::string myShootee;
161
162 //! \brief Current waypoint identifier
163 std::string myWaypoint;
164
165 //! \brief Pointer to the action menu logic component
167
168 //! \brief Pointer to the human control logic component
170
171 //! \brief Current task location in the world
173
174 //! \brief Handle for the action menu manager instance.
175 //! \vreAttrKey{menuManager}
177};
178
179} // namespace makVre
Component for managing entity interaction menus and their logic.
Definition actionMenuLogic.h:101
Type-specific handle class for attributes.
Definition attributeHandle.h:229
Control logic component for the human entity.
Definition humanControlLogic.h:142
virtual void disembarkEntity()
Disembarks the player from the current vehicle.
virtual void taskMoveToWaypoint()
Tasks an entity to move to a specific waypoint.
std::string myWaypoint
Current waypoint identifier.
Definition humanMenuLogic.h:163
DtHumanMenuLogic()
Default constructor.
DtActionMenuLogic * myMenuLogic
Pointer to the action menu logic component.
Definition humanMenuLogic.h:166
virtual bool postInitialize() override
Performs post-initialization setup.
virtual void taskDiGuyAction(const std::string &actionName)
Tasks an entity to execute a DI-Guy animated action.
virtual void taskFireTarget()
Tasks an entity to fire at a target.
virtual bool isSensorCapableAircraft(const DtEntityType &type) const
Checks if an entity is a sensor-capable aircraft.
virtual void taskSupressFire()
Tasks an entity to suppress fire.
std::string myTaskee
Entity ID of the current taskee.
Definition humanMenuLogic.h:157
virtual void taskDiGuyGesture(const std::string &gestureName)
Tasks an entity to execute a DI-Guy animated gesture.
DtAttributeHandleType< DtMenuManager * > myMenuManagerAttr
Handle for the action menu manager instance.
Definition humanMenuLogic.h:176
virtual makVre::DtVreMessageResult handleEntityRealized(makVre::DtVreMessage *msg)
Handles entity realized messages.
virtual void tick(double dt) override
Updates menu logic for the current frame.
DtVector myTaskLocation
Current task location in the world.
Definition humanMenuLogic.h:172
virtual void taskFollowMe()
Tasks an entity to follow the player.
std::string myShootee
Entity ID of the current target.
Definition humanMenuLogic.h:160
virtual makVre::DtVreMessageResult handleMenuMessage(makVre::DtVreMessage *msg)
Handles menu-related messages.
virtual const char * type() const override
Returns the component type identifier.
virtual makVre::DtVreMessageResult handleEntityRemoved(makVre::DtVreMessage *msg)
Handles entity removed messages.
virtual void shutdown() override
Cleans up resources when the component is being shut down.
virtual void taskMoveToViewLocation()
Tasks an entity to move to the current view location.
virtual ~DtHumanMenuLogic() override
Virtual destructor.
virtual void taskMoveToMyLocation()
Tasks an entity to move to the player's location.
DtHumanControlLogic * mySimLogic
Pointer to the human control logic component.
Definition humanMenuLogic.h:169
virtual void initSensorViewsList()
Initializes the list of available sensor views.
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the menu logic component.
Table-based access to Lua state for configuration data.
Definition initializer.h:38
Central manager for all menus in VR-Engage.
Definition actionMenuManager.h:111
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
constexpr const char * taskeeName
Definition humanMenuLogic.h:42
constexpr const char * shooteeName
Definition humanMenuLogic.h:39
constexpr const char * waypointName
Definition humanMenuLogic.h:45
Defines export macros for the Human Frontend library.
#define HUMAN_DLL
Definition export.h:19
Definition humanMenuLogic.h:31
!
Definition glsVreMessageUtil.h:50
constexpr const char * DtHumanMenuLogicType
Type identifier constant for DtHumanMenuLogic components.
Definition humanMenuLogic.h:55
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.