Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
rainprocurementcomponent.c
Go to the documentation of this file.
2{
5 protected bool m_IsUnderRoof;
6 protected bool m_IsActive;
7 protected int m_UpdateCounter;
8 protected const int UPDATE_ROOFCHECK_COUNT = 3; //do roofcheck every n updates
9
11 {
12 m_ProcuringItem = procuringItem;
13 Reset();
14 m_Handler = MissionBaseWorld.Cast(GetGame().GetMission()).GetRainProcurementHandler();
15 }
16
19 {
20 #ifdef SERVER
21 Reset();
22 SetActive(true);
24 #endif
25 }
26
29 {
30 #ifdef SERVER
31 if (IsActive())
32 {
33 SetActive(false);
34 m_Handler.QueueStop(this);
35 }
36 #endif
37 }
38
39 void OnUpdate(float deltaTime, float amount)
40 {
43 {
46 }
47 ProcureLiquid(amount);
48 }
49
50 protected void Reset()
51 {
52 m_UpdateCounter = -1;
53 }
54
55 protected void ProcureLiquid(float amountBase, int liquidType = LIQUID_CLEANWATER)
56 {
57 if (!m_IsUnderRoof)
58 {
59 float actualAmount = amountBase * GetBaseLiquidAmount();
60 Liquid.FillContainerEnviro(m_ProcuringItem, liquidType, actualAmount);
61 }
62 }
63
64 protected void UpdateIsUnderRoof()
65 {
66 m_IsUnderRoof = MiscGameplayFunctions.IsUnderRoof(m_ProcuringItem);
67 }
68
71 {
72 return GameConstants.LIQUID_RAIN_AMOUNT_COEF_BASE;
73 }
74
75 bool IsActive()
76 {
77 return m_IsActive;
78 }
79
80 void SetActive(bool run)
81 {
82 //resets times on start
83 if (run)
84 Reset();
85 m_IsActive = run;
86 }
87};
88
#define LIQUID_CLEANWATER
TODO doc.
Definition enscript.c:118
void ProcureLiquid(float amountBase, int liquidType=LIQUID_CLEANWATER)
void StartRainProcurement()
Called on server to queue rain procurement (on next cycle end)
void OnUpdate(float deltaTime, float amount)
void RainProcurementComponentBase(ItemBase procuringItem)
void StopRainProcurement()
Called on server to queue rain procurement removal (on next cycle end)
float GetBaseLiquidAmount()
override this to get different amount per ProcureLiquid cycle
void QueueStart(RainProcurementComponentBase component)
void QueueStop(RainProcurementComponentBase component)
proto native CGame GetGame()
void SetActive()
Definition trapbase.c:414