Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
feverblurstate.c
Go to the documentation of this file.
1class 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}
Super root of all classes in Enforce script.
Definition enscript.c:11
Definition debug.c:2
Definition enmath.c:7
override void OnGetActivatedClient(PlayerBase player)
override void OnInit()
override void OnGetActivatedServer(PlayerBase player)
gets called once on an Symptom which is being activated
override void OnGetDeactivatedServer(PlayerBase player)
override void OnUpdateClient(PlayerBase player, float deltatime)
PPERequester_FeverEffects m_Requester
override void OnUpdateServer(PlayerBase player, float deltatime)
gets called every frame
override void OnGetDeactivatedClient(PlayerBase player)
only gets called once on an active Symptom that is being deactivated
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition effect.c:51
proto string ToString()
float m_Time
Definition environment.c:59
proto native CGame GetGame()
DayZPlayer m_Player
Definition hand_events.c:42
bool m_IsPersistent
should this modifier track overall time it was active ?
int m_SymptomType
SymptomTypes
PPERUndergroundAcco m_Requester