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

Protected Member Functions

void ConstructionActionData ()
 
string GetMainPartName ()
 
string GetMainPartNameNoTool ()
 
void SetTarget (Object target)
 
Object GetTarget ()
 
void SetTargetPart (ConstructionPart target_part)
 
ConstructionPart GetTargetPart ()
 
void SetSlotId (int slot_id)
 
int GetSlotId ()
 
void SetActionInitiator (PlayerBase action_initiator)
 
PlayerBase GetActionInitiator ()
 
void SetNextIndex ()
 
void RefreshPartsToBuild (string main_part_name, ItemBase tool, bool use_tool=true)
 
void OnUpdateActions (Object item, Object target, int component_index)
 
void OnUpdateActionsNoTool (Object item, Object target, int component_index)
 
int GetConstructionPartsCount ()
 
ConstructionPart GetCurrentBuildPart ()
 
ConstructionPart GetBuildPartAtIndex (int idx)
 
ConstructionPart GetBuildPartNoToolAtIndex (int idx)
 
CombinationLock GetCombinationLock ()
 
void SetCombinationLock (CombinationLock combination_lock)
 
string GetDialNumberText ()
 
int GetAttachmentSlotFromSelection (PlayerBase player, EntityAI target, ItemBase item_to_attach, string selection)
 
void GetAttachmentsFromSelection (EntityAI target, string selection, out array< EntityAI > attachments)
 
void CombineItems (ItemBase target, ItemBase item)
 
void RefreshAttachmentsToDetach (EntityAI target, string main_part_name)
 
void SetNextAttachmentIndex ()
 
int GetAttachmentsToDetachCount ()
 
EntityAI GetActualAttachmentToDetach ()
 
void ResetActionIndexes ()
 

Protected Attributes

ActionVariantManager m_ActionVariantManager
 
ActionVariantManager m_ActionNoToolVariantManager
 
int m_AttachmentsIndex
 

Private Attributes

Object m_Target
 
ref array< ConstructionPartm_BuildParts
 
ref array< ConstructionPartm_BuildPartsNoTool
 
int m_PartIndex
 
string m_MainPartName
 
string m_MainPartNameNoTool
 
ref ConstructionPart m_TargetPart
 
CombinationLock m_CombinationLock
 
int m_SlotId
 
PlayerBase m_ActionInitiator
 
ref array< EntityAIm_Attachments
 

Detailed Description

Definition at line 1 of file ConstructionActionData.c.

Constructor & Destructor Documentation

◆ ConstructionActionData()

void ConstructionActionData::ConstructionActionData ( )
inlineprotected

Definition at line 28 of file ConstructionActionData.c.

29 {
32 m_PartIndex = 0;
33
36
37 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
38 {
42
46 }
47 }
static ActionVariantManager GetVariantManager(typename actionName)
ScriptInvoker GetOnUpdateInvoker()
ref array< EntityAI > m_Attachments
ref array< ConstructionPart > m_BuildParts
ActionVariantManager m_ActionNoToolVariantManager
void OnUpdateActionsNoTool(Object item, Object target, int component_index)
ActionVariantManager m_ActionVariantManager
void OnUpdateActions(Object item, Object target, int component_index)
ref array< ConstructionPart > m_BuildPartsNoTool
proto native void Clear()
remove all calls from list
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
proto native CGame GetGame()

References ScriptInvoker::Clear(), GetGame(), ActionVariantManager::GetOnUpdateInvoker(), ActionManagerClient::GetVariantManager(), ScriptInvoker::Insert(), m_ActionNoToolVariantManager, m_ActionVariantManager, m_Attachments, m_AttachmentsIndex, m_BuildParts, m_BuildPartsNoTool, m_PartIndex, OnUpdateActions(), and OnUpdateActionsNoTool().

Member Function Documentation

◆ CombineItems()

void ConstructionActionData::CombineItems ( ItemBase target,
ItemBase item )
inlineprotected

Definition at line 310 of file ConstructionActionData.c.

311 {
312 if (target.ConfigGetBool("canBeSplit") && item && !target.IsFullQuantity())
313 {
314 int quantity_used = target.ComputeQuantityUsed(item, true);
315 if (quantity_used != 0)
316 {
317 target.AddQuantity(quantity_used);
318 item.AddQuantity(-quantity_used);
319 }
320 }
321 }

◆ GetActionInitiator()

PlayerBase ConstructionActionData::GetActionInitiator ( )
inlineprotected

Definition at line 97 of file ConstructionActionData.c.

98 {
99 return m_ActionInitiator;
100 }

References m_ActionInitiator.

◆ GetActualAttachmentToDetach()

