|
VR-Engage
2.2
|
DtWeaponResourceLogic tracks available weapon systems and munitions, processes resource list updates from simulation state messages, and maintains weapon-related state attributes. It maps between internal system names and human-readable names, handles resource dependencies, and enables weapons based on equipment availability.
#include <weaponResourceLogic.h>
Public Member Functions | |
| DtWeaponResourceLogic () | |
| virtual | ~DtWeaponResourceLogic () override |
| virtual bool | initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override |
| virtual bool | postInitialize () override |
| virtual void | tick (double dt) override |
| virtual void | shutdown () override |
| virtual const char * | type () const override |
| virtual std::vector< std::string > | resourceMappingKeys () |
| virtual std::string | lookUpShortName (const std::string &vrfResourceName) |
| virtual std::string | lookUpDiguyHandItem (const std::string &vrfResourceName) |
| virtual std::string | lookUpResourceByDeployedEquipment (const DtEntityType &equipmentType) |
| virtual bool | doesHandItemMatch (const std::string &vrfResourceName, const std::string &handItem) |
| template<typename T> | |
| T | lookUpField (std::string resource, const std::string &field, T defaultValue) |
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 makVre::DtVreMessageResult | handleResourceUpdate (makVre::DtVreMessage *msg) |
| virtual void | resourceChanged (const DtAttributeHandle &changed) |
| virtual void | addWeaponToList (const std::string &resource) |
| virtual void | removeWeaponFromList (const std::string &resource) |
Protected Member Functions inherited from makVre::DtPlayerComponent | |
| virtual void | initializeStateAttributes () |
Protected Attributes | |
| DtInitTable | myResourceMappings |
| DtAttributeHandleType< std::vector< std::string > > | myResourceStore |
| DtAttributeChangeCallback | myResourceCallback |
Protected Attributes inherited from makVre::DtPlayerComponent | |
| std::string | myName |
| DtInitTable | myConfig |
| DtPlayerStation * | myPlayer |
| makVrv::DtDe * | myDe |
| DtEntityResolver * | myResolver |
| DtAttributeCallbackManager | myAttributeCallbacks |
| makVre::DtWeaponResourceLogic::DtWeaponResourceLogic | ( | ) |
Constructor for DtWeaponResourceLogic.
Initializes the component with default settings
|
overridevirtual |
Virtual destructor for DtWeaponResourceLogic.
|
overridevirtual |
Initializes the weapon resource logic component.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing resource mappings |
Reads resource mappings configuration, initializes state attributes, and sets up message handlers for simulation state updates
Reimplemented from makVre::DtPlayerComponent.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Performs post-initialization after all components are initialized.
Updates the weapon list based on the current resource list
Reimplemented from makVre::DtPlayerComponent.
|
overridevirtual |
Called every frame to update component state.
| dt | Delta time since the last frame in seconds |
Current implementation is empty as updates occur through message handlers
Implements makVre::DtPlayerComponent.
|
overridevirtual |
Shuts down the weapon resource logic component.
Removes message handlers and attribute change callbacks
Reimplemented from makVre::DtPlayerComponent.
|
overridevirtual |
Returns the type identifier for this component.
Implements makVre::DtPlayerComponent.
|
virtual |
Gets a list of all resource mappings keys.
Returns the list of all keys in the resource mappings table
|
virtual |
Looks up the human-readable short name for a resource.
| vrfResourceName | Resource name in VRF format (possibly with system prefix) |
Retrieves the human-readable short name for a given resource
|
virtual |
Looks up the diguy hand item for a resource.
| vrfResourceName | Resource name in VRF format |
Retrieves the diguy hand item corresponding to a resource
|
virtual |
Finds a resource name by matching against an entity type.
| equipmentType | Entity type to match against patterns |
Finds the resource name (table key) by checking a deployed equipment type against the patterns in the "deployedEquipmentTypes" table. The pattern represents the external entity the ownship entity is currently using (such as a tripod-mounted launcher).
|
virtual |
Checks if a hand item matches a resource.
| vrfResourceName | Resource name in VRF format |
| handItem | Hand item to check for a match |
Determines if a hand item matches either the primary diguy hand item or one of the alternative items in the itemMatches list
References lookUpField().
| T makVre::DtWeaponResourceLogic::lookUpField | ( | std::string | resource, |
| const std::string & | field, | ||
| T | defaultValue ) |
Looks up a field value for a resource in the resource mappings table.
| T | Type of the field value to retrieve |
| resource | Resource name in VRF format (possibly with system prefix) |
| field | Name of the field to look up |
| defaultValue | Default value to return if the field is not found |
Retrieves a field value from the resource mappings table, handling cases where the resource name may include system prefixes or contain special characters
References makVre::DtInitTable::findData(), makVre::DtLuaObject::hasField(), LOG_DEBUG, and myResourceMappings.
Referenced by doesHandItemMatch().
|
protectedvirtual |
Handles resource update.
| msg | Resource update |
Processes resource updates to update resource and equipment information
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protected |
Configuration table containing resource mappings.
Referenced by lookUpField().
|
protected |
|
protected |