Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
braindisease.c
Go to the documentation of this file.
2 {
3  static const int AGENT_THRESHOLD_ACTIVATE = 2000;
4  static const int AGENT_THRESHOLD_DEACTIVATE = 0;
5  const int SHAKE_INTERVAL_MIN = 1;
6  const int SHAKE_INTERVAL_MAX = 4;
7  //const float SHAKE_INTERVAL_DEVIATION = 1;
8 
9  float m_Time;
10  float m_ShakeTime;
11 
12  override void Init()
13  {
14  m_TrackActivatedTime = false;
15  m_ID = eModifiers.MDF_BRAIN;
18  }
19 
20  override string GetDebugText()
21  {
22  return ("Activate threshold: "+AGENT_THRESHOLD_ACTIVATE + "| " +"Deativate threshold: "+AGENT_THRESHOLD_DEACTIVATE);
23  }
24 
25  override protected bool ActivateCondition(PlayerBase player)
26  {
27  if(player.GetSingleAgentCount(eAgents.BRAIN) >= AGENT_THRESHOLD_ACTIVATE)
28  {
29  return true;
30  }
31  else
32  {
33  return false;
34  }
35  }
36 
37  override protected void OnActivate(PlayerBase player)
38  {
39  player.IncreaseDiseaseCount();
40  }
41 
42  override protected void OnDeactivate(PlayerBase player)
43  {
44  player.DecreaseDiseaseCount();
45  }
46 
47  override protected bool DeactivateCondition(PlayerBase player)
48  {
49  if(player.GetSingleAgentCount(eAgents.BRAIN) <= AGENT_THRESHOLD_DEACTIVATE)
50  {
51  return true;
52  }
53  else
54  {
55  return false;
56  }
57  }
58 
59  override protected void OnTick(PlayerBase player, float deltaT)
60  {
61  m_Time += deltaT;
62  float brain_agents = player.GetSingleAgentCountNormalized(eAgents.BRAIN) / 8.0;
63  float chance_of_laughter = Math.RandomFloat01();
64 
65  if( chance_of_laughter < brain_agents )
66  {
67  player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_LAUGHTER);
68  }
69 
70  if( m_Time >= m_ShakeTime )
71  {
72  DayZPlayerSyncJunctures.SendKuruRequest(player, brain_agents);
73  m_ShakeTime = m_Time + Math.RandomFloat(SHAKE_INTERVAL_MIN, SHAKE_INTERVAL_MAX);
74  }
75 
76  }
77 };
m_Time
protected float m_Time
Definition: carscript.c:146
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
DEFAULT_TICK_TIME_ACTIVE
const int DEFAULT_TICK_TIME_ACTIVE
Definition: modifiersmanager.c:31
PlayerBase
Definition: playerbaseclient.c:1
eAgents
eAgents
Definition: eagents.c:2
m_TickIntervalInactive
float m_TickIntervalInactive
Definition: modifierbase.c:18
eModifiers
eModifiers
Definition: emodifiers.c:1
ModifierBase
Definition: breathvapourmdfr.c:3
DayZPlayerSyncJunctures
Definition: dayzplayersyncjunctures.c:4
BrainDiseaseMdfr
Definition: braindisease.c:1
Math
Definition: enmath.c:6
m_ID
protected int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition: effect.c:49
DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_INACTIVE
Definition: modifiersmanager.c:33