Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
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
8
class
ComponentAnimalBleeding
:
Component
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
16
void
ComponentAnimalBleeding
()
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
;
//= g_Game.ConfigGetFloat( "CfgVehicles " + m_ThisEntityAI.GetType() + " DamageSystem " + "DamageZones " + zone_name + " canBleed" );
58
//Print("can_bleed: " + can_bleed );
59
float
bleed_treshold = 0;
//= g_Game.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
}
ComponentAnimalBleeding::GetWoundIntensity
float GetWoundIntensity(float bleed_treshold)
Definition
componentanimalbleeding.c:111
ComponentAnimalBleeding::m_BleedTimer
ref Timer m_BleedTimer
Definition
componentanimalbleeding.c:11
ComponentAnimalBleeding::PASS_OUT_AMOUT
const float PASS_OUT_AMOUT
Definition
componentanimalbleeding.c:13
ComponentAnimalBleeding::CreateWound
void CreateWound(TotalDamageResult damage_result, string zone_name, string ammo)
Definition
componentanimalbleeding.c:51
ComponentAnimalBleeding::InflictWoundDamage
void InflictWoundDamage(TotalDamageResult damage_result, string zone_name, string ammo)
Definition
componentanimalbleeding.c:21
ComponentAnimalBleeding::ComponentAnimalBleeding
void ComponentAnimalBleeding()
Definition
componentanimalbleeding.c:16
ComponentAnimalBleeding::Bleed
void Bleed(float wound_intensity)
Definition
componentanimalbleeding.c:83
ComponentAnimalBleeding::BASE_BLEED_RATE
const float BASE_BLEED_RATE
Definition
componentanimalbleeding.c:12
Component
Definition
component.c:16
Component::m_ThisEntityAI
EntityAI m_ThisEntityAI
Definition
component.c:24
Timer
Definition
dayzplayerimplement.c:39
TotalDamageResult
Definition
damagesystem.c:2
TotalDamageResult::GetDamage
proto native float GetDamage(string zoneName, string healthType)
Games
Dayz
scripts
3_game
tools
component
componentanimalbleeding.c
Generated by
1.17.0