|
VR-Engage
2.2
|
DtVreHumanDamageActuator handles damage adjudication for human entities. It defines different areas of the human body and calculates the amount of damage received when hit in those areas based on posture, hit location, and weapon characteristics. The actuator maintains separate health values for overall health, mobility, and firepower, which can be affected differently depending on the hit location.
#include <vreHumanDamageActuator.h>
Public Member Functions | |
| DtVreHumanDamageActuator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| virtual | ~DtVreHumanDamageActuator () override |
| virtual const char * | type () const override |
| virtual bool | init () override |
| virtual void | tick () override |
| virtual bool | adjudicateDirectDamage (const DtDetonationContext &detonationContext) override |
| virtual bool | adjudicateCollateralDamage (const DtDetonationContext &detonationContext) override |
Public Member Functions inherited from makVre::DtVreSimComponent< DtHumanDamageActuator > | |
| DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| virtual | ~DtVreSimComponent () |
| bool | isPlayerControlled (const std::string &role="") const |
| DtString | entitySystemName () const |
Static Public Member Functions | |
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
Protected Types | |
| using | DtDamageZoneInfo |
| using | DtDamageMap = std::map<std::string, DtDamageZoneInfo> |
Protected Member Functions | |
| virtual void | updateState (DtDamageState state) override |
| virtual void | setDestroyed () override |
| virtual void | setRestored () override |
| void | sendSetPosture (DtLifeformState post) |
| void | initPostureDamageMaps () |
Protected Attributes | |
| std::map< DtLifeformState, DtDamageMap > | myPostureDamageMap |
| DtRwInt * | myOverallHealth |
| DtRwInt * | myMobilityHealth |
| DtRwInt * | myFirepowerHealth |
| bool | myOpeOk |
Private Member Functions | |
| DtVreHumanDamageActuator (const DtVreHumanDamageActuator &other) | |
| DtVreHumanDamageActuator & | operator= (const DtVreHumanDamageActuator &other) |
|
protected |
Information about a body zone and its damage characteristics.
Specifies amount of damage caused when a specific body zone is hit. Each body zone can affect different health aspects differently.
|
protected |
Damage map for body parts indexed by body zone name.
Maps body zone names to their corresponding damage information. The key is the bodyZoneName string.
| makVre::DtVreHumanDamageActuator::DtVreHumanDamageActuator | ( | const DtString & | name, |
| DtLocalObject * | owner, | ||
| DtSimulationServices * | simManager, | ||
| DtComponentDescriptor * | desc = 0, | ||
| DtReaderWriterRegistry * | parentRegistry = 0 ) |
Constructor.
| name | The name of this component |
| owner | The local object that owns this component |
| simManager | The simulation services manager |
| desc | Component descriptor with configuration parameters |
| parentRegistry | Optional parent registry for reader/writer functionality |
Creates a new human damage actuator component with the specified parameters.
Referenced by DtVreHumanDamageActuator(), and operator=().
|
overridevirtual |
Virtual destructor.
Cleans up resources used by the human damage actuator component.
|
private |
Copy constructor (not implemented)
Copy constructor is private and not implemented to prevent copy construction.
References DtVreHumanDamageActuator().
|
overridevirtual |
Gets the type identifier for this component.
Implements the DtSimComponent::type() method to return the type identifier for this component.
|
overridevirtual |
Initializes the human damage actuator.
Performs initial setup of the human damage actuator, including setting up body zone damage maps and connecting to entity state variables. This method is called during component initialization.
|
overridevirtual |
Updates the actuator state each simulation frame.
Processes the human entity's damage state during each simulation frame. This includes checking current health values and updating the entity's state accordingly, such as changing posture when health drops below certain thresholds.
|
overridevirtual |
Processes direct damage from a detonation.
| detonationContext | Information about the detonation that hit the entity |
Determines damage from a direct impact on the entity and decrements the hit points on the entity if appropriate. The amount of damage depends on the hit location, entity posture, and weapon characteristics.
|
overridevirtual |
Processes collateral damage from a nearby detonation.
| detonationContext | Information about the detonation that occurred near the entity |
Determines collateral damage from an impact near the entity, based on the distance from the detonation, weapon type, and other factors. Applies appropriate health reductions based on the blast effects.
|
static |
Factory method to create a new instance of this component.
| name | The name for the new component |
| owner | The local object that will own this component |
| simManager | The simulation services manager |
| desc | Optional component descriptor |
| parentRegistry | Optional parent registry for reader/writer functionality |
Static factory method used by the component creation system to instantiate new instances of this component type.
|
overrideprotectedvirtual |
Updates the damage state of the entity.
| state | The new damage state to apply to the entity |
Updates the entity's damage state and applies appropriate visual and functional effects based on the new state. This may include changing appearance, posture, or mobility capabilities.
|
overrideprotectedvirtual |
Sets the entity to a destroyed state.
Sets the entity to a destroyed state when health reaches zero. This includes updating visual appearance, disabling mobility, and potentially triggering death animations.
|
private |
Assignment operator (not implemented)
Assignment operator is private and not implemented to prevent assignment.
References DtVreHumanDamageActuator().
|
overrideprotectedvirtual |
Restores an entity to a functional state.
Re-registers the entity to receive detonations since it is now restored. This is called when an entity's health is reset or restored after being damaged or destroyed.
|
protected |
Changes the entity's posture.
| post | The new posture to set for the entity |
Changes the entity's posture, typically used to knock the entity to the ground when significantly damaged. This sends the appropriate commands to update the entity's visual representation and movement capabilities.
|
protected |
Initializes the posture-specific damage maps.
Sets up the damage maps for different postures, defining how much damage is applied to different body zones in each posture. This is a temporary implementation until damage maps can be read from configuration files.
|
protected |
Map of damage maps for different postures.
Each posture (standing, prone, etc.) has its own damage map defining how much damage is applied to different body zones in that posture.
|
protected |
Entity's overall health value.
State property defined in the Human OPE file, representing the entity's overall health status.
|
protected |
Entity's mobility health value.
State property defined in the Human OPE file, representing the entity's ability to move effectively.
|
protected |
Entity's firepower health value.
State property defined in the Human OPE file, representing the entity's ability to use weapons effectively.
|
protected |
Flag indicating if OPE access is valid.
Indicates whether the component was able to successfully access the OPE (Object Property Editor) state variables.