DayZ 1.24
Loading...
Searching...
No Matches
ComponentAnimalBleeding.c
Go to the documentation of this file.
1//-----------------------------
2// ANIMAL BLEEDING
3//-----------------------------
4/*
5 Animal bleeding is handled by this component.
6*/
7
9{
10 // Member variables
12 protected const float BASE_BLEED_RATE = 250;
13 protected const float PASS_OUT_AMOUT = 500;
14
15 // Constructor
17 {
18
19 }
20
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 }
48
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 }
80
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 }
108
110 {
111 //higher the bleeding treshold => more intense bleeding
112 return bleed_treshold * 2;
113 }
114}
void Bleed(float wound_intensity)
void InflictWoundDamage(TotalDamageResult damage_result, string zone_name, string ammo)
float GetWoundIntensity(float bleed_treshold)
void CreateWound(TotalDamageResult damage_result, string zone_name, string ammo)
EntityAI m_ThisEntityAI
Definition Component.c:24