27 GetMainWidget().SetFlags(
WidgetFlags.IGNOREPOINTER);
28 m_MainWidget = m_MainWidget.FindWidget(
"body");
29 GetMainWidget().SetFlags(
WidgetFlags.IGNOREPOINTER);
40 RecomputeOpenedContainers();
69 return m_ActiveIndex == m_OpenedContainers.Count() - 1;
74 int index = m_ActiveIndex - 1;
96 if (m_ActiveIndex > m_OpenedContainers.Count())
97 m_ActiveIndex = m_OpenedContainers.Count();
101#ifdef PLATFORM_CONSOLE
102 if (m_MainWidget.FindAnyWidget(
"Cursor"))
103 m_MainWidget.FindAnyWidget(
"Cursor").Show(
true);
116 SetFocusedContainer(
m_Atts.GetWrapper());
152 if (m_MainWidget.FindAnyWidget(
"Cursor"))
153 m_MainWidget.FindAnyWidget(
"Cursor").Show(
false);
187 if (m_ActiveIndex == 0)
189 if (CanTakeToInventory())
196 m_MainWidget.FindAnyWidget(
"Cursor").Show(
false);
197 m_MainWidget.FindAnyWidget(
"hands_preview_root").SetAlpha(0.7);
203 else if (GetFocusedContainer())
204 return GetFocusedContainer().TransferItem();
212 if (m_ActiveIndex == 0)
221 else if (GetFocusedContainer())
222 return GetFocusedContainer().SplitItem();
231 if (m_ActiveIndex == 0)
240 m_MainWidget.FindAnyWidget(
"Cursor").Show(
false);
241 m_MainWidget.FindAnyWidget(
"hands_preview_root").SetAlpha(0.7);
247 else if (GetFocusedContainer())
248 return GetFocusedContainer().EquipItem();
261 if (m_MainWidget.FindAnyWidget(
"Cursor"))
262 m_MainWidget.FindAnyWidget(
"Cursor").Show(
active);
267 GetMainWidget().GetScreenPos(
x,
y);
274 m_MainWidget.FindAnyWidget(
"hands_preview_root").SetAlpha(0.85);
276 m_MainWidget.FindAnyWidget(
"hands_preview_root").SetAlpha(0.7);
282 super.SetLastActive();
288 if (m_ActiveIndex == 0)
290 if (m_MainWidget.FindAnyWidget(
"Cursor"))
291 m_MainWidget.FindAnyWidget(
"Cursor").Show(
true);
294 GetMainWidget().GetScreenPos(
x,
y);
299 m_MainWidget.FindAnyWidget(
"hands_preview_root").SetAlpha(0.85);
329 return player.GetHumanInventory().GetEntityInHands() ==
null;
336 if (m_ActiveIndex == 0)
346 m_MainWidget.FindAnyWidget(
"Cursor").Show(
false);
347 m_MainWidget.FindAnyWidget(
"hands_preview_root").SetAlpha(0.7);
351 else if (GetFocusedContainer())
352 return GetFocusedContainer().TransferItemToVicinity();
359 if (m_ActiveIndex == 0)
369 else if (GetFocusedContainer())
370 return GetFocusedContainer().InspectItem();
376 if (m_ActiveIndex == 0)
383 Inventory.GetInstance().DisableMicromanagement();
391 Inventory.GetInstance().EnableMicromanagement();
397 if (GetFocusedContainer())
398 return GetFocusedContainer().OnSelectButton();
408 string name =
w.GetName();
409 name.Replace(
"PanelWidget",
"Render");
419 return ipw.GetItem();
430 string name =
w.GetName();
431 name.Replace(
"PanelWidget",
"Render");
562 if (m_am_entity1 ==
null || m_am_entity2 ==
null)
return;
580 m_Body.RemoveItem(
m_Atts.GetWrapper());
583 if (m_am_entity2.GetSlotsCountCorrect() > 0)
586 m_Atts.InitAttachmentGrid(1);
609 m_player.PredictiveTakeEntityToTargetCargo(m_am_entity1, m_am_entity2);
629 if (!
m_player.PredictiveSwapEntities(m_am_entity1, m_am_entity2) &&
m_player.GetHumanInventory().CanAddEntityInHands(m_am_entity1))
630 m_player.PredictiveTakeEntityToHands(m_am_entity1);
637 m_Body.RemoveItem(
m_Atts.GetWrapper());
641 if (m_am_entity2.GetSlotsCountCorrect() > 0)
644 m_Atts.InitAttachmentGrid(1);
650 if (
m_player.GetHumanInventory().CanAddEntityInHands(m_am_entity2))
651 m_player.PredictiveTakeEntityToHands(m_am_entity2);
799 m_Body.RemoveItem(
m_Atts.GetWrapper());
813 m_Body.RemoveItem(
att);
822 RecomputeOpenedContainers();
864 m_Body.RemoveItem(
cargo);
872 RecomputeOpenedContainers();
894#ifdef PLATFORM_CONSOLE
905#ifdef PLATFORM_CONSOLE
923#ifdef PLATFORM_CONSOLE
932 item.GetInventory().GetCurrentInventoryLocation(
src);
933 if (
src.CompareLocationOnly(
dst) &&
src.GetFlip() ==
dst.GetFlip())
936#ifdef PLATFORM_CONSOLE
948 if (
w &&
w.FindAnyWidget(
"Cursor"))
989 if (
w.FindAnyWidget(
"Cursor"))
990 w.FindAnyWidget(
"Cursor").SetColor(
color);
993 string name =
w.GetName();
994 name.Replace(
"PanelWidget",
"Cursor");
1024 if (!
item.GetInventory().CanRemoveEntity() || !
player.CanManipulateInventory())
1032 if (
player.GetWeaponManager().CanAttachMagazine(
wpn,
mag))
1033 player.GetWeaponManager().AttachMagazine(
mag);
1034 else if (
player.GetWeaponManager().CanSwapMagazine(
wpn,
mag))
1035 player.GetWeaponManager().SwapMagazine(
mag);
1065 else if (
m_Entity.GetInventory().CanAddAttachment(
item))
1072 else if ((
m_Entity.GetInventory().CanAddEntityInCargo(
item,
item.GetInventory().GetFlipCargo()) && (!
player.GetInventory().HasEntityInInventory(
item) || !
m_Entity.GetInventory().HasEntityInCargo(
item))) ||
player.GetHumanInventory().HasEntityInHands(
item))
1089 if (
entity.GetSlotsCountCorrect() > 0)
1092 m_Atts.InitAttachmentGrid(1);
1101 if (
entity.GetInventory().GetCargo())
1131 RecomputeOpenedContainers();
1138 for (
int i = 0;
i < m_Body.Count();
i++)
1139 m_Body.Get(
i).OnShow();
1151 if (
item.GetInventory().GetAttachmentSlotsCount() > 0)
1163 Inventory.GetInstance().UpdateConsoleToolbar();
1166 if (
item.GetInventory().GetCargo())
1170 cont.GetRootWidget().SetSort(
sort);
1178 Inventory.GetInstance().UpdateConsoleToolbar();
1183 att_cont.ShowFalseAttachmentsHeader(
true);
1186 cont.ShowFalseCargoHeader(
false);
1188 cont.SetAlternateFalseTextHeaderWidget(
att_cont.GetFalseHeaderTextWidget());
1193 cont.SetAlternateFalseTextHeaderWidget(
null);
1196 RecomputeOpenedContainers();
1211 Inventory.GetInstance().UpdateConsoleToolbar();
1223 Inventory.GetInstance().UpdateConsoleToolbar();
1225 RecomputeOpenedContainers();
1230 super.UpdateInterval();
1265 for (
int i = 0;
i < m_Body.Count();
i++)
1266 m_Body.Get(
i).OnShow();
1271 string name =
w.GetName();
1272 name.Replace(
"PanelWidget",
"Render");
1284#ifdef DIAG_DEVELOPER
1285 if (
g_Game.IsLeftCtrlDown())
1297 if (
g_Game.IsLeftCtrlDown())
1326 string name =
w.GetName();
1327 name.Replace(
"PanelWidget",
"Render");
1340 if (!
item.GetInventory().CanRemoveEntity())
1359 name.Replace(
"PanelWidget",
"Temperature");
1360 w.FindAnyWidget(
name).Show(
false);
1388 GetRootWidget().FindAnyWidget(
"electricity").Show(
false);
1396 for (
i = 0;
i < m_Body.Count();
i++)
1397 m_Body.Get(
i).OnHide();
1402 for (
i = 0;
i < m_Body.Count();
i++)
1403 m_Body.Get(
i).OnShow();
1407 w.FindAnyWidget(
"opened").Show(
m_Hidden);
1408 w.FindAnyWidget(
"closed").Show(!
m_Hidden);
1418 RecomputeOpenedContainers();
1427 RecomputeOpenedContainers();
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)
PluginBase GetPlugin(typename plugin_type)
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
represents base for cargo storage for entities
Super root of all classes in Enforce script.
static ColorManager GetInstance()
override EntityAI GetFocusedItem()
void CargoContainer(LayoutHolder parent, bool is_attachment=false)
WeaponManager GetWeaponManager()
script counterpart to engine's class Inventory
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
override void OnDropReceivedFromHeader(Widget w, int x, int y, Widget receiver)
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
void DropReceived(Widget w, int x, int y, CargoContainer cargo)
override bool InspectItem()
ref map< EntityAI, AttachmentsWrapper > m_AttachmentAttachmentsContainers
void ShowAtt(EntityAI entity)
void ScrollToActiveContainer(Container active_container)
ref map< EntityAI, ref Attachments > m_AttachmentAttachments
override bool TransferItem()
void AttachmentRemoved(EntityAI item, string slot, EntityAI parent)
void DoubleClick(Widget w, int x, int y, int button)
void OnPerformCombination(int combinationFlags)
int GetRecipeCount(bool recipe_anywhere, EntityAI entity1, EntityAI entity2)
void DraggingOverHeader2(Widget w, int x, int y, Widget receiver)
ref HandsHeader m_CollapsibleHeader
override bool OnSelectButton()
override bool TransferItemToVicinity()
EntityAI GetItemPreviewItem(Widget w)
void ShowActionMenuCombine(EntityAI entity1, EntityAI entity2, int combinationFlags)
ScrollWidget m_ScrollWidget
override bool IsLastIndex()
override void SetLayoutName()
override void SetLastActive()
ref HandsPreview m_HandsPreview
override void UpdateInterval()
void AttachmentAdded(EntityAI item, string slot, EntityAI parent)
bool DraggingOverGrid(Widget w, int x, int y, Widget reciever, CargoContainer cargo)
override bool EquipItem()
override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
override bool IsItemWithQuantityActive()
void TakeAsAttachment(Widget w, Widget receiver)
void OnDropReceivedFromHeader2(Widget w, int x, int y, Widget receiver)
void HandsContainer(LayoutHolder parent)
override Header GetHeader()
override void UnfocusGrid()
void CollapseButtonOnMouseButtonDown(Widget w)
ref CargoContainer m_CargoGrid
int GetCombinationFlags(EntityAI entity1, EntityAI entity2)
override void UnfocusAll()
override void Insert(LayoutHolder container, int pos=-1, bool immedUpdate=true)
void MouseClick2(Widget w, int x, int y, int button)
override void SetActive(bool active)
override bool SplitItem()
override bool IsItemActive()
ref array< int > m_AttachmentSlotsSorted
static const int LOAD_CHAMBER
static const int ADD_AS_CARGO
static const int TAKE_TO_HANDS
static const int SET_ACTION
static const int ADD_AS_ATTACHMENT
static const int RECIPE_ANYWHERE
static const int COMBINE_QUANTITY2
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 int HasItemQuantity(notnull EntityAI item)
static void TakeOrSplitToInventoryLocation(notnull PlayerBase player, notnull InventoryLocation dst)
static void TakeOrSplitToInventory(notnull PlayerBase player, notnull EntityAI target, notnull EntityAI item)
bool CanAttachMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
bool AttachMagazine(Magazine mag, ActionBase control_action=NULL)
bool LoadBullet(Magazine mag, ActionBase control_action=NULL)
bool CanSwapMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
bool SwapMagazine(Magazine mag, ActionBase control_action=NULL)
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
void PrintString(string s)
Helper for printing out string expression. Example: PrintString("Hello " + var);.
proto void GetMousePos(out int x, out int y)