24#ifndef PLATFORM_CONSOLE
43#ifndef PLATFORM_CONSOLE
71 item.GetInventory().GetCurrentInventoryLocation( il );
84 ref
Icon icon =
new Icon(
this,
false );
93 #ifdef PLATFORM_CONSOLE
94 for (
int i = 0; i <
m_Cargo.GetItemCount(); i++ )
100 data.param1.SetCargoPos( i );
101 data.param1.SetPos();
122 m_Icons.RemoveItem( data.param1 );
128 #ifdef PLATFORM_CONSOLE
129 for(
int i = 0; i <
m_Cargo.GetItemCount(); i++ )
133 if( data && data.param1 )
135 data.param1.SetCargoPos( i );
136 data.param1.SetPos();
149 item.GetInventory().GetCurrentInventoryLocation( il );
152 #ifdef PLATFORM_CONSOLE
162 if( data.param2 !=
x || data.param3 !=
y )
166 #ifdef PLATFORM_CONSOLE
167 data.param1.SetCargoPos( data.param3 );
169 #ifdef PLATFORM_WINDOWS
170 data.param1.SetPosX( data.param2 );
171 data.param1.SetPosY( data.param3 );
174 data.param1.UpdateInterval();
182 #ifndef PLATFORM_CONSOLE
186 int index =
GetGame().
GetPlayer().GetHumanInventory().FindUserReservedLocationIndex( item );
189 GetGame().
GetPlayer().GetHumanInventory().GetUserReservedLocation( index, il );
191 ref
Icon icon =
new Icon(
this,
false );
203 #ifndef PLATFORM_CONSOLE
216 #ifdef PLATFORM_CONSOLE
246 m_Cargo = item.GetInventory().GetCargoFromIndex(cargo_index);
267 for ( i = 0; i <
m_Cargo.GetItemCount(); i++ )
276 #ifdef PLATFORM_CONSOLE
326 #ifdef PLATFORM_CONSOLE
327 int cargo_height = 1;
332 for (
int j = 0; j < cargo_height; j++ )
339 #ifdef PLATFORM_WINDOWS
340 #ifndef PLATFORM_CONSOLE
345 row.GetRootWidget().SetSort( j,
false );
350 row.GetRootWidget().FindAnyWidget(
"Icon0" ).GetScreenSize(
y,
m_IconSize );
351 #ifdef PLATFORM_WINDOWS
352 #ifndef PLATFORM_CONSOLE
353 row.GetRootWidget().FindAnyWidget(
"Spacer0" ).GetScreenSize(
m_SpaceSize,
y );
358#ifndef PLATFORM_CONSOLE
365#ifndef PLATFORM_CONSOLE
384 #ifdef PLATFORM_CONSOLE
385 #ifndef PLATFORM_WINDOWS
386 return CargoList.Cast(
m_Cargo ).GetTotalWeight( null );
390 for (
int i = 0; i <
m_Cargo.GetItemCount(); ++i )
401 #ifdef PLATFORM_CONSOLE
402 #ifndef PLATFORM_WINDOWS
403 return CargoList.Cast(
m_Cargo ).GetMaxWeight();
426 if ( index >= 0 &&
m_Cargo.GetItemCount() > index )
442 GetRootWidget().GetScreenSize(
x,
y );
452 GetRootWidget().GetPos(
x,
y );
462 GetRootWidget().GetScreenPos(
x,
y );
473 if( icon && !icon.IsActive() )
476 Inventory.GetInstance().UpdateConsoleToolbar();
494 Error(
string.Format(
"%1::UpdateRowVisibility - CargoBase is NULL for entity %2 at position %3",
ToString(),
m_Entity.GetType(),
m_Entity.GetPosition()));
497 int diff = rows -
m_Rows.Count();
500 for(i =
m_Rows.Count() - 1; i >= rows; i--)
508 for(i =
m_Rows.Count(); i < rows; i++)
514 row.GetRootWidget().SetSort(i);
521 #ifndef PLATFORM_CONSOLE
528 #ifdef PLATFORM_CONSOLE
549 data.param1.UpdateInterval();
556 #ifdef PLATFORM_CONSOLE
558 #ifdef PLATFORM_WINDOWS
559 pos_y = pos_y * 5 + pos_x;
568 if ( item.GetInventory().GetFlipCargo() )
569 icon.
SetSize( size_y, size_x );
571 icon.
SetSize( size_x, size_y );
577 icon.
InitEx( item, refresh );
583 return InitIconEx( icon, item, pos_x, pos_y );
599 if( item && player.CanDropEntity( item ) )
601 if( item.GetTargetQuantityMax() < item.GetQuantity() )
602 item.SplitIntoStackMaxClient( null, -1 );
604 player.PhysicalPredictiveDropItem( item );
614 super.SetDefaultFocus(while_micromanagment_mode);
641 icon.SetActive(
false );
653 if ( max_row > focused_row )
673 if ( focused_row > 0 )
694 if ( row_max >=
m_Icons.Count() )
718 if ( row_max >=
m_Icons.Count() )
746 super.SetLastActive();
752 int focusedIconCount =
m_Icons.Count();
757 int diff = focusedIconCount - iconMax;
771 super.SetActive( active );
780 return ( item != null );
802 PluginRecipesManager recipes_manager = PluginRecipesManager.Cast(
GetPlugin( PluginRecipesManager ) );
803 return recipes_manager.GetValidRecipes( entity1, entity2, null, player );
822 if (CanTakeToInventory())
859 if( focused_item != selected_item )
863 if( selected_item.GetInventory().CanRemoveEntity() &&
m_Entity )
865 bool can_add =
m_Entity.GetInventory().CanAddEntityInCargo( selected_item, selected_item.GetInventory().GetFlipCargo());
866 bool in_cargo = !player.GetInventory().HasEntityInInventory( selected_item ) || !
m_Entity.GetInventory().HasEntityInCargo( selected_item );
867 if( can_add && in_cargo )
869 player.PredictiveTakeEntityToTargetCargo(
m_Entity, selected_item );
893 else if ( focused_item && focused_item.GetInventory().CanRemoveEntity() )
900 player.PredictiveSwapEntities( item_in_hands, focused_item );
906 if( player.GetHumanInventory().CanAddEntityInHands( focused_item ) )
908 player.PredictiveTakeEntityToHands( focused_item );
928 if( item_in_hands && prev_item )
void Inventory(LayoutHolder parent)
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
FindInventoryLocationType
flags for searching locations in inventory
PluginBase GetPlugin(typename plugin_type)
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
proto void GetInventoryItemSize(InventoryItem item, out int width, out int height)
proto native DayZPlayer GetPlayer()
represents base for cargo storage for entities
override void SetLastFocus()
ref SizeToChild m_Resizer2
override void SetActive(bool active)
void SetAttachmentSlotID(int slotID)
void MovedInCargo(EntityAI item)
TextWidget m_FalseHeaderTextWidget
override void SetNextActive()
override void SetLayoutName()
void SetLock(EntityAI item)
override EntityAI GetFocusedItem()
void ShowFalseCargoHeader(bool show)
int GetAttachmentSlotID()
ref array< ref Icon > m_Icons
override float GetFocusedContainerYPos(bool contents=false)
int GetMaxCargoCapacity()
ref SizeToChild m_Resizer1
override void UnfocusAll()
override float GetFocusedContainerHeight(bool contents=false)
override bool IsItemActive()
const int ROWS_NUMBER_XBOX
void SetEntity(EntityAI item, int cargo_index=0, bool immedUpdate=true)
void AddedToCargoEx(EntityAI item, bool refresh=true)
override bool SelectItem()
override bool TransferItemToVicinity()
override bool TransferItem()
Icon InitIcon(Icon icon, EntityAI item, int pos_x, int pos_y)
int m_FocusedItemPosition
bool HasItem(EntityAI item)
override void SetPreviousActive(bool force=false)
override Header GetHeader()
override float GetFocusedContainerYScreenPos(bool contents=false)
void RemovedFromCargo(EntityAI item)
void AddedToCargo(EntityAI item)
override void SetDefaultFocus(bool while_micromanagment_mode=false)
void UpdateRowVisibility(int count)
override bool IsItemWithQuantityActive()
void SetAlternateFalseTextHeaderWidget(TextWidget w)
override void SetNextLeftActive()
ref map< EntityAI, ref Param3< ref Icon, int, int > > m_ShowedItemPositions
ref map< EntityAI, ref Param3< ref Icon, int, int > > m_ShowedLockPositions
override bool CanCombineAmmo()
override void SetLastActive()
Icon GetIcon(EntityAI item)
void ReleaseLock(EntityAI item)
TextWidget m_AlternateFalseHeaderTextWidget
override void SetNextRightActive()
void CargoContainer(LayoutHolder parent, bool is_attachment=false)
int GetRecipeCount(bool recipe_anywhere, ItemBase entity1, ItemBase entity2, PlayerBase player)
Icon InitIconEx(Icon icon, EntityAI item, int pos_x, int pos_y, bool refresh=true)
ref array< ref CargoContainerRow > m_Rows
override void UpdateInterval()
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
script counterpart to engine's class Inventory
void SetPosEx(bool refresh=true)
bool CombineItems(EntityAI entity1, EntityAI entity2)
override void SetActive(bool active)
void SetSize(int x, int y)
void InitEx(EntityAI obj, bool refresh=true)
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native bool GetFlip()
returns flip status of cargo
override bool CanPutIntoHands(EntityAI parent)
override bool IsTakeable()
override bool CanBeSplit()
void SetSelectedItemEx(EntityAI selected_item, Container selected_container, LayoutHolder selected_icon)
Container GetSelectedContainer()
EntityAI GetSelectedItem()
static ItemManager GetInstance()
static int HasItemQuantity(notnull EntityAI item)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Ceil(float f)
Returns ceil of value.