DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
CAContinuousDisinfectPlant.c
См. документацию.
2{
3 protected float m_PlantNeededSpraying;
4 protected float m_TimeToComplete;
5 protected float m_SpentQuantityTotal;
6 protected float m_StartQuantity;
7 protected PlantBase m_Plant;
8
9 void CAContinuousDisinfectPlant( float quantity_used_per_second )
10 {
11 m_QuantityUsedPerSecond = quantity_used_per_second;
12 }
13
14 override void Setup( ActionData action_data )
15 {
16 GardenBase garden_base;
17 ActionTarget target = action_data.m_Target;
18 if ( Class.CastTo(garden_base, target.GetObject()))
19 {
20 Slot slot;
21
22 array<string> selections = new array<string>;
23 garden_base.GetActionComponentNameList(target.GetComponentIndex(), selections);
24 string selection;
25
26 for (int s = 0; s < selections.Count(); s++)
27 {
28 selection = selections[s];
29 slot = garden_base.GetSlotBySelection( selection );
30 if (slot)
31 break;
32 }
33
34 if ( slot && slot.GetPlant() )
35 {
36 m_Plant = PlantBase.Cast(slot.GetPlant());
37 if ( m_Plant )
38 {
40 m_StartQuantity = action_data.m_MainItem.GetQuantity();
41 if ( !m_SpentUnits )
42 {
43 m_SpentUnits = new Param1<float>(0);
44 }
45 else
46 {
47 m_SpentUnits.param1 = 0;
48 }
49 if ( action_data.m_MainItem )
50 {
51 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
52 }
53 if ( m_Plant )
54 {
55 m_PlantNeededSpraying = m_Plant.GetSprayUsage() - m_Plant.GetSprayQuantity();
56 }
57
59 }
60 }
61 }
62
63 /*PlantBase target_PB;
64 if (Class.CastTo(target_PB, action_data.m_Target.GetObject()))
65 {
66 m_SpentQuantity = 0;
67 m_StartQuantity = action_data.m_MainItem.GetQuantity();
68 if ( !m_SpentUnits )
69 {
70 m_SpentUnits = new Param1<float>(0);
71 }
72 else
73 {
74 m_SpentUnits.param1 = 0;
75 }
76 if ( action_data.m_MainItem )
77 {
78 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
79 }
80 if ( target_PB )
81 {
82 m_PlantNeededSpraying = target_PB.GetSprayUsage() - target_PB.GetSprayQuantity();
83 }
84
85 m_TimeToComplete = (Math.Min(m_PlantNeededSpraying,m_ItemQuantity))/m_QuantityUsedPerSecond;
86 }*/
87 }
88
89 override int Execute( ActionData action_data )
90 {
91 Object targetObject = action_data.m_Target.GetObject();
92
93 if ( !action_data.m_Player )
94 {
95 return UA_ERROR;
96 }
97
98 if ( m_ItemQuantity <= 0 )
99 {
100 return UA_FINISHED;
101 }
102 else
103 {
105 {
106 m_SpentQuantity += m_QuantityUsedPerSecond * action_data.m_Player.GetDeltaT();
108
109 if ( m_Action )
110 {
111 /*PlantBase plant;
112 Class.CastTo(plant, targetObject );*/
113 m_Plant.SprayPlant(m_SpentQuantity);
114 //m_Action.SendMessageToClient(action_data.m_Player, plant.StopInfestation( transfered_spray ));
115 }
116
117 CalcAndSetQuantity( action_data );
118
119 return UA_PROCESSING;
120 }
121 else
122 {
123 CalcAndSetQuantity( action_data );
124 OnCompletePogress(action_data);
125 return UA_FINISHED;
126 }
127 }
128 }
129
130 override float GetProgress()
131 {
132 //return (m_SpentQuantity*m_QuantityUsedPerSecond)/m_TimeToComplete;
134 }
135};
ActionBase ActionData
Определения ActionBase.c:30
class ActionTargets ActionTarget
void CalcAndSetQuantity()
Определения FireplaceBase.c:2640
void PlantBase()
Определения PlantBase.c:54
ActionBase m_Action
Определения CABase.c:3
void OnCompletePogress(ActionData action_data)
Определения CAContinuousBase.c:8
override int Execute(ActionData action_data)
Определения CAContinuousDisinfectPlant.c:89
void CAContinuousDisinfectPlant(float quantity_used_per_second)
Определения CAContinuousDisinfectPlant.c:9
override void Setup(ActionData action_data)
Определения CAContinuousDisinfectPlant.c:14
override float GetProgress()
Определения CAContinuousDisinfectPlant.c:130
float m_ItemQuantity
Определения CAContinuousQuantity.c:3
ref Param1< float > m_SpentUnits
Определения CAContinuousQuantity.c:8
float m_SpentQuantity
Определения CAContinuousQuantity.c:4
float m_QuantityUsedPerSecond
Определения CAContinuousQuantity.c:6
void CAContinuousQuantity(float quantity_used_per_second)
Определения CAContinuousQuantity.c:10
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения GardenPlot.c:2
Определения EnMath.c:7
Определения ObjectTyped.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Min(float x, float y)
Returns smaller of two given values.
const int UA_FINISHED
Определения constants.c:464
const int UA_ERROR
Определения constants.c:483
const int UA_PROCESSING
Определения constants.c:462