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

Protected Member Functions

void Attachments (Container parent, EntityAI entity)
 
void ~Attachments ()
 
AttachmentsWrapper GetWrapper ()
 
bool IsEmpty ()
 
bool IsItemActive ()
 
bool IsItemWithQuantityActive ()
 
void UnfocusAll ()
 
void SetDefaultFocus (bool while_micromanagment_mode=false)
 
void SetLastActive ()
 
void SetActive (bool active)
 
void SelFirstActive ()
 
SlotsIcon GetFocusedSlotsIcon ()
 
EntityAI GetFocusedItem ()
 
int GetFocusedSlot ()
 
bool SelectItem ()
 
bool Select ()
 
int GetRecipeCount (bool recipe_anywhere, EntityAI entity1, EntityAI entity2)
 
bool CanCombine ()
 
bool CanCombineAmmo ()
 
bool CanEquip ()
 
bool Combine ()
 
bool SplitItem ()
 
bool EquipItem ()
 
bool TransferItem ()
 
bool InspectItem ()
 
bool TransferItemToVicinity ()
 
bool IsActive ()
 
int GetAttachmentHeight ()
 
void UpdateInterval ()
 
array< intGetSlotsSorted ()
 
void AttachmentAdded (EntityAI item, string slot, EntityAI parent)
 
void AttachmentRemoved (EntityAI item, string slot, EntityAI parent)
 
void OnAttachmentReservationSet (EntityAI item, int slot_id)
 
void OnAttachmentReservationRelease (EntityAI item, int slot_id)
 
void InitAttachmentGrid (int att_row_index)
 
array< stringGetItemSlots (EntityAI e)
 
void ShowFalseAttachmentsHeader (bool show)
 
void SetFalseAttachmentsHeaderText (string text)
 
TextWidget GetFalseHeaderTextWidget ()
 

Protected Attributes

Container m_Parent
 
EntityAI m_Entity
 
ref AttachmentsWrapper m_AttachmentsContainer
 
ref array< stringm_AttachmentSlotNames
 
ref array< stringm_AttachmentSlotDisplayable
 
ref map< int, SlotsIconm_AttachmentSlots
 
ref array< intm_AttachmentIDOrdered
 
int m_RowIndex
 

Detailed Description

Definition at line 3 of file Attachments.c.

Constructor & Destructor Documentation

◆ Attachments()

void Attachments::Attachments ( Container parent,
EntityAI entity )
inlineprotected

Definition at line 15 of file Attachments.c.

16 {
17 m_Parent = parent;
23 m_Entity.GetOnItemAttached().Insert(AttachmentAdded);
24 m_Entity.GetOnItemDetached().Insert(AttachmentRemoved);
25 m_Entity.GetOnAttachmentSetLock().Insert(OnAttachmentReservationSet);
26 m_Entity.GetOnAttachmentReleaseLock().Insert(OnAttachmentReservationRelease);
27
28 }
Container m_Parent
Definition Attachments.c:5
void AttachmentRemoved(EntityAI item, string slot, EntityAI parent)
ref array< string > m_AttachmentSlotDisplayable
Definition Attachments.c:9
ref array< string > m_AttachmentSlotNames
Definition Attachments.c:8
void AttachmentAdded(EntityAI item, string slot, EntityAI parent)
void OnAttachmentReservationRelease(EntityAI item, int slot_id)
EntityAI m_Entity
Definition Attachments.c:6
array< string > GetItemSlots(EntityAI e)
ref array< int > m_AttachmentIDOrdered
Definition Attachments.c:11
void OnAttachmentReservationSet(EntityAI item, int slot_id)
ref map< int, SlotsIcon > m_AttachmentSlots
Definition Attachments.c:10

References AttachmentAdded(), AttachmentRemoved(), GetItemSlots(), m_AttachmentIDOrdered, m_AttachmentSlotDisplayable, m_AttachmentSlotNames, m_AttachmentSlots, m_Entity, m_Parent, OnAttachmentReservationRelease(), and OnAttachmentReservationSet().

◆ ~Attachments()

void Attachments::~Attachments ( )
inlineprotected

Definition at line 30 of file Attachments.c.

31 {
32 if (m_Entity)
33 {
34 m_Entity.GetOnItemAttached().Remove(AttachmentAdded);
35 m_Entity.GetOnItemDetached().Remove(AttachmentRemoved);
36 m_Entity.GetOnAttachmentSetLock().Remove(OnAttachmentReservationSet);
37 m_Entity.GetOnAttachmentReleaseLock().Remove(OnAttachmentReservationRelease);
38 }
39
41 }
ref AttachmentsWrapper m_AttachmentsContainer
Definition Attachments.c:7

References AttachmentAdded(), AttachmentRemoved(), m_AttachmentsContainer, m_Entity, OnAttachmentReservationRelease(), and OnAttachmentReservationSet().

Member Function Documentation

◆ AttachmentAdded()

void Attachments::AttachmentAdded ( EntityAI item,
string slot,
EntityAI parent )
inlineprotected

Definition at line 389 of file Attachments.c.

390 {
393 if (icon)
394 {
395 icon.SetSlotID(slot_id);
396 icon.SetSlotDisplayName(InventorySlots.GetSlotDisplayName(slot_id));
397 if (item)
398 icon.Init(item);
399 }
400 }
provides access to slot configuration
static proto native owned string GetSlotDisplayName(int id)
converts slot_id to string
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id

References InventorySlots::GetSlotDisplayName(), InventorySlots::GetSlotIdFromString(), and m_AttachmentSlots.

Referenced by Attachments(), InitAttachmentGrid(), and ~Attachments().

◆ AttachmentRemoved()

void Attachments::AttachmentRemoved ( EntityAI item,
string slot,
EntityAI parent )
inlineprotected

Definition at line 402 of file Attachments.c.

403 {
406 if (icon)
407 icon.Clear();
408 }

References InventorySlots::GetSlotIdFromString(), and m_AttachmentSlots.

Referenced by Attachments(), and ~Attachments().

◆ CanCombine()

bool Attachments::CanCombine ( )
inlineprotected

Definition at line 196 of file Attachments.c.

197 {
199 ItemBase item_in_hands = ItemBase.Cast(GetGame().GetPlayer().GetHumanInventory().GetEntityInHands());
200
202 }
PlayerBase GetPlayer()
EntityAI GetFocusedItem()
Definition Attachments.c:99
static int GetCombinationFlags(EntityAI entity1, EntityAI entity2)
proto native CGame GetGame()

References ItemManager::GetCombinationFlags(), GetFocusedItem(), GetGame(), and GetPlayer().

Referenced by AttachmentsWrapper::CanCombine().

◆ CanCombineAmmo()

bool Attachments::CanCombineAmmo ( )
inlineprotected

Definition at line 204 of file Attachments.c.

205 {
208 ItemBase item_in_hands = ItemBase.Cast(GetGame().GetPlayer().GetHumanInventory().GetEntityInHands());
210 Class.CastTo(amc, m_player.GetActionManager());
211
212 return (amc.CanPerformActionFromInventory(item_in_hands, ent));
213 }
DayZPlayer m_player
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), GetFocusedItem(), GetGame(), GetPlayer(), and m_player.

Referenced by AttachmentsWrapper::CanCombineAmmo().

◆ CanEquip()

bool Attachments::CanEquip ( )
inlineprotected

Definition at line 215 of file Attachments.c.

216 {
219 if (!entity || entity.IsInherited(Magazine))
220 return false;
221 return GetGame().GetPlayer().GetInventory().FindFreeLocationFor(entity, FindInventoryLocationType.ATTACHMENT, il);
222 }
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocation.

References GetFocusedItem(), and GetGame().

Referenced by AttachmentsWrapper::CanEquip().

◆ Combine()

bool Attachments::Combine ( )
inlineprotected

Definition at line 224 of file Attachments.c.

225 {
227 ItemBase item_in_hands = ItemBase.Cast(GetGame().GetPlayer().GetHumanInventory().GetEntityInHands());
228 Icon hands_icon = ItemManager.GetInstance().GetHandsPreview().GetIcon();
229
230 if (item_in_hands && ent && hands_icon)
231 return hands_icon.CombineItems(item_in_hands, ent);
232
233 return false;
234 }
Definition Icon.c:2
static ItemManager GetInstance()

References GetFocusedItem(), GetGame(), ItemManager::GetInstance(), and GetPlayer().

Referenced by AttachmentsWrapper::Combine().

◆ EquipItem()

bool Attachments::EquipItem ( )
inlineprotected

Definition at line 250 of file Attachments.c.

251 {
253 if (entity && !entity.IsInherited(Magazine) && !GetFocusedSlotsIcon().IsOutOfReach())
254 {
255 GetGame().GetPlayer().PredictiveTakeEntityToInventory(FindInventoryLocationType.ATTACHMENT, entity);
256 return true;
257 }
258 return false;
259 }
SlotsIcon GetFocusedSlotsIcon()
Definition Attachments.c:94

References GetFocusedItem(), GetFocusedSlotsIcon(), and GetGame().

Referenced by AttachmentsWrapper::EquipItem().

◆ GetAttachmentHeight()

int Attachments::GetAttachmentHeight ( )
inlineprotected

Definition at line 303 of file Attachments.c.

304 {
305 return m_AttachmentsContainer.Count();
306 }

References m_AttachmentsContainer.

◆ GetFalseHeaderTextWidget()

TextWidget Attachments::GetFalseHeaderTextWidget ( )
inlineprotected

Definition at line 559 of file Attachments.c.

560 {
561 return m_AttachmentsContainer.GetFalseHeaderTextWidget();
562 }

References m_AttachmentsContainer.

◆ GetFocusedItem()

EntityAI Attachments::GetFocusedItem ( )
inlineprotected

◆ GetFocusedSlot()

int Attachments::GetFocusedSlot ( )
inlineprotected

Definition at line 104 of file Attachments.c.

105 {
106 SlotsIcon icon = m_AttachmentsContainer.GetFocusedSlotsIcon();
107 if (icon)
108 return icon.GetSlotID();
109 return -1;
110 }

References m_AttachmentsContainer.

Referenced by AttachmentsWrapper::GetFocusedSlot().

◆ GetFocusedSlotsIcon()

SlotsIcon Attachments::GetFocusedSlotsIcon ( )
inlineprotected

Definition at line 94 of file Attachments.c.

95 {
96 return m_AttachmentsContainer.GetFocusedSlotsIcon();
97 }

References m_AttachmentsContainer.

Referenced by EquipItem(), Select(), SelectItem(), SplitItem(), TransferItem(), TransferItemToVicinity(), and UpdateInterval().

◆ GetItemSlots()

array< string > Attachments::GetItemSlots ( EntityAI e)
inlineprotected

Definition at line 520 of file Attachments.c.

521 {
526
528 int i = 0;
529 for (int s = 0; s < searching_in.Count(); ++s)
530 {
531 string cfg_name = searching_in.Get(s);
532 string path = cfg_name + " " + e.GetType();
533
534 if (GetGame().ConfigIsExisting(path))
535 {
536 GetGame().ConfigGetTextArray(path + " attachments", attachments_slots);
537 if (e.IsWeapon() && (!e.ConfigIsExisting("DisplayMagazine") || e.ConfigGetBool("DisplayMagazine")))
538 attachments_slots.Insert("magazine");
539
540 return attachments_slots;
541 }
542 }
543 if (e.IsWeapon() && (!e.ConfigIsExisting("DisplayMagazine") || e.ConfigGetBool("DisplayMagazine")))
544 attachments_slots.Insert("magazine");
545
546 return attachments_slots;
547 }
array< string > TStringArray
Definition EnScript.c:666
const string CFG_VEHICLESPATH
Definition constants.c:209
const string CFG_WEAPONSPATH
Definition constants.c:210
const string CFG_MAGAZINESPATH
Definition constants.c:211

