DayZ 1.24
Loading...
Searching...
No Matches
AreaDamageOnce.c
Go to the documentation of this file.
1class AreaDamageOnce : AreaDamageManager
2{
3 override void OnEnterServerEvent(TriggerInsider insider)
4 {
5 super.OnEnterServerEvent(insider);
6
7 OnEvaluateDamageEx(insider, 1);
8 }
9}
10
12{
14 protected float m_DeferDuration = 1.0;
15
16 override void SetDeferDuration(float time)
17 {
19 }
20
21 override void OnStayServerEvent(TriggerInsider insider, float deltaTime)
22 {
23 super.OnStayServerEvent(insider, deltaTime);
24
26 if (CastTo(dInsider, insider) && dInsider.lastDamaged == 0)
27 OnEvaluateDamageEx(insider, 1);
28 }
29
30 override protected float CalculateDamageScale(TriggerInsider insider, float deltaTime)
31 {
32 if (m_DeferDuration > 0 && (insider.lastUpdated - insider.timeEntered) >= m_DeferDuration)
33 return super.CalculateDamageScale(insider, deltaTime);
34
35 return 0;
36 }
37}
override void OnStayServerEvent(TriggerInsider insider, float deltaTime)
void SetDeferDuration(float time)
float CalculateDamageScale(TriggerInsider insider, float deltaTime)
Helper for calculating damageCoeff when using OnEvaluateDamageEx.
bool OnEvaluateDamageEx(TriggerInsider insider, float deltaTime)
AreaDamageOnce m_DeferDuration
Time the damage should be deferred in seconds.
override void OnEnterServerEvent(TriggerInsider insider)
Extended TriggerInsider for AreaDamageTriggerBase.
The object which is in a trigger and its metadata.
Definition Trigger.c:3
float lastUpdated
Last time the object was updated in seconds, is used for calculating deltaTime.
Definition Trigger.c:16
float timeEntered
Time the object was first seen in seconds.
Definition Trigger.c:13