EntityAI ConstructionActionData::GetActualAttachmentToDetach ( )
inlineprotected

Definition at line 346 of file ConstructionActionData.c.

347 {
349 {
351
354 }
355
356 return NULL;
357 }
Definition EnMath.c:7
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

References Math::Clamp(), GetAttachmentsToDetachCount(), m_Attachments, and m_AttachmentsIndex.

◆ GetAttachmentsFromSelection()

void ConstructionActionData::GetAttachmentsFromSelection ( EntityAI target,
string selection,
out array< EntityAI > attachments )
inlineprotected

Definition at line 274 of file ConstructionActionData.c.

275 {
276 attachments.Clear(); //clear output
277
278 string cfg_path = "cfgVehicles" + " " + target.GetType() + " " + "GUIInventoryAttachmentsProps";
279 if (GetGame().ConfigIsExisting(cfg_path))
280 {
281 int child_count = GetGame().ConfigGetChildrenCount(cfg_path);
282
283 for (int i = 0; i < child_count; i++)
284 {
285 string child_name;
286 GetGame().ConfigGetChildName(cfg_path, i, child_name);
287
288 string child_selection;
289 GetGame().ConfigGetText(cfg_path + " " + child_name + " " + "selection", child_selection);
290
291 if (selection == child_selection)
292 {
294 GetGame().ConfigGetTextArray(cfg_path + " " + child_name + " " + "attachmentSlots", attachment_slots);
295
296 for (int j = 0; j < attachment_slots.Count(); ++j)
297 {
299
300 //is attached and can be detached
301 EntityAI attachment = target.GetInventory().FindAttachment(target_slot_id);
302 if (attachment && target.GetInventory().CanRemoveAttachmentEx(attachment, target_slot_id) && !target.GetInventory().GetSlotLock(target_slot_id))
303 attachments.Insert(attachment);
304 }
305 }
306 }
307 }
308 }
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id

References GetGame(), and InventorySlots::GetSlotIdFromString().

Referenced by RefreshAttachmentsToDetach().

◆ GetAttachmentSlotFromSelection()

int ConstructionActionData::GetAttachmentSlotFromSelection ( PlayerBase player,
EntityAI target,
ItemBase item_to_attach,
string selection )
inlineprotected

Definition at line 224 of file ConstructionActionData.c.

225 {
226 string cfg_path = "cfgVehicles" + " " + target.GetType() + " " + "GUIInventoryAttachmentsProps";
227
228 if (GetGame().ConfigIsExisting(cfg_path))
229 {
230 int child_count = GetGame().ConfigGetChildrenCount(cfg_path);
231
232 for (int i = 0; i < child_count; i++)
233 {
234 string child_name;
235 GetGame().ConfigGetChildName(cfg_path, i, child_name);
236
237 string child_selection;
238 GetGame().ConfigGetText(cfg_path + " " + child_name + " " + "selection", child_selection);
239
240 if (selection == child_selection)
241 {
243 GetGame().ConfigGetTextArray(cfg_path + " " + child_name + " " + "attachmentSlots", attachment_slots);
244
245 for (int j = 0; j < attachment_slots.Count(); ++j)
246 {
248 int item_slot_count = item_to_attach.GetInventory().GetSlotIdCount();
249
250 for (int k = 0; k < item_slot_count; ++k)
251 {
252 int item_slot_id = item_to_attach.GetInventory().GetSlotId(k);
253 ItemBase attachment_item = ItemBase.Cast(target.GetInventory().FindAttachment(item_slot_id));
254
256 {
257 if (target.GetInventory().CanAddAttachmentEx(item_to_attach, item_slot_id) && target.CanReceiveAttachment(item_to_attach, item_slot_id) || attachment_item && attachment_item.CanBeCombined(item_to_attach))
258 {
259 if (target.CanDisplayAttachmentSlot(target_slot_id))
260 return item_slot_id;
261 else
262 return -1;
263 }
264 }
265 }
266 }
267 }
268 }
269 }
270
271 return -1;
272 }

References GetGame(), and InventorySlots::GetSlotIdFromString().

◆ GetAttachmentsToDetachCount()

int ConstructionActionData::GetAttachmentsToDetachCount ( )
inlineprotected

Definition at line 341 of file ConstructionActionData.c.

342 {
343 return m_Attachments.Count();
344 }

References m_Attachments.

Referenced by GetActualAttachmentToDetach(), and SetNextAttachmentIndex().

◆ GetBuildPartAtIndex()

ConstructionPart ConstructionActionData::GetBuildPartAtIndex ( int idx)
inlineprotected

Definition at line 168 of file ConstructionActionData.c.

169 {
170 if (m_BuildParts.Count() > idx)
171 return m_BuildParts.Get(idx);
172 return null;
173 }

