143 Man player =
g_Game.GetPlayer();
145 if( focused_slot.
IsReserved() || focused_item != selected_item && !(selected_slot && selected_slot.
IsOutOfReach() ) )
149 if( selected_item.GetInventory().CanRemoveEntity() )
151 if(
m_Entity.GetInventory().CanAddAttachmentEx( selected_item, focused_slot.
GetSlotID() ) )
153 player.PredictiveTakeEntityToTargetAttachmentEx(
m_Entity, selected_item, focused_slot.
GetSlotID() );
158 else if(
m_Entity.GetInventory().CanAddAttachment( selected_item ) )
160 player.PredictiveTakeEntityToTargetAttachment(
m_Entity, selected_item);
172 focused_item.GetInventory().GetCurrentInventoryLocation( il );
174 if( reachable && focused_item.GetInventory().CanRemoveEntity() )
176 if( item_in_hands && item_in_hands.GetInventory().CanRemoveEntity() )
180 player.PredictiveSwapEntities( item_in_hands, focused_item );
186 if( player.GetHumanInventory().CanAddEntityInHands( focused_item ) )
188 player.PredictiveTakeEntityToHands( focused_item );
201 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin( PluginRecipesManager ) );
228 if( !entity || entity.IsInherited( Magazine ) )
241 if ( item_in_hands && ent && hands_icon )
254 if( entity.HasQuantity() )
256 entity.OnRightClick();
302 if (item.GetTargetQuantityMax() < item.GetQuantity())
303 item.SplitIntoStackMaxClient( null, -1 );
305 player.PhysicalPredictiveDropItem(item);
313 return m_Parent.GetMainWidget().FindAnyWidget(
"AttachmentsWrapper").GetAlpha() > 0;
330 if (
m_Entity.CanDisplayAttachmentSlot(slot_id))
339 icon.GetMainWidget().Show(
false );
365 icon.GetMainWidget().Show(
true );
369 bool draggable =
true;
386 bool in_hands_condition =
m_Entity.GetHierarchyRoot() && item.GetInventory().CanRemoveEntity();
388 if( in_hands_condition || in_vicinity_condition )
447 icon.
Init( item,
true );
474 for ( i = 0; i < number_of_rows; i++ )
516 path =
"CfgSlots" +
" Slot_" +
"magazine2";
519 string icon_name =
"";
520 if(
g_Game.ConfigGetText(
path +
" ghostIcon", icon_name ) && icon_name !=
"" )
535 if (
m_Entity.CanDisplayAttachmentSlot(slot_id))
537 icon.GetMainWidget().Show(
true );
541 icon.GetMainWidget().Show(
false );
547 int row_index = number_of_rows - 1;
553 row_last.
GetSlotIcon( k ).GetMainWidget().Show(
false );
555 row_last.GetRootWidget().Update();
556 row_last.GetRootWidget().GetParent().Update();
572 for (
int s = 0; s < searching_in.Count(); ++s )
574 string cfg_name = searching_in.Get( s );
575 string path = cfg_name +
" " + e.GetType();
579 g_Game.ConfigGetTextArray(
path +
" attachments", attachments_slots );
580 if ( e.IsWeapon() && (!e.ConfigIsExisting(
"DisplayMagazine") || e.ConfigGetBool(
"DisplayMagazine")) )
582 attachments_slots.Insert(
"magazine" );
585 return attachments_slots;
588 if ( e.IsWeapon() && (!e.ConfigIsExisting(
"DisplayMagazine") || e.ConfigGetBool(
"DisplayMagazine")) )
590 attachments_slots.Insert(
"magazine" );
593 return attachments_slots;
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
AttachmentsWrapper GetWrapper()
ref array< int > m_AttachmentIDOrdered
void SetDefaultFocus(bool while_micromanagment_mode=false)
EntityAI GetFocusedItem()
void SetFalseAttachmentsHeaderText(string text)
int GetAttachmentSlotID()
TextWidget GetFalseHeaderTextWidget()
SlotsIcon GetFocusedSlotsIcon()
void SetActive(bool active)
void AttachmentAdded(EntityAI item, string slot, EntityAI parent)
bool IsItemWithQuantityActive()
array< string > GetItemSlots(EntityAI e)
void SetAttachmentSlotID(int slotID)
void Attachments(Container parent, EntityAI entity)
void InitAttachmentGrid(int att_row_index)
ref array< string > m_AttachmentSlotNames
void ShowFalseAttachmentsHeader(bool show)
void AttachmentRemoved(EntityAI item, string slot, EntityAI parent)
bool TransferItemToVicinity()
void OnAttachmentReservationSet(EntityAI item, int slot_id)
int GetAttachmentHeight()
ref array< string > m_AttachmentSlotDisplayable
ref map< int, SlotsIcon > m_AttachmentSlots
void OnAttachmentReservationRelease(EntityAI item, int slot_id)
array< int > GetSlotsSorted()
ref AttachmentsWrapper m_AttachmentsContainer
int GetRecipeCount(bool recipe_anywhere, EntityAI entity1, EntityAI entity2)
static bool IsAttachmentReachable(EntityAI e, string att_slot_name="", int slot_id=-1, float range=1.5)
Super root of all classes in Enforce script.
script counterpart to engine's class Inventory
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
bool CombineItems(EntityAI entity1, EntityAI entity2)
proto native int GetSlot()
returns slot id if current type is Attachment
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
static proto native owned string GetSlotDisplayName(int id)
override bool CanBeSplit()
override bool CanPutIntoHands(EntityAI parent)
EntityAI GetSelectedItem()
HandsPreview GetHandsPreview()
static int GetCombinationFlags(EntityAI entity1, EntityAI entity2)
void SetSelectedItemEx(EntityAI selected_item, Container selected_container, LayoutHolder selected_icon)
SlotsIcon GetSelectedIcon()
static ItemManager GetInstance()
EntityAI GetDraggedItem()
base for semi auto weapons @NOTE name copies config base class
static int HasItemQuantity(notnull EntityAI item)
SlotsIcon GetSlotIcon(int index)
void SetSlotDisplayName(string text)
override void UpdateInterval()
Widget GetOutOfReachWidget()
Widget GetMountedWidget()
ImageWidget GetGhostSlot()
void SetSlotID(int slot_ID)
void Init(EntityAI obj, bool reservation=false)
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.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< string > TStringArray
static proto float Ceil(float f)
Returns ceil of value.
FindInventoryLocationType
flags for searching locations in inventory
PluginBase GetPlugin(typename plugin_type)