DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
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_WATER)
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 {
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
void SetActive()
Definition TrapBase.c:463
Definition Liquid.c:2
static void FillContainerEnviro(ItemBase container, int liquid_type, float amount, bool inject_agents=false)
Definition Liquid.c:138
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)
float GetBaseLiquidAmount()
override this to get different amount per ProcureLiquid cycle
protected void ProcureLiquid(float amountBase, int liquidType=LIQUID_WATER)
protected RainProcurementHandler m_Handler
void QueueStart(RainProcurementComponentBase component)
void QueueStop(RainProcurementComponentBase component)
proto native CGame GetGame()
const float LIQUID_RAIN_AMOUNT_COEF_BASE
Definition constants.c:708
const int LIQUID_WATER
Definition constants.c:489