Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
areadamagecomponent.c
Go to the documentation of this file.
2 {
3  string Hitzone = "";
4  vector Modelpos = "0.5 0.5 0.5";
5 }
6 
8 {
10 
12  string m_AmmoName;
13 
14  ref array<typename> m_DamageableTypes
15 
17  {
18  m_Parent = parent;
19 
20  m_DamageType = DT_CUSTOM;
21  m_AmmoName = "MeleeDamage";
22 
23  m_DamageableTypes = new array<typename>;
24  m_DamageableTypes.Insert(DayZPlayer);
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 
52  {
53  return new AreaDamageComponentData;
54  }
55 
56  private bool EvaluateDamageInternal(TriggerInsider insider, float damageCoef)
57  {
59 
60  AreaDamageTriggerInsider dInsider;
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 }
TriggerInsider
The object which is in a trigger and its metadata.
Definition: trigger.c:2
AreaDamageTriggerInsider
Extended TriggerInsider for AreaDamageTriggerBase.
Definition: areadamagetriggerbase.c:2
ShouldDamage
protected bool ShouldDamage(Object object)
Definition: areadamagecomponent.c:46
OnEvaluateDamage
override bool OnEvaluateDamage(TriggerInsider insider, float damageCoef)
Definition: areadamagecomponent.c:27
DayZPlayer
Definition: dayzplayerimplement.c:72
AreaDamageEvents
Events used across AreaDamage API, calling of these needs to be handled by parent.
Definition: areadamageevents.c:2
m_AmmoName
string m_AmmoName
Definition: areadamagecomponent.c:12
GetAreaDamageComponentData
protected AreaDamageComponentData GetAreaDamageComponentData(Object object)
Definition: areadamagecomponent.c:51
vector
Definition: enconvert.c:105
PreDamageActions
override void PreDamageActions()
Definition: areadamagecomponent.c:36
g_Game
DayZGame g_Game
Definition: dayzgame.c:3727
EvaluateDamageInternal
private bool EvaluateDamageInternal(TriggerInsider insider, float damageCoef)
Definition: areadamagecomponent.c:56
Object
Definition: objecttyped.c:1
AreaDamageComponent
ref array< typename > m_DamageableTypes void AreaDamageComponent(AreaDamageManager parent)
Definition: areadamagecomponent.c:16
array< typename >
AreaDamageComponentData
Definition: areadamagecomponent.c:1
m_Parent
class AreaDamageComponentData m_Parent
AreaDamageManager
void AreaDamageManager(EntityAI parent)
Definition: areadamagemanager.c:22
m_DamageType
int m_DamageType
Definition: areadamagecomponent.c:11
PostDamageActions
override void PostDamageActions()
Definition: areadamagecomponent.c:41