Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
charcoalmdfr.c
Go to the documentation of this file.
2 {
3  float m_Killrate;
4  const int CHARCOAL_LIFETIME = 300;
5  const int CHARCOAL_EFFECT_TIME = 100;
6 
7  override void Init()
8  {
10  m_IsPersistent = true;
11  m_ID = eModifiers.MDF_CHARCOAL;
14  m_Killrate = 2.85; // # of killed agents per sec
16  }
17 
18  override bool ActivateCondition(PlayerBase player)
19  {
20  return false;
21  }
22 
23  override void OnReconnect(PlayerBase player)
24  {
25  OnActivate( player );
26  }
27 
28  /*
29  override string GetDebugText()
30  {
31 
32  string text;
33  float time_till_effective = CHARCOAL_LIFETIME - CHARCOAL_EFFECT_TIME - GetAttachedTime();
34 
35  text = "time till effective: " + time_till_effective.ToString() + "\n";
36 
37  if(time_till_effective > 0)
38  text += "killing agents:" + "NO";
39  else
40  text += "killing agents:" + "YES";
41 
42 
43  return text;
44 
45  }
46  */
47 
48 
49  override string GetDebugTextSimple()
50  {
51  return ( (int)(CHARCOAL_LIFETIME - GetAttachedTime()) ).ToString() + " | " + (((int)(CHARCOAL_LIFETIME - CHARCOAL_EFFECT_TIME - GetAttachedTime())) * -1).ToString();
52  }
53 
54  override void OnActivate(PlayerBase player)
55  {
56  player.IncreaseHealingsCount();
57 
58  }
59 
60  override void OnDeactivate(PlayerBase player)
61  {
62  player.DecreaseHealingsCount();
63 
64  }
65 
66  override bool DeactivateCondition(PlayerBase player)
67  {
68  float attached_time = GetAttachedTime();
69 
70  if ( attached_time >= CHARCOAL_LIFETIME )
71  {
72  return true;
73  }
74  else
75  {
76  return false;
77  }
78  }
79 
80  override void OnTick(PlayerBase player, float deltaT)
81  {
82  if ( GetAttachedTime() > ( CHARCOAL_LIFETIME - CHARCOAL_EFFECT_TIME ) )
83  {
84  player.m_AgentPool.AddAgent(eAgents.SALMONELLA, -m_Killrate * deltaT);
85  }
86  }
87 };
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
ToString
proto string ToString()
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
m_IsPersistent
bool m_IsPersistent
Definition: modifierbase.c:16
GetAttachedTime
float GetAttachedTime()
Definition: modifierbase.c:150
int
Param3 int
DisableActivateCheck
void DisableActivateCheck()
Definition: modifierbase.c:78
CharcoalMdfr
Definition: charcoalmdfr.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
DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_INACTIVE
Definition: modifiersmanager.c:33