Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
painkillersmdfr.c
Go to the documentation of this file.
2 {
3  const int LIFETIME = 240;
4  const int ACTIVATION_DELAY = 15;
5  override void Init()
6  {
8  m_IsPersistent = true;
9  m_ID = eModifiers.MDF_PAINKILLERS;
13  }
14 
15  override bool ActivateCondition(PlayerBase player)
16  {
17  return false;
18  }
19 
20  override void OnReconnect(PlayerBase player)
21  {
22  OnActivate(player);
23  }
24 
25  override string GetDebugText()
26  {
27  return (LIFETIME - GetAttachedTime()).ToString();
28  }
29 
30 
31  override void OnActivate(PlayerBase player)
32  {
33  if (player.GetBrokenLegs() != eBrokenLegs.NO_BROKEN_LEGS)
34  player.m_ShockHandler.SetMultiplier(0.5);//was 0.75 //Switch the shock multiplier NEED A CONST
35  player.IncreaseHealingsCount();
36  /*
37  if( player.GetNotifiersManager() )
38  player.GetNotifiersManager().ActivateByType(eNotifiers.NTF_PILLS);
39  */
40  m_Player.m_InjuryHandler.m_ForceInjuryAnimMask = m_Player.m_InjuryHandler.m_ForceInjuryAnimMask | eInjuryOverrides.PAIN_KILLERS_LVL0;
41  }
42 
43  override void OnDeactivate(PlayerBase player)
44  {
45  if (player.GetBrokenLegs() != eBrokenLegs.NO_BROKEN_LEGS)
46  player.m_ShockHandler.SetMultiplier(1); //Reset the shock multiplier when modifier stops
47  player.DecreaseHealingsCount();
48  /*
49  if( player.GetNotifiersManager() )
50  player.GetNotifiersManager().DeactivateByType(eNotifiers.NTF_PILLS);
51  */
52  m_Player.m_InjuryHandler.m_ForceInjuryAnimMask = m_Player.m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PAIN_KILLERS_LVL0;
53  m_Player.m_InjuryHandler.m_ForceInjuryAnimMask = m_Player.m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PAIN_KILLERS_LVL1;
54  }
55 
56  override bool DeactivateCondition(PlayerBase player)
57  {
58  float attached_time = GetAttachedTime();
59 
60  if( attached_time >= LIFETIME )
61  {
62  return true;
63  }
64  else
65  {
66  return false;
67  }
68  }
69 
70  override void OnTick(PlayerBase player, float deltaT)
71  {
72  if(GetAttachedTime() > ACTIVATION_DELAY)
73  {
74  m_Player.m_InjuryHandler.m_ForceInjuryAnimMask = m_Player.m_InjuryHandler.m_ForceInjuryAnimMask | eInjuryOverrides.PAIN_KILLERS_LVL1;
75  }
76  }
77 };
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
eBrokenLegs
eBrokenLegs
Definition: ebrokenlegs.c:1
LIFETIME
@ LIFETIME
Float R/W.
Definition: envisual.c:161
PlayerBase
Definition: playerbaseclient.c:1
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
m_TickIntervalInactive
float m_TickIntervalInactive
Definition: modifierbase.c:18
eModifiers
eModifiers
Definition: emodifiers.c:1
ModifierBase
Definition: breathvapourmdfr.c:3
m_IsPersistent
bool m_IsPersistent
Definition: modifierbase.c:16
GetAttachedTime
float GetAttachedTime()
Definition: modifierbase.c:150
PainKillersMdfr
Definition: painkillersmdfr.c:1
DisableActivateCheck
void DisableActivateCheck()
Definition: modifierbase.c:78
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