Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
stomach.c
Go to the documentation of this file.
2 {
3  override void Init()
4  {
5  m_TrackActivatedTime = false;
6  m_ID = eModifiers.MDF_STOMACH;
9 
11  }
12 
13  override bool ActivateCondition(PlayerBase player)
14  {
15  return true;
16  }
17 
18  override bool DeactivateCondition(PlayerBase player)
19  {
20  return false;
21  }
22 
23  override void OnReconnect(PlayerBase player)
24  {
25 
26  }
27 
28  override void OnTick(PlayerBase player, float deltaT)
29  {
30  player.m_PlayerStomach.Update(deltaT);
31  /*
32  float stomachs_combined_before = player.GetStatStomachWater().Get() + player.GetStatStomachEnergy().Get();
33  if(stomachs_combined_before <=0) // takes care of division by 0 also there is no point in doing anything if there is nothing to transfer
34  {
35  player.GetStatStomachVolume().Set(0);
36  return;
37  }
38 
39  // Energy
40  if ( player.GetStatStomachEnergy().Get() >= PlayerConstants.STOMACH_ENERGY_TRANSFERED_PER_SEC*deltaT )
41  {
42  player.GetStatEnergy().Add(PlayerConstants.STOMACH_ENERGY_TRANSFERED_PER_SEC*deltaT);
43  player.GetStatStomachEnergy().Add(-PlayerConstants.STOMACH_ENERGY_TRANSFERED_PER_SEC*deltaT);
44  }
45  else
46  {
47  player.GetStatEnergy().Add(player.GetStatStomachEnergy().Get());
48  player.GetStatStomachEnergy().Set(0);
49  }
50  //Water
51  if ( player.GetStatStomachWater().Get() >= PlayerConstants.STOMACH_WATER_TRANSFERED_PER_SEC*deltaT )
52  {
53  player.GetStatWater().Add(PlayerConstants.STOMACH_WATER_TRANSFERED_PER_SEC*deltaT);
54  player.GetStatStomachWater().Add(-PlayerConstants.STOMACH_WATER_TRANSFERED_PER_SEC*deltaT);
55 
56  }
57  else
58  {
59  player.GetStatWater().Add(player.GetStatStomachWater().Get());
60  player.GetStatStomachWater().Set(0);
61 
62  }
63 
64  float stomachs_combined_after = player.GetStatStomachWater().Get() + player.GetStatStomachEnergy().Get();
65  float percentage = stomachs_combined_after / stomachs_combined_before;
66 
67  player.GetStatStomachVolume().Set( player.GetStatStomachVolume().Get() * percentage );
68  */
69  }
70 };
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
StomachMdfr
Definition: stomach.c:1
DisableDeactivateCheck
void DisableDeactivateCheck()
Definition: modifierbase.c:83
DEFAULT_TICK_TIME_ACTIVE
const int DEFAULT_TICK_TIME_ACTIVE
Definition: modifiersmanager.c:31
PlayerBase
Definition: playerbaseclient.c:1
m_TickIntervalInactive
float m_TickIntervalInactive
Definition: modifierbase.c:18
eModifiers
eModifiers
Definition: emodifiers.c:1
ModifierBase
Definition: breathvapourmdfr.c:3
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