DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
RainProcurementManager.c
См. документацию.
1
3{
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 // ----------------------------------------------------------------------------------------
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 // ----------------------------------------------------------------------------------------
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_FRESHWATER, fill_per_update );
39
40 //Print( "Quantity of " + m_ProcuringItem + " is: " + m_ProcuringItem.GetQuantity() );
41 }
42 else
43 {
44 //Print("vesel full");
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
77 {
78 if( !m_IsUnderRoof )
79 {
80 m_UpdateTimer.Stop();
81 }
82
83 }
84};
proto native Weather GetWeather()
Returns weather controller object.
Определения InventoryItem.c:731
void StopRainProcurement()
Определения RainProcurementManager.c:76
ref Timer m_UpdateTimer
Определения RainProcurementManager.c:6
const int RAIN_COEFFICIENT
Определения RainProcurementManager.c:7
void RainProcurementCheck()
Определения RainProcurementManager.c:29
void RainProcurementManager(ItemBase procuring_item)
Определения RainProcurementManager.c:9
void InitRainProcurement()
Определения RainProcurementManager.c:15
ItemBase m_ProcuringItem
Определения RainProcurementManager.c:4
Определения DayZPlayerImplement.c:63
proto native Rain GetRain()
Returns a rain phenomenon object.
proto native float GetActual()
proto native CGame GetGame()
const int LIQUID_FRESHWATER
Определения constants.c:549