References m_BuildParts.

◆ GetBuildPartNoToolAtIndex()

ConstructionPart ConstructionActionData::GetBuildPartNoToolAtIndex ( int idx)
inlineprotected

Definition at line 175 of file ConstructionActionData.c.

176 {
177 if (m_BuildPartsNoTool.Count() > idx)
178 return m_BuildPartsNoTool.Get(idx);
179 return null;
180 }

References m_BuildPartsNoTool.

◆ GetCombinationLock()

CombinationLock ConstructionActionData::GetCombinationLock ( )
inlineprotected

Definition at line 185 of file ConstructionActionData.c.

186 {
187 return m_CombinationLock;
188 }

References m_CombinationLock.

◆ GetConstructionPartsCount()

int ConstructionActionData::GetConstructionPartsCount ( )
inlineprotected

Definition at line 157 of file ConstructionActionData.c.

158 {
159 return m_BuildParts.Count();
160 }

References m_BuildParts.

◆ GetCurrentBuildPart()

ConstructionPart ConstructionActionData::GetCurrentBuildPart ( )
inlineprotected

Definition at line 163 of file ConstructionActionData.c.

164 {
165 return null;
166 }

◆ GetDialNumberText()

string ConstructionActionData::GetDialNumberText ( )
inlineprotected

Definition at line 195 of file ConstructionActionData.c.

196 {
197 string dial_text;
198
200 {
201 string combination_text = m_CombinationLock.GetCombination().ToString();
202
203 //insert zeros to dials with 0 value
204 int length_diff = m_CombinationLock.GetLockDigits() - combination_text.Length();
205 for (int i = 0; i < length_diff; ++i)
207
208 //assemble the whole combination with selected part
209 for (int j = 0; j < m_CombinationLock.GetLockDigits(); ++j)
210 {
211 if (j == m_CombinationLock.GetDialIndex())
212 dial_text += string.Format("[%1]", combination_text.Get(j));
213 else
214 dial_text += string.Format(" %1 ", combination_text.Get(j));
215 }
216 }
217
218 return dial_text;
219 }

References m_CombinationLock.

◆ GetMainPartName()

string ConstructionActionData::GetMainPartName ( )
inlineprotected

Definition at line 52 of file ConstructionActionData.c.

53 {
54 return m_MainPartName;
55 }

References m_MainPartName.

◆ GetMainPartNameNoTool()

string ConstructionActionData::GetMainPartNameNoTool ( )
inlineprotected

Definition at line 57 of file ConstructionActionData.c.

58 {
60 }

References m_MainPartNameNoTool.

◆ GetSlotId()

int ConstructionActionData::GetSlotId ( )
inlineprotected

Definition at line 87 of file ConstructionActionData.c.

88 {
89 return m_SlotId;
90 }

References m_SlotId.

◆ GetTarget()

Object ConstructionActionData::GetTarget ( )
inlineprotected

Definition at line 67 of file ConstructionActionData.c.

68 {
69 return m_Target;
70 }

References m_Target.

◆ GetTargetPart()

ConstructionPart ConstructionActionData::GetTargetPart ( )
inlineprotected

Definition at line 77 of file ConstructionActionData.c.

78 {
79 return m_TargetPart;
80 }
ref ConstructionPart m_TargetPart

References m_TargetPart.

◆ OnUpdateActions()

void ConstructionActionData::OnUpdateActions ( Object item,
Object target,
int component_index )
inlineprotected

Definition at line 113 of file ConstructionActionData.c.

114 {
115 ItemBase tool = ItemBase.Cast(item);
116 if (tool)
117 {
120 {
121 string main_part_name = target.GetActionComponentName(component_index);
122 base_building_object.GetConstruction().GetConstructionPartsToBuild(main_part_name, m_BuildParts, tool, m_MainPartName, true);
124 }
125 else
126 {
127 m_BuildParts.Clear();
129 }
130
131 }
132 else
133 {
134 m_BuildParts.Clear();
136 }
137 //not needed
138 //m_Target = target;
139 }
void SetActionVariantCount(int count)

References ActionVariantManager::Clear(), m_ActionVariantManager, m_BuildParts, m_MainPartName, and ActionVariantManager::SetActionVariantCount().

Referenced by ConstructionActionData().

◆ OnUpdateActionsNoTool()

void ConstructionActionData::OnUpdateActionsNoTool ( Object item,
Object target,
int component_index )
inlineprotected

◆ RefreshAttachmentsToDetach()

void ConstructionActionData::RefreshAttachmentsToDetach ( EntityAI target,
string main_part_name )
inlineprotected

Definition at line 323 of file ConstructionActionData.c.