References CFG_MAGAZINESPATH, CFG_VEHICLESPATH, CFG_WEAPONSPATH, GetGame(), and path.

Referenced by Attachments().

◆ GetRecipeCount()

int Attachments::GetRecipeCount ( bool recipe_anywhere,
EntityAI entity1,
EntityAI entity2 )
inlineprotected

Definition at line 190 of file Attachments.c.

191 {
192 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
193 return plugin_recipes_manager.GetValidRecipes(ItemBase.Cast(entity1), ItemBase.Cast(entity2), null, PlayerBase.Cast(GetGame().GetPlayer()));
194 }
PluginBase GetPlugin(typename plugin_type)

References GetGame(), GetPlayer(), and GetPlugin().

◆ GetSlotsSorted()

array< int > Attachments::GetSlotsSorted ( )
inlineprotected

Definition at line 384 of file Attachments.c.

385 {
387 }

References m_AttachmentIDOrdered.

◆ GetWrapper()

AttachmentsWrapper Attachments::GetWrapper ( )
inlineprotected

Definition at line 43 of file Attachments.c.

44 {
46 }

References m_AttachmentsContainer.

◆ InitAttachmentGrid()

void Attachments::InitAttachmentGrid ( int att_row_index)
inlineprotected

Definition at line 425 of file Attachments.c.

426 {
428 int i;
430
432 string name = m_Entity.GetDisplayName();
433 name.ToUpper();
434
436 m_AttachmentsContainer.SetParent(this);
437 m_AttachmentsContainer.SetFalseAttachmentsHeaderText(name);
438 m_AttachmentsContainer.GetRootWidget().SetSort(att_row_index);
440
441 for (i = 0; i < number_of_rows; i++)
442 {
445
446 if (i == (number_of_rows - 1) && m_AttachmentSlotNames.Count() % ITEMS_IN_ROW != 0)
447 ic.SetColumnCount(m_AttachmentSlotNames.Count() % ITEMS_IN_ROW);
448 else
449 ic.SetColumnCount(ITEMS_IN_ROW);
450
451 for (int j = 0; j < ITEMS_IN_ROW; j++)
452 {
453 icon = ic.GetSlotIcon(j);
454 WidgetEventHandler.GetInstance().RegisterOnDropReceived(icon.GetMainWidget(), m_Parent, "OnDropReceivedFromHeader2");
455 WidgetEventHandler.GetInstance().RegisterOnDropReceived(icon.GetGhostSlot(), m_Parent, "OnDropReceivedFromHeader2");
456 WidgetEventHandler.GetInstance().RegisterOnDropReceived(icon.GetPanelWidget(), m_Parent, "OnDropReceivedFromHeader2");
457
458 WidgetEventHandler.GetInstance().RegisterOnDraggingOver(icon.GetMainWidget(), m_Parent, "DraggingOverHeader");
459 WidgetEventHandler.GetInstance().RegisterOnDraggingOver(icon.GetGhostSlot(), m_Parent, "DraggingOverHeader");
460 WidgetEventHandler.GetInstance().RegisterOnDraggingOver(icon.GetPanelWidget(), m_Parent, "DraggingOverHeader");
461
462 WidgetEventHandler.GetInstance().RegisterOnMouseButtonDown(icon.GetMainWidget(), m_Parent, "MouseClick2");
463 WidgetEventHandler.GetInstance().RegisterOnMouseButtonDown(icon.GetGhostSlot(), m_Parent, "MouseClick2");
464 WidgetEventHandler.GetInstance().RegisterOnMouseButtonDown(icon.GetPanelWidget(), m_Parent, "MouseClick2");
465 }
466 }
467
468 for (i = 0; i < m_AttachmentSlotNames.Count(); i++)
469 {
471 WidgetEventHandler.GetInstance().RegisterOnDoubleClick(icon.GetPanelWidget(), m_Parent, "DoubleClick");
472
473 string path = "CfgSlots" + " Slot_" + m_AttachmentSlotNames[i];
474
475 //Show different magazine icon for firearms and pistols
476 if (m_AttachmentSlotNames[i] == "magazine")
477 {
478 if (!m_Entity.IsInherited(Pistol_Base))
479 path = "CfgSlots" + " Slot_" + "magazine2";
480 }
481
482 string icon_name = ""; //icon_name must be in format "set:<setname> image:<imagename>"
483 if (GetGame().ConfigGetText(path + " ghostIcon", icon_name) && icon_name != "")
488
489 icon.SetSlotID(slot_id);
490 icon.SetSlotDisplayName(InventorySlots.GetSlotDisplayName(slot_id));
491
492 EntityAI item = m_Entity.GetInventory().FindAttachment(slot_id);
493 if (item)
495 else
496 icon.Clear();
497
498 if (m_Entity.CanDisplayAttachmentSlot(slot_id))
499 icon.GetMainWidget().Show(true);
500 else
501 icon.GetMainWidget().Show(false);
502 }
503
504 if (m_AttachmentSlotNames.Count() > 0)
505 {
506 int row_index = number_of_rows - 1;
508 if (row_last)
509 {
510 for (int k = ((m_AttachmentSlotNames.Count() - 1) % ITEMS_IN_ROW) + 1; k < ITEMS_IN_ROW; k++)
511 row_last.GetSlotIcon(k).GetMainWidget().Show(false);
512 row_last.GetRootWidget().Update();
513 row_last.GetRootWidget().GetParent().Update();
514 }
515 }
516
517 m_AttachmentsContainer.RecomputeOpenedContainers();
518 }
const int ITEMS_IN_ROW
Definition Attachments.c:1
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Definition EnMath.c:7
base for semi auto weapons @NOTE name copies config base class
SlotsIcon GetSlotIcon(int index)
static const int IMAGESETGROUP_INVENTORY
static string VerifyIconImageString(int imageset_group=IMAGESETGROUP_INVENTORY, string icon_name="")
Checks for improperly formated, legacy image names and corrects them to default format.
static WidgetEventHandler GetInstance()
static proto float Ceil(float f)
Returns ceil of value.

