DayZ 1.24
Loading...
Searching...
No Matches
AreaDamageComponent.c
Go to the documentation of this file.
2{
3 string Hitzone = "";
4 vector Modelpos = "0.5 0.5 0.5";
5}
6
7class AreaDamageComponent : AreaDamageEvents
8{
9 AreaDamageManager m_Parent;
10
12 string m_AmmoName;
13
15
16 void AreaDamageComponent(AreaDamageManager parent)
17 {
18 m_Parent = parent;
19
21 m_AmmoName = "MeleeDamage";
22
25 }
26
27 override bool OnEvaluateDamage(TriggerInsider insider, float damageCoef)
28 {
29 // No need to damage if the coef is 0!
30 if (ShouldDamage(insider.GetObject()) && damageCoef > 0)
31 return EvaluateDamageInternal(insider, damageCoef);
32
33 return false;
34 }
35
36 override void PreDamageActions()
37 {
38 m_Parent.PreDamageActions();
39 }
40
41 override void PostDamageActions()
42 {
43 m_Parent.PostDamageActions();
44 }
45
46 protected bool ShouldDamage(Object object)
47 {
48 return object && object.IsAlive() && object.IsAnyInherited(m_DamageableTypes);
49 }
50
55
57 {
59
61 if (CastTo(dInsider, insider))
62 dInsider.lastDamaged = g_Game.GetTickTime();
63
64 Object object = insider.GetObject();
65
67 object.ProcessDirectDamage(m_DamageType, m_Parent.GetParentObject(), data.Hitzone, m_AmmoName, data.Modelpos, damageCoef);
68
70
71 return true;
72 }
73}
ref array< typename > m_DamageableTypes void AreaDamageComponent(AreaDamageManager parent)
AreaDamageComponentData GetAreaDamageComponentData(Object object)
bool ShouldDamage(Object object)
bool EvaluateDamageInternal(TriggerInsider insider, float damageCoef)
string m_AmmoName
int m_DamageType
override bool OnEvaluateDamage(TriggerInsider insider, float damageCoef)
Tell the AreaDamageComponent to calculate and apply the damage to the Object.
override void PostDamageActions()
Usually called from AreaDamageComponent.
override void PreDamageActions()
Usually called from AreaDamageComponent.
DayZGame g_Game
Definition DayZGame.c:3528
Widget m_Parent
Definition SizeToChild.c:86
Events used across AreaDamage API, calling of these needs to be handled by parent.
Extended TriggerInsider for AreaDamageTriggerBase.
The object which is in a trigger and its metadata.
Definition Trigger.c:3
Object GetObject()
Definition Trigger.c:28