VR-Engage  2.3
Loading...
Searching...
No Matches
launcherControlLogic.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2024 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6#pragma once
7
12
13#include <vlpi/appearance.h>
14#include <matrix/vlVector.h>
15#include <vrvCore/DtUniqueID.h>
16
17#include <map>
18#include <string>
19
20namespace makVre
21{
24class DtIntersector;
25
27{
28//! \ingroup RoleConfigParams
29//! \defgroup LauncherControlLogicRoleParams Launcher Control Logic Role Parameters
30//! \roleInherits{EntityControlLogicRoleParams}
31//! Configuration options for launcher and guided weapon control logic.
32//! @{
33
34//! \vreRoleParam{lockTargetHoldTime,double,0.5,launcherControlLogic,Time in seconds to hold a target lock weight.}
35constexpr const char* lockTargetHoldTime = "lockTargetHoldTime";
36
37//! \vreRoleParam{timeOnTargetForLock,double,0.1,launcherControlLogic,Time in seconds required on target to achieve weapon lock.}
38constexpr const char* timeOnTargetForLock = "timeOnTargetForLock";
39
40//! \vreRoleParam{targetLockFadeRate,double,0.2,launcherControlLogic,Rate at which target lock weight fades over time.}
41constexpr const char* targetLockFadeRate = "targetLockFadeRate";
42
43//! @}
44} // namespace LauncherControlLogicConfig
45
46//! \brief Type identifier for DtLauncherControlLogic component
47constexpr const char* DtLauncherControlLogicType = "DtLauncherControlLogic";
48
49//! \brief Component that manages missile launcher and guided weapon control
50//!
51//! DtLauncherControlLogic handles shoulder-mounted and tripod-mounted launcher
52//! operations including firing, missile tracking, target locking, and indirect
53//! fire coordinate management. It publishes missile state to the playerAttributeStore
54//! so that DtRemoteSensorViewLogic can manage the scope view accordingly.
56{
57public:
59 virtual ~DtLauncherControlLogic() override;
60
61 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
62 virtual void tick(double dt) override;
63 virtual void shutdown() override;
64
65 virtual const char* type() const override;
66
67 virtual void toggleMissileLauncher();
68 virtual void useLauncher(const DtEntityIdentifier& id);
69 virtual void exitLauncher();
70
71 virtual void fireMissile(const std::string& rangeId = "");
72 virtual void firstStageTrigger(double val);
73
74 virtual void toggleMissileAttackMode(double val);
75 virtual void toggleMissileTargetMode(double val);
76 virtual void toggleMissileFireAndForget(double val);
77 virtual void detachFromMissile(double val);
78
79 virtual void setIndirectFireCoordinate(const std::string& coordinate);
80 virtual void clearIndirectTarget();
81
82 virtual DtEntityIdentifier launcherId();
83
84protected:
90
91 virtual void processMissileRealized(const DtEntityIdentifier& munitionId);
92 virtual void processMissileRemoved();
93 virtual void processLauncherRemoved();
94 virtual void enableLauncher(LauncherType launcherType = SHOULDER_MOUNTED);
95 virtual void disableLauncher();
96 virtual void updateLauncherFocus(double dt);
97 virtual void setLauncherTargetMode(const std::string& targetMode);
98
99 bool hasLauncher() const;
100 bool isAimingLauncher() const;
101
102 void onDamageStateChanged(DtDamageState val);
103 void onSceneClicked(makVrv::DtUniqueID id, const DtVector& location, double altAboveGround);
104
107
108 DtEntityIdentifier myMissileToAttachTo;
112
116
117 std::map<makVrv::DtElementID, double> myPotentialTargetsWeightMap;
118
153};
154
155} // namespace makVre
Type-specific handle class for attributes.
Definition attributeHandle.h:229
Event processor for entity creation and placement.
Definition createNewEntityEventProcessor.h:36
DtEntityControlLogic()
Constructor.
Table-based access to Lua state for configuration data.
Definition initializer.h:38
Abstract base class for performing intersection tests in 3D space.
Definition intersector.h:37
DtAttributeHandleType< DtTaitBryan > myObserverOrientationAttr
Definition launcherControlLogic.h:149
DtAttributeHandleType< makVrv::DtElementID > myLauncherElementIdAttr
Definition launcherControlLogic.h:124
DtAttributeHandleType< makVrv::DtElementID > myLockedTargetIdAttr
Definition launcherControlLogic.h:128
DtAttributeHandleType< DtEntityType > myLauncherEntityTypeAttr
Definition launcherControlLogic.h:125
DtAttributeHandleType< std::string > myMgrsFireCoordinateAttr
Definition launcherControlLogic.h:135
virtual makVre::DtVreMessageResult handleMenuActionMessage(makVre::DtVreMessage *msg)
DtAttributeHandleType< bool > myManualMissileControlAttr
Definition launcherControlLogic.h:151
double myTargetWeightFadeRate
Definition launcherControlLogic.h:115
DtAttributeHandleType< HumanPosture > myDesiredPostureAttr
Definition launcherControlLogic.h:144
DtAttributeHandleType< bool > myAimingAttr
Definition launcherControlLogic.h:143
virtual void setLauncherTargetMode(const std::string &targetMode)
DtAttributeHandleType< LauncherType > myLauncherTypeAttr
Definition launcherControlLogic.h:120
virtual void tick(double dt) override
Updates the entity control logic each frame.
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the entity control logic.
virtual void updateLauncherFocus(double dt)
DtAttributeHandleType< std::string > myAttackModeAttr
Definition launcherControlLogic.h:139
DtAttributeHandleType< DtU32 > myCachedAppearanceAttr
Definition launcherControlLogic.h:147
DtAttributeHandleType< DtEntityIdentifier > myAttachedToAttr
Definition launcherControlLogic.h:132
virtual void clearIndirectTarget()
DtAttributeHandleType< bool > myHasLauncherAttr
Definition launcherControlLogic.h:122
DtAttributeHandleType< DtVector > myObserverLocationAttr
Definition launcherControlLogic.h:148
DtAttributeHandleType< bool > myFirstStageTriggerAttr
Definition launcherControlLogic.h:133
virtual DtEntityIdentifier launcherId()
DtAttributeHandleType< DtEntityIdentifier > myLauncherMissileIdAttr
Definition launcherControlLogic.h:137
virtual makVre::DtVreMessageResult handleEntityRealized(makVre::DtVreMessage *msg)
DtAttributeHandleType< std::string > myLauncherFireAndForgetAttr
Definition launcherControlLogic.h:141
virtual void processLauncherRemoved()
virtual void shutdown() override
Shuts down the entity control logic.
DtAttributeHandleType< LauncherState > myLauncherStateAttr
Definition launcherControlLogic.h:119
virtual void setIndirectFireCoordinate(const std::string &coordinate)
DtAttributeHandleType< bool > myAimMissileInFlightAttr
Definition launcherControlLogic.h:142
DtAttributeHandleType< DtVector > myMissileTargetLocationAttr
Definition launcherControlLogic.h:130
DtAttributeHandleType< DtVector > myIndirectFireCoordinateAttr
Definition launcherControlLogic.h:134
virtual ~DtLauncherControlLogic() override
double myTargetHoldWeight
Definition launcherControlLogic.h:113
DtAttributeHandleType< DtEntityIdentifier > myLauncherEntityIdAttr
Definition launcherControlLogic.h:123
void onDamageStateChanged(DtDamageState val)
DtAttributeHandleType< bool > myTargetLockedAttr
Definition launcherControlLogic.h:127
DtAttributeHandleType< bool > myUsingIndirectCoordinateAttr
Definition launcherControlLogic.h:136
virtual void toggleMissileFireAndForget(double val)
bool myLaunchedInManualMode
Definition launcherControlLogic.h:110
virtual void firstStageTrigger(double val)
bool myAutoSwitchedToLockOnInFlight
Definition launcherControlLogic.h:111
virtual void processMissileRealized(const DtEntityIdentifier &munitionId)
DtCreateNewEntityEventProcessor * myEventProcessor
Definition launcherControlLogic.h:105
DtAttributeHandleType< bool > myWeaponNeedsLockAttr
Definition launcherControlLogic.h:126
DtAttributeHandleType< bool > myMissileInFlightAttr
Definition launcherControlLogic.h:129
DtAttributeHandleType< makVrv::DtUniqueID > myMissileTargetIdAttr
Definition launcherControlLogic.h:131
DtAttributeHandleType< DtIntersector * > myIntersectorAttr
Definition launcherControlLogic.h:152
DtAttributeHandleType< std::string > myLauncherMissileNameAttr
Definition launcherControlLogic.h:138
virtual void enableLauncher(LauncherType launcherType=SHOULDER_MOUNTED)
DtAttributeHandleType< DtDamageState > myOwnshipDamageStateAttr
Definition launcherControlLogic.h:145
virtual void processMissileRemoved()
DtVector myPreviousRemoteViewTarget
Definition launcherControlLogic.h:109
DtAttributeHandleType< DtEntityType > myEntityTypeAttr
Definition launcherControlLogic.h:146
DtLauncherInputLogic * myInputLogic
Definition launcherControlLogic.h:106
virtual makVre::DtVreMessageResult handleFireInteraction(makVre::DtVreMessage *msg)
virtual makVre::DtVreMessageResult handleEntityRemoved(makVre::DtVreMessage *msg)
virtual void useLauncher(const DtEntityIdentifier &id)
std::map< makVrv::DtElementID, double > myPotentialTargetsWeightMap
Definition launcherControlLogic.h:117
void onSceneClicked(makVrv::DtUniqueID id, const DtVector &location, double altAboveGround)
virtual void toggleMissileAttackMode(double val)
DtAttributeHandleType< std::string > myLauncherTargetModeAttr
Definition launcherControlLogic.h:140
virtual makVre::DtVreMessageResult handleFireMissileMessage(makVre::DtVreMessage *msg)
virtual const char * type() const override
Returns the component type identifier.
virtual void toggleMissileLauncher()
double myTargetLockWeight
Definition launcherControlLogic.h:114
DtAttributeHandleType< bool > myUsingLauncherAttr
Definition launcherControlLogic.h:121
virtual void detachFromMissile(double val)
DtAttributeHandleType< int > myResetObserverAttr
Definition launcherControlLogic.h:150
virtual void fireMissile(const std::string &rangeId="")
virtual void toggleMissileTargetMode(double val)
DtEntityIdentifier myMissileToAttachTo
Definition launcherControlLogic.h:108
Input logic for missile launcher control actions.
Definition launcherInputLogic.h:28
virtual DtPlayerStation & player()
Gets the player station.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Defines the logic for controlling entities in VR-Engage.
constexpr const char * lockTargetHoldTime
Definition launcherControlLogic.h:35
constexpr const char * timeOnTargetForLock
Definition launcherControlLogic.h:38
constexpr const char * targetLockFadeRate
Definition launcherControlLogic.h:41
Defines export/import macros for the vreCommonComponents library.
#define VRECOMMONCOMPONENTS_DLL
DLL export/import macro for the vreCommonComponents library.
Definition export.h:28
Definition launcherControlLogic.h:27
!
Definition glsVreMessageUtil.h:50
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
constexpr const char * DtLauncherControlLogicType
Type identifier for DtLauncherControlLogic component.
Definition launcherControlLogic.h:47
LauncherType
Enumeration of launcher equipment types.
Definition stateDefines.h:76
@ SHOULDER_MOUNTED
Launcher designed to be fired from the shoulder.
Definition stateDefines.h:78
Common enumeration definitions used throughout the VREngage system.
Defines the base class for all VREngage messages.