DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousDisinfectPlant Class Reference
Inheritance diagram for CAContinuousDisinfectPlant:
[legend]
Collaboration diagram for CAContinuousDisinfectPlant:
[legend]

Protected Member Functions

void CAContinuousDisinfectPlant (float quantity_used_per_second)
 
override void Setup (ActionData action_data)
 
override int Execute (ActionData action_data)
 
override float GetProgress ()
 

Protected Attributes

float m_PlantNeededSpraying
 
float m_TimeToComplete
 
float m_SpentQuantityTotal
 
float m_StartQuantity
 
PlantBase m_Plant
 

Additional Inherited Members

- Private Member Functions inherited from CAContinuousQuantity
void CAContinuousQuantity (float quantity_used_per_second)
 
override void Setup (ActionData action_data)
 
override int Execute (ActionData action_data)
 
override int Cancel (ActionData action_data)
 
override float GetProgress ()
 
void CalcAndSetQuantity (ActionData action_data)
 
- Private Attributes inherited from CAContinuousQuantity
float m_ItemQuantity
 
float m_SpentQuantity
 
float m_ItemMaxQuantity
 
float m_QuantityUsedPerSecond
 
float m_AdjustedQuantityUsedPerSecond
 
ref Param1< floatm_SpentUnits
 

Detailed Description

Definition at line 1 of file CAContinuousDisinfectPlant.c.

Constructor & Destructor Documentation

◆ CAContinuousDisinfectPlant()

void CAContinuousDisinfectPlant::CAContinuousDisinfectPlant ( float quantity_used_per_second)
inlineprotected

Member Function Documentation

◆ Execute()

override int CAContinuousDisinfectPlant::Execute ( ActionData action_data)
inlineprotected

Definition at line 81 of file CAContinuousDisinfectPlant.c.

82 {
83 Object targetObject = action_data.m_Target.GetObject();
84
85 if (!action_data.m_Player)
86 return UA_ERROR;
87
88 if (m_ItemQuantity <= 0)
89 return UA_FINISHED;
90 else
91 {
93 {
94 m_SpentQuantity += m_QuantityUsedPerSecond * action_data.m_Player.GetDeltaT();
95 float transfered_spray = action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus(m_SpentQuantity, m_Action.GetSpecialtyWeight(), true);
96
98
99 if (m_Action)
100 {
101 /*PlantBase plant;
102 Class.CastTo(plant, targetObject );*/
103 m_Plant.SprayPlant(transfered_spray);
104 //m_Action.SendMessageToClient(action_data.m_Player, plant.StopInfestation( transfered_spray ));
105 }
106
108
109 return UA_PROCESSING;
110 }
111 else
112 {
115 return UA_FINISHED;
116 }
117 }
118 }
void CalcAndSetQuantity()
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
const int UA_FINISHED
Definition constants.c:436
const int UA_ERROR
Definition constants.c:455
const int UA_PROCESSING
Definition constants.c:434

References CalcAndSetQuantity(), CABase::m_Action, CAContinuousQuantity::m_ItemQuantity, m_Plant, m_PlantNeededSpraying, CAContinuousQuantity::m_QuantityUsedPerSecond, CAContinuousQuantity::m_SpentQuantity, m_SpentQuantityTotal, CAContinuousBase::OnCompletePogress(), UA_ERROR, UA_FINISHED, and UA_PROCESSING.

◆ GetProgress()

override float CAContinuousDisinfectPlant::GetProgress ( )
inlineprotected

Definition at line 120 of file CAContinuousDisinfectPlant.c.

121 {
122 //return (m_SpentQuantity*m_QuantityUsedPerSecond)/m_TimeToComplete;
124 }

References m_SpentQuantityTotal, and m_StartQuantity.

◆ Setup()

override void CAContinuousDisinfectPlant::Setup ( ActionData action_data)
inlineprotected

Definition at line 14 of file CAContinuousDisinfectPlant.c.

15 {
17 ActionTarget target = action_data.m_Target;
18 if (Class.CastTo(garden_base, target.GetObject()))
19 {
20 Slot slot;
21
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)
43 else
44 m_SpentUnits.param1 = 0;
45 if (action_data.m_MainItem)
46 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
47 if (m_Plant)
48 m_PlantNeededSpraying = m_Plant.GetSprayUsage() - m_Plant.GetSprayQuantity();
49
51 }
52 }
53 }
54
55 /*PlantBase target_PB;
56 if (Class.CastTo(target_PB, action_data.m_Target.GetObject()))
57 {
58 m_SpentQuantity = 0;
59 m_StartQuantity = action_data.m_MainItem.GetQuantity();
60 if ( !m_SpentUnits )
61 {
62 m_SpentUnits = new Param1<float>(0);
63 }
64 else
65 {
66 m_SpentUnits.param1 = 0;
67 }
68 if ( action_data.m_MainItem )
69 {
70 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
71 }
72 if ( target_PB )
73 {
74 m_PlantNeededSpraying = target_PB.GetSprayUsage() - target_PB.GetSprayQuantity();
75 }
76
77 m_TimeToComplete = (Math.Min(m_PlantNeededSpraying,m_ItemQuantity))/m_QuantityUsedPerSecond;
78 }*/
79 }
ref Param1< float > m_SpentUnits
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition EnMath.c:7
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.

References Class::CastTo(), CAContinuousQuantity::m_ItemQuantity, m_Plant, m_PlantNeededSpraying, CAContinuousQuantity::m_QuantityUsedPerSecond, CAContinuousQuantity::m_SpentQuantity, CAContinuousQuantity::m_SpentUnits, m_StartQuantity, m_TimeToComplete, and Math::Min().

Member Data Documentation

◆ m_Plant

PlantBase CAContinuousDisinfectPlant::m_Plant
protected

Definition at line 7 of file CAContinuousDisinfectPlant.c.

Referenced by Execute(), and Setup().

◆ m_PlantNeededSpraying

float CAContinuousDisinfectPlant::m_PlantNeededSpraying
protected

Definition at line 3 of file CAContinuousDisinfectPlant.c.

Referenced by Execute(), and Setup().

◆ m_SpentQuantityTotal

float CAContinuousDisinfectPlant::m_SpentQuantityTotal
protected

Definition at line 5 of file CAContinuousDisinfectPlant.c.

Referenced by Execute(), and GetProgress().

◆ m_StartQuantity

float CAContinuousDisinfectPlant::m_StartQuantity
protected

Definition at line 6 of file CAContinuousDisinfectPlant.c.

Referenced by GetProgress(), and Setup().

◆ m_TimeToComplete

float CAContinuousDisinfectPlant::m_TimeToComplete
protected

Definition at line 4 of file CAContinuousDisinfectPlant.c.

Referenced by Setup().


The documentation for this class was generated from the following file: