VR-Engage  2.3
Loading...
Searching...
No Matches
makVre::DtTowingControlLogic Class Reference

Detailed Description

The DtTowingControlLogic provides towing-related frontend behavior including hook input handling, tow-target state attributes, and tow-hook sensor contact subscriptions.

#include <towingControlLogic.h>

Inheritance diagram for makVre::DtTowingControlLogic:
[legend]

Public Member Functions

 DtTowingControlLogic ()
 
virtual ~DtTowingControlLogic () override
 
virtual bool initialize (DtPlayerStation *player, DtInitTable &config) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
virtual void tick (double dt) override
 
virtual void setHook (double val)
 
virtual void sendJoystickMessage (const std::string &function, double val, double delay=0)
 
virtual DtVreMessageResult handleMenuMessage (DtVreMessage *msg)
 
virtual DtVreMessageResult handleOwnershipTransferResponse (DtVreMessage *msg)
 
- Public Member Functions inherited from makVre::DtEntityControlLogic
 DtEntityControlLogic ()
 
virtual ~DtEntityControlLogic () override
 
virtual bool postInitialize () override
 
virtual void setMouseControlEnabled (bool enabled)
 
virtual bool isMouseControlEnabled ()
 
virtual bool isMouseControlSupportAllowed () const
 
virtual void setMouseControlSupportAllowed (bool enable)
 
virtual const std::vector< std::string > & joystickGroups () const
 
virtual void sendJoystickCommand (const DtEntityIdentifier &id, const std::string &functionGroup, const std::string &function, double val, bool repeat=false)
 
