Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
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(g_Game.GetMission()).GetRainProcurementHandler();
15 }
16
19 {
20 #ifdef SERVER
21 Reset();
22 SetActive(true);
23 m_Handler.QueueStart(this);
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
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
TODO doc.
Definition enscript.c:118
void RainProcurementComponentBase(ItemBase procuringItem)
void OnUpdate(float deltaTime, float amount)
void StopRainProcurement()
Called on server to queue rain procurement removal (on next cycle end).
void StartRainProcurement()
Called on server to queue rain procurement (on next cycle end).
void ProcureLiquid(float amountBase, int liquidType=LIQUID_CLEANWATER)
float GetBaseLiquidAmount()
override this to get different amount per ProcureLiquid cycle
DayZGame g_Game
Definition dayzgame.c:3942
const float LIQUID_RAIN_AMOUNT_COEF_BASE
how intensive a snowfall should be to enable snowfall penalty on naked body
Definition constants.c:793
const int LIQUID_CLEANWATER
Definition constants.c:557
void SetActive()
Definition trapbase.c:404