25 RecomputeOpenedContainers();
50 bool show_radial_icon;
52 Widget rip = m_SlotIcon.GetRadialIconPanel();
53 Widget icon_open = m_SlotIcon.GetRadialIcon();
54 Widget icon_closed = m_SlotIcon.GetRadialIconClosed();
56 icon_open.Show( show_radial_icon );
57 icon_closed.Show( !show_radial_icon );
69 return GetFocusedContainer().IsInherited( ContainerWithCargo );
74 return GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments );
85 return ent && ( ent.GetInventory().GetCargo() || ent.GetSlotsCountCorrect() > 0 );
107 string name = w.GetName();
108 name.Replace(
"PanelWidget",
"Render" );
123 if( !item.GetInventory().CanRemoveEntity() )
126 if (
m_ZombieEntity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ))
128 else if(
m_ZombieEntity.GetInventory().CanAddEntityToInventory( item ) )
137 string name = receiver.GetName();
138 name.Replace(
"PanelWidget",
"Render");
143 receiver_item = receiver_iw.GetItem();
149 name.Replace(
"PanelWidget",
"Render");
165 if(!item.GetInventory().CanRemoveEntity())
172 string name = receiver.GetName();
173 name.Replace(
"PanelWidget",
"Render");
178 receiver_item = receiver_iw.GetItem();
184 name.Replace(
"PanelWidget",
"Render" );
200 if(!item.GetInventory().CanRemoveEntity())
207 if(receiver_item.GetInventory().CanAddAttachment(item))
209 player.PredictiveTakeEntityToTargetAttachment(receiver_item, item);
212 else if(receiver_item.GetInventory().CanAddEntityInCargo(item, item.GetInventory().GetFlipCargo()) && !receiver_item.GetInventory().HasEntityInCargo(item))
223 player.PredictiveTakeEntityToTargetAttachment(
m_ZombieEntity, item);
225 else if(
m_ZombieEntity.GetInventory().CanAddEntityToInventory(item))
257 if( item.GetSlotsCountCorrect() > 0 )
259 ContainerWithCargoAndAttachments iwca =
new ContainerWithCargoAndAttachments(
this,
false );
260 iwca.SetEntity( item );
268 else if( item.GetInventory().GetCargo() )
270 ContainerWithCargo iwc =
new ContainerWithCargo(
this,
false );
271 iwc.SetEntity( item );
272 iwc.UpdateInterval();
282 string config =
"CfgVehicles " + item.GetType() +
" GUIInventoryAttachmentsProps";
285 bool show_radial_icon = ( item.GetInventory().GetCargo() || item.GetSlotsCountCorrect() > 0 ) && !
GetGame().ConfigIsExisting( config );
289 rip.Show( show_radial_icon );
291 icon_closed.Show( !conta.
IsOpened() );
293 RecomputeOpenedContainers();
307 (
Container.Cast( con.m_Parent ) ).Remove( con );
308 RecomputeOpenedContainers();
309 GetMainWidget().Update();
317 in.UpdateConsoleToolbar();
364 RecomputeOpenedContainers();
380 #ifdef DIAG_DEVELOPER
382 ShowActionMenu(selectedItem);
387 InspectItem(selectedItem);
391 if (
g_Game.IsLeftCtrlDown())
394 if (controlledPlayer.CanDropEntity(selectedItem))
396 if (selectedItem.GetTargetQuantityMax() < selectedItem.GetQuantity())
397 selectedItem.SplitIntoStackMaxClient(null, -1);
399 controlledPlayer.PhysicalPredictiveDropItem(selectedItem);
418 bool has_cargo =
m_ZombieEntity.GetInventory().GetCargo() != null;
420 string config_path_ghosts_slots =
"CfgVehicles ZombieBase InventoryEquipment playerSlots";
422 GetGame().ConfigGetTextArray( config_path_ghosts_slots, player_ghosts_slots );
424 for (
int i = 0; i < player_ghosts_slots.Count(); i++ )
426 string slot_name = player_ghosts_slots.Get ( i );
427 string path =
"CfgSlots" +
" " + slot_name;
432 GetGame().ConfigGetText(
path +
" ghostIcon", icon_name );
441 if( row < ( (player_ghosts_slots.Count() + 1 )/
ITEMS_IN_ROW ) )
449 if ( row < ( player_ghosts_slots.Count() /
ITEMS_IN_ROW ) )
459 icon.GetMainWidget().Show(
true );
475 GetGame().ConfigGetText(
path +
" name", slot_name );
495 if( row < ( player_ghosts_slots.Count() + 1 /
ITEMS_IN_ROW ) )
502 icon.GetMainWidget().Show(
true );
510 m_CargoGrid =
new ContainerWithCargo(
this,
false );
517 RecomputeOpenedContainers();
523 s_cont.SetColumnCount( row_count );
532 return m_Container.Get( row ).GetMainWidget().FindAnyWidget(
"Render" + column );
546 string name = w.GetName();
547 name.Replace(
"PanelWidget",
"Render" );
564 if( player.GetInventory().HasInventoryReservation( item, null ) || player.IsItemsToDelete() )
569 if( !item.GetInventory().CanRemoveEntity() )
572 if ( player.GetInventory().HasEntityInInventory( item ) &&
GetGame().
GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
574 player.PredictiveTakeEntityToHands( item );
581 if( item.GetTargetQuantityMax(il.GetSlot()) < item.GetQuantity() )
582 item.SplitIntoStackMaxToInventoryLocationClient( il );
586 else if(
GetGame().
GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
588 if( item.GetTargetQuantityMax() < item.GetQuantity() )
589 item.SplitIntoStackMaxHandsClient( player );
591 player.PredictiveTakeEntityToHands( item );
599 menu.RefreshQuickbar();
606 super.CollapseButtonOnMouseButtonDown(w);
613 if ( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
615 return GetFocusedContainer().EquipItem();
634 if (CanTakeToInventory())
639 if (GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ))
641 return GetFocusedContainer().TransferItem();
655 if (!GetFocusedContainer().IsInherited( ContainerWithCargo ) && !GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ))
671 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
673 return GetFocusedContainer().Select();
684 if( selected_item != focused_item)
686 if( selected_item.GetInventory().CanRemoveEntity() )
696 if( focused_item && focused_item.GetInventory().CanRemoveEntity() )
698 EntityAI item_in_hands =
GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
699 if( item_in_hands && item_in_hands.GetInventory().CanRemoveEntity() )
703 GetGame().GetPlayer().PredictiveSwapEntities( item_in_hands, focused_item );
713 if (
GetGame().
GetPlayer().NeedInventoryJunctureFromServer(item_in_hands, item_in_hands.GetHierarchyParent(), il_hands_dst.GetParent()) ||
GetGame().
GetPlayer().NeedInventoryJunctureFromServer(focused_item, focused_item.GetHierarchyParent(),
GetGame().
GetPlayer()) )
716 GetGame().GetPlayer().GetHumanInventory().ForceSwapEntities(
InventoryMode.JUNCTURE, focused_item, item_in_hands, il_hands_dst );
723 if(
GetGame().
GetPlayer().GetHumanInventory().CanAddEntityInHands( focused_item ) )
725 GetGame().GetPlayer().PredictiveTakeEntityToHands( focused_item );
740 if ( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
742 return GetFocusedContainer().TransferItemToVicinity();
746 Man player =
GetGame().GetPlayer();
748 if( item && player.CanDropEntity( item ) )
750 if( item.GetTargetQuantityMax() < item.GetQuantity() )
751 item.SplitIntoStackMaxClient( null, -1 );
753 player.PhysicalPredictiveDropItem( item );
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
void Inventory(LayoutHolder parent)
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
override bool IsDisplayable()
ref CollapsibleHeader m_CollapsibleHeader
override Header GetHeader()
override void SetHeader(Header header)
override EntityAI GetFocusedItem()
override LayoutHolder Get(int x)
script counterpart to engine's class Inventory
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
provides access to slot configuration
void SetSelectedItemEx(EntityAI selected_item, Container selected_container, LayoutHolder selected_icon)
SlotsIcon GetSelectedIcon()
EntityAI GetSelectedItem()
void SetWidgetDraggable(Widget w, bool draggable)
static ItemManager GetInstance()
SlotsIcon GetSlotIcon(int index)
Widget GetRadialIconClosed()
void Init(EntityAI obj, bool reservation=false)
void SetSlotID(int slot_ID)
void SetSlotDisplayName(string text)
void SetContainer(Container container)
Widget GetRadialIconPanel()
ImageWidget GetGhostSlot()
override bool TransferItem()
ref map< EntityAI, ref Container > m_ShowedItems
override bool TransferItemToVicinity()
override void ExpandCollapseContainer()
Widget GetWidgetSlot(int slot_number)
override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
void DoubleClick(Widget w, int x, int y, int button)
ref AttachmentsGroupContainer m_Container
bool IsItemWithAttachmentsActive()
void ZombieContainer(LayoutHolder parent, int sort=-1)
void OnDropReceivedFromGhostArea(Widget w, int x, int y, Widget receiver)
void ItemAttached(EntityAI item, string slot_name)
override void OnDropReceivedFromHeader(Widget w, int x, int y, Widget receiver)
void MouseClick(Widget w, int x, int y, int button)
void ItemDetached(EntityAI item, string slot_name)
override void CollapseButtonOnMouseButtonDown(Widget w)
override bool CanOpenCloseContainerEx(EntityAI focusedEntity)
ref ContainerWithCargo m_CargoGrid
void AddSlotsContainer(int row_count)
bool IsZombieEquipmentActive()
bool IsContainerWithCargoActive()
SlotsIcon GetSlotsIcon(int row, int column)
override bool EquipItem()
override bool IsItemWithQuantityActive()
void ToggleContainer(Widget w)
override void UpdateRadialIcon()
bool IsItemWithContainerActive()
ref map< int, SlotsIcon > m_InventorySlots
void SetEntity(EntityAI zombie_entity)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
FindInventoryLocationType
flags for searching locations in inventory
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]