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

Protected Member Functions

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

Protected Attributes

float m_SlotFertilizerNeed
 
float m_TimeToComplete
 
float m_SpentQuantityTotal
 
float m_StartQuantity
 
Slot m_Slot
 
string m_Selection
 

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 CAContinuousFertilizeGardenSlot.c.

Constructor & Destructor Documentation

◆ CAContinuousFertilizeGardenSlot()

void CAContinuousFertilizeGardenSlot::CAContinuousFertilizeGardenSlot ( float quantity_used_per_second)
inlineprotected

Member Function Documentation

◆ Execute()

override int CAContinuousFertilizeGardenSlot::Execute ( ActionData action_data)
inlineprotected

Definition at line 63 of file CAContinuousFertilizeGardenSlot.c.

64 {
65 if (!action_data.m_Player)
66 return UA_ERROR;
67
69 return UA_FINISHED;
70 else
71 {
73 {
74 m_SpentQuantity += m_QuantityUsedPerSecond * action_data.m_Player.GetDeltaT();
75 float val = action_data.m_Player.GetSoftSkillsManager().AddSpecialtyBonus(m_SpentQuantity, m_Action.GetSpecialtyWeight(), true);
77 Class.CastTo(garden_base, action_data.m_Target.GetObject());
78 //string selection = garden_base.GetActionComponentName(action_data.m_Target.GetComponentIndex());
79
81
82 if (GetGame().IsServer())
83 action_data.m_MainItem.AddQuantity(-m_SpentQuantity);
84
85 garden_base.Fertilize(action_data.m_Player, action_data.m_MainItem, val, m_Selection);
86
87 return UA_PROCESSING;
88 }
89 else
90 {
93 return UA_FINISHED;
94 }
95 }
96 }
void CalcAndSetQuantity()
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
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(), Class::CastTo(), GetGame(), CABase::m_Action, CAContinuousQuantity::m_ItemQuantity, CAContinuousQuantity::m_QuantityUsedPerSecond, m_Selection, CAContinuousQuantity::m_SpentQuantity, m_SpentQuantityTotal, CAContinuousBase::OnCompletePogress(), UA_ERROR, UA_FINISHED, and UA_PROCESSING.

◆ GetProgress()

override float CAContinuousFertilizeGardenSlot::GetProgress ( )
inlineprotected

Definition at line 98 of file CAContinuousFertilizeGardenSlot.c.

99 {
100 /*if ( m_TimeToComplete == 0) //Prevent division by 0 case
101 {
102 return -1;
103 }*/
105 //return (m_SpentQuantity)/m_ItemQuantity;///(m_TimeToComplete * m_QuantityUsedPerSecond)/m_ItemQuantity;
106 }

References m_SpentQuantityTotal, and m_StartQuantity.

◆ Setup()

override void CAContinuousFertilizeGardenSlot::Setup ( ActionData action_data)
inlineprotected

Definition at line 16 of file CAContinuousFertilizeGardenSlot.c.

17 {
19 if (Class.CastTo(target_GB, action_data.m_Target.GetObject()))
20 {
22 m_StartQuantity = action_data.m_MainItem.GetQuantity();
23
24 if (!m_SpentUnits)
26 else
27 m_SpentUnits.param1 = 0;
28
29 if (action_data.m_MainItem)
30 m_ItemQuantity = action_data.m_MainItem.GetQuantity();
31
32 if (target_GB)
33 {
34 /*string selection = target_GB.GetActionComponentName(action_data.m_Target.GetComponentIndex());
35
36 Slot slot = target_GB.GetSlotBySelection( selection );*/
37
39 target_GB.GetActionComponentNameList(action_data.m_Target.GetComponentIndex(), selections);
40
41 for (int s = 0; s < selections.Count(); s++)
42 {
43 //string selection = selections[s];
45 m_Slot = target_GB.GetSlotBySelection(m_Selection);
46 if (m_Slot)
47 break;
48 }
49
50
51 string item_type = action_data.m_MainItem.GetType();
52 float consumed_quantity = GetGame().ConfigGetFloat("cfgVehicles " + item_type + " Horticulture ConsumedQuantity");
53
54 float max = m_Slot.GetFertilizerQuantityMax();
55
57 }
59 }
60 }
ref Param1< float > m_SpentUnits
Definition EnMath.c:7
static proto float Min(float x, float y)
Returns smaller of two given values.

References Class::CastTo(), GetGame(), CAContinuousQuantity::m_ItemQuantity, CAContinuousQuantity::m_QuantityUsedPerSecond, m_Selection, m_Slot, m_SlotFertilizerNeed, CAContinuousQuantity::m_SpentQuantity, CAContinuousQuantity::m_SpentUnits, m_StartQuantity, m_TimeToComplete, and Math::Min().

Member Data Documentation

◆ m_Selection

string CAContinuousFertilizeGardenSlot::m_Selection
protected

Definition at line 8 of file CAContinuousFertilizeGardenSlot.c.

Referenced by Execute(), and Setup().

◆ m_Slot

Slot CAContinuousFertilizeGardenSlot::m_Slot
protected

Definition at line 7 of file CAContinuousFertilizeGardenSlot.c.

Referenced by Setup().

◆ m_SlotFertilizerNeed

float CAContinuousFertilizeGardenSlot::m_SlotFertilizerNeed
protected

Definition at line 3 of file CAContinuousFertilizeGardenSlot.c.

Referenced by Setup().

◆ m_SpentQuantityTotal

float CAContinuousFertilizeGardenSlot::m_SpentQuantityTotal
protected

Definition at line 5 of file CAContinuousFertilizeGardenSlot.c.

Referenced by Execute(), and GetProgress().

◆ m_StartQuantity

float CAContinuousFertilizeGardenSlot::m_StartQuantity
protected

Definition at line 6 of file CAContinuousFertilizeGardenSlot.c.

Referenced by GetProgress(), and Setup().

◆ m_TimeToComplete

float CAContinuousFertilizeGardenSlot::m_TimeToComplete
protected

Definition at line 4 of file CAContinuousFertilizeGardenSlot.c.

Referenced by CAContinuousFertilizeGardenSlot(), and Setup().


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