![]() |
VR-Forces 4.0.4 Class Documentation
|
DtBallisticGunController provides ammunition loading, unloading, and trigger inputs for use by a ballistic gun actuator. More...

Public Member Functions | |
| DtBallisticGunController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtBallisticGunController () |
| destructor | |
| virtual bool | postAddComponentsInit () |
| Override to call lookupAndCacheProcessSR() (another component creates it - we just look it up and keep a pointer to it). | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual bool | init () |
| Sets up weapon component interface. | |
| virtual void | tick () |
| Calculate new control values. | |
| virtual bool | createTriggerPort () |
| These are called in init to create the ports used to communicate with the actuator. | |
| virtual DtBooleanOutputPort * | triggerPort () const |
| virtual bool | createQuantityOutputPort () |
| virtual DtIntegerOutputPort * | quantityOutputPort () const |
| virtual bool | createLoadedPort () |
| virtual DtBooleanOutputPort * | loadedPort () const |
| virtual bool | createLosOutputPort () |
| virtual DtIntegerOutputPort * | losOutputPort () const |
| virtual bool | createLosInputPort () |
| virtual DtIntegerInputPort * | losInputPort () const |
| virtual bool | createWeaponsHoldInputPort () |
| virtual bool | createTargetToAcquireOutputPort () |
| virtual void | setLoadAmmoTime (DtTime loadAmmoTime) |
| virtual DtTime | loadAmmoTime () const |
| virtual void | setUnloadAmmoTime (DtTime unloadAmmoTime) |
| virtual DtTime | unloadAmmoTime () const |
| virtual void | fire () |
| Sets myTriggerPort to true and myLoaded to false. | |
| virtual bool | chooseAmmo (DtVrfObject *entity, DtSimMunition &munition, DtDetonatorFuze &fuze, int &ammoAvailable) |
| The chooseAmmo() function is passed a pointer to a target entity and returns the best ammunition to use for the target’s entity type. | |
| virtual void | initProcessSR () |
| Sets the load & unload ammo time from the component descriptor. | |
Static Public Member Functions | |
| static DtSimComponent * | creator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
Protected Member Functions | |
| virtual bool | createPorts () |
| Called by init to create the output ports. | |
| virtual bool | createPortGroups () |
| Called by init to create myGunControlPortGroup. | |
| virtual void | lookupAndCacheProcessSR () |
This function looks up a process state repository in the process state repository manager by name, and caches a pointer to it in
myProcessState. | |
| virtual bool | weaponsHoldState () |
| DtBallisticGunController () | |
| Not implemented. | |
| DtBallisticGunController (const DtBallisticGunController &orig) | |
| Not implemented. | |
| const DtBallisticGunController & | operator= (const DtBallisticGunController &orig) |
| Not implemented. | |
Protected Attributes | |
| DtEntityIdentifier | myPreviousTarget |
| Maintain the target we had last tick (if any) to detect changes in target (which will kick off possible ammo reload. | |
| DtSimMunition | myCurrentMunition |
| The correct munition and fuze for our current target. | |
| DtDetonatorFuze | myCurrentFuze |
| int | myRoundsAvailable |
| The quantity of the current munition in the resources store. | |
| DtVrfBalGunPSR * | myProcessState |
| Pointer to a process state repository used to store state data associated with this component. | |
| const DtBallisticGunControllerDescriptor * | myGunDescriptor |
| Get ammo select tables from here. | |
| bool | myWaitingForFire |
| This flag is set to true when the controller pulls the trigger, and set back to false when the controllers sees that the loaded munition has been unloaded (by the gun). | |
| bool | myFirstTick |
| bool | myOutOfAmmoWarn |
| Flag so an out-of-ammo warning is only sent once per target. | |
| DtWeaponComponentInterface * | myWeaponComponentInterface |
| Interface between this weapon controller and the entity's DtTargetSelectionController. | |
Ports and Port Groups | |
| DtIntegerInputPort * | myLosInputPort |
| Input Port Name: line-of-sight Input Port Description: Indicates the result of a line of sight calculation to the current target. | |
| DtBooleanOutputPort * | myTriggerPort |
| Output Port Name: trigger Output Port Description: Sends a new True value when trigger is pulled. | |
| DtIntegerOutputPort * | myQuantityOutputPort |
| Output Port Name: quantity Output Port Description: Sends the number of rounds to be fired with a single trigger pull. | |
| DtBooleanOutputPort * | myLoadedPort |
| Output Port Name: loaded Output Port Description: True when the gun is loaded. | |
| DtIntegerOutputPort * | myLosOutputPort |
| Output Port Name: line-of-sight Output Port Description: Indicates the result of a line of sight calculation to the current target. | |
| DtOutputPortGroup * | myGunControlPortGroup |
| Output Port Group Name: gun-control Output Port Group Description: | |
| DtBooleanInputPort * | myWeaponsHoldInputPort |
| Input Port Name: weapons-hold Input Port Description: When true, all firing is disabled. | |
| DtEntityListOutputPort * | myTargetToAcquireOutputPort |
| Output Port Name: target-to-acquire Output Port Description: When there is a target in the weapon interface, it is put onto this output port. | |
DtBallisticGunController provides ammunition loading, unloading, and trigger inputs for use by a ballistic gun actuator.
End User Description: It chooses ammunition to load based on entity type according to criteria specified in the DtBallisticGunControllerDescriptor used to specify the component. Load and unload times are also provided in this manner. If the entity has permission to fire, has acquired a target, and has the appropriate ammunition loaded, the DtBallisticGunController sets the trigger port to true, firing the ballistic gun.
Uses Descriptor Type: DtBallisticGunControllerDescriptor
| DtBallisticGunController::DtBallisticGunController | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
| virtual DtBallisticGunController::~DtBallisticGunController | ( | ) | [virtual] |
destructor
| DtBallisticGunController::DtBallisticGunController | ( | ) | [protected] |
Not implemented.
| DtBallisticGunController::DtBallisticGunController | ( | const DtBallisticGunController & | orig | ) | [protected] |
Not implemented.
| virtual bool DtBallisticGunController::postAddComponentsInit | ( | ) | [virtual] |
Override to call lookupAndCacheProcessSR() (another component creates it - we just look it up and keep a pointer to it).
Also calls initProcessSR().
Reimplemented from DtSimComponent.
| virtual DtString DtBallisticGunController::type | ( | ) | const [virtual] |
Returns a string identifies the class type of component.
Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.
Reimplemented from DtControllerComponent.
Reimplemented in DtBallisticGunJoyController.
| virtual bool DtBallisticGunController::init | ( | ) | [virtual] |
Sets up weapon component interface.
Reimplemented from DtControllerComponent.
| virtual void DtBallisticGunController::tick | ( | ) | [virtual] |
Calculate new control values.
The first call to tick will restore the checkpointed values of myCurrentMunition and myCurrentFuze from the the munition loader of the DtVrfBalGunPSR.
Reimplemented from DtSimComponent.
Reimplemented in DtBallisticGunJoyController.
| virtual bool DtBallisticGunController::createTriggerPort | ( | ) | [virtual] |
These are called in init to create the ports used to communicate with the actuator.
| virtual DtBooleanOutputPort* DtBallisticGunController::triggerPort | ( | ) | const [virtual] |
| virtual bool DtBallisticGunController::createQuantityOutputPort | ( | ) | [virtual] |
| virtual DtIntegerOutputPort* DtBallisticGunController::quantityOutputPort | ( | ) | const [virtual] |
| virtual bool DtBallisticGunController::createLoadedPort | ( | ) | [virtual] |
| virtual DtBooleanOutputPort* DtBallisticGunController::loadedPort | ( | ) | const [virtual] |
| virtual bool DtBallisticGunController::createLosOutputPort | ( | ) | [virtual] |
| virtual DtIntegerOutputPort* DtBallisticGunController::losOutputPort | ( | ) | const [virtual] |
| virtual bool DtBallisticGunController::createLosInputPort | ( | ) | [virtual] |
| virtual DtIntegerInputPort* DtBallisticGunController::losInputPort | ( | ) | const [virtual] |
| virtual bool DtBallisticGunController::createWeaponsHoldInputPort | ( | ) | [virtual] |
| virtual bool DtBallisticGunController::createTargetToAcquireOutputPort | ( | ) | [virtual] |
| virtual void DtBallisticGunController::setLoadAmmoTime | ( | DtTime | loadAmmoTime | ) | [virtual] |
| virtual DtTime DtBallisticGunController::loadAmmoTime | ( | ) | const [virtual] |
| virtual void DtBallisticGunController::setUnloadAmmoTime | ( | DtTime | unloadAmmoTime | ) | [virtual] |
| virtual DtTime DtBallisticGunController::unloadAmmoTime | ( | ) | const [virtual] |
| virtual void DtBallisticGunController::fire | ( | ) | [virtual] |
Sets myTriggerPort to true and myLoaded to false.
It also looks up the resource named by myCurrentMunitionName and if found, calls DtIntegerResource::deplete().
| virtual bool DtBallisticGunController::chooseAmmo | ( | DtVrfObject * | entity, |
| DtSimMunition & | munition, | ||
| DtDetonatorFuze & | fuze, | ||
| int & | ammoAvailable | ||
| ) | [virtual] |
The chooseAmmo() function is passed a pointer to a target entity and returns the best ammunition to use for the target’s entity type.
Type of ammunition and availability, if any, is from the Ammo Select Table specified in the DtBallisticGunControllerDescriptor. chooseAmmo() starts at the beginning of the list of appropriate ammunition types, and returns the first one for which the resource is available. DtFuzeOther is returned for the fuze.
| virtual void DtBallisticGunController::initProcessSR | ( | ) | [virtual] |
Sets the load & unload ammo time from the component descriptor.
| static DtSimComponent* DtBallisticGunController::creator | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) | [static] |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
Reimplemented in DtBallisticGunJoyController.
| virtual bool DtBallisticGunController::createPorts | ( | ) | [protected, virtual] |
Called by init to create the output ports.
Reimplemented from DtSimComponent.
Reimplemented in DtBallisticGunJoyController.
| virtual bool DtBallisticGunController::createPortGroups | ( | ) | [protected, virtual] |
Called by init to create myGunControlPortGroup.
Reimplemented from DtSimComponent.
| virtual void DtBallisticGunController::lookupAndCacheProcessSR | ( | ) | [protected, virtual] |
This function looks up a process state repository in the process state repository manager by name, and caches a pointer to it in
The name (if it exists) is given in the component descriptor (DtComponentDescriptor::processStateRepositoryName). If the name does not exist, it uses the appropriate default name defined in procSRTypes.h. Another component is responsible for creating and destroying the process state repository.
| virtual bool DtBallisticGunController::weaponsHoldState | ( | ) | [protected, virtual] |
| const DtBallisticGunController& DtBallisticGunController::operator= | ( | const DtBallisticGunController & | orig | ) | [protected] |
Not implemented.
Input Port Name: line-of-sight
Input Port Description: Indicates the result of a line of sight calculation to the current target.
Input Port Range: 0 = Unknown, 1 = Blocked, 2 = Clear
Input Port Default Value:
Input Group Parent:
Output Port Name: trigger
Output Port Description: Sends a new True value when trigger is pulled.
Output Port Range:
Output Port Default Value:
Output Group Parent: gun-control
Output Port Name: quantity
Output Port Description: Sends the number of rounds to be fired with a single trigger pull.
Output Port Range:
Output Port Default Value:
Output Group Parent: gun-control
Output Port Name: loaded
Output Port Description: True when the gun is loaded.
Output Port Range:
Output Port Default Value:
Output Group Parent: gun-control
Output Port Name: line-of-sight
Output Port Description: Indicates the result of a line of sight calculation to the current target.
Output Port Range: 0 = Unkown, 1 = Blocked, 2 = Clear
Output Port Default Value:
Output Group Parent: gun-control
Output Port Group Name: gun-control
Output Port Group Description:
Input Port Name: weapons-hold
Input Port Description: When true, all firing is disabled.
Connecting to this port is optional. If no connection is made, it will default to false.
Input Port Range: True/False
Input Port Default Value: False
Output Port Name: target-to-acquire
Output Port Description: When there is a target in the weapon interface, it is put onto this output port.
DtEntityIdentifier DtBallisticGunController::myPreviousTarget [protected] |
Maintain the target we had last tick (if any) to detect changes in target (which will kick off possible ammo reload.
The correct munition and fuze for our current target.
DtDetonatorFuze DtBallisticGunController::myCurrentFuze [protected] |
int DtBallisticGunController::myRoundsAvailable [protected] |
The quantity of the current munition in the resources store.
DtVrfBalGunPSR* DtBallisticGunController::myProcessState [protected] |
Pointer to a process state repository used to store state data associated with this component.
This process state repository is shared with other components. Another component is responsible for creating and destroying the process state repository. This state is saved and restored as part of a scenario (or checkpoint).
const DtBallisticGunControllerDescriptor* DtBallisticGunController::myGunDescriptor [protected] |
Get ammo select tables from here.
bool DtBallisticGunController::myWaitingForFire [protected] |
This flag is set to true when the controller pulls the trigger, and set back to false when the controllers sees that the loaded munition has been unloaded (by the gun).
bool DtBallisticGunController::myFirstTick [protected] |
bool DtBallisticGunController::myOutOfAmmoWarn [protected] |
Flag so an out-of-ammo warning is only sent once per target.
Interface between this weapon controller and the entity's DtTargetSelectionController.