7 protected float m_PlayerDamage;
8 protected float m_OthersDamage;
10 protected string m_AmmoName;
11 protected int m_DamageType;
13 protected float m_LoopInterval;
14 protected float m_DeferDuration;
20 protected ref
Timer m_LoopTimer;
21 protected ref
Timer m_DeferTimer;
48 void OnEnter(
Object object)
52 OnEnterServer(
object);
56 OnEnterClient(
object);
59 void OnEnterClient(
Object object) {}
60 void OnEnterServer(
Object object) {}
62 void OnLeave(
Object object)
66 OnLeaveServer(
object);
70 OnLeaveClient(
object);
74 void OnLeaveClient(
Object object) {}
75 void OnLeaveServer(
Object object)
78 if ( m_DeferTimer && m_DeferTimer.IsRunning() )
82 if ( m_LoopTimer && m_LoopTimer.IsRunning() )
88 protected void EvaluateDamage_Loop(
Object object)
90 m_LoopTimer.Run(m_LoopInterval,
this,
"EvaluateDamage",
new Param1<Object>(
object),
true);
93 protected void EvaluateDamage_Defer(
Object object)
95 m_DeferTimer.Run(
m_DeferDuration,
this,
"EvaluateDamage",
new Param1<Object>(
object),
false);
98 protected void EvaluateDamage_DeferLoop(
Object object)
100 m_DeferTimer.Run(
m_DeferDuration,
this,
"EvaluateDamage_Loop",
new Param1<Object>(
object),
false);
103 protected void EvaluateDamage(
Object object)
107 if ( m_RaycastSources.Count() )
109 hitzone = GetRaycastedHitZone(
object, m_RaycastSources);
110 EvaluateDamage_Common(
object, hitzone);
114 hitzone = GetRandomHitZone(m_HitZones);
115 EvaluateDamage_Common(
object, hitzone);
119 protected void EvaluateDamage_Common(
Object object,
string hitzone)
121 if (
object &&
object.IsAlive() )
123 if (
object.IsAnyInherited( m_DamageableTypes ) )
157 int idx =
Math.RandomInt( 0, 100 ) % hitzones.Count();
159 return hitzones[idx];
171 int contactComponent;
172 bool isSteppedOn =
false;
175 ref set<Object> victims =
new set<Object>;
178 for (
int v = 0; v < raycast_sources_str.Count(); ++v)
180 raycast_sources.Insert(raycast_sources_str[v].ToVector());
183 for (
int i = 0; i < raycast_sources.Count(); ++i )
186 vector raycast_end_pos =
"0 0.5 0" + raycast_start_pos;
191 DayZPhysics.RaycastRV( raycast_start_pos, raycast_end_pos, contact_pos, contact_dir, contactComponent, victims ,
null,
m_AreaDamageTrigger,
true,
false, ObjIntersectIFire);
193 for (
int j = 0; j < victims.Count(); ++j )
195 Object contact_obj = victims.Get(j);
197 if ( contact_obj.IsAnyInherited(m_DamageableTypes) )
209 hitzone = eai.GetDamageZoneNameByComponentIndex(contactComponent);
222 string dmg_zone_rnd =
"LeftFoot";
223 if (
Math.RandomIntInclusive(0, 1) == 1 )
224 dmg_zone_rnd =
"RightFoot";
247 Debug_CleanupShapes(triggerAreaShapes);
251 protected void Debug_DrawArea()
256 triggerAreaShapes.Insert(
Debug.DrawBox(min, max));
259 private void Debug_CleanupShapes(
array<Shape> shapesArr)
261 for (
int it = 0; it < shapesArr.Count(); ++it )
263 Debug.RemoveShape( shapesArr[it] );