References AttachmentAdded(), Math::Ceil(), GetGame(), WidgetEventHandler::GetInstance(), InventorySlots::GetSlotDisplayName(), SlotsContainer::GetSlotIcon(), InventorySlots::GetSlotIdFromString(), StaticGUIUtils::IMAGESETGROUP_INVENTORY, ITEMS_IN_ROW, m_AttachmentIDOrdered, m_AttachmentsContainer, m_AttachmentSlotNames, m_AttachmentSlots, m_Entity, m_Parent, m_RowIndex, name, path, and StaticGUIUtils::VerifyIconImageString().

◆ InspectItem()

bool Attachments::InspectItem ( )
inlineprotected

Definition at line 272 of file Attachments.c.

273 {
275 if (entity)
276 {
277 m_Parent.InspectItem(entity);
278 return true;
279 }
280 return false;
281 }

References GetFocusedItem(), and m_Parent.

Referenced by AttachmentsWrapper::InspectItem().

◆ IsActive()

bool Attachments::IsActive ( )
inlineprotected

Definition at line 298 of file Attachments.c.

299 {
300 return m_Parent.GetMainWidget().FindAnyWidget("AttachmentsWrapper").GetAlpha() > 0;
301 }

References m_Parent.

◆ IsEmpty()

bool Attachments::IsEmpty ( )
inlineprotected

Definition at line 48 of file Attachments.c.

49 {
50 return m_AttachmentsContainer.IsEmpty();
51 }

References m_AttachmentsContainer.

Referenced by IsItemActive(), and IsItemWithQuantityActive().

◆ IsItemActive()

bool Attachments::IsItemActive ( )
inlineprotected

Definition at line 53 of file Attachments.c.

54 {
56 if (!item)
57 return false;
59 }
bool IsEmpty()
Definition Attachments.c:48
static int HasItemQuantity(notnull EntityAI item)

References GetFocusedItem(), QuantityConversions::HasItemQuantity(), and IsEmpty().

Referenced by AttachmentsWrapper::IsItemActive().

