4 protected ref CargoContainer m_CargoGrid;
20 m_Entity.GetOnItemAttached().Remove(AttachmentAdded);
21 m_Entity.GetOnItemDetached().Remove(AttachmentRemoved);
30 if (m_AttachmentAttachments)
31 m_AttachmentAttachments.Clear();
33 if (m_AttachmentAttachmentsContainers)
34 m_AttachmentAttachmentsContainers.Clear();
36 if (m_AttachmentCargos)
37 m_AttachmentCargos.Clear();
45 m_Body.Insert(m_Atts.GetWrapper());
48 m_Body.Insert(m_CargoGrid);
51 for (
int i = 0;
i <
inv.AttachmentCount();
i++)
60 CargoContainer
cargo = m_AttachmentCargos.Get(
ent);
75 if (
item.GetInventory().GetAttachmentSlotsCount() > 0 &&
item.CanDisplayAnyAttachmentSlot())
80 sort = (m_AttachmentSlotsSorted.Find(
slot_id) * 2) + SORT_ATTACHMENTS_NEXT_OFFSET;
84 m_AttachmentAttachmentsContainers.Insert(
item,
att_cont.GetWrapper());
89 if (
item.GetInventory().GetCargo())
93 cont =
new CargoContainer(
this,
true);
94 sort = (m_AttachmentSlotsSorted.Find(
slot_id) * 2) + SORT_CARGO_NEXT_OFFSET;
97 Insert(
cont, m_Atts.GetAttachmentHeight() + m_AttachmentCargos.Count() + 1);
99 m_AttachmentCargos.Insert(
item,
cont);
106 att_cont.ShowFalseAttachmentsHeader(
true);
109 cont.ShowFalseCargoHeader(
false);
111 cont.SetAlternateFalseTextHeaderWidget(
att_cont.GetFalseHeaderTextWidget());
116 cont.SetAlternateFalseTextHeaderWidget(
null);
119 RecomputeContainers();
120 RecomputeOpenedContainers();
122 Inventory.GetInstance().UpdateConsoleToolbar();
131 AttachmentAddedEx(
item, slot, parent);
141 m_AttachmentCargos.Remove(
item);
146 Inventory.GetInstance().UpdateConsoleToolbar();
153 m_AttachmentAttachmentsContainers.Remove(
item);
154 m_AttachmentAttachments.Remove(
item);
159 Inventory.GetInstance().UpdateConsoleToolbar();
162 RecomputeContainers();
163 RecomputeOpenedContainers();
173 if (m_CargoGrid.IsVisible() &&
hideCargo)
175 else if (!m_CargoGrid.IsVisible() && !
hideCargo)
178 m_CargoGrid.UpdateInterval();
186 m_SlotIcon.GetRadialIconPanel().Show(!
hide);
190 super.UpdateInterval();
205 m_CargoGrid.UnfocusAll();
217 return m_ActiveIndex == (m_OpenedContainers.Count() - 1);
222 return IsFirstIndex();
227 return IsLastIndex();
236 Inventory.GetInstance().UpdateConsoleToolbar();
245 m_Atts.InitAttachmentGrid(SORT_ATTACHMENTS_OWN);
246 m_AttachmentSlotsSorted = m_Atts.GetSlotsSorted();
248 m_Entity.GetOnItemAttached().Insert(AttachmentAdded);
249 m_Entity.GetOnItemDetached().Insert(AttachmentRemoved);
251 m_ClosableHeader.SetItemPreview(
m_Entity);
252 CheckHeaderDragability();
254 if (
m_Entity.GetInventory().GetCargo())
256 m_CargoGrid =
new CargoContainer(
this,
false);
257 m_CargoGrid.GetRootWidget().SetSort(SORT_CARGO_OWN);
259 m_CargoGrid.UpdateHeaderText();
266 m_ClosableHeader.SetName(
name);
275 foreach (
int slot_id : m_AttachmentSlotsSorted)
282 RecomputeContainers();
287 if (m_CargoGrid.IsVisible() &&
hideCargo)
289 else if (!m_CargoGrid.IsVisible() && !
hideCargo)
301 RecomputeOpenedContainers();
308 if (m_CargoGrid.IsVisible())
310 m_CargoGrid.OnHide();
311 RecomputeOpenedContainers();
320 if (!m_CargoGrid.IsVisible())
322 m_CargoGrid.OnShow();
323 RecomputeOpenedContainers();
335 string name =
w.GetName();
336 name.Replace(
"PanelWidget",
"Render");
345 string name =
w.GetName();
346 name.Replace(
"PanelWidget",
"Render");
353 return ipw.GetItem();
361 string name =
w.GetName();
362 name.Replace(
"PanelWidget",
"Render");
410 if (
g_Game.IsLeftCtrlDown())
439#ifndef PLATFORM_CONSOLE
446 if (
cargo != m_CargoGrid)
452#ifdef PLATFORM_CONSOLE
453 if (m_CargoGrid && m_CargoGrid.HasItem(
item))
462#ifdef PLATFORM_CONSOLE
474 item.GetInventory().GetCurrentInventoryLocation(
src);
475 if (
src.CompareLocationOnly(
dst) &&
src.GetFlip() ==
dst.GetFlip())
478#ifdef PLATFORM_CONSOLE
491 if (
w &&
w.FindAnyWidget(
"Cursor"))
533 if (!
item.GetInventory().CanRemoveEntity() || !
player.CanManipulateInventory())
541 if (
player.GetWeaponManager().CanAttachMagazine(
wpn,
mag))
542 player.GetWeaponManager().AttachMagazine(
mag);
574 else if (
m_Entity.GetInventory().CanAddAttachment(
item))
583 else if (
m_Entity.GetInventory().CanAddEntityInCargo(
item,
item.GetInventory().GetFlipCargo()) && !
m_Entity.GetInventory().HasEntityInCargo(
item))
606 if (
w ==
NULL ||
player.GetInventory().IsInventoryLocked())
611 string name =
w.GetName();
612 name.Replace(
"PanelWidget",
"Render");
630 if (!
item.GetInventory().CanRemoveEntity() || !
player.CanManipulateInventory())
633 if (
player.GetInventory().HasEntityInInventory(
item) &&
player.GetHumanInventory().CanAddEntityInHands(
item))
637 if (
player.GetInventory().CanAddEntityToInventory(
item) &&
item.GetInventory().CanRemoveEntity())
641 if (
player.GetHumanInventory().CanAddEntityInHands(
item))
649 name.Replace(
"PanelWidget",
"Temperature");
650 w.FindAnyWidget(
name).Show(
false);
671 if (
cargo == m_CargoGrid)
704 if (
w.FindAnyWidget(
"Cursor"))
705 w.FindAnyWidget(
"Cursor").SetColor(
color);
708 string name =
w.GetName();
709 name.Replace(
"PanelWidget",
"Cursor");
710 if (
w.FindAnyWidget(
name))
754 if (
player.GetWeaponManager().CanAttachMagazine(
wpn,
mag))
805 else if (
m_Entity.GetInventory().CanAddAttachment(
item))
814 else if ((
m_Entity.GetInventory().CanAddEntityInCargo(
item,
item.GetInventory().GetFlipCargo()) && !
m_Entity.GetInventory().HasEntityInCargo(
item)) )
void Inventory(LayoutHolder parent)
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
FindInventoryLocationType
flags for searching locations in inventory
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
represents base for cargo storage for entities
Super root of all classes in Enforce script.
Widget GetItemPreviewWidget(Widget w)
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
void TakeAsAttachment(Widget w, Widget receiver)
void AttachmentAddedEx(EntityAI item, string slot, EntityAI parent, bool immedUpdate=true)
override bool IsFirstContainerFocused()
void DoubleClick(Widget w, int x, int y, int button)
override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
override bool IsLastContainerFocused()
void AttachmentRemoved(EntityAI item, string slot, EntityAI parent)
void RecomputeContainers()
void OnDropReceivedFromHeader2(Widget w, int x, int y, Widget receiver)
override void DraggingOver(Widget w, int x, int y, Widget receiver)
ref map< EntityAI, ref Attachments > m_AttachmentAttachments
ref map< EntityAI, ref AttachmentsWrapper > m_AttachmentAttachmentsContainers
void AttachmentAdded(EntityAI item, string slot, EntityAI parent)
void ContainerWithCargoAndAttachments(LayoutHolder parent, int sort=-1)
override bool IsLastIndex()
override void UpdateInterval()
override void MoveGridCursor(int direction)
void MouseClick2(Widget w, int x, int y, int button)
bool DraggingOverGrid(Widget w, int x, int y, Widget reciever, CargoContainer cargo)
void ~ContainerWithCargoAndAttachments()
ItemPreviewWidget GetItemPreviewWidgetDragOrDrop(Widget w)
EntityAI GetItemPreviewItem(Widget w)
ref array< int > m_AttachmentSlotsSorted
override EntityAI GetFocusedContainerEntity()
override void OnDropReceivedFromHeader(Widget w, int x, int y, Widget receiver)
override void UnfocusAll()
void SetEntity(EntityAI entity, bool immedUpdate=true)
void DropReceived(Widget w, int x, int y, CargoContainer cargo)
NOTE Used for mouse only.
static ColorManager GetInstance()
script counterpart to engine's class Inventory
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
provides access to slot configuration
static proto native owned string GetSlotName(int id)
converts slot_id to string
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
static ItemManager GetInstance()
static void TakeOrSplitToInventoryLocation(notnull PlayerBase player, notnull InventoryLocation dst)
static void TakeOrSplitToInventory(notnull PlayerBase player, notnull EntityAI target, notnull EntityAI item)
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.