Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
coughstate.c
Go to the documentation of this file.
1 class CoughSymptom extends SymptomBase
2 {
3  const int COUGH_BLOOD_LOSS = 50;
4  //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
5  override void OnInit()
6  {
7  m_SymptomType = SymptomTypes.PRIMARY;
8  m_Priority = 100;
9  m_ID = SymptomIDs.SYMPTOM_COUGH;
10  m_DestroyOnAnimFinish = true;
11  m_SyncToClient = false;
12  }
13 
14  bool IsContaminationActive()
15  {
16  return m_Player.GetModifiersManager().IsModifierActive(eModifiers.MDF_CONTAMINATION2) || m_Player.GetModifiersManager().IsModifierActive(eModifiers.MDF_CONTAMINATION3);
17  }
18 
19 
21  override void OnUpdateServer(PlayerBase player, float deltatime)
22  {
23 
24  }
25 
26  override void OnUpdateClient(PlayerBase player, float deltatime)
27  {
28  }
29 
30  override void OnAnimationStart()
31  {
32  if ( IsContaminationActive() )
33  {
34  PluginLifespan module_lifespan = PluginLifespan.Cast( GetPlugin( PluginLifespan ) );
35  module_lifespan.UpdateBloodyHandsVisibilityEx( m_Player, eBloodyHandsTypes.JUST_BLOOD );
36  }
37  }
38 
39 
40  override SmptAnimMetaBase SpawnAnimMetaObject()
41  {
42  return new SmptAnimMetaADD();
43  }
44 
46  override void OnGetActivatedServer(PlayerBase player)
47  {
48  if( m_Manager.GetCurrentCommandID() == DayZPlayerConstants.COMMANDID_MOVE && !player.IsRaised() && player.GetCommand_Move() && player.GetCommand_Move() && !player.GetCommand_Move().IsOnBack())
49  {
50  PlayAnimationADD(1);
51  }
52  else
53  {
54  PlaySound(EPlayerSoundEventID.SYMPTOM_COUGH);
55  }
56  player.SpreadAgentsEx(3);
57 
58  if ( IsContaminationActive() )
59  player.AddHealth("","Blood", -COUGH_BLOOD_LOSS);
60  }
61 
63  override void OnGetActivatedClient(PlayerBase player)
64  {
65  //if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetActivated", m_Player.ToString());
66  }
67 
69  override void OnGetDeactivatedServer(PlayerBase player)
70  {
71  //if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetDeactivated", m_Player.ToString());
72  }
73 
75  override void OnGetDeactivatedClient(PlayerBase player)
76  {
77  //if (LogManager.IsSymptomLogEnable()) Debug.SymptomLog("n/a", this.ToString(), "n/a", "OnGetDeactivated", m_Player.ToString());
78  }
79 }
SmptAnimMetaADD
Definition: smptanimmeta.c:193
m_Priority
int m_Priority
Definition: bioslobbyservice.c:34
m_Manager
ModifiersManager m_Manager
Definition: modifierbase.c:12
eBloodyHandsTypes
eBloodyHandsTypes
Definition: pluginlifespan.c:8
SymptomBase
Definition: statebase.c:1
m_SymptomType
int m_SymptomType
Definition: smptanimmeta.c:13
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
PlayerBase
Definition: playerbaseclient.c:1
OnUpdateServer
void OnUpdateServer(float deltatime, float blood_scale, bool no_blood_loss)
Definition: bleedingsource.c:114
PluginLifespan
void PluginLifespan()
Definition: pluginlifespan.c:45
OnUpdateClient
void OnUpdateClient(ActionData action_data)
Definition: actionbase.c:998
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
eModifiers
eModifiers
Definition: emodifiers.c:1
SymptomTypes
SymptomTypes
Definition: statemanager.c:26
PlaySound
void PlaySound()
Definition: hungersoundhandler.c:38
OnInit
void OnInit()
Definition: aibehaviour.c:49
EPlayerSoundEventID
EPlayerSoundEventID
Definition: playersoundeventhandler.c:1
m_ID
protected int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition: effect.c:49
SmptAnimMetaBase
Definition: smptanimmeta.c:82