Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
feverblurstate.c
Go to the documentation of this file.
1 class FeverBlurSymptom extends SymptomBase
2 {
3  Material m_MatGauss;
4 
5  float m_BlurDuration;
6  float m_BlurStrength;
7  float m_EffectTime;
8  float m_EffectStartTime;
9  float m_Time;
10  protected PPERequester_FeverEffects m_Requester;
11 
12  const float BLUR_STRENGTH_MIN = 0.15;
13  const float BLUR_STRENGTH_MAX = 0.25;
14 
15  const int BLUR_DURATION_TIME_MIN = 1.5;
16  const int BLUR_DURATION_TIME_MAX = 2.5;
17 
18  const int MIN_TIME_BETWEEN_EFFECTS = 25.0;
19  const int MAX_TIME_BETWEEN_EFFECTS = 35.0;
20 
21  //this is just for the Symptom parameters set-up and is called even if the Symptom doesn't execute, don't put any gameplay code in here
22  override void OnInit()
23  {
24  m_SymptomType = SymptomTypes.SECONDARY;
25  m_Priority = 0;
26  m_ID = SymptomIDs.SYMPTOM_FEVERBLUR;
27  m_DestroyOnAnimFinish = true;
28  m_IsPersistent = false;
29  m_SyncToClient = true;
30 
31  if ( !GetGame().IsDedicatedServer() )
32  {
33  Class.CastTo(m_Requester,PPERequesterBank.GetRequester(PPERequester_FeverEffects));
34  }
35  }
36 
38  override void OnUpdateServer(PlayerBase player, float deltatime)
39  {
40  //int i = 1 + 1;
41  }
42 
43 
44  override void OnUpdateClient(PlayerBase player, float deltatime)
45  {
46  m_Time += deltatime;
47  if ( m_EffectStartTime <= 0 )
48  {
49  m_EffectStartTime = Math.RandomFloatInclusive(MIN_TIME_BETWEEN_EFFECTS, MAX_TIME_BETWEEN_EFFECTS);
50  m_BlurDuration = Math.RandomFloatInclusive(BLUR_DURATION_TIME_MIN, BLUR_DURATION_TIME_MAX);
51  m_BlurStrength = Math.RandomFloat(BLUR_STRENGTH_MIN, BLUR_STRENGTH_MAX);
52  //PrintString("m_BlurDuration=" +m_BlurDuration.ToString());
53  }
54 
55  if ( m_EffectStartTime > 0 && m_Time > m_EffectStartTime )
56  {
57  m_EffectTime += deltatime / m_BlurDuration;
58  float cos_value = Math.Sin(m_EffectTime * Math.PI);
59  float val = cos_value * m_BlurStrength;
60  //Print(val);
61  m_Requester.SetFeverIntensity(val);
62  //PrintString("cos=" +cos_value.ToString());
63 
64  if ( m_EffectTime >= 1 )
65  {
66  m_EffectTime = 0;
67  m_EffectStartTime = -1;
68  m_Time = 0;
69  }
70  }
71  }
72 
74  override void OnGetActivatedServer(PlayerBase player)
75  {
76  if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetActivated", m_Player.ToString());
77  }
78 
79  override void OnGetActivatedClient(PlayerBase player)
80  {
81  if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetActivated", m_Player.ToString());
82  }
83 
84  override void OnGetDeactivatedServer(PlayerBase player)
85  {
86  if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetDeactivated", m_Player.ToString());
87  }
88 
90  override void OnGetDeactivatedClient(PlayerBase player)
91  {
92  m_Requester.Stop();
93  if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetDeactivated", m_Player.ToString());
94  }
95 }
GetGame
proto native CGame GetGame()
m_Time
protected float m_Time
Definition: carscript.c:146
m_Requester
protected PPERUndergroundAcco m_Requester
Definition: undergroundhandlerclient.c:22
LogManager
Definition: debug.c:734
m_Priority
int m_Priority
Definition: bioslobbyservice.c:34
SymptomBase
Definition: statebase.c:1
m_SymptomType
int m_SymptomType
Definition: smptanimmeta.c:13
ToString
proto string ToString()
PlayerBase
Definition: playerbaseclient.c:1
OnUpdateServer
void OnUpdateServer(float deltatime, float blood_scale, bool no_blood_loss)
Definition: bleedingsource.c:114
OnUpdateClient
void OnUpdateClient(ActionData action_data)
Definition: actionbase.c:998
Material
Definition: proto.c:267
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
m_IsPersistent
bool m_IsPersistent
Definition: modifierbase.c:16
SymptomTypes
SymptomTypes
Definition: statemanager.c:26
Debug
Definition: debug.c:13
OnInit
void OnInit()
Definition: aibehaviour.c:49
Math
Definition: enmath.c:6
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
m_ID
protected int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition: effect.c:49