|
VR-Engage
2.2
|
DtGunnerControlLogic provides input handling and simulation logic for gunner roles, including weapon control, turret movement, firing, aiming modes, and commander override capabilities. It manages weapon selection, zoom levels, sensor types, and slew-to-cue functionality for targeting systems.
#include <gunnerControlLogic.h>
Public Member Functions | |
| DtGunnerControlLogic () | |
| virtual | ~DtGunnerControlLogic () override |
| virtual bool | initialize (DtPlayerStation *player, DtInitTable &config) override |
| virtual bool | postInitialize () override |
| virtual void | tick (double dt) override |
| virtual void | shutdown () override |
| virtual const char * | type () const override |
| virtual void | fire (double val) |
| virtual void | azimuth (double val) |
| virtual void | elevation (double val) |
| virtual void | stabilize (double val) |
| virtual void | nextWeapon (double val) |
| virtual void | previousWeapon (double val) |
| virtual void | zoomIn (double val) |
| virtual void | zoomOut (double val) |
| virtual void | nextSensor (double val) |
| virtual void | cycleAimingMode () |
| virtual void | slewToCue (bool onoff) |
| virtual void | switchToAltRole () |
| virtual void | handleSlewToCue (float val) |
| virtual void | handleSwitchToAltRole (float val) |
| virtual void | turretUp (float val) |
| virtual void | turretDown (float val) |
| virtual void | turretRight (float val) |
| virtual void | turretLeft (float val) |
| virtual void | zoom (float val) |
| virtual void | missileX (double val) |
| virtual void | missileY (double val) |
| virtual void | toggleArmed () |
| virtual makVre::DtVreMessageResult | handleMenuMessage (makVre::DtVreMessage *msg) |
Public Member Functions inherited from makVre::DtEntityControlLogic | |
| DtEntityControlLogic () | |
| virtual | ~DtEntityControlLogic () override |
| virtual void | setExtendedData (const std::string &key, const std::string &value, DtEntityIdentifier entity=DtEntityIdentifier::nullId()) |
| 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 makVre::DtVreMessageResult | handleSimState (makVre::DtVreMessage *msg) |
| virtual makVre::DtVreMessageResult | handleStateMessages (makVre::DtVreMessage *message) |
| virtual makVre::DtVreMessageResult | handleReset (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 () |
| virtual void | setName (const std::string &name) |
| virtual const std::string & | name () |
| virtual DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
Protected Member Functions | |
| virtual bool | aimWithObserver () const |
| virtual void | setCommanderOverrideActive (bool active) const |
| void | sendJoystickMessage (const std::string &func, const double val) |
| virtual void | aimMissile (double x, double y) |
| virtual bool | canFire () |
Protected Member Functions inherited from makVre::DtEntityControlLogic | |
| virtual void | takeControlOfPlayerEntity () |
| virtual void | releaseControlOfPlayerEntity () |
Protected Member Functions inherited from makVre::DtPlayerComponent | |
| virtual void | initializeStateAttributes () |
| makVre::DtGunnerControlLogic::DtGunnerControlLogic | ( | ) |
Constructor for DtGunnerControlLogic.
Initializes component state and checks out required VRE_GROUND license
|
overridevirtual |
Destructor for DtGunnerControlLogic.
|
overridevirtual |
Initializes the gunner control logic component.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing gunner settings |
Sets up joystick controls, input handlers, state attributes, zoom levels, and configures extended weapon systems and slew-to-cue functionality
Reimplemented from makVre::DtEntityControlLogic.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Performs post-initialization after all components are initialized.
Locates and establishes connection with the DtWeaponResourceLogic component
Reimplemented from makVre::DtEntityControlLogic.
|
overridevirtual |
Called every frame to update gunner control logic.
| dt | Delta time since the last frame in seconds |
Updates weapon system state, handles extended weapon system targeting, manages slew-to-cue functionality, and sends firing position updates
Reimplemented from makVre::DtEntityControlLogic.
|
overridevirtual |
Shuts down the gunner control logic component.
Cleans up input handlers, message handlers, and disables commander override if active
Reimplemented from makVre::DtEntityControlLogic.
|
overridevirtual |
Returns the component type identifier.
Reimplemented from makVre::DtEntityControlLogic.
|
virtual |
Input functions mapped to particular action strings in configuration.
Handles weapon firing input
| val | Input value (1.0 = fire, 0.0 = stop firing) |
|
virtual |
Controls turret azimuth (horizontal rotation)
| val | Input value for azimuth rate (-1.0 to 1.0) |
|
virtual |
Controls turret elevation (vertical angle)
| val | Input value for elevation rate (-1.0 to 1.0) |
|
virtual |
Controls weapon stabilization system.
| val | Input value (1.0 = enable, 0.0 = disable) |
|
virtual |
Selects the next available weapon.
| val | Input value (1.0 = select next weapon) |
|
virtual |
Selects the previous available weapon.
| val | Input value (1.0 = select previous weapon) |
|
virtual |
Increases the sight magnification level.
| val | Input value (1.0 = zoom in one level) |
|
virtual |
Decreases the sight magnification level.
| val | Input value (1.0 = zoom out one level) |
|
virtual |
Cycles to the next available sensor type (visual, NVG, thermal)
| val | Input value (1.0 = select next sensor) |
|
virtual |
Cycles between available aiming modes.
|
virtual |
Activates or deactivates slew-to-cue functionality.
| onoff | True to activate slew-to-cue, false to deactivate |
|
virtual |
Switches between gunner and alternate role (e.g., commander RWS)
|
virtual |
Handles input for slew-to-cue activation.
| val | Input value (1.0 = activate, 0.0 = deactivate) |
|
virtual |
Handles input for switching to alternate role.
| val | Input value (1.0 = switch role) |
|
virtual |
Moves turret upward (direct control)
| val | Input value (0.0 to 1.0 for speed) |
|
virtual |
Moves turret downward (direct control)
| val | Input value (0.0 to 1.0 for speed) |
|
virtual |
Moves turret to the right (direct control)
| val | Input value (0.0 to 1.0 for speed) |
|
virtual |
Moves turret to the left (direct control)
| val | Input value (0.0 to 1.0 for speed) |
|
virtual |
Controls continuous zoom level directly.
| val | Input value (-1.0 to 1.0) for zoom direction and speed |
|
virtual |
Set x and y inputs for manual missile aiming.
|
virtual |
|
virtual |
Toggles armed state for a weapon that requires arming (weapons don't by default).
|
virtual |
Handles action menu messages for the gunner role.
| msg | The message to handle |
Processes menu actions like cycling weapons, sensors, aiming modes, and role switching
|
protectedvirtual |
Determines if aiming should use the observer's view.
|
protectedvirtual |
Sets the commander override active state.
| active | True to activate commander override, false to deactivate |
|
protected |
Sends a joystick message to the entity.
| func | Function name to trigger on the entity |
| val | Value to send with the function (typically -1.0 to 1.0) |
|
protectedvirtual |
Update missile's target point based on the x and y input. Called any time x and y are not 0.
|
protectedvirtual |
Returns true if the weapon can fire. Checks for range, azimuth and isArmed.
|
protected |
Previously used munition name, used to detect changes.
|
protected |
Primary control group name for this gunner station.
|
protected |
Input logic that handles mapping of input actions to functions.
|
protected |
Name of the weapon system controlled by this gunner.
|
protected |
Pointer to the weapon resource logic component.
|
protected |
Available zoom magnification levels.
|
protected |
Current index into the zoom levels array.
|
protected |
Configuration table for extended weapon systems.
|
protected |
Configuration for the currently active extended weapon system.
|
protected |
Current target location for extended weapon systems.
|
protected |
Element ID of the current target.
|
protected |
Name of the target system for slew-to-cue functionality.
|
protected |
Flag indicating if slew-to-cue is currently active.
|
protected |
Rate at which to send slew-to-cue updates (seconds)
|
protected |
Timer for tracking when to send the next slew-to-cue update.
|
protected |
Threshold for determining when to send updates based on angle change.
|
protected |
Last direction vector sent in a slew-to-cue message.
|
protected |
Name of the alternate role to switch to.
|
protected |
Flag indicating if this gunner is in override mode.
|
protected |
Name of the system to override.
|
protected |
Flag indicating if a weapon cycle operation is in progress.
|
protected |
Timer for delaying weapon cycling operations.
|
protected |
Allow the configuration to specify a resource name directly.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |