VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
weaponController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
12 
13 #pragma once
16 #include "vrfutil/simMunition.h"
18 #include "vrfobjcore/boolIOPort.h"
21 
22 class DtObjectIdPort;
23 
26 class DtSimMessage;
32 
60 {
61 
62 public:
63 
66  DtWeaponController(const DtString& name,
67  DtLocalObject* owner,
68  DtSimulationServices* simManager,
69  DtComponentDescriptor* desc = nullptr,
70  DtReaderWriterRegistry* parentRegistry = nullptr);
71 
73  virtual ~DtWeaponController() override;
74 
77  virtual const char* type() const override;
78 
80  virtual bool createMountingController() override;
81 
82  virtual bool init() override;
83 
86  virtual void preFirstTickInit() override;
87 
94  virtual void tick() override;
95 
97  virtual void fire() override;
98 
107  virtual const DtSimObject* chooseTarget();
108 
113  virtual DtSimObjectReference chooseTarget(const DtEntityTargetList& targetList) const;
114 
123  virtual const DtVector chooseLocationTarget();
124 
135  virtual const DtSimObject* chooseTargetWithOffset(DtVector& offset);
136 
141  virtual void tickMunitionLoader(const DtSimObject* target);
142 
163  virtual bool acquireTarget(const DtSimObject* target);
164 
167  virtual bool acquireLocationTarget(const DtVector locTarget);
168 
172  virtual bool acquireTargetWithOffset(const DtSimObject* target, const DtVector& offset);
173 
179  virtual void maneuverRequiredToAcquireTarget(DtReal requiredHeading,
180  DtReal requiredPitch,
181  DtReal requiredMaxSpeed);
182 
184  bool outOfAmmo() const;
185 
190  virtual bool loadedAmmoValidForTarget(const DtSimObject* target) const;
191 
208  virtual bool chooseAmmo(const DtEntityType& entityType,
209  DtSimMunition& munitionOut, DtDetonatorFuze& fuzeOut,
210  bool setCurrentMunition = true);
211 
217  virtual bool acceptSensorTargettingInput();
218 
222  virtual bool inSector(const DtSimObject* entity) const;
223 
226  virtual void findBodyHeadingElevationToTarget(const DtSimObject* entity,
227  DtReal &bodyHeadingOut,
228  DtReal &bodyElevationOut) const;
229 
233  virtual DtSimObjectReference easier(DtSimObjectReference entity1, DtSimObjectReference entity2) const;
234 
238  static DtSimComponent * creator(const DtString& name,
239  DtLocalObject* owner,
240  DtSimulationServices* simManager,
241  DtComponentDescriptor* desc = nullptr,
242  DtReaderWriterRegistry* parentRegistry = nullptr);
243 
244 
245  virtual void enable() override;
246 
247  virtual void disable() override;
248 
249 protected:
250 
252  virtual bool createPorts() override;
253 
255  virtual void addRangeItems();
256 
257  virtual DtWeaponInfoInterface::TargetApplicability targetApplicability(const DtEntityType& type);
258 
262  [[deprecated("Use canEngageTarget() on the PSR -- see TODO(DEPRECATED-TargetRegionFcn)")]]
263  virtual bool positionWithinTargetRegion(const DtVector& localPosition);
264  virtual void setupRegionEvaluator();
266  virtual void updateRegionEvaluator();
267 
268  virtual double maximumRange();
269  virtual double minimumRange();
270 
271 protected:
272 
275 
278 
281  orig);
282 
283 
284 //=================================================================================================
291 //=================================================================================================
292 protected:
295 
296  virtual bool isFireMissileLauncherTasked() const;
297  virtual const DtFireMissileLauncherTask* getFireMissileLauncherTask() const;
298  const DtEntityTargetInformation createTargetInfo() const;
299  bool hasTarget() const;
300 
302  virtual const DtRwLocationReference::LocationType targetLocationType() const;
303 
305  virtual const DtEntityTargetInformation target() const;
306 
308  virtual const DtVector locationTarget() const;
309 
310  void setRoundsFiredUponTarget(const int& roundsFired);
311  const int roundsFiredUponTarget() const;
312  const int totalRoundsToFireUponTarget() const;
313  void setIsExplicitlyTasked(const bool& explicitlyTasked);
314  const bool isExplicitlyTasked() const;
315  void setWeaponStatus(const int weaponStatus);
316  const int weaponStatus() const;
317  void addWeaponStatus(const DtBaseWeaponComponentInterface::DtWeaponStatus weaponStatus);
318  void removeWeaponStatus(const DtBaseWeaponComponentInterface::DtWeaponStatus weaponStatus);
320 //=================================================================================================
321 
322 
323 protected:
324 
326 
329 
337 
339 
340 
343 
346 
347  std::map<DtString, DtSimMunition> myUsableMunitions;
348 
350 
351  std::shared_ptr<DtSpatialFilterEvaluator> myRegionEvaluator;
353  double myTaskGiveUpTime = -1.0;
354 };
std::map< DtString, DtSimMunition > myUsableMunitions
Definition: weaponController.h:347
UUID is a unique ID wrapper class.
Definition: uuid.h:59
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
DtMountingController; models rotation of a launcher.
Definition: mountingController.h:23
DtTargetApplicability
Applicability tier of a weapon against a given target type.
Definition: targetApplicability.h:19
DtBaseWeaponController is a controller that creates the ports needed to choose ammo for...
Definition: baseWeaponController.h:34
Task for firing the missile launcher at a target.
Definition: fireMissileLauncherTask.h:25
DtWeaponController is a controller that extends the DtBaseWeaponController with the ability to accept...
Definition: weaponController.h:59
std::shared_ptr< DtSpatialFilterEvaluator > myRegionEvaluator
Definition: weaponController.h:351
virtual const char * type() const override
Returns a string identifies the class type of component. Type values are defined in compTypes...
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
Definition: readerWriterRegistry.h:39
Definition: entityTargetInformation.h:28
LocationType
Definition: rwLocationReference.h:28
This file contains the class declaration for the.
DtMountingController * myMountingController
Definition: weaponController.h:341
const DtBaseWeaponController & operator=(const DtBaseWeaponController &orig)
assignment operator; not implemented
virtual bool createPorts() override
Overridden to create input &amp; output ports.
Contains class declarations for DtEntityListInputPort, DtEntityListOutputPort, and DtEntityListPortDa...
Definition: entListIOPort.h:29
virtual void disable() override
Overridden to 1) remove any task message callbacks registered by this controller 2) call clear task...
An implementation of DtWeaponInforInterface that allows for flexible registering of functions from ot...
Definition: genericWeaponInfo.h:18
File: simMsg.h.
Definition: simMessage.h:35
An abstract base class for all evaluators of spatial filters. The evaluation of spatial filters is sp...
Definition: spatialFilterEvaluator.h:31
Contains class declarations for DtBooleanInputPort, DtBooleanOutputPort, and DtBooleanPortData.
Definition: boolIOPort.h:25
DtWeaponComponentInterface * myWeaponComponentInterface
Definition: weaponController.h:344
virtual void fire()
fires the weapon
virtual void preFirstTickInit() override
This function can be overridden to initialize a component before it is ticked for the first time...
DtWeaponStatus
The status items below are used as bit fields. To set a state, OR the enumerated value into the weapo...
Definition: baseWeaponComponentInterface.h:36
virtual bool createMountingController()
Creates myBaseMountingController.
DtUUID myCurrentTarget
Definition: weaponController.h:325
DtTime myLastRegionEvaluatorUpdateTime
Definition: weaponController.h:352
virtual void tick() override
Sets the current dT on the base mounting controller and ticks it.
DtGenericWeaponInfo * myWeaponInfo
Definition: weaponController.h:345
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:97
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=nullptr, DtReaderWriterRegistry *parentRegistry=nullptr)
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:80
virtual void enable() override
Overridden to call registerTaskMsgCallbacks().
const DtWeaponControllerDescriptor * myWeaponCtlrDesc
Definition: weaponController.h:342
double myMaxMunitionEffectiveRange
Definition: weaponController.h:349
virtual bool init() override
Overridden to initialize values obtained from the descriptor.
voidpf uLong offset
Definition: ioapi.h:42
DtSimMunition class.
Definition: simMunition.h:31
DtBooleanInputPort * myWeaponsHoldPort
Input Port Name: weapons-hold Input Port Description: When true, all firing of missiles is disabled...
Definition: weaponController.h:336
Represents the interface between the DtTargetSelectionController and a weapon system.
Definition: weaponComponentInterface.h:20
A locally simulated VRF object.
Definition: localObject.h:98
DtWeaponControllerDescriptor; descriptor for the DtWeaponController component.
Definition: weaponControllerDescriptor.h:26

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)