VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtExtendedStateLogic Class Reference

Detailed Description

The DtExtendedStateLogic component provides functionality to dynamically add custom state attributes to an entity. These attributes can be configured in Lua and support various data types (int, float, double, string, bool, ammoClipMap).

This component is particularly useful for simulation monitoring and sharing state information that isn't covered by the standard state attributes. It will send an ExtendedStateMonitorInitMessage to notify the system of these additional attributes.

#include <extendedStateLogic.h>

Inheritance diagram for makVre::DtExtendedStateLogic:
[legend]

Public Member Functions

 DtExtendedStateLogic ()
 
virtual ~DtExtendedStateLogic () override
 
virtual bool initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual bool postInitialize ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Member Functions

void addAdditionalAttributesToState (std::vector< std::string > &names, std::vector< std::string > &types)
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Additional Inherited Members

- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Constructor & Destructor Documentation

◆ DtExtendedStateLogic()

makVre::DtExtendedStateLogic::DtExtendedStateLogic ( )

Constructor for DtExtendedStateLogic.

Initializes the component with the name "DtExtendedStateLogic".

◆ ~DtExtendedStateLogic()

virtual makVre::DtExtendedStateLogic::~DtExtendedStateLogic ( )
overridevirtual

Virtual destructor for DtExtendedStateLogic.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtExtendedStateLogic::initialize ( makVre::DtPlayerStation * player,
makVre::DtInitTable & config )
overridevirtual

Initializes the component with configuration from Lua.

Processes the "extendedState" and "stateProperties" sections from the configuration, creating state attributes based on their specifications. For each attribute defined, the component will:

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing attribute definitions
Returns
True if initialization succeeds, false otherwise

Reimplemented from makVre::DtPlayerComponent.

References makVre::DtPlayerComponent::player().

◆ tick()

virtual void makVre::DtExtendedStateLogic::tick ( double dt)
overridevirtual

Updates the component state (empty implementation)

This method is called each frame but currently has no implementation.

Parameters
dtDelta time in seconds since the last tick

Implements makVre::DtPlayerComponent.

◆ shutdown()

virtual void makVre::DtExtendedStateLogic::shutdown ( )
overridevirtual

Shuts down the component.

Sends an ExtendedStateMonitorInitMessage with a null entity ID to deregister the extended state attributes.

Reimplemented from makVre::DtPlayerComponent.

◆ type()

virtual const char * makVre::DtExtendedStateLogic::type ( ) const
overridevirtual

Returns the type identifier for this component.

Returns
The type string for DtExtendedStateLogic

Implements makVre::DtPlayerComponent.

◆ addAdditionalAttributesToState()

void makVre::DtExtendedStateLogic::addAdditionalAttributesToState ( std::vector< std::string > & names,
std::vector< std::string > & types )
protected

Adds custom attributes to the player's attribute store.

Creates attributes in the player's attribute store based on the provided names and types. Supports the following data types:

  • int: Initialized to 0
  • float: Initialized to 0.0f
  • double: Initialized to 0.0
  • string: Initialized to "not set"
  • bool: Initialized to false
  • ammoClipMap: Special case that requires no initialization
Parameters
namesVector of attribute names to add
typesVector of attribute types corresponding to the names

The documentation for this class was generated from the following file: