DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ComponentAnimalBleeding.c
См. документацию.
1//-----------------------------
2// ANIMAL BLEEDING
3//-----------------------------
4/*
5Animal bleeding is handled by this component.
6*/
7
9{
10 // Member variables
11 protected ref Timer m_BleedTimer;
12 protected const float BASE_BLEED_RATE = 250;
13 protected const float PASS_OUT_AMOUT = 500;
14
15 // Constructor
17 {
18
19 }
20
21 void InflictWoundDamage( TotalDamageResult damage_result, string zone_name, string ammo )
22 {
23 if ( ammo == "MeleeWolf")
24 {
25 m_ThisEntityAI.SetHealth( "", "", 0 );
26 }
27
28 if ( !zone_name )
29 return;
30
31 float health_damage_inflicted = damage_result.GetDamage( zone_name, "Health");
32 //float blood_damage_inflicted = damage_result.GetDamage( zone_name, "Blood");
33 float wound_healt_damage = health_damage_inflicted;
34 //float wound_blood_damage = health_damage_inflicted;
35
36 m_ThisEntityAI.DecreaseHealth( "", "Health", wound_healt_damage );
37 //m_ThisEntityAI.DecreaseHealth( "", "Blood", wound_blood_damage );
38
39 if ( zone_name != "" )
40 {
41 m_ThisEntityAI.DecreaseHealth( zone_name, "Health", wound_healt_damage );
42 //m_ThisEntityAI.DecreaseHealth( zone_name, "Blood", wound_blood_damage );
43 }
44
45 //Print("Zone hit: " + zone_name );
46
47 //Print("damage_result Health: " + damage_result.GetDamage( zone_name, "Health" ) );
48 //Print("damage_result Blood: " + damage_result.GetDamage( zone_name, "Blood" ) );
49 }
50
51 void CreateWound( TotalDamageResult damage_result, string zone_name, string ammo )
52 {
53 //Print( "GetHealth Health before creating wound@: " + zone_name + " " + m_ThisEntityAI.GetHealth( zone_name, "Health" ));
54 InflictWoundDamage( damage_result, zone_name, ammo );
55 //Print( "GetHealth Health after creating wood@: " + zone_name + " " + m_ThisEntityAI.GetHealth( zone_name, "Health" ));
56
57 float can_bleed = false; //= GetGame().ConfigGetFloat( "CfgVehicles " + m_ThisEntityAI.GetType() + " DamageSystem " + "DamageZones " + zone_name + " canBleed" );
58 //Print("can_bleed: " + can_bleed );
59 float bleed_treshold = 0; //= GetGame().ConfigGetFloat( "CfgAmmo " + ammo + " DamageApplied " + "bleedThreshold" );
60 //Print("bleed_treshold: " + bleed_treshold );
61 float chance = -1; //Math.RandomFloat01();
62 //Print("chance: " + chance );
63
64 //Print( "GetHealth Health @: " + m_ThisEntityAI.GetHealth( zone_name, "Health" ));
65 //Print( "GetHealth Blood @: " + m_ThisEntityAI.GetHealth( zone_name, "Blood" ));
66 //Print( "GetHealth Shock @: " + m_ThisEntityAI.GetHealth( zone_name, "Shock" ));
67
68 if ( can_bleed && chance <= bleed_treshold )
69 {
70 m_BleedTimer = new Timer();
71 float wound_intensity = GetWoundIntensity( bleed_treshold );
72 //Print("wound_intensity: " + wound_intensity);
73 m_BleedTimer.Run( 1, this, "Bleed", new Param1<float>( wound_intensity ), true );
74 }
75 /*
76 else
77 {
78 Print("Not bleeding");
79 }
80 */
81 }
82
83 void Bleed( float wound_intensity )
84 {
85 if ( m_ThisEntityAI.IsAlive() )
86 {
87 float bleeding_intensity = BASE_BLEED_RATE * wound_intensity;
88 //Print("bleeding_intensity: " + bleeding_intensity);
89 float global_blood_lvl = m_ThisEntityAI.GetHealth( "", "Blood" );
90
91 m_ThisEntityAI.DecreaseHealth( "", "Blood", bleeding_intensity );
92
93 if ( global_blood_lvl < PASS_OUT_AMOUT )
94 {
95 m_ThisEntityAI.SetHealth( "", "", 0 );
96 //Print("global_blood_lvl < PASS_OUT_AMOUT => Zabijam zviera.");
97 }
98
99 //Print( "GetHealth Global Health: " + m_ThisEntityAI.GetHealth( "", "Health" ));
100 //Print( "GetHealth Global Blood: " + m_ThisEntityAI.GetHealth( "", "Blood" ));
101 //Print( "GetHealth Global Shock: " + m_ThisEntityAI.GetHealth( "", "Shock" ));
102
103 }
104 else
105 {
106 m_BleedTimer.Stop();
107 //Print("Vypinam timer.");
108 }
109 }
110
111 float GetWoundIntensity( float bleed_treshold )
112 {
113 //higher the bleeding treshold => more intense bleeding
114 return bleed_treshold * 2;
115 }
116}
EntityAI m_ThisEntityAI
Определения Component.c:24
const float BASE_BLEED_RATE
Определения ComponentAnimalBleeding.c:12
void Bleed(float wound_intensity)
Определения ComponentAnimalBleeding.c:83
void ComponentAnimalBleeding()
Определения ComponentAnimalBleeding.c:16
void InflictWoundDamage(TotalDamageResult damage_result, string zone_name, string ammo)
Определения ComponentAnimalBleeding.c:21
const float PASS_OUT_AMOUT
Определения ComponentAnimalBleeding.c:13
ref Timer m_BleedTimer
Определения ComponentAnimalBleeding.c:11
float GetWoundIntensity(float bleed_treshold)
Определения ComponentAnimalBleeding.c:111
void CreateWound(TotalDamageResult damage_result, string zone_name, string ammo)
Определения ComponentAnimalBleeding.c:51
Определения Component.c:16
Определения DayZPlayerImplement.c:63
proto native float GetDamage(string zoneName, string healthType)
Определения DamageSystem.c:2