virtual makVre::DtVreMessageResult handleSimState (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleReset (makVre::DtVreMessage *message)
 
virtual makVre::DtVreMessageResult handleCreationStatus (makVre::DtVreMessage *message)
 
virtual void reset (float val)
 
virtual void resetInPlace (float val)
 
virtual void toggleMouseControl (float val)
 
virtual void enableMouseControl (float val)
 
virtual makVre::DtVreMessageResult handleFocusMessage (makVre::DtVreMessage *message)
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
bool componentReady () const
 
void setComponentReady (bool ready)
 
virtual DtInitTickStatus finalizeInitTick (double dt)
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStation & player ()
 
virtual DtAttributeHandle & playerAttributeStore ()
 
virtual const DtAttributeHandle & playerAttributeStore () const
 
virtual const DtAttributeHandle & ownshipState () const
 
virtual void setExtendedData (const std::string &key, const std::string &value, DtEntityIdentifier entity=DtEntityIdentifier::nullId())
 

Protected Member Functions

virtual void onHookTargetUuidChanged (const std::string &hookTargetUuid)
 
virtual void onTowSensorContactsChanged (const TowSensorContactsMap &sensorContacts)
 
virtual void onHookedChanged (bool hooked)
 
virtual void onVreBackendChanged (const DtSimulationAddress &vreBackendAddress)
 
virtual void onTowCandidateSimEngineAddressChanged (const DtAttributeHandle &attr)
 
virtual void updateTowCandidateSimEngineAttrs (const TowSensorContactsMap &sensorContacts)
 
virtual void updateTowCandidateState ()
 
virtual void updateTowMenuTargetState ()
 
virtual bool shouldUseTowCandidatePrepMode () const
 
virtual void startTowOwnershipTransfer ()
 
virtual void clearTowOwnershipTransferState ()
 
virtual void releasePendingTowTransferTarget ()
 
virtual void releaseTransferredTowTarget ()
 
virtual void updateTransferredTowTargetRelease (double dt)
 
virtual void updateTransferredTowReleaseDelayFromSensorContacts ()
 
virtual bool transferredTowTargetInSensorContacts () const
 
virtual void tryAutoHookAfterTransfer ()
 
virtual DtSimulationAddress towCandidateSimEngine (const DtUUID &candidateUuid) const
 
virtual void queueTowTargetStateProperty (const DtEntityIdentifier &entityId, const std::string &name, const std::string &value, bool isBoolean)
 
virtual void updateHookActionLabel ()
 
- Protected Member Functions inherited from makVre::DtEntityControlLogic
bool requiresControl () const
 
bool isAirborne () const
 
void showNotification (const QString &text, double duration)
 
virtual void takeControlOfPlayerEntity ()
 
virtual void releaseControlOfPlayerEntity ()
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

DtInputLogic myTowingInputLogic
 
std::string myMainJoystickGroup
 
bool myHasTowHook
 
double myTowOwnershipAcquireDelaySeconds
 
double myTowOwnershipReleaseDelaySeconds
 
double myTowHookHandoffTimeoutSeconds
 
DtAttributeHandleType< bool > myHookedSourceAttr
 
DtAttributeHandleType< std::string > myHookTargetUuidSourceAttr
 
DtAttributeHandleType< TowSensorContactsMap > mySensorContactsAttr
 
DtAttributeHandleType< DtSimulationAddress > myVreBackendAttr
 
DtAttributeHandleType< bool > myCanTowAttr
 
DtAttributeHandleType< bool > myHookedAttr
 
DtAttributeHandleType< std::string > myHookTargetMarkingTextAttr
 
DtAttributeHandleType< bool > myHasTowMenuTargetAttr
 
DtAttributeHandleType< std::string > myHookActionLabelAttr
 
TowCandidateSimEngineAttrMap myTowCandidateSimEngineAttrs
 
DtAttributeCallbackManager myTowCandidateAttributeCallbacks
 
bool myHasHookTarget
 
bool myHasTowCandidate
 
DtUUID myTowCandidateUuid
 
DtEntityIdentifier myTowCandidateEntityId
 
bool myTowCandidateNeedsOwnershipTransfer
 
bool myTowOwnershipTransferInProgress
 
bool myTowOwnershipTransferWaitingForHook
 
bool myTowHookCommandSent
 
unsigned long long myPendingTowOwnershipRequestId
 
DtUUID myPendingTowTransferUuid
 
DtEntityIdentifier myPendingTowTransferEntityId
 
double myPendingTowHookTimeout
 
DtUUID myTransferredTowTargetUuid
 
DtEntityIdentifier myTransferredTowTargetEntityId
 
bool myTransferredTowReleaseWaitingForSensorClear
 
double myTransferredTowReleaseDelay
 
- Protected Attributes inherited from makVre::DtEntityControlLogic
std::vector< std::string > myJoystickFunctionGroups
 
DtInputLogic myCommonInputLogic
 
std::string myInputConfigFile
 
bool myMouseControlEnabled
 
bool myMouseControlSupportAllowed
 
DtAttributeHandle myOwnshipAttr
 
DtAttributeHandleType< bool > myEmbarkedAttr
 
DtAttributeHandleType< DtEntityIdentifier > myEmbarkedHostAttr
 
DtAttributeHandleType< DtEntityType > myEmbarkedHostTypeAttr
 
DtAttributeHandleType< std::string > myEmbarkedHostMarkingAttr
 
DtAttributeHandleType< bool > myEmbarkedOnAircraftAttr
 
DtAttributeHandleType< std::string > myEmbarkedInSlotAttr
 
DtAttributeHandleType< unsigned int > myAppearanceAttr
 
DtAttributeHandleType< DtVector > myPositionAttr
 
DtAttributeHandleType< DtTaitBryan > myOrientationAttr
 
DtAttributeHandleType< double > mySpeedAttr
 
DtAttributeHandleType< DtVector32 > myVelocityAttr
 
DtAttributeHandleType< DtVector32 > myAccelerationAttr
 
DtAttributeHandleType< DtVector32 > myRotVelAttr
 
DtAttributeHandleType< DtEntityType > myEntityTypeAttr
 
DtAttributeHandleType< DtVector32 > myRelativeVelocityAttr
 
DtAttributeHandleType< DtDamageState > myDamageStateAttr
 
DtAttributeHandleType< int > mySimStateUpdateIndexAttr
 
DtAttributeHandleType< bool > myHideOccupantsAttr
 
- Protected Attributes inherited from makVre::DtPlayerComponent
bool myComponentReady = true
 
std::string myName
 
DtInitTable myConfig
 
DtPlayerStation * myPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolver * myResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 
DtVreMessageHandlerGroup myMessageHandlers
 

Private Types

using TowSensorContactsMap = std::map<DtUUID, DtEntityType>
 
using TowCandidateSimEngineAttrMap = std::map<DtUUID, DtAttributeHandleType<DtSimulationAddress>>
 

Member Typedef Documentation

◆ TowSensorContactsMap

using makVre::DtTowingControlLogic::TowSensorContactsMap = std::map<DtUUID, DtEntityType>
private

◆ TowCandidateSimEngineAttrMap

using makVre::DtTowingControlLogic::TowCandidateSimEngineAttrMap = std::map<DtUUID, DtAttributeHandleType<DtSimulationAddress>>
private

Constructor & Destructor Documentation

◆ DtTowingControlLogic()

makVre::DtTowingControlLogic::DtTowingControlLogic ( )

Constructor for DtTowingControlLogic.

◆ ~DtTowingControlLogic()

virtual makVre::DtTowingControlLogic::~DtTowingControlLogic ( )
overridevirtual

Virtual destructor for DtTowingControlLogic.

Member Function Documentation

◆ initialize()

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

Initializes the towing control logic from Lua configuration.

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

Reimplemented from makVre::DtEntityControlLogic.

References makVre::DtPlayerComponent::player().

◆ shutdown()

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

Shuts down the component and removes towing callbacks and input handlers.

Reimplemented from makVre::DtEntityControlLogic.

◆ type()

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

Returns the component type identifier.

Returns
The component type string

Reimplemented from makVre::DtEntityControlLogic.

◆ tick()

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

Updates pending tow-transfer handoff state.

Parameters
dtTime in seconds since the previous update

Reimplemented from makVre::DtEntityControlLogic.

◆ setHook()

virtual void makVre::DtTowingControlLogic::setHook ( double val)
virtual

Controls the towing hook.

Parameters
valThe input value, typically toggling hook engagement

◆ sendJoystickMessage()

virtual void makVre::DtTowingControlLogic::sendJoystickMessage ( const std::string & function,
double val,
double delay = 0 )
virtual

Sends a joystick message to the simulation.

Parameters
functionThe function name to include in the message
valThe function value to include in the message
delayOptional delay before sending the message

◆ handleMenuMessage()

virtual DtVreMessageResult makVre::DtTowingControlLogic::handleMenuMessage ( DtVreMessage * msg)
virtual

Handles towing-related action-menu messages.

Parameters
msgThe message to process
Returns
HANDLED if the towing menu action was processed, IGNORED otherwise

◆ handleOwnershipTransferResponse()

virtual DtVreMessageResult makVre::DtTowingControlLogic::handleOwnershipTransferResponse ( DtVreMessage * msg)
virtual

Handles ownership-transfer responses for tow-candidate acquires.

Parameters
msgThe response message to process
Returns
HANDLED if the response was for the pending towing request

◆ onHookTargetUuidChanged()

virtual void makVre::DtTowingControlLogic::onHookTargetUuidChanged ( const std::string & hookTargetUuid)
protectedvirtual

Callback for changes to the hook target UUID.

Parameters
hookTargetUuidThe UUID of the potential hook target

◆ onTowSensorContactsChanged()

virtual void makVre::DtTowingControlLogic::onTowSensorContactsChanged ( const TowSensorContactsMap & sensorContacts)
protectedvirtual

Callback for changes to the tow-hook sensor contact map.

Parameters
sensorContactsThe current set of tow-hook sensor contacts

◆ onHookedChanged()

virtual void makVre::DtTowingControlLogic::onHookedChanged ( bool hooked)
protectedvirtual

Callback for changes to local hooked state.

Parameters
hookedTrue when the ownship is currently hooked

◆ onVreBackendChanged()

virtual void makVre::DtTowingControlLogic::onVreBackendChanged ( const DtSimulationAddress & vreBackendAddress)
protectedvirtual

Callback for changes to the local VRE backend address.

Parameters
vreBackendAddressCurrent VRE backend sim address

◆ onTowCandidateSimEngineAddressChanged()

virtual void makVre::DtTowingControlLogic::onTowCandidateSimEngineAddressChanged ( const DtAttributeHandle & attr)
protectedvirtual

Callback for tracked tow-candidate sim-engine updates.

Parameters
attrThe simEngineAddress attribute handle that changed

◆ updateTowCandidateSimEngineAttrs()

virtual void makVre::DtTowingControlLogic::updateTowCandidateSimEngineAttrs ( const TowSensorContactsMap & sensorContacts)
protectedvirtual

Synchronizes persistent simEngineAddress handles for the current contact set.

Parameters
sensorContactsThe current tow-hook sensor contacts

◆ updateTowCandidateState()

virtual void makVre::DtTowingControlLogic::updateTowCandidateState ( )
protectedvirtual

Refreshes fallback tow-candidate state from the tow-hook sensor contact map.

◆ updateTowMenuTargetState()

virtual void makVre::DtTowingControlLogic::updateTowMenuTargetState ( )
protectedvirtual

Refreshes whether the towing menu has a visible interaction target.

◆ shouldUseTowCandidatePrepMode()

virtual bool makVre::DtTowingControlLogic::shouldUseTowCandidatePrepMode ( ) const
protectedvirtual

Returns true when towing should stay in prep-only mode.

Prep-only mode is used when we have exactly one tow sensor candidate but no authoritative same-backend hook target yet.

◆ startTowOwnershipTransfer()

virtual void makVre::DtTowingControlLogic::startTowOwnershipTransfer ( )
protectedvirtual

Starts ownership transfer for the current fallback tow candidate.

◆ clearTowOwnershipTransferState()

virtual void makVre::DtTowingControlLogic::clearTowOwnershipTransferState ( )
protectedvirtual

Clears pending towing ownership-transfer state.

◆ releasePendingTowTransferTarget()

virtual void makVre::DtTowingControlLogic::releasePendingTowTransferTarget ( )
protectedvirtual

Releases an acquired tow target that could not be hooked.

◆ releaseTransferredTowTarget()

virtual void makVre::DtTowingControlLogic::releaseTransferredTowTarget ( )
protectedvirtual

Releases the transferred tow target after towing stops.

◆ updateTransferredTowTargetRelease()

virtual void makVre::DtTowingControlLogic::updateTransferredTowTargetRelease ( double dt)
protectedvirtual

Releases the transferred tow target after it leaves sensor range and the delay expires.

◆ updateTransferredTowReleaseDelayFromSensorContacts()

virtual void makVre::DtTowingControlLogic::updateTransferredTowReleaseDelayFromSensorContacts ( )
protectedvirtual

Starts or cancels the release delay based on whether the transferred target is still in sensor contacts.

◆ transferredTowTargetInSensorContacts()

virtual bool makVre::DtTowingControlLogic::transferredTowTargetInSensorContacts ( ) const
protectedvirtual

Returns true if the transferred tow target is still in tow-hook sensor contacts.

◆ tryAutoHookAfterTransfer()

virtual void makVre::DtTowingControlLogic::tryAutoHookAfterTransfer ( )
protectedvirtual

Attempts to hand off to the normal Vortex hook path after acquire success.

◆ towCandidateSimEngine()

virtual DtSimulationAddress makVre::DtTowingControlLogic::towCandidateSimEngine ( const DtUUID & candidateUuid) const
protectedvirtual

Returns the tracked sim-engine address for a fallback tow candidate.

◆ queueTowTargetStateProperty()

virtual void makVre::DtTowingControlLogic::queueTowTargetStateProperty ( const DtEntityIdentifier & entityId,
const std::string & name,
const std::string & value,
bool isBoolean )
protectedvirtual

Queues a set-state-property request for a tow target entity.

References makVre::DtPlayerComponent::name().

◆ updateHookActionLabel()

virtual void makVre::DtTowingControlLogic::updateHookActionLabel ( )
protectedvirtual

Refreshes the dynamic towing action-menu label.

Member Data Documentation

◆ myTowingInputLogic

DtInputLogic makVre::DtTowingControlLogic::myTowingInputLogic
protected

Input handler logic for processing towing input device events.

◆ myMainJoystickGroup

std::string makVre::DtTowingControlLogic::myMainJoystickGroup
protected

Main joystick function group name from configuration.

◆ myHasTowHook

bool makVre::DtTowingControlLogic::myHasTowHook
protected

Configuration flag indicating if this role should expose towing support.

◆ myTowOwnershipAcquireDelaySeconds

double makVre::DtTowingControlLogic::myTowOwnershipAcquireDelaySeconds
protected

Delay in seconds before sending the tow-target ownership acquire request.

◆ myTowOwnershipReleaseDelaySeconds

double makVre::DtTowingControlLogic::myTowOwnershipReleaseDelaySeconds
protected

Delay in seconds after the towed target leaves sensor range before releasing ownership.

◆ myTowHookHandoffTimeoutSeconds

double makVre::DtTowingControlLogic::myTowHookHandoffTimeoutSeconds
protected

Timeout in seconds to wait for the tow hook to engage after transfer succeeds.

◆ myHookedSourceAttr

DtAttributeHandleType<bool> makVre::DtTowingControlLogic::myHookedSourceAttr
protected

Source attribute handle tracking whether the ownship is already hooked. Reads the extended-state alias produced by DtExtendedStateLogic.

◆ myHookTargetUuidSourceAttr

DtAttributeHandleType<std::string> makVre::DtTowingControlLogic::myHookTargetUuidSourceAttr
protected

Source attribute handle storing the authoritative same-backend hook target UUID. Reads the extended-state alias produced by DtExtendedStateLogic.

◆ mySensorContactsAttr

DtAttributeHandleType<TowSensorContactsMap> makVre::DtTowingControlLogic::mySensorContactsAttr
protected

Sensor contacts used to discover nearby tow targets.

Attribute Store Keysensors.tow-hook-sensor.contacts

◆ myVreBackendAttr

DtAttributeHandleType<DtSimulationAddress> makVre::DtTowingControlLogic::myVreBackendAttr
protected

Simulation address of this station's VRE backend.

Attribute Store KeyvreBackendStatus.SimAddress

◆ myCanTowAttr

DtAttributeHandleType<bool> makVre::DtTowingControlLogic::myCanTowAttr
protected

Attribute handle tracking live tow-hook availability. Consumed by the towing HUD.

Attribute Store Keytowing.can-tow

◆ myHookedAttr

DtAttributeHandleType<bool> makVre::DtTowingControlLogic::myHookedAttr
protected

Attribute handle tracking whether the ownship is already hooked. Consumed by the towing HUD.

Attribute Store Keytowing.hooked

◆ myHookTargetMarkingTextAttr

DtAttributeHandleType<std::string> makVre::DtTowingControlLogic::myHookTargetMarkingTextAttr
protected

Attribute handle storing the marking text of the current tow hook target entity. Consumed by the towing HUD.

Attribute Store Keytowing.hook-target-marking-text

◆ myHasTowMenuTargetAttr

DtAttributeHandleType<bool> makVre::DtTowingControlLogic::myHasTowMenuTargetAttr
protected

Attribute handle indicating whether the towing menu should surface an interaction target.

This remains true during ownership transfer so the action menu does not disappear while the tow target is temporarily unavailable as a normal hook target. Consumed by the towing action menu.

Attribute Store Keytowing.hasTowMenuTarget

◆ myHookActionLabelAttr

DtAttributeHandleType<std::string> makVre::DtTowingControlLogic::myHookActionLabelAttr
protected

Attribute handle storing the dynamic label for the towing action-menu item. Consumed by the towing action menu.

Attribute Store Keytowing.hookActionLabel

◆ myTowCandidateSimEngineAttrs

TowCandidateSimEngineAttrMap makVre::DtTowingControlLogic::myTowCandidateSimEngineAttrs
protected

Persistent per-contact simEngineAddress handles for fallback tow candidates.

◆ myTowCandidateAttributeCallbacks

DtAttributeCallbackManager makVre::DtTowingControlLogic::myTowCandidateAttributeCallbacks
protected

Callback manager for tracked tow-candidate simEngineAddress attributes.

◆ myHasHookTarget

bool makVre::DtTowingControlLogic::myHasHookTarget
protected

True when there is a valid authoritative tow hook target entity.

◆ myHasTowCandidate

bool makVre::DtTowingControlLogic::myHasTowCandidate
protected

True when a single fallback tow candidate exists.

◆ myTowCandidateUuid

DtUUID makVre::DtTowingControlLogic::myTowCandidateUuid
protected

UUID of the fallback tow candidate.

◆ myTowCandidateEntityId

DtEntityIdentifier makVre::DtTowingControlLogic::myTowCandidateEntityId
protected

Entity identifier of the fallback tow candidate.

◆ myTowCandidateNeedsOwnershipTransfer

bool makVre::DtTowingControlLogic::myTowCandidateNeedsOwnershipTransfer
protected

True when the fallback tow candidate is on another sim backend.

◆ myTowOwnershipTransferInProgress

bool makVre::DtTowingControlLogic::myTowOwnershipTransferInProgress
protected

True while a tow-target ownership acquire is in flight.

◆ myTowOwnershipTransferWaitingForHook

bool makVre::DtTowingControlLogic::myTowOwnershipTransferWaitingForHook
protected

True after acquire success while waiting for the normal hook target to appear.

◆ myTowHookCommandSent

bool makVre::DtTowingControlLogic::myTowHookCommandSent
protected

True after the hook command has been sent for a transferred target.

◆ myPendingTowOwnershipRequestId

unsigned long long makVre::DtTowingControlLogic::myPendingTowOwnershipRequestId
protected

Request id for the active tow-target ownership acquire.

◆ myPendingTowTransferUuid

DtUUID makVre::DtTowingControlLogic::myPendingTowTransferUuid
protected

UUID of the tow target being acquired.

◆ myPendingTowTransferEntityId

DtEntityIdentifier makVre::DtTowingControlLogic::myPendingTowTransferEntityId
protected

Entity identifier of the tow target being acquired.

◆ myPendingTowHookTimeout

double makVre::DtTowingControlLogic::myPendingTowHookTimeout
protected

Seconds remaining while waiting for the acquired target to become hookable and hooked.

◆ myTransferredTowTargetUuid

DtUUID makVre::DtTowingControlLogic::myTransferredTowTargetUuid
protected

UUID of the transferred tow target while it is being towed.

◆ myTransferredTowTargetEntityId

DtEntityIdentifier makVre::DtTowingControlLogic::myTransferredTowTargetEntityId
protected

Entity identifier of the transferred tow target while it is being towed.

◆ myTransferredTowReleaseWaitingForSensorClear

bool makVre::DtTowingControlLogic::myTransferredTowReleaseWaitingForSensorClear
protected

True after unhooking while waiting for the transferred target to leave tow-hook sensor contacts.

◆ myTransferredTowReleaseDelay

double makVre::DtTowingControlLogic::myTransferredTowReleaseDelay
protected

Seconds remaining before releasing the transferred tow target after it leaves sensor contacts.


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