324 {
326 }
void GetAttachmentsFromSelection(EntityAI target, string selection, out array< EntityAI > attachments)

References GetAttachmentsFromSelection(), and m_Attachments.

◆ RefreshPartsToBuild()

void ConstructionActionData::RefreshPartsToBuild ( string main_part_name,
ItemBase tool,
bool use_tool = true )
inlineprotected

Definition at line 108 of file ConstructionActionData.c.

109 {
110
111 }

◆ ResetActionIndexes()

void ConstructionActionData::ResetActionIndexes ( )
inlineprotected

Definition at line 362 of file ConstructionActionData.c.

363 {
364 m_PartIndex = 0;
366 }

References m_AttachmentsIndex, and m_PartIndex.

◆ SetActionInitiator()

void ConstructionActionData::SetActionInitiator ( PlayerBase action_initiator)
inlineprotected

Definition at line 92 of file ConstructionActionData.c.

References m_ActionInitiator.

◆ SetCombinationLock()

void ConstructionActionData::SetCombinationLock ( CombinationLock combination_lock)
inlineprotected

◆ SetNextAttachmentIndex()

void ConstructionActionData::SetNextAttachmentIndex ( )
inlineprotected

Definition at line 328 of file ConstructionActionData.c.

329 {
331 {
336 }
337 else
339 }

References GetAttachmentsToDetachCount(), and m_AttachmentsIndex.

◆ SetNextIndex()

void ConstructionActionData::SetNextIndex ( )
inlineprotected

Definition at line 103 of file ConstructionActionData.c.

104 {
105 }

◆ SetSlotId()

void ConstructionActionData::SetSlotId ( int slot_id)
inlineprotected

Definition at line 82 of file ConstructionActionData.c.

83 {
85 }

References m_SlotId.

◆ SetTarget()

void ConstructionActionData::SetTarget ( Object target)
inlineprotected

Definition at line 62 of file ConstructionActionData.c.

63 {
65 }

References m_Target.

◆ SetTargetPart()

void ConstructionActionData::SetTargetPart ( ConstructionPart target_part)
inlineprotected

Definition at line 72 of file ConstructionActionData.c.

73 {
75 }

References m_TargetPart.

Member Data Documentation

◆ m_ActionInitiator

PlayerBase ConstructionActionData::m_ActionInitiator
private

Definition at line 19 of file ConstructionActionData.c.

Referenced by GetActionInitiator(), and SetActionInitiator().

◆ m_ActionNoToolVariantManager

ActionVariantManager ConstructionActionData::m_ActionNoToolVariantManager
protected

Definition at line 24 of file ConstructionActionData.c.

Referenced by ConstructionActionData(), and OnUpdateActionsNoTool().

◆ m_ActionVariantManager

ActionVariantManager ConstructionActionData::m_ActionVariantManager
protected

Definition at line 23 of file ConstructionActionData.c.

Referenced by ConstructionActionData(), and OnUpdateActions().

◆ m_Attachments

ref array<EntityAI> ConstructionActionData::m_Attachments
private

◆ m_AttachmentsIndex

int ConstructionActionData::m_AttachmentsIndex
protected

◆ m_BuildParts

ref array<ConstructionPart> ConstructionActionData::m_BuildParts
private

◆ m_BuildPartsNoTool

ref array<ConstructionPart> ConstructionActionData::m_BuildPartsNoTool
private

◆ m_CombinationLock

CombinationLock ConstructionActionData::m_CombinationLock
private

◆ m_MainPartName

string ConstructionActionData::m_MainPartName
private

Definition at line 10 of file ConstructionActionData.c.

Referenced by GetMainPartName(), and OnUpdateActions().

◆ m_MainPartNameNoTool

string ConstructionActionData::m_MainPartNameNoTool
private

Definition at line 11 of file ConstructionActionData.c.

Referenced by GetMainPartNameNoTool(), and OnUpdateActionsNoTool().

◆ m_PartIndex

int ConstructionActionData::m_PartIndex
private

Definition at line 9 of file ConstructionActionData.c.

Referenced by ConstructionActionData(), and ResetActionIndexes().

◆ m_SlotId

int ConstructionActionData::m_SlotId
private

Definition at line 18 of file ConstructionActionData.c.

Referenced by GetSlotId(), and SetSlotId().

◆ m_Target

Object ConstructionActionData::m_Target
private

Definition at line 3 of file ConstructionActionData.c.

Referenced by GetTarget(), and SetTarget().

◆ m_TargetPart

ref ConstructionPart ConstructionActionData::m_TargetPart
private

Definition at line 12 of file ConstructionActionData.c.

Referenced by GetTargetPart(), and SetTargetPart().


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