◆ IsItemWithQuantityActive()

bool Attachments::IsItemWithQuantityActive ( )
inlineprotected

Definition at line 61 of file Attachments.c.

62 {
64 if (!item)
65 return false;
66 return !IsEmpty() && QuantityConversions.HasItemQuantity(item) && item.CanBeSplit();
67 }

References GetFocusedItem(), QuantityConversions::HasItemQuantity(), and IsEmpty().

Referenced by AttachmentsWrapper::IsItemWithQuantityActive().

◆ OnAttachmentReservationRelease()

void Attachments::OnAttachmentReservationRelease ( EntityAI item,
int slot_id )
inlineprotected

Definition at line 418 of file Attachments.c.

419 {
421 icon.Clear();
422 }

References m_AttachmentSlots.

Referenced by Attachments(), and ~Attachments().

◆ OnAttachmentReservationSet()

void Attachments::OnAttachmentReservationSet ( EntityAI item,
int slot_id )
inlineprotected

Definition at line 410 of file Attachments.c.

411 {
413
414 if (item)
415 icon.Init(item, true);
416 }

References m_AttachmentSlots.

Referenced by Attachments(), and ~Attachments().

◆ Select()

bool Attachments::Select ( )
inlineprotected

Definition at line 128 of file Attachments.c.

129 {
130 SlotsIcon selected_slot = ItemManager.GetInstance().GetSelectedIcon();
131 EntityAI selected_item = ItemManager.GetInstance().GetSelectedItem();
134 Man player = GetGame().GetPlayer();
135
136 if (focused_slot.IsReserved() || focused_item != selected_item && !(selected_slot && selected_slot.IsOutOfReach()))
137 {
138 if (selected_item)
139 {
140 if (selected_item.GetInventory().CanRemoveEntity())
141 {
142 if (m_Entity.GetInventory().CanAddAttachmentEx(selected_item, focused_slot.GetSlotID()))
143 {
144 player.PredictiveTakeEntityToTargetAttachmentEx(m_Entity, selected_item, focused_slot.GetSlotID());
145 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
146 return true;
147
148 }
149 else if (m_Entity.GetInventory().CanAddAttachment(selected_item))
150 {
151 player.PredictiveTakeEntityToTargetAttachment(m_Entity, selected_item);
152 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
153 return true;
154 }
155 }
156 }
157 else
158 {
159 if (focused_item && !focused_slot.IsOutOfReach())
160 {
161 EntityAI item_in_hands = GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
163 focused_item.GetInventory().GetCurrentInventoryLocation(il);
165 if (reachable && focused_item.GetInventory().CanRemoveEntity())
166 {
167 if (item_in_hands && item_in_hands.GetInventory().CanRemoveEntity())
168 {
170 {
171 player.PredictiveSwapEntities(item_in_hands, focused_item);
172 return true;
173 }
174 }
175 else
176 {
177 if (player.GetHumanInventory().CanAddEntityInHands(focused_item))
178 {
179 player.PredictiveTakeEntityToHands(focused_item);
180 return true;
181 }
182 }
183 }
184 }
185 }
186 }
187 return false;
188 }
static bool IsAttachmentReachable(EntityAI e, string att_slot_name="", int slot_id=-1, float range=1.5)
script counterpart to engine's class Inventory
Definition Inventory.c:79
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition Inventory.c:610

References GameInventory::CanSwapEntitiesEx(), GetFocusedItem(), GetFocusedSlotsIcon(), GetGame(), ItemManager::GetInstance(), AttachmentsOutOfReach::IsAttachmentReachable(), and m_Entity.

Referenced by AttachmentsWrapper::Select().

◆ SelectItem()

bool Attachments::SelectItem ( )
inlineprotected

Definition at line 112 of file Attachments.c.

113 {
116
117 if (icon && !icon.IsOutOfReach())
118 {
119 if (item && item.CanPutIntoHands(null))
120 ItemManager.GetInstance().SetSelectedItemEx(item, null, icon);
121 else
122 ItemManager.GetInstance().SetSelectedItemEx(null, null, icon);
123 return true;
124 }
125 return false;
126 }

References GetFocusedItem(), GetFocusedSlotsIcon(), and ItemManager::GetInstance().

Referenced by AttachmentsWrapper::SelectItem().

◆ SelFirstActive()

void Attachments::SelFirstActive ( )
inlineprotected

Definition at line 89 of file Attachments.c.

90 {
91 m_AttachmentsContainer.SetFirstActive();
92 }

References m_AttachmentsContainer.

◆ SetActive()

void Attachments::SetActive ( bool active)
inlineprotected

Definition at line 84 of file Attachments.c.

85 {
87 }

References m_AttachmentsContainer.

◆ SetDefaultFocus()

void Attachments::SetDefaultFocus ( bool while_micromanagment_mode = false)
inlineprotected

Definition at line 74 of file Attachments.c.

75 {
77 }

References m_AttachmentsContainer.

Referenced by UpdateInterval().

◆ SetFalseAttachmentsHeaderText()

void Attachments::SetFalseAttachmentsHeaderText ( string text)
inlineprotected

Definition at line 554 of file Attachments.c.

555 {
556 m_AttachmentsContainer.SetFalseAttachmentsHeaderText(text);
557 }

References m_AttachmentsContainer.

◆ SetLastActive()

void Attachments::SetLastActive ( )
inlineprotected

Definition at line 79 of file Attachments.c.

80 {
81 m_AttachmentsContainer.SetLastActive();
82 }

References m_AttachmentsContainer.

◆ ShowFalseAttachmentsHeader()

void Attachments::ShowFalseAttachmentsHeader ( bool show)
inlineprotected

Definition at line 549 of file Attachments.c.

550 {
551 m_AttachmentsContainer.ShowFalseAttachmentsHeader(show);
552 }

References m_AttachmentsContainer.

◆ SplitItem()

bool Attachments::SplitItem ( )
inlineprotected

Definition at line 236 of file Attachments.c.

237 {
239 if (entity && !entity.IsInherited(Magazine) && !GetFocusedSlotsIcon().IsOutOfReach())
240 {
241 if (entity.HasQuantity())
242 {
243 entity.OnRightClick();
244 return true;
245 }
246 }
247 return false;
248 }

References GetFocusedItem(), and GetFocusedSlotsIcon().

Referenced by AttachmentsWrapper::SplitItem().

◆ TransferItem()

bool Attachments::TransferItem ( )
inlineprotected

Definition at line 261 of file Attachments.c.

262 {
264 if (entity && !GetFocusedSlotsIcon().IsOutOfReach())
265 {
266 GetGame().GetPlayer().PredictiveTakeEntityToInventory(FindInventoryLocationType.CARGO, entity);
267 return true;
268 }
269 return false;
270 }

References GetFocusedItem(), GetFocusedSlotsIcon(), and GetGame().

Referenced by AttachmentsWrapper::TransferItem().

◆ TransferItemToVicinity()

bool Attachments::TransferItemToVicinity ( )
inlineprotected

Definition at line 283 of file Attachments.c.

284 {
287 if (item && !GetFocusedSlotsIcon().IsOutOfReach())
288 {
289 if (item.GetTargetQuantityMax() < item.GetQuantity())
290 item.SplitIntoStackMaxClient(null, -1);
291 else
292 player.PhysicalPredictiveDropItem(item);
293 return true;
294 }
295 return false;
296 }

References GetFocusedItem(), GetFocusedSlotsIcon(), GetGame(), and GetPlayer().

Referenced by AttachmentsWrapper::TransferItemToVicinity().

◆ UnfocusAll()

void Attachments::UnfocusAll ( )
inlineprotected

Definition at line 69 of file Attachments.c.

70 {
71 m_AttachmentsContainer.UnfocusAll();
72 }

References m_AttachmentsContainer.

◆ UpdateInterval()

void Attachments::UpdateInterval ( )
inlineprotected

Definition at line 308 of file Attachments.c.

309 {
311 int slot_id;
313 int i = 0;
314 for (i = m_AttachmentSlotNames.Count() - 1; i >= 0; --i)
315 {
317 if (m_Entity.CanDisplayAttachmentSlot(slot_id))
319 else
320 {
322 if (icon)
323 {
324 icon.GetMainWidget().Show(false);
325 if (GetFocusedSlotsIcon() == icon)
327 // radial icon (collabsable icon handling)
328 icon.UpdateInterval();
329 }
330 }
331
332 }
333
334 if (m_AttachmentSlotDisplayable.Count() == 0)
335 {
336 if (m_Parent)
337 {
339 //m_Parent.Close();
340 }
341 }
342
343 for (i = 0; i < m_AttachmentSlotDisplayable.Count(); ++i)
344 {
347 EntityAI item = icon.GetEntity();
348 icon.GetMainWidget().Show(true);
349 icon.UpdateInterval();
350 if (item)
351 {
352 bool draggable = true;
353 if (icon.IsReserved())
354 draggable = false;
355
356 if (m_Entity.GetInventory().GetSlotLock(slot_id) && ItemManager.GetInstance().GetDraggedItem() != item)
357 {
358 icon.GetMountedWidget().Show(true);
359 draggable = false;
360 }
361 else
362 icon.GetMountedWidget().Show(false);
363
364 PlayerBase p = PlayerBase.Cast(GetGame().GetPlayer());
365 bool in_hands_condition = m_Entity.GetHierarchyRoot() && item.GetInventory().CanRemoveEntity();
368 icon.GetOutOfReachWidget().Show(false);
369 else
370 {
371 icon.GetOutOfReachWidget().Show(true);
372 draggable = false;
373 }
374
375 if (draggable)
376 icon.GetPanelWidget().SetFlags(WidgetFlags.DRAGGABLE);
377 else
378 icon.GetPanelWidget().ClearFlags(WidgetFlags.DRAGGABLE);
379 }
380 }
381 m_AttachmentsContainer.GetRootWidget().Update();
382 }
void SetDefaultFocus(bool while_micromanagment_mode=false)
Definition Attachments.c:74
override void UpdateRadialIcon()
WidgetFlags
Definition EnWidgets.c:58

References GetFocusedSlotsIcon(), GetGame(), ItemManager::GetInstance(), InventorySlots::GetSlotIdFromString(), AttachmentsOutOfReach::IsAttachmentReachable(), m_AttachmentsContainer, m_AttachmentSlotDisplayable, m_AttachmentSlotNames, m_AttachmentSlots, m_Entity, m_Parent, SetDefaultFocus(), and Container::UpdateRadialIcon().

Referenced by AttachmentsWrapper::UpdateInterval().

Member Data Documentation

◆ m_AttachmentIDOrdered

ref array<int> Attachments::m_AttachmentIDOrdered
protected

Definition at line 11 of file Attachments.c.

Referenced by Attachments(), GetSlotsSorted(), and InitAttachmentGrid().

◆ m_AttachmentsContainer

◆ m_AttachmentSlotDisplayable

ref array<string> Attachments::m_AttachmentSlotDisplayable
protected

Definition at line 9 of file Attachments.c.

Referenced by Attachments(), and UpdateInterval().

◆ m_AttachmentSlotNames

ref array<string> Attachments::m_AttachmentSlotNames
protected

Definition at line 8 of file Attachments.c.

Referenced by Attachments(), InitAttachmentGrid(), and UpdateInterval().

◆ m_AttachmentSlots

◆ m_Entity

EntityAI Attachments::m_Entity
protected

Definition at line 6 of file Attachments.c.

Referenced by Attachments(), InitAttachmentGrid(), Select(), UpdateInterval(), and ~Attachments().

◆ m_Parent

Container Attachments::m_Parent
protected

Definition at line 5 of file Attachments.c.

Referenced by Attachments(), InitAttachmentGrid(), InspectItem(), IsActive(), and UpdateInterval().

◆ m_RowIndex

int Attachments::m_RowIndex
protected

Definition at line 13 of file Attachments.c.

Referenced by InitAttachmentGrid().


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