DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс CAContinuousMineWood
+ Граф наследования:CAContinuousMineWood:

Защищенные члены

void CAContinuousMineWood (float time_between_drops)
 
override void Setup (ActionData action_data)
 
override int Execute (ActionData action_data)
 
override float GetProgress ()
 
bool GetMiningData (ActionData action_data)
 
void CreatePrimaryItems (ActionData action_data)
 
void CreateSecondaryItems (ActionData action_data, string material_secondary="", int quantity_secondary=-1)
 
void DamagePlayersHands (PlayerBase player)
 

Защищенные данные

float m_TimeElpased
 
float m_AdjustedTimeBetweenMaterialDrops
 
float m_CycleTimeOverride
 
float m_TimeBetweenMaterialDrops
 
float m_DamageToMiningItemEachDrop
 
float m_AdjustedDamageToMiningItemEachDrop
 
int m_AmountOfDrops
 
int m_CurrentAssumedDrops
 
ref map< string, intm_MaterialAndQuantityMap
 
float m_TimeToComplete
 
ref Param1< floatm_SpentUnits
 
bool m_DataLoaded = false
 
const int MINEDITEM_MAX = 5
 
ItemBase m_MinedItem [MINEDITEM_MAX]
 
ItemBase m_SecondaryItem
 

Подробное описание

Конструктор(ы)

◆ CAContinuousMineWood()

void CAContinuousMineWood ( float time_between_drops)
inlineprotected
20 {
23 }
float m_TimeBetweenMaterialDrops
Definition CAContinuousMineWood.c:6
float m_CycleTimeOverride
Definition CAContinuousMineWood.c:5
Definition EntityAI.c:95

Перекрестные ссылки m_CycleTimeOverride и m_TimeBetweenMaterialDrops.

Методы

◆ CreatePrimaryItems()

void CreatePrimaryItems ( ActionData action_data)
inlineprotected
151 {
152 string material;
153 int increment;
154 for (int i = 0; i < m_MaterialAndQuantityMap.Count(); i++)
155 {
157
158 if (material != "")
159 {
161
162 if ( !m_MinedItem[i] )
163 {
164 m_MinedItem[i] = ItemBase.Cast(GetGame().CreateObjectEx(material,action_data.m_Player.GetPosition(), ECE_PLACE_ON_SURFACE));
165 m_MinedItem[i].SetQuantity(increment);
166 }
167 else if (m_MinedItem[i].HasQuantity())
168 {
170 {
171 int stack_max = m_MinedItem[i].GetQuantityMax();
172
173 increment -= stack_max - m_MinedItem[i].GetQuantity();
174 if (increment >= 1.0)
175 {
176 m_MinedItem[i] = ItemBase.Cast(GetGame().CreateObjectEx(material,action_data.m_Player.GetPosition(), ECE_PLACE_ON_SURFACE));
177 m_MinedItem[i].SetQuantity(increment,false);
178 }
179 }
180 else
181 {
182 m_MinedItem[i].AddQuantity(increment,false);
183 }
184 }
185 else
186 {
187 m_MinedItem[i] = ItemBase.Cast(GetGame().CreateObjectEx(material,action_data.m_Player.GetPosition(), ECE_PLACE_ON_SURFACE));
188 }
189 }
190 }
191 }
const int ECE_PLACE_ON_SURFACE
Definition CentralEconomy.c:37
bool IsFullQuantity()
Definition ItemBase.c:8134
override bool HasQuantity()
Definition ItemBase.c:8124
ItemBase m_MinedItem[MINEDITEM_MAX]
Definition CAContinuousMineWood.c:16
ref map< string, int > m_MaterialAndQuantityMap
Definition CAContinuousMineWood.c:11
Definition InventoryItem.c:731
proto native CGame GetGame()

Перекрестные ссылки ECE_PLACE_ON_SURFACE, GetGame(), HasQuantity(), IsFullQuantity(), m_MaterialAndQuantityMap и m_MinedItem.

Используется в Execute().

◆ CreateSecondaryItems()

void CreateSecondaryItems ( ActionData action_data,
string material_secondary = "",
int quantity_secondary = -1 )
inlineprotected
194 {
195 if (material_secondary == "" || quantity_secondary <= 0)
196 {
197 return;
198 }
199
200 m_SecondaryItem = ItemBase.Cast(GetGame().CreateObjectEx(material_secondary,action_data.m_Player.GetPosition(), ECE_PLACE_ON_SURFACE));
201 if ( !m_SecondaryItem.HasQuantity() )
202 {
204 return;
205 }
206
208 int stack_max = m_SecondaryItem.GetQuantityMax();
209 int stacks_amount;
210
212
213 for (int i = 0; i < stacks_amount; i++)
214 {
215 if (increment > stack_max)
216 {
217 m_SecondaryItem.SetQuantity(stack_max);
219 m_SecondaryItem = ItemBase.Cast(GetGame().CreateObjectEx(material_secondary,action_data.m_Player.GetPosition(), ECE_PLACE_ON_SURFACE));
220 }
221 else
222 {
223 m_SecondaryItem.SetQuantity(increment);
224 }
225 }
226 }
ItemBase m_SecondaryItem
Definition CAContinuousMineWood.c:17
void CreateSecondaryItems(ActionData action_data, string material_secondary="", int quantity_secondary=-1)
Definition CAContinuousMineWood.c:193
Definition EnMath.c:7
static proto float Ceil(float f)
Returns ceil of value.

