VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtVreHumanDamageActuator Class Reference

Detailed Description

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>

Inheritance diagram for makVre::DtVreHumanDamageActuator:
[legend]

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, DtDamageMapmyPostureDamageMap
 
DtRwInt * myOverallHealth
 
DtRwInt * myMobilityHealth
 
DtRwInt * myFirepowerHealth
 
bool myOpeOk
 

Private Member Functions

 DtVreHumanDamageActuator (const DtVreHumanDamageActuator &other)
 
DtVreHumanDamageActuatoroperator= (const DtVreHumanDamageActuator &other)
 

Member Typedef Documentation

◆ DtDamageZoneInfo

Initial value:
{
std::string bodyZoneName;
DtVector bodyZoneCenter;
bool useSurfaceData;
std::string surfaceName;
int overallHealthLoss;
int overallHealthLossModifier;
int mobilityHealthLoss;
int mobilityHealthLossModifier;
int firepowerHealthLoss;
int firepowerHealthLossModifier;
}
struct DtDamageZoneInfo { std::string bodyZoneName; DtVector bodyZoneCenter; bool useSurfaceData; std::string surfaceName; int overallHealthLoss; int overallHealthLossModifier; int mobilityHealthLoss; int mobilityHealthLossModifier; int firepowerHealthLoss; int firepowerHealthLossModifier; } DtDamageZoneInfo
Information about a body zone and its damage characteristics.
Definition vreHumanDamageActuator.h:170

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.

◆ DtDamageMap

using makVre::DtVreHumanDamageActuator::DtDamageMap = std::map<std::string, DtDamageZoneInfo>
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.

Constructor & Destructor Documentation

◆ DtVreHumanDamageActuator() [1/2]

makVre::DtVreHumanDamageActuator::DtVreHumanDamageActuator ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )

Constructor.

Parameters
nameThe name of this component
ownerThe local object that owns this component
simManagerThe simulation services manager
descComponent descriptor with configuration parameters
parentRegistryOptional parent registry for reader/writer functionality

Creates a new human damage actuator component with the specified parameters.

Referenced by DtVreHumanDamageActuator(), and operator=().

◆ ~DtVreHumanDamageActuator()

virtual makVre::DtVreHumanDamageActuator::~DtVreHumanDamageActuator ( )
overridevirtual

Virtual destructor.

Cleans up resources used by the human damage actuator component.

◆ DtVreHumanDamageActuator() [2/2]

makVre::DtVreHumanDamageActuator::DtVreHumanDamageActuator ( const DtVreHumanDamageActuator & other)
private

Copy constructor (not implemented)

Copy constructor is private and not implemented to prevent copy construction.

References DtVreHumanDamageActuator().

Member Function Documentation

◆ type()

virtual const char * makVre::DtVreHumanDamageActuator::type ( ) const
overridevirtual

Gets the type identifier for this component.

Returns
String identifying the component type (DtVreHumanDamageActuatorType)

Implements the DtSimComponent::type() method to return the type identifier for this component.

◆ init()

virtual bool makVre::DtVreHumanDamageActuator::init ( )
overridevirtual

Initializes the human damage actuator.

Returns
True if initialization is successful, false otherwise

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.

◆ tick()

virtual void makVre::DtVreHumanDamageActuator::tick ( )
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.

◆ adjudicateDirectDamage()

virtual bool makVre::DtVreHumanDamageActuator::adjudicateDirectDamage ( const DtDetonationContext & detonationContext)
overridevirtual

Processes direct damage from a detonation.

Parameters
detonationContextInformation about the detonation that hit the entity
Returns
True if damage was applied, false otherwise

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.

◆ adjudicateCollateralDamage()

virtual bool makVre::DtVreHumanDamageActuator::adjudicateCollateralDamage ( const DtDetonationContext & detonationContext)
overridevirtual

Processes collateral damage from a nearby detonation.

Parameters
detonationContextInformation about the detonation that occurred near the entity
Returns
True if damage was applied, false otherwise

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.

◆ creator()

static DtSimComponent * makVre::DtVreHumanDamageActuator::creator ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )
static

Factory method to create a new instance of this component.

Parameters
nameThe name for the new component
ownerThe local object that will own this component
simManagerThe simulation services manager
descOptional component descriptor
parentRegistryOptional parent registry for reader/writer functionality
Returns
Pointer to the newly created component

Static factory method used by the component creation system to instantiate new instances of this component type.

◆ updateState()

virtual void makVre::DtVreHumanDamageActuator::updateState ( DtDamageState state)
overrideprotectedvirtual

Updates the damage state of the entity.

Parameters
stateThe 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.

◆ setDestroyed()

virtual void makVre::DtVreHumanDamageActuator::setDestroyed ( )
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.

◆ operator=()

DtVreHumanDamageActuator & makVre::DtVreHumanDamageActuator::operator= ( const DtVreHumanDamageActuator & other)
private

Assignment operator (not implemented)

Returns
Reference to this object

Assignment operator is private and not implemented to prevent assignment.

References DtVreHumanDamageActuator().

◆ setRestored()

virtual void makVre::DtVreHumanDamageActuator::setRestored ( )
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.

See also
registerForDetonations

◆ sendSetPosture()

void makVre::DtVreHumanDamageActuator::sendSetPosture ( DtLifeformState post)
protected

Changes the entity's posture.

Parameters
postThe 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.

◆ initPostureDamageMaps()

void makVre::DtVreHumanDamageActuator::initPostureDamageMaps ( )
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.

Member Data Documentation

◆ myPostureDamageMap

std::map<DtLifeformState, DtDamageMap> makVre::DtVreHumanDamageActuator::myPostureDamageMap
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.

◆ myOverallHealth

DtRwInt* makVre::DtVreHumanDamageActuator::myOverallHealth
protected

Entity's overall health value.

State property defined in the Human OPE file, representing the entity's overall health status.

◆ myMobilityHealth

DtRwInt* makVre::DtVreHumanDamageActuator::myMobilityHealth
protected

Entity's mobility health value.

State property defined in the Human OPE file, representing the entity's ability to move effectively.

◆ myFirepowerHealth

DtRwInt* makVre::DtVreHumanDamageActuator::myFirepowerHealth
protected

Entity's firepower health value.

State property defined in the Human OPE file, representing the entity's ability to use weapons effectively.

◆ myOpeOk

bool makVre::DtVreHumanDamageActuator::myOpeOk
protected

Flag indicating if OPE access is valid.

Indicates whether the component was able to successfully access the OPE (Object Property Editor) state variables.


The documentation for this class was generated from the following file: