DayZ
1.24
Loading...
Searching...
No Matches
RainProcurementManager.c
Go to the documentation of this file.
1
2
class
RainProcurementManager
3
{
4
protected
ItemBase
m_ProcuringItem
;
5
protected
int
m_IsUnderRoof
;
6
protected
ref
Timer
m_UpdateTimer
;
7
protected
const
int
RAIN_COEFFICIENT
= 10;
8
9
void
RainProcurementManager
(
ItemBase
procuring_item
)
10
{
11
m_ProcuringItem
=
procuring_item
;
12
}
13
14
// ----------------------------------------------------------------------------------------
15
void
InitRainProcurement
()
16
{
17
m_IsUnderRoof
=
MiscGameplayFunctions
.IsUnderRoof(
m_ProcuringItem
);
18
19
//m_ProcuringItem.SetQuantity(0); /*set to 0 for debug purposses*/
20
21
if
(!
m_IsUnderRoof
)
22
{
23
m_UpdateTimer
=
new
Timer
();
24
m_UpdateTimer
.Run(10,
this
,
"RainProcurementCheck"
,
NULL
,
true
);
25
}
26
}
27
28
// ----------------------------------------------------------------------------------------
29
void
RainProcurementCheck
()
30
{
31
float
rain_intensity
=
GetGame
().GetWeather().GetRain().GetActual();
32
float
fill_per_update
=
RAIN_COEFFICIENT
*
rain_intensity
;
33
34
if
(
rain_intensity
> 0)
35
{
36
if
(
m_ProcuringItem
.GetQuantity() <
m_ProcuringItem
.GetQuantityMax())
37
{
38
Liquid
.
FillContainerEnviro
(
m_ProcuringItem
,
LIQUID_WATER
,
fill_per_update
);
39
40
//Print( "Quantity of " + m_ProcuringItem + " is: " + m_ProcuringItem.GetQuantity() );
41
}
42
else
43
{
44
//Print("vesel full");
45
StopRainProcurement
();
46
}
47
}
48
}
49
50
// ----------------------------------------------------------------------------------------
51
/*bool IsUnderRoof()
52
{
53
vector minMax[2];
54
m_ProcuringItem.GetCollisionBox(minMax);
55
56
vector size = Vector(0,0,0);
57
size[1] = minMax[1][1] - minMax[0][1];
58
59
vector from = m_ProcuringItem.GetPosition() + size;
60
vector ceiling = "0 20 0";
61
vector to = from + ceiling;
62
vector contact_pos;
63
vector contact_dir;
64
65
int contact_component;
66
67
return DayZPhysics.RaycastRV( from, to, contact_pos, contact_dir, contact_component, NULL, NULL, m_ProcuringItem );
68
}*/
69
70
// ----------------------------------------------------------------------------------------
71
bool
IsRunning
()
72
{
73
return
m_UpdateTimer
!=
null
;
74
}
75
76
void
StopRainProcurement
()
77
{
78
if
(!
m_IsUnderRoof
)
79
m_UpdateTimer
.Stop();
80
81
}
82
};
ItemBase
Definition
InventoryItem.c:697
Liquid
Definition
Liquid.c:2
Liquid::FillContainerEnviro
static void FillContainerEnviro(ItemBase container, int liquid_type, float amount, bool inject_agents=false)
Definition
Liquid.c:126
Param3
Definition
EntityAI.c:95
RainProcurementManager
DEPRECATED, done through the RainProcurementHandler / component instead.
Definition
RainProcurementManager.c:3
RainProcurementManager::StopRainProcurement
void StopRainProcurement()
Definition
RainProcurementManager.c:76
RainProcurementManager::IsRunning
bool IsRunning()
Definition
RainProcurementManager.c:71
RainProcurementManager::m_UpdateTimer
ref Timer m_UpdateTimer
Definition
RainProcurementManager.c:6
RainProcurementManager::RAIN_COEFFICIENT
const int RAIN_COEFFICIENT
Definition
RainProcurementManager.c:7
RainProcurementManager::RainProcurementCheck
void RainProcurementCheck()
Definition
RainProcurementManager.c:29
RainProcurementManager::RainProcurementManager
void RainProcurementManager(ItemBase procuring_item)
Definition
RainProcurementManager.c:9
RainProcurementManager::m_IsUnderRoof
int m_IsUnderRoof
Definition
RainProcurementManager.c:5
RainProcurementManager::InitRainProcurement
void InitRainProcurement()
Definition
RainProcurementManager.c:15
RainProcurementManager::m_ProcuringItem
ItemBase m_ProcuringItem
Definition
RainProcurementManager.c:4
Timer
Definition
DayZPlayerImplement.c:61
GetGame
proto native CGame GetGame()
LIQUID_WATER
const int LIQUID_WATER
Definition
constants.c:504
scripts
4_World
Classes
RainProcurementManager.c
Generated by
1.10.0