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

Detailed Description

DtVreHumanHandWeaponSwitchController manages the enabling and disabling of secondary weapons on human entities. Due to handling limitations in the current version of VRF with multiple weapons, this controller disables secondary weapons when VRF is in control of the entity and enables them when VR Engage is in control.

This ensures proper weapon handling while maintaining compatibility between VRF and VR Engage control modes.

#include <humanHandWeaponSwitchController.h>

Inheritance diagram for makVre::DtVreHumanHandWeaponSwitchController:
[legend]

Public Member Functions

 DtVreHumanHandWeaponSwitchController (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual void preFirstTickInit () override
 
virtual ~DtVreHumanHandWeaponSwitchController () override
 
virtual void tick () override
 
virtual const char * type () const override
 
- Public Member Functions inherited from makVre::DtVreSimComponent< DtSimComponent >
 DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreSimComponent ()
 
bool isPlayerControlled (const std::string &role="") const
 
DtString entitySystemName () const
 

Static Public Member Functions

static DtSimComponent * creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *parentRegistry)
 

Protected Member Functions

void collectHandheldWeaponSystems ()
 

Protected Attributes

std::vector< DtComponentSystem * > mySystemList
 
bool myWasPlayerControlled
 

Private Member Functions

 DtVreHumanHandWeaponSwitchController ()
 
 DtVreHumanHandWeaponSwitchController (const DtVreHumanHandWeaponSwitchController &orig)
 
const DtVreHumanHandWeaponSwitchControlleroperator= (const DtVreHumanHandWeaponSwitchController &orig)
 

Constructor & Destructor Documentation

◆ DtVreHumanHandWeaponSwitchController() [1/3]

makVre::DtVreHumanHandWeaponSwitchController::DtVreHumanHandWeaponSwitchController ( )
private

Default constructor (not implemented)

Default constructor is private and not implemented to prevent creation of instances without proper initialization.

Referenced by DtVreHumanHandWeaponSwitchController(), and operator=().

◆ DtVreHumanHandWeaponSwitchController() [2/3]

makVre::DtVreHumanHandWeaponSwitchController::DtVreHumanHandWeaponSwitchController ( const DtVreHumanHandWeaponSwitchController & orig)
private

Copy constructor (not implemented)

Copy constructor is private and not implemented to prevent copy construction.

References DtVreHumanHandWeaponSwitchController().

◆ DtVreHumanHandWeaponSwitchController() [3/3]

makVre::DtVreHumanHandWeaponSwitchController::DtVreHumanHandWeaponSwitchController ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )

Constructor.

Parameters
nameThe name of this component
ownerThe local object that owns this component
simManagerThe simulation services manager
descOptional component descriptor
parentRegistryOptional parent registry for reader/writer functionality

Creates a new human handheld weapon switch controller component with the specified parameters.

◆ ~DtVreHumanHandWeaponSwitchController()

virtual makVre::DtVreHumanHandWeaponSwitchController::~DtVreHumanHandWeaponSwitchController ( )
overridevirtual

Virtual destructor.

Cleans up resources used by the human handheld weapon switch controller component.

Member Function Documentation

◆ operator=()

const DtVreHumanHandWeaponSwitchController & makVre::DtVreHumanHandWeaponSwitchController::operator= ( const DtVreHumanHandWeaponSwitchController & orig)
private

Assignment operator (not implemented)

Returns
Reference to this object

Assignment operator is private and not implemented to prevent assignment.

References DtVreHumanHandWeaponSwitchController().

◆ preFirstTickInit()

virtual void makVre::DtVreHumanHandWeaponSwitchController::preFirstTickInit ( )
overridevirtual

Initializes weapon system references before the first tick.

Identifies all weapon systems in the entity by checking for "aimable-weapon" in the system category. Excludes the first weapon system and stores references to any additional weapon systems found. These secondary weapons will be managed based on control state changes.

◆ tick()

virtual void makVre::DtVreHumanHandWeaponSwitchController::tick ( )
overridevirtual

Updates weapon system states each simulation frame.

Checks whether the entity is player-controlled each frame. When control state changes, enables or disables secondary weapon systems accordingly. Secondary weapons are enabled when under VR Engage control and disabled when under VRF control.

◆ type()

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

Gets the type identifier for this component.

Returns
String identifying the component type (DtVreHumanHandWeaponSwitchControllerType)

Implements the DtSimComponent::type() method to return the type identifier for this component.

◆ creator()

static DtSimComponent * makVre::DtVreHumanHandWeaponSwitchController::creator ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc,
DtReaderWriterRegistry * parentRegistry )
static

Factory method to create a new instance of this component.

Parameters
nameThe name for the new component
ownerThe local object that will own this component
simManagerThe simulation services manager
descComponent descriptor with configuration parameters
parentRegistryOptional parent registry for reader/writer functionality
Returns
Pointer to the newly created component

Static factory method used by the component creation system to instantiate new instances of this component type.

◆ collectHandheldWeaponSystems()

void makVre::DtVreHumanHandWeaponSwitchController::collectHandheldWeaponSystems ( )
protected

Collects references to secondary weapon systems.

Scans through all component systems in the entity and identifies those with the "aimable-weapon" category. Excludes the first weapon system found (primary weapon) and adds any others to mySystemList for management. In most cases, the secondary weapon will be a pistol or other sidearm.

Member Data Documentation

◆ mySystemList

std::vector<DtComponentSystem*> makVre::DtVreHumanHandWeaponSwitchController::mySystemList
protected

List of secondary weapon systems to be managed.

Contains pointers to all secondary weapon systems (all but the first) that have the "aimable-weapon" category.

◆ myWasPlayerControlled

bool makVre::DtVreHumanHandWeaponSwitchController::myWasPlayerControlled
protected

Previous player control state.

Tracks whether the entity was player-controlled in the previous frame, used to detect transitions between control states.


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