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

#include <vreLasingController.h>

Inheritance diagram for makVre::DtVreLasingController:
[legend]

Public Member Functions

 DtVreLasingController (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreLasingController () override
 
virtual const char * type () const override
 
virtual void preFirstTickInit () override
 
virtual void tick () override
 
virtual bool init () override
 
- Public Member Functions inherited from makVre::DtVreSimComponent< DtLasingController >
 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=0, DtReaderWriterRegistry *parentRegistry=0)
 
static void setRestoreCallback (DtSimMessage *msg, void *usrData)
 

Protected Member Functions

virtual makVre::DtVreMessageResult handleStartLasingLocation (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleStopLasingLocation (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleSetLasingLocation (makVre::DtVreMessage *msg)
 
virtual void processSetRestore (DtSimMessage *msg)
 
virtual void processSetLaserCodeRequestMessage (DtSimMessage *msg) override
 
virtual bool lineOfSight (DtSimObjectReference target, DtString &reason) override
 

Protected Attributes

bool myPlayerIsLasing
 

Private Member Functions

 DtVreLasingController ()
 
 DtVreLasingController (const DtVreLasingController &orig)
 
const DtVreLasingControlleroperator= (const DtVreLasingController &orig)
 

Constructor & Destructor Documentation

◆ DtVreLasingController() [1/3]

makVre::DtVreLasingController::DtVreLasingController ( )
private

Default constructor (not implemented)

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

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

◆ DtVreLasingController() [2/3]

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

Copy constructor (not implemented)

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

References DtVreLasingController().

◆ DtVreLasingController() [3/3]

makVre::DtVreLasingController::DtVreLasingController ( 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
descComponent descriptor with configuration parameters
parentRegistryOptional parent registry for reader/writer functionality

Creates a new lasing controller component with the specified parameters.

◆ ~DtVreLasingController()

virtual makVre::DtVreLasingController::~DtVreLasingController ( )
overridevirtual

Virtual destructor.

Cleans up resources used by the lasing controller component.

Member Function Documentation

◆ operator=()

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

Assignment operator (not implemented)

Returns
Reference to this object

Assignment operator is private and not implemented to prevent assignment.

References DtVreLasingController().

◆ type()

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

Gets the type identifier for this component.

Returns
String identifying the component type (DtVreLasingControllerType)

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

◆ preFirstTickInit()

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

Performs initialization before the first simulation tick.

Gets initial laser designator code from the Process State Repository (PSR) and copies it to the state property "laserCode". This ensures that the GUI displays the correct laser code when the simulation starts.

◆ tick()

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

Updates the controller state each simulation frame.

Processes lasing operations during each simulation frame. This includes updating laser position, checking line of sight conditions, and managing the lasing state based on player inputs.

◆ init()

virtual bool makVre::DtVreLasingController::init ( )
overridevirtual

Initializes the lasing controller.

Returns
True if initialization is successful, false otherwise

Sets the state property named "HasLaser" to True. This property is defined in the platform sysdef file under state-data and is used by the VR-Engage menu system to determine whether to show laser designation options in the user interface.

◆ creator()

static DtSimComponent * makVre::DtVreLasingController::creator ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )
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
descOptional component descriptor
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.

◆ setRestoreCallback()

static void makVre::DtVreLasingController::setRestoreCallback ( DtSimMessage * msg,
void * usrData )
static

Callback for entity restoration events.

Parameters
msgThe message containing restoration information
usrDataUser data pointer, typically pointing to the instance of this class

Static callback function invoked when an entity is restored. This function forwards the message to the instance's processSetRestore method to reinitialize state properties.

◆ handleStartLasingLocation()

virtual makVre::DtVreMessageResult makVre::DtVreLasingController::handleStartLasingLocation ( makVre::DtVreMessage * msg)
protectedvirtual

Handles messages to start lasing at a specific location.

Parameters
msgThe message containing lasing parameters
Returns
Message processing result indicating success or failure

Processes StartLasingLocation messages, which activate the laser designator at a specified location. This allows the entity to designate targets for laser-guided weapons.

◆ handleStopLasingLocation()

virtual makVre::DtVreMessageResult makVre::DtVreLasingController::handleStopLasingLocation ( makVre::DtVreMessage * msg)
protectedvirtual

Handles messages to stop lasing.

Parameters
msgThe message containing stop lasing request
Returns
Message processing result indicating success or failure

Processes StopLasingLocation messages, which deactivate the laser designator. This turns off the laser and stops target designation.

◆ handleSetLasingLocation()

virtual makVre::DtVreMessageResult makVre::DtVreLasingController::handleSetLasingLocation ( makVre::DtVreMessage * msg)
protectedvirtual

Handles messages to set a new lasing location.

Parameters
msgThe message containing new lasing location parameters
Returns
Message processing result indicating success or failure

Processes SetLasingLocation messages, which update the location at which the laser designator is pointing. This allows for tracking moving targets or switching designation to a new target.

◆ processSetRestore()

virtual void makVre::DtVreLasingController::processSetRestore ( DtSimMessage * msg)
protectedvirtual

Processes entity restoration messages.

Parameters
msgThe message containing restoration information

Reinitializes the state property "HasLaser" when a set restore operation is executed. This ensures that the entity's laser capabilities are properly restored after entity restoration, allowing the VR-Engage menu to correctly display laser options.

◆ processSetLaserCodeRequestMessage()

virtual void makVre::DtVreLasingController::processSetLaserCodeRequestMessage ( DtSimMessage * msg)
overrideprotectedvirtual

Processes laser code change requests.

Parameters
msgThe message containing the new laser code

Sets the state property for laser code based on the message contents, so the updated code can be reflected in the GUI. This allows users to change laser codes through the user interface, ensuring that laser-guided weapons are properly configured for the selected code.

◆ lineOfSight()

virtual bool makVre::DtVreLasingController::lineOfSight ( DtSimObjectReference target,
DtString & reason )
overrideprotectedvirtual

Determines if the controller has line of sight to a target.

Parameters
targetReference to the target object
reasonOutput parameter that will contain the reason for line of sight failure
Returns
True if line of sight exists, false otherwise

Checks whether the laser controller has line of sight with the specified target. Overridden to demote an excessive warning in the console (changed from DtWarn to DtVerbose level). The actual line of sight calculation functionality remains unchanged from the base class implementation.

Member Data Documentation

◆ myPlayerIsLasing

bool makVre::DtVreLasingController::myPlayerIsLasing
protected

Flag indicating whether the player is currently lasing.

When true, indicates that the player has activated the laser designator and is currently designating a target. This state affects various controller behaviors including message handling and visual effects.


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