VR-Engage  2.2
Loading...
Searching...
No Matches
vreBallisticGunDescriptor.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreBallisticGunDescriptor.h
7//! \ingroup vreVrfobjparam
8//! \brief Ballistic gun descriptor for VREngage
9//!
10//! This file defines the DtVreBallisticGunDescriptor class, which extends the base
11//! ballistic gun descriptor with VREngage-specific parameters, including ammunition
12//! load times, maximum range, and projectile configuration options.
13
14#pragma once
15
17#include "vreVrfObjparam/ammoLoadTime.h"
18
19#include <vrfobjparam/ballisticGunDescriptor.h>
20
21namespace makVre
22{
23//! \brief Type identifier string for the VREngage ballistic gun descriptor
24const char DtVreBallisticGunDescriptorType[] = "vre-ballistic-gun-descriptor";
25
26//! \brief Extended ballistic gun descriptor for VREngage weapon systems
27//!
28//! The DtVreBallisticGunDescriptor extends the base ballistic gun descriptor to add
29//! ammunition-specific load times, maximum range, and additional configuration options
30//! for VREngage weapon systems. This is particularly useful for complex weapon systems
31//! like the LAV gun, where the gunner can utilize multiple different ammunition types
32//! with different ballistic properties and loading times.
33class VREVRFOBJPARAM_DLL DtVreBallisticGunDescriptor : public DtBallisticGunDescriptor
34{
35public:
36 //! \brief Constructor with component name
37 //! \param componentName The name of this component
38 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
39 //!
40 //! Creates a new ballistic gun descriptor with the specified name.
41 DtVreBallisticGunDescriptor(const DtString& componentName, DtReaderWriterRegistry* parentRegistry = 0);
42
43 //! \brief Constructor with component name as symbol string
44 //! \param componentName The name of this component as a symbol string
45 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
46 //!
47 //! Creates a new ballistic gun descriptor with the specified name.
48 DtVreBallisticGunDescriptor(const DtSymbolString& componentName, DtReaderWriterRegistry* parentRegistry = 0);
49
50 //! \brief Assignment operator
51 //! \param orig The source descriptor to copy from
52 //! \return Reference to this descriptor after assignment
53 //!
54 //! Assigns the contents of the provided descriptor to this one.
56
57 //! \brief Copy constructor
58 //! \param orig The source descriptor to copy from
59 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
60 //!
61 //! Creates a new ballistic gun descriptor as a copy of the provided original.
62 DtVreBallisticGunDescriptor(const DtVreBallisticGunDescriptor& orig, DtReaderWriterRegistry* parentRegistry = 0);
63
64 //! \brief Virtual destructor
65 //!
66 //! Cleans up resources used by the descriptor.
67 virtual ~DtVreBallisticGunDescriptor() override;
68
69 //! \brief Gets the type identifier for this descriptor
70 //! \return String identifying this descriptor type
71 //!
72 //! Returns a unique type identifier string for this descriptor type.
73 //! Will return DtVreBallisticGunDescriptorType.
74 virtual DtString type() const override;
75
76 //! \brief Creates a clone of this descriptor
77 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
78 //! \return Pointer to a new descriptor that is a clone of this one
79 //!
80 //! Creates a new ballistic gun descriptor as a deep copy of this one.
81 virtual DtComponentDescriptor* clone(DtReaderWriterRegistry* parentRegistry = 0) const override;
82
83 //! \brief Sets the ammunition load time list
84 //! \param ammoLoadTimeList The list of ammunition load times
85 //!
86 //! Sets the list of ammunition types and their associated load times.
87 //! This defines the loading time for each type of ammunition this gun can use.
89
90 //! \brief Gets the ammunition load time list
91 //! \return The list of ammunition load times
92 //!
93 //! Returns the list of ammunition types and their associated load times.
95
96 //! \brief Gets the maximum range of the weapon
97 //! \return The maximum range in meters
98 //!
99 //! Returns the maximum effective range of this weapon.
100 virtual DtReal maxRange() const;
101
102 //! \brief Sets the maximum range of the weapon
103 //! \param maxRange The maximum range in meters
104 //!
105 //! Sets the maximum effective range of this weapon.
106 virtual void setMaxRange(DtReal maxRange);
107
108 //! \brief Checks if projectiles detonate at maximum range
109 //! \return True if projectiles detonate at maximum range, false otherwise
110 //!
111 //! Returns whether projectiles should detonate when they reach maximum range
112 //! if there is no line-of-sight collision before that point.
113 virtual DtBoolean maxRangeDetonation() const;
114
115 //! \brief Sets whether projectiles detonate at maximum range
116 //! \param maxRangeDetonation True to enable detonation at maximum range, false otherwise
117 //!
118 //! Sets whether projectiles should detonate when they reach maximum range
119 //! if there is no line-of-sight collision before that point.
121
122 //! \brief Gets the initial munition type
123 //! \return Reference to the initial munition entity type
124 //!
125 //! Returns the entity type of the munition that should be set as the
126 //! initial current munition for this weapon.
127 virtual const DtEntityType& initialMunition() const;
128
129 //! \brief Sets the initial munition type
130 //! \param munition The initial munition entity type
131 //!
132 //! Sets the entity type of the munition that should be used as the
133 //! initial current munition for this weapon.
134 virtual void setInitialMunition(const DtEntityType& munition);
135
136 //! \brief Checks if flyout projectiles are created
137 //! \return True if flyout projectiles are created, false otherwise
138 //!
139 //! Returns whether this weapon creates visible projectile entities
140 //! when fired, rather than just simulating ballistic trajectories.
141 virtual DtBoolean createFlyOutProjectile() const;
142
143 //! \brief Sets whether flyout projectiles are created
144 //! \param createFlyOutProjectile True to create flyout projectiles, false otherwise
145 //!
146 //! Sets whether this weapon creates visible projectile entities
147 //! when fired, rather than just simulating ballistic trajectories.
149
150 //! \brief Gets the joystick function group
151 //! \return String identifying the joystick function group
152 //!
153 //! Returns the joystick function group identifier, which is used to
154 //! distinguish fire input meant for this weapon from other weapons.
155 virtual const DtString& joystickFunctionGroup() const;
156
157 //! \brief Sets the joystick function group
158 //! \param group String identifying the joystick function group
159 //!
160 //! Sets the joystick function group identifier, which is used to
161 //! distinguish fire input meant for this weapon from other weapons.
162 virtual void setJoystickFunctionGroup(const DtString& group);
163
164 //! \brief Gets the projectile type
165 //! \return String identifying the projectile type
166 //!
167 //! Returns the type of projectile entity to create when the weapon is fired.
168 //! This is used when createFlyOutProjectile is set to true.
169 virtual const DtString& projectileType() const;
170
171 //! \brief Sets the projectile type
172 //! \param type String identifying the projectile type
173 //!
174 //! Sets the type of projectile entity to create when the weapon is fired.
175 //! This is used when createFlyOutProjectile is set to true.
176 virtual void setProjectileType(const DtString& type);
177
178 //! \brief Gets the duration before returning gun control to CGF
179 //! \return The duration in seconds
180 //!
181 //! Returns the time in seconds to wait after player disengages before
182 //! allowing CGF to control gun aiming. This prevents unwanted elevation
183 //! resets during role swaps.
184 //!
185 //! \see setReturnGunToCGFControlDuration()
186 //! \see myReturnGunToCGFControlDuration
187 virtual DtReal returnGunToCGFControlDuration() const;
188
189 //! \brief Sets the duration before returning gun control to CGF
190 //! \param duration The duration in seconds (must be >= 0)
191 //!
192 //! Sets the time in seconds to wait after player disengages before
193 //! allowing CGF to control gun aiming. This prevents unwanted elevation
194 //! resets during role swaps.
195 //!
196 //! \see returnGunToCGFControlDuration()
197 //! \see myReturnGunToCGFControlDuration
198 virtual void setReturnGunToCGFControlDuration(DtReal duration);
199
200 //! \brief Factory function to create a new instance of this descriptor
201 //! \return Pointer to a newly created descriptor
202 //!
203 //! Static factory function used by the descriptor creation system to instantiate
204 //! new instances of this descriptor type.
205 static DtComponentDescriptor* creator();
206
207private:
208 //! \brief Default constructor (not implemented)
209 //!
210 //! Default constructor is private and not implemented to prevent
211 //! creation of instances without proper initialization.
213
214protected:
215 //! \brief List of ammunition load times
216 //!
217 //! Stores the list of ammunition types and their associated load times.
218 //! This defines the loading time for each type of ammunition this gun can use.
220
221 //! \brief Maximum range of the weapon
222 //!
223 //! The maximum effective range of this weapon in meters.
224 //! Parameter name: "max-range"
225 //! Default value: 2000.0 meters
226 DtRwReal myMaxRange;
227
228 //! \brief Joystick function group identifier
229 //!
230 //! String used to distinguish fire input meant for this weapon from other weapons.
231 //! This allows multiple weapons to be controlled by different joystick bindings.
233
234 //! \brief Flag for maximum range detonation
235 //!
236 //! When true, projectiles will detonate when they reach maximum range
237 //! if there is no line-of-sight collision before that point.
238 //! Parameter name: "max-range-detonation"
239 //! Default value: False
241
242 //! \brief Initial munition entity type
243 //!
244 //! The entity type of the munition that should be set as the
245 //! initial current munition for this weapon.
246 //! Parameter name: "initial-munition"
247 DtRwEntityType myInitialMunition;
248
249 //! \brief Flag for creating flyout projectiles
250 //!
251 //! When true, this weapon creates visible projectile entities when fired,
252 //! rather than just simulating ballistic trajectories.
253 //! Parameter name: "create-flyout-projectile"
254 //! Default value: False
256
257 //! \brief Type of projectile to create
258 //!
259 //! The type of projectile entity to create when the weapon is fired.
260 //! This is used when createFlyOutProjectile is set to true.
261 //! Parameter name: "projectile-type"
262 //! Default value: "DtProjectile"
264
265 //! \brief Duration before returning gun control to CGF
266 //!
267 //! Time in seconds to wait after player disengages before allowing CGF to
268 //! control gun aiming. This prevents unwanted elevation resets during role swaps.
269 //!
270 //! Sysdef parameter: `return-gun-to-cgf-control-duration`
271 //!
272 //! \note Default value is 2.0 seconds
273 //! \see returnGunToCGFControlDuration()
274 //! \see setReturnGunToCGFControlDuration()
276};
277} // namespace makVre
DtRwReal myMaxRange
Maximum range of the weapon.
Definition vreBallisticGunDescriptor.h:226
virtual DtString type() const override
Gets the type identifier for this descriptor.
DtRwBoolean myCreateFlyOutProjectile
Flag for creating flyout projectiles.
Definition vreBallisticGunDescriptor.h:255
DtRwString myProjectileType
Type of projectile to create.
Definition vreBallisticGunDescriptor.h:263
virtual void setAmmoLoadTimeList(const DtAmmoLoadTimeList &ammoLoadTimeList)
Sets the ammunition load time list.
static DtComponentDescriptor * creator()
Factory function to create a new instance of this descriptor.
virtual ~DtVreBallisticGunDescriptor() override
Virtual destructor.
DtRwString myJoystickFunctionGroup
Joystick function group identifier.
Definition vreBallisticGunDescriptor.h:232
virtual void setMaxRangeDetonation(DtBoolean maxRangeDetonation)
Sets whether projectiles detonate at maximum range.
virtual const DtEntityType & initialMunition() const
Gets the initial munition type.
virtual DtAmmoLoadTimeList ammoLoadTimeList() const
Gets the ammunition load time list.
virtual void setProjectileType(const DtString &type)
Sets the projectile type.
DtVreBallisticGunDescriptor(const DtSymbolString &componentName, DtReaderWriterRegistry *parentRegistry=0)
Constructor with component name as symbol string.
DtRwReal myReturnGunToCGFControlDuration
Duration before returning gun control to CGF.
Definition vreBallisticGunDescriptor.h:275
virtual DtBoolean createFlyOutProjectile() const
Checks if flyout projectiles are created.
virtual void setReturnGunToCGFControlDuration(DtReal duration)
Sets the duration before returning gun control to CGF.
virtual const DtString & projectileType() const
Gets the projectile type.
DtVreBallisticGunDescriptor & operator=(const DtVreBallisticGunDescriptor &orig)
Assignment operator.
DtVreBallisticGunDescriptor(const DtVreBallisticGunDescriptor &orig, DtReaderWriterRegistry *parentRegistry=0)
Copy constructor.
DtRwEntityType myInitialMunition
Initial munition entity type.
Definition vreBallisticGunDescriptor.h:247
virtual void setInitialMunition(const DtEntityType &munition)
Sets the initial munition type.
virtual void setJoystickFunctionGroup(const DtString &group)
Sets the joystick function group.
DtVreBallisticGunDescriptor()
Default constructor (not implemented)
virtual DtReal maxRange() const
Gets the maximum range of the weapon.
DtRwBoolean myMaxRangeDetonation
Flag for maximum range detonation.
Definition vreBallisticGunDescriptor.h:240
virtual DtComponentDescriptor * clone(DtReaderWriterRegistry *parentRegistry=0) const override
Creates a clone of this descriptor.
virtual DtReal returnGunToCGFControlDuration() const
Gets the duration before returning gun control to CGF.
virtual const DtString & joystickFunctionGroup() const
Gets the joystick function group.
DtAmmoLoadTimeList myAmmoLoadTimeList
List of ammunition load times.
Definition vreBallisticGunDescriptor.h:219
virtual void setMaxRange(DtReal maxRange)
Sets the maximum range of the weapon.
DtVreBallisticGunDescriptor(const DtString &componentName, DtReaderWriterRegistry *parentRegistry=0)
Constructor with component name.
virtual void setCreateFlyOutProjectile(DtBoolean createFlyOutProjectile)
Sets whether flyout projectiles are created.
virtual DtBoolean maxRangeDetonation() const
Checks if projectiles detonate at maximum range.
Export macros for the VREngage Object Parameter library.
#define VREVRFOBJPARAM_DLL
Platform-specific DLL export/import declaration.
Definition export.h:27
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
DtRwTemplatedListPtr< DtAmmoLoadTime, true > DtAmmoLoadTimeList
List of ammunition loading time parameters.
Definition ammoLoadTime.h:142
const char DtVreBallisticGunDescriptorType[]
Type identifier string for the VREngage ballistic gun descriptor.
Definition vreBallisticGunDescriptor.h:24