DayZ 1.24
Loading...
Searching...
No Matches
ComponentAnimalBleeding Class Reference
Inheritance diagram for ComponentAnimalBleeding:
[legend]
Collaboration diagram for ComponentAnimalBleeding:
[legend]

Protected Member Functions

void ComponentAnimalBleeding ()
 
void InflictWoundDamage (TotalDamageResult damage_result, string zone_name, string ammo)
 
void CreateWound (TotalDamageResult damage_result, string zone_name, string ammo)
 
void Bleed (float wound_intensity)
 
float GetWoundIntensity (float bleed_treshold)
 

Protected Attributes

ref Timer m_BleedTimer
 
const float BASE_BLEED_RATE = 250
 
const float PASS_OUT_AMOUT = 500
 

Additional Inherited Members

- Private Member Functions inherited from Component
void Event_OnFrame (IEntity other, float timeSlice)
 
Shape DebugBBoxDraw ()
 
void DebugBBoxSetColor (int color)
 
void DebugBBoxDelete ()
 
Shape DebugDirectionDraw (float distance=1)
 
void DebugDirectionSetColor (int color)
 
void DebugDirectionDelete ()
 
void SetParentEntityAI (EntityAI e)
 
void Event_OnAwake ()
 
void Event_OnInit ()
 
void LogThis (string msg, string fnc_name="n/a")
 
void LogThisWarning (string msg, string fnc_name="n/a")
 
void LogThisError (string msg, string fnc_name="n/a")
 
string GetCompName ()
 
int GetCompType ()
 
void Event_OnItemAttached (EntityAI item, string slot_name)
 
void Event_OnItemDetached (EntityAI item, string slot_name)
 
override Shape DebugBBoxDraw ()
 
override void DebugBBoxSetColor (int color)
 
override void DebugBBoxDelete ()
 
override Shape DebugDirectionDraw (float distance=1)
 
override void DebugDirectionDelete ()
 
void OnDrawing ()
 
- Static Private Member Functions inherited from Component
static void Init ()
 
static string GetNameByType (int comp_type)
 
static bool IsTypeExist (int comp_type)
 
static void LogErrorBadCompType (int comp_type, string fnc_name)
 
static void LogWarningAlredyExist (int comp_type, string fnc_name)
 
- Private Attributes inherited from Component
EntityAI m_ThisEntityAI
 
Shape m_DebugShapeBBox
 
Shape m_DebugShapeDirection
 
float m_DebugShapeDirectionDist
 

Detailed Description

Definition at line 8 of file ComponentAnimalBleeding.c.

Constructor & Destructor Documentation

◆ ComponentAnimalBleeding()

void ComponentAnimalBleeding::ComponentAnimalBleeding ( )
inlineprotected

Definition at line 16 of file ComponentAnimalBleeding.c.

17 {
18
19 }

Member Function Documentation

◆ Bleed()

void ComponentAnimalBleeding::Bleed ( float wound_intensity)
inlineprotected

Definition at line 81 of file ComponentAnimalBleeding.c.

82 {
83 if (m_ThisEntityAI.IsAlive())
84 {
86 //Print("bleeding_intensity: " + bleeding_intensity);
87 float global_blood_lvl = m_ThisEntityAI.GetHealth("", "Blood");
88
89 m_ThisEntityAI.DecreaseHealth("", "Blood", bleeding_intensity);
90
92 {
93 m_ThisEntityAI.SetHealth("", "", 0);
94 //Print("global_blood_lvl < PASS_OUT_AMOUT => Zabijam zviera.");
95 }
96
97 //Print( "GetHealth Global Health: " + m_ThisEntityAI.GetHealth( "", "Health" ));
98 //Print( "GetHealth Global Blood: " + m_ThisEntityAI.GetHealth( "", "Blood" ));
99 //Print( "GetHealth Global Shock: " + m_ThisEntityAI.GetHealth( "", "Shock" ));
100
101 }
102 else
103 {
104 m_BleedTimer.Stop();
105 //Print("Vypinam timer.");
106 }
107 }
EntityAI m_ThisEntityAI
Definition Component.c:24

References BASE_BLEED_RATE, m_BleedTimer, Component::m_ThisEntityAI, and PASS_OUT_AMOUT.

◆ CreateWound()

void ComponentAnimalBleeding::CreateWound ( TotalDamageResult damage_result,
string zone_name,
string ammo )
inlineprotected

Definition at line 49 of file ComponentAnimalBleeding.c.

50 {
51 //Print( "GetHealth Health before creating wound@: " + zone_name + " " + m_ThisEntityAI.GetHealth( zone_name, "Health" ));
53 //Print( "GetHealth Health after creating wood@: " + zone_name + " " + m_ThisEntityAI.GetHealth( zone_name, "Health" ));
54
55 float can_bleed = false; //= GetGame().ConfigGetFloat( "CfgVehicles " + m_ThisEntityAI.GetType() + " DamageSystem " + "DamageZones " + zone_name + " canBleed" );
56 //Print("can_bleed: " + can_bleed );
57 float bleed_treshold = 0; //= GetGame().ConfigGetFloat( "CfgAmmo " + ammo + " DamageApplied " + "bleedThreshold" );
58 //Print("bleed_treshold: " + bleed_treshold );
59 float chance = -1; //Math.RandomFloat01();
60 //Print("chance: " + chance );
61
62 //Print( "GetHealth Health @: " + m_ThisEntityAI.GetHealth( zone_name, "Health" ));
63 //Print( "GetHealth Blood @: " + m_ThisEntityAI.GetHealth( zone_name, "Blood" ));
64 //Print( "GetHealth Shock @: " + m_ThisEntityAI.GetHealth( zone_name, "Shock" ));
65
67 {
68 m_BleedTimer = new Timer();
70 //Print("wound_intensity: " + wound_intensity);
71 m_BleedTimer.Run(1, this, "Bleed", new Param1<float>(wound_intensity), true);
72 }
73 /*
74 else
75 {
76 Print("Not bleeding");
77 }
78 */
79 }
void InflictWoundDamage(TotalDamageResult damage_result, string zone_name, string ammo)
float GetWoundIntensity(float bleed_treshold)

References GetWoundIntensity(), InflictWoundDamage(), and m_BleedTimer.

◆ GetWoundIntensity()

float ComponentAnimalBleeding::GetWoundIntensity ( float bleed_treshold)
inlineprotected

Definition at line 109 of file ComponentAnimalBleeding.c.

110 {
111 //higher the bleeding treshold => more intense bleeding
112 return bleed_treshold * 2;
113 }

Referenced by CreateWound().

◆ InflictWoundDamage()

void ComponentAnimalBleeding::InflictWoundDamage ( TotalDamageResult damage_result,
string zone_name,
string ammo )
inlineprotected

Definition at line 21 of file ComponentAnimalBleeding.c.

22 {
23 if (ammo == "MeleeWolf")
24 m_ThisEntityAI.SetHealth("", "", 0);
25
26 if (!zone_name)
27 return;
28
29 float health_damage_inflicted = damage_result.GetDamage(zone_name, "Health");
30 //float blood_damage_inflicted = damage_result.GetDamage( zone_name, "Blood");
32 //float wound_blood_damage = health_damage_inflicted;
33
34 m_ThisEntityAI.DecreaseHealth("", "Health", wound_healt_damage);
35 //m_ThisEntityAI.DecreaseHealth( "", "Blood", wound_blood_damage );
36
37 if (zone_name != "")
38 {
39 m_ThisEntityAI.DecreaseHealth(zone_name, "Health", wound_healt_damage);
40 //m_ThisEntityAI.DecreaseHealth( zone_name, "Blood", wound_blood_damage );
41 }
42
43 //Print("Zone hit: " + zone_name );
44
45 //Print("damage_result Health: " + damage_result.GetDamage( zone_name, "Health" ) );
46 //Print("damage_result Blood: " + damage_result.GetDamage( zone_name, "Blood" ) );
47 }

References Component::m_ThisEntityAI.

Referenced by CreateWound().

Member Data Documentation

◆ BASE_BLEED_RATE

const float ComponentAnimalBleeding::BASE_BLEED_RATE = 250
protected

Definition at line 12 of file ComponentAnimalBleeding.c.

Referenced by Bleed().

◆ m_BleedTimer

ref Timer ComponentAnimalBleeding::m_BleedTimer
protected

Definition at line 11 of file ComponentAnimalBleeding.c.

Referenced by Bleed(), and CreateWound().

◆ PASS_OUT_AMOUT

const float ComponentAnimalBleeding::PASS_OUT_AMOUT = 500
protected

Definition at line 13 of file ComponentAnimalBleeding.c.

Referenced by Bleed().


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