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

Detailed Description

The DtFriendlyUnitsLogic listens for EntityFriendlyUnitsMessages and maintains a list of friendly units via state attributes. When a message is received, the component updates the "subordinateList" and "taskableEntities" state attributes with the list of friendly units and a flag indicating whether any are available, respectively.

This component is particularly useful in command roles where it's important to know what friendly units can be tasked or interacted with.

#include <friendlyUnitLogic.h>

Inheritance diagram for makVre::DtFriendlyUnitsLogic:
[legend]

Public Member Functions

 DtFriendlyUnitsLogic ()
 
virtual ~DtFriendlyUnitsLogic () override
 
virtual bool initialize (DtPlayerStation *player, DtInitTable &config) override
 
virtual bool postInitialize () 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 void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Member Functions

virtual void initializeStateAttributes () override
 
DtVreMessageResult handleFriendlyUnitsMessage (DtVreMessage *msg)
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ DtFriendlyUnitsLogic()

makVre::DtFriendlyUnitsLogic::DtFriendlyUnitsLogic ( )

Constructor for DtFriendlyUnitsLogic.

Initializes the component with the name "DtFriendlyUnitsLogic".

◆ ~DtFriendlyUnitsLogic()

virtual makVre::DtFriendlyUnitsLogic::~DtFriendlyUnitsLogic ( )
overridevirtual

Virtual destructor for DtFriendlyUnitsLogic.

Member Function Documentation

◆ initialize()

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

Initializes the component with configuration from Lua.

Sets up a message handler for EntityFriendlyUnitsMessages.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing initialization parameters
Returns
True if initialization succeeds

Reimplemented from makVre::DtPlayerComponent.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

virtual bool makVre::DtFriendlyUnitsLogic::postInitialize ( )
overridevirtual

Performs post-initialization setup.

Currently just returns true as there's no additional setup needed.

Returns
True, indicating successful post-initialization

Reimplemented from makVre::DtPlayerComponent.

◆ tick()

virtual void makVre::DtFriendlyUnitsLogic::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::DtFriendlyUnitsLogic::shutdown ( )
overridevirtual

Shuts down the component.

Removes the EntityFriendlyUnitsMessage handler.

Reimplemented from makVre::DtPlayerComponent.

◆ type()

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

Returns the type identifier for this component.

Returns
The type string for DtFriendlyUnitsLogic

Implements makVre::DtPlayerComponent.

◆ initializeStateAttributes()

virtual void makVre::DtFriendlyUnitsLogic::initializeStateAttributes ( )
overrideprotectedvirtual

Initializes state attributes (empty implementation)

This method is reserved for initializing state attributes, but currently has an empty implementation with commented-out code for potential future use.

Reimplemented from makVre::DtPlayerComponent.

◆ handleFriendlyUnitsMessage()

DtVreMessageResult makVre::DtFriendlyUnitsLogic::handleFriendlyUnitsMessage ( DtVreMessage * msg)
protected

Handles messages about friendly units.

Processes EntityFriendlyUnitsMessages by extracting the list of friendly units and updating the "subordinateList" and "taskableEntities" state attributes.

Parameters
msgThe message to process
Returns
HANDLED if the message was processed successfully, IGNORED otherwise

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