Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
flies.c
Go to the documentation of this file.
2{
3 const float DISTANCE_SENSITIVITY_SQR = Math.SqrFloat(0.05/*actual distance in meters*/);
4 const int TICK_FREQUENCY = 15;
5 const int IDLE_COUNT_THRESHOLD = 40;
6 vector m_PrevPosition;
7 int m_IdleCount;
8
9
10 override void Init()
11 {
13 m_ID = eModifiers.MDF_FLIES;
15 m_TickIntervalActive = TICK_FREQUENCY;
18 }
19
20 override bool ActivateCondition(PlayerBase player)
21 {
22 return false;
23 }
24
25 override bool DeactivateCondition(PlayerBase player)
26 {
27 return false;
28 }
29
30 override void OnTick(PlayerBase player, float deltaT)
31 {
32 float dist_sqr = vector.DistanceSq(player.GetPosition(), m_PrevPosition);
33 if( dist_sqr < DISTANCE_SENSITIVITY_SQR)//has the player stayed still since last check
34 {
35 m_IdleCount++;
36 }
37 else
38 {
39 if(m_IdleCount >= IDLE_COUNT_THRESHOLD)//disable the effect
40 {
41 player.m_CorpseState = -PlayerConstants.CORPSE_STATE_DECAYED;
42 player.SetSynchDirty();
43 }
44
45 m_IdleCount = 0;//player moved, reset the count
46 }
47 m_PrevPosition = player.GetPosition();
48
49 if( m_IdleCount == IDLE_COUNT_THRESHOLD)//should we play the effect ?
50 {
51 player.m_CorpseState = PlayerConstants.CORPSE_STATE_DECAYED;
52 player.SetSynchDirty();
53 }
54
55
56 }
57
58 override void OnReconnect(PlayerBase player)
59 {
60 OnActivate(player);
61 }
62
63 override void OnActivate(PlayerBase player)
64 {
65 m_IdleCount = 0;
66 player.m_CorpseState = -PlayerConstants.CORPSE_STATE_DECAYED;
67 player.SetSynchDirty();
68 }
69
70 override void OnDeactivate(PlayerBase player)
71 {
72
73 }
74
75
76
77};
Definition enmath.c:7
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition effect.c:51
eModifiers
Definition emodifiers.c:2
bool m_TrackActivatedTime
overall time this modifier was active
void DisableDeactivateCheck()
void DisableActivateCheck()
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
void OnActivate()