Перекрестные ссылки Math::Ceil(), CreateSecondaryItems(), ECE_PLACE_ON_SURFACE, GetGame() и m_SecondaryItem.

Используется в CreateSecondaryItems() и Execute().

◆ DamagePlayersHands()

void DamagePlayersHands ( PlayerBase player)
inlineprotected
229 {
230 ItemBase gloves = ItemBase.Cast(player.FindAttachmentBySlotName("Gloves"));
231 if ( gloves && !gloves.IsDamageDestroyed() )
232 {
233 gloves.DecreaseHealth("","",m_AdjustedDamageToMiningItemEachDrop);
234 }
235 else
236 {
237 int rand = Math.RandomIntInclusive(0,9);
238 if ( rand == 0 )
239 {
241 if ( rand == 0 && !player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("LeftForeArmRoll") )
242 {
243 player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("RightForeArmRoll");
244 }
245 else if ( rand == 1 && !player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("RightForeArmRoll") )
246 {
247 player.GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("LeftForeArmRoll");
248 }
249 }
250 }
251 }
float m_AdjustedDamageToMiningItemEachDrop
Definition CAContinuousMineWood.c:8
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54

Перекрестные ссылки m_AdjustedDamageToMiningItemEachDrop и Math::RandomIntInclusive().

Используется в Execute().

◆ Execute()

override int Execute ( ActionData action_data)
inlineprotected
50 {
52 Class.CastTo(targetObject, action_data.m_Target.GetObject());
53 if ( !action_data.m_Player || !m_DataLoaded )
54 {
55 return UA_ERROR;
56 }
57
58 if ( (action_data.m_MainItem && action_data.m_MainItem.IsDamageDestroyed()) || targetObject.IsDamageDestroyed() )
59 {
60 return UA_FINISHED;
61 }
62 else
63 {
65 {
66 m_TimeElpased += action_data.m_Player.GetDeltaT();
67 }
68 else
69 {
70 if ( GetGame().IsServer() )
71 {
72 float damage = 0;
73 if (m_AmountOfDrops > 0)
74 damage = (1 / m_AmountOfDrops) * 100;
75
76 targetObject.DecreaseHealth("", "", damage, targetObject.CanBeAutoDeleted());
78 if (action_data.m_MainItem)
79 action_data.m_MainItem.DecreaseHealth( "", "", m_AdjustedDamageToMiningItemEachDrop );
80 else
81 {
83 }
84
85 if ( targetObject.IsDamageDestroyed() ) //client does not know the target is destroyed yet, happens on the next Execute!
86 {
87 if ( m_SpentUnits )
88 {
91 }
92
93 if ( WoodBase.Cast(targetObject) )
94 {
96
97 if (target_woodbase.GetSecondaryOutput() != "")
98 CreateSecondaryItems(action_data,target_woodbase.GetSecondaryOutput(),target_woodbase.GetSecondaryDropsAmount());
99 }
100
101 if (action_data.m_MainItem)
102 {
103 targetObject.OnTreeCutDown( action_data.m_MainItem );
104 }
105 else
106 {
107 targetObject.OnTreeCutDown( action_data.m_Player );
108 }
109 }
110 }
111
113 if (m_AmountOfDrops > 0 && m_CurrentAssumedDrops >= m_AmountOfDrops) //assumed end, client does not know the target is destroyed yet
114 {
116 return UA_FINISHED;
117 }
118
121 }
122 return UA_PROCESSING;
123 }
124 }
void WoodBase()
Definition WoodBase.c:30
void SetACData(Param units)
Definition CABase.c:40
void OnCompletePogress(ActionData action_data)
Definition CAContinuousBase.c:8
void CreatePrimaryItems(ActionData action_data)
Definition CAContinuousMineWood.c:150
float m_AdjustedTimeBetweenMaterialDrops
Definition CAContinuousMineWood.c:4
int m_CurrentAssumedDrops
Definition CAContinuousMineWood.c:10
bool m_DataLoaded
Definition CAContinuousMineWood.c:14
int m_AmountOfDrops
Definition CAContinuousMineWood.c:9
ref Param1< float > m_SpentUnits
Definition CAContinuousMineWood.c:13
float m_TimeElpased
Definition CAContinuousMineWood.c:3
void DamagePlayersHands(PlayerBase player)
Definition CAContinuousMineWood.c:228
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition ObjectTyped.c:2
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:443
const int UA_ERROR
Definition constants.c:462
const int UA_PROCESSING
Definition constants.c:441

Перекрестные ссылки Class::CastTo(), CreatePrimaryItems(), CreateSecondaryItems(), DamagePlayersHands(), GetGame(), m_AdjustedDamageToMiningItemEachDrop, m_AdjustedTimeBetweenMaterialDrops, m_AmountOfDrops, m_CurrentAssumedDrops, m_DataLoaded, m_SpentUnits, m_TimeElpased, CAContinuousBase::OnCompletePogress(), CABase::SetACData(), UA_ERROR, UA_FINISHED, UA_PROCESSING и WoodBase().

◆ GetMiningData()

bool GetMiningData ( ActionData action_data)
inlineprotected
134 {
137 if ( Class.CastTo(ntarget, action_data.m_Target.GetObject()) )
138 {
139 m_AmountOfDrops = ntarget.GetAmountOfDropsEx(action_data.m_MainItem,adata.m_HarvestType);
141 m_CycleTimeOverride = ntarget.GetCycleTimeOverride(); //TODO
142 ntarget.GetMaterialAndQuantityMapEx(action_data.m_MainItem,m_MaterialAndQuantityMap, adata.m_HarvestType);
143 m_DamageToMiningItemEachDrop = ntarget.GetDamageToMiningItemEachDropEx(action_data.m_MainItem, adata.m_HarvestType );
145 return true;
146 }
147 return false;
148 }
float m_DamageToMiningItemEachDrop
Definition CAContinuousMineWood.c:7
Definition ActionMineTree.c:2

Перекрестные ссылки Class::CastTo(), m_AdjustedDamageToMiningItemEachDrop, m_AmountOfDrops, m_CurrentAssumedDrops, m_CycleTimeOverride, m_DamageToMiningItemEachDrop, m_MaterialAndQuantityMap и WoodBase().

Используется в Setup().

◆ GetProgress()

override float GetProgress ( )
inlineprotected

Перекрестные ссылки m_AdjustedTimeBetweenMaterialDrops и m_TimeElpased.

◆ Setup()

override void Setup ( ActionData action_data)
inlineprotected
26 {
27 m_TimeElpased = 0;
28 if ( !m_SpentUnits )
29 {
31 }
32 else
33 {
34 m_SpentUnits.param1 = 0;
35 }
38
39 if (m_CycleTimeOverride > -1.0)
40 {
42 if (!action_data.m_MainItem) //hand action
44 }
47 }
bool GetMiningData(ActionData action_data)
Definition CAContinuousMineWood.c:133
float m_TimeToComplete
Definition CAContinuousMineWood.c:12

Перекрестные ссылки GetMiningData(), m_AdjustedTimeBetweenMaterialDrops, m_AmountOfDrops, m_CycleTimeOverride, m_DataLoaded, m_MaterialAndQuantityMap, m_SpentUnits, m_TimeBetweenMaterialDrops, m_TimeElpased и m_TimeToComplete.

Поля

◆ m_AdjustedDamageToMiningItemEachDrop

float m_AdjustedDamageToMiningItemEachDrop
protected

◆ m_AdjustedTimeBetweenMaterialDrops

float m_AdjustedTimeBetweenMaterialDrops
protected

Используется в Execute(), GetProgress() и Setup().

◆ m_AmountOfDrops

int m_AmountOfDrops
protected

◆ m_CurrentAssumedDrops

int m_CurrentAssumedDrops
protected

Используется в Execute() и GetMiningData().

◆ m_CycleTimeOverride

float m_CycleTimeOverride
protected

Используется в CAContinuousMineWood(), GetMiningData() и Setup().

◆ m_DamageToMiningItemEachDrop

float m_DamageToMiningItemEachDrop
protected

Используется в CAContinuousMineRock::GetMiningData() и GetMiningData().

◆ m_DataLoaded

bool m_DataLoaded = false
protected

Используется в Execute() и Setup().

◆ m_MaterialAndQuantityMap

ref map<string,int> m_MaterialAndQuantityMap
protected

◆ m_MinedItem

ItemBase m_MinedItem[MINEDITEM_MAX]
protected

Используется в CreatePrimaryItems().

◆ m_SecondaryItem

ItemBase m_SecondaryItem
protected

Используется в CreateSecondaryItems().

◆ m_SpentUnits

ref Param1<float> m_SpentUnits
protected

Используется в Execute() и Setup().

◆ m_TimeBetweenMaterialDrops

float m_TimeBetweenMaterialDrops
protected

◆ m_TimeElpased

float m_TimeElpased
protected

Используется в Execute(), GetProgress() и Setup().

◆ m_TimeToComplete

float m_TimeToComplete
protected

Используется в Setup().

◆ MINEDITEM_MAX

const int MINEDITEM_MAX = 5
protected

Объявления и описания членов класса находятся в файле: