VR-Engage  2.3
Loading...
Searching...
No Matches
extendedStateLogic.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file extendedStateLogic.h
7//! \brief Defines the DtExtendedStateLogic component for managing extended state attributes.
8//!
9//! This component allows for the dynamic addition of state attributes beyond the standard set,
10//! supporting various data types and custom properties for simulation monitoring and control.
11//!
12//! \ingroup vreCommonComponents
13
14#pragma once
15
18
19namespace makVre
20{
21
23{
24//! \ingroup RoleConfigParams
25//! \defgroup ExtendedStateLogicRoleParams Extended State Logic Role Parameters
26//! \roleInherits{PlayerComponentRoleParams}
27//! Configuration Options for extended state logic component.
28//! @{
29
30//! \vreRoleParam{extendedState,table,{},extendedStateLogic,Table containing definitions for extended state attributes with name and type fields.}
31constexpr const char* extendedState = "extendedState";
32
33//! \vreRoleParam{stateProperties,table,{},extendedStateLogic,Table containing definitions for state properties with name and type fields.}
34constexpr const char* stateProperties = "stateProperties";
35
36//! @}
37} // namespace ExtendedStateLogicConfig
38
39//! \brief Forward declaration of the initialization table class
40class DtInitTable;
41
42//! \brief Type identifier for DtExtendedStateLogic component
43constexpr const char* DtExtendedStateLogicType = "DtExtendedStateLogic";
44
45//! \brief Component for managing extended state attributes beyond the standard set
46//!
47//! The DtExtendedStateLogic component provides functionality to dynamically add custom
48//! state attributes to an entity. These attributes can be configured in Lua and support
49//! various data types (int, float, double, string, bool, ammoClipMap).
50//!
51//! This component is particularly useful for simulation monitoring and sharing state
52//! information that isn't covered by the standard state attributes. It will send an
53//! ExtendedStateMonitorInitMessage to notify the system of these additional attributes.
55{
56public:
57 //! \brief Constructor for DtExtendedStateLogic
58 //!
59 //! Initializes the component with the name "DtExtendedStateLogic".
61
62 //! \brief Virtual destructor for DtExtendedStateLogic
63 virtual ~DtExtendedStateLogic() override;
64
65 //! \brief Initializes the component with configuration from Lua
66 //!
67 //! Processes the "extendedState" and "stateProperties" sections from the configuration,
68 //! creating state attributes based on their specifications. For each attribute defined,
69 //! the component will:
70 //! - Add the attribute to the player's attribute store
71 //! - Send an ExtendedStateMonitorInitMessage to register the attribute with the system
72 //!
73 //! \param player Pointer to the player station this component belongs to
74 //! \param config Configuration table containing attribute definitions
75 //! \return True if initialization succeeds, false otherwise
77
78 //! \brief Updates the component state (empty implementation)
79 //!
80 //! This method is called each frame but currently has no implementation.
81 //!
82 //! \param dt Delta time in seconds since the last tick
83 virtual void tick(double dt) override;
84
85 //! \brief Shuts down the component
86 //!
87 //! Sends an ExtendedStateMonitorInitMessage with a null entity ID to
88 //! deregister the extended state attributes.
89 virtual void shutdown() override;
90
91 //! \brief Returns the type identifier for this component
92 //! \return The type string for DtExtendedStateLogic
93 virtual const char* type() const override;
94};
95} // namespace makVre
virtual const char * type() const override
Returns the type identifier for this component.
virtual bool initialize(makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
Initializes the component with configuration from Lua.
virtual void shutdown() override
Shuts down the component.
virtual ~DtExtendedStateLogic() override
Virtual destructor for DtExtendedStateLogic.
virtual void tick(double dt) override
Updates the component state (empty implementation)
DtExtendedStateLogic()
Constructor for DtExtendedStateLogic.
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
constexpr const char * stateProperties
Definition extendedStateLogic.h:34
constexpr const char * extendedState
Definition extendedStateLogic.h:31
Defines export/import macros for the vreCommonComponents library.
#define VRECOMMONCOMPONENTS_DLL
DLL export/import macro for the vreCommonComponents library.
Definition export.h:28
Definition extendedStateLogic.h:23
!
Definition glsVreMessageUtil.h:50
constexpr const char * DtExtendedStateLogicType
Type identifier for DtExtendedStateLogic component.
Definition extendedStateLogic.h:43
Defines the DtPlayerComponent base class for VR-Engage role components.