4 protected int m_CargoIndex = -1;
11 m_CargoGrid =
new CargoContainer(
this );
12 Insert( m_CargoGrid );
14 m_CargoGrid.GetRootWidget().SetSort( 1 );
17 RecomputeOpenedContainers();
29 return m_CargoGrid.IsEmpty();
34 return m_CargoGrid.IsItemActive();
39 return m_CargoGrid.CanCombine();
44 return m_CargoGrid.CanCombineAmmo();
49 return m_CargoGrid.IsItemWithQuantityActive();
54 if( value != m_LockCargo )
64 SetOpenState(!m_Closed);
75 SetOpenForSlotIcon(
true);
82 m_SlotIcon.GetRadialIconPanel().Show( !m_LockCargo );
92 SetOpenForSlotIcon(
false);
99 m_SlotIcon.GetRadialIconPanel().Show( !m_LockCargo );
105 return !m_Closed && !m_LockCargo;
112 if (
m_Entity.GetInventory().IsInventoryLockedForLockType( HIDE_INV_FROM_SCRIPT ) || !
m_Entity.CanDisplayCargo() )
115 if ( m_CargoGrid.IsVisible() )
117 RecomputeOpenedContainers();
123 if ( !m_CargoGrid.IsVisible() )
125 RecomputeOpenedContainers();
129 super.UpdateInterval();
130 m_CargoGrid.UpdateInterval();
140 m_SlotIcon.GetRadialIconPanel().Show( !hide );
147 return m_CargoGrid.IsFirstContainerFocused();
152 return m_CargoGrid.IsLastContainerFocused();
157 m_CargoGrid.SetDefaultFocus( while_micromanagment_mode );
162 m_CargoGrid.Unfocus();
167 return m_CargoGrid.SplitItem();
172 return m_CargoGrid.EquipItem();
177 return m_CargoGrid.TransferItem();
182 return m_CargoGrid.TransferItemToVicinity();
187 return m_CargoGrid.InspectItem();
193 m_CargoIndex = cargo_index;
195 SetOpenState(
true );
197 m_CargoGrid.SetEntity( entity, immedUpdate );
198 m_CargoGrid.UpdateHeaderText();
199 m_ClosableHeader.SetItemPreview( entity );
200 CheckHeaderDragability();
203 if (
m_Entity.GetInventory().IsInventoryLockedForLockType( HIDE_INV_FROM_SCRIPT ) || !
m_Entity.CanDisplayCargo() )
211 GetMainWidget().Update();
230 string name = w.GetName();
253 if( !player.CanManipulateInventory() )
265 if( !item.GetInventory().CanRemoveEntity() )
272 #ifdef PLATFORM_CONSOLE
286 #ifdef PLATFORM_CONSOLE
291 dst.
SetCargoAuto(cargo, item,
x,
y, item.GetInventory().GetFlipCargo());
294 #ifdef PLATFORM_CONSOLE
295 if( dst.
IsValid() &&
m_Entity.GetInventory().LocationCanAddEntityEx(dst))
297 if(
m_Entity && c_x >
x && c_y >
y &&
m_Entity.GetInventory().LocationCanAddEntityEx(dst))
317 if( w.FindAnyWidget(
"Selected") )
319 w.FindAnyWidget(
"Selected").SetColor( color );
323 string name = w.GetName();
325 if( w.FindAnyWidget(
name ) )
327 w.FindAnyWidget(
name ).SetColor( color );
337 GetMainWidget().Update();
338 GetMainWidget().GetScreenSize( xx, yy );
341 GetMainWidget().FindAnyWidget(
"Background").Show(
true );
342 GetMainWidget().FindAnyWidget(
"Background").SetSize( xx, yy );
350 #ifdef PLATFORM_CONSOLE
351 if( m_CargoGrid.HasItem( item ) )
357 #ifdef PLATFORM_CONSOLE
373 #ifdef PLATFORM_CONSOLE
378 dst.
SetCargoAuto(cargo, item,
x,
y, item.GetInventory().GetFlipCargo());
382 item.GetInventory().GetCurrentInventoryLocation(src);
387 #ifdef PLATFORM_CONSOLE
388 if(dst.
IsValid() &&
m_Entity.GetInventory().LocationCanAddEntityEx(dst))
390 if( c_x >
x && c_y >
y &&
m_Entity.GetInventory().LocationCanAddEntityEx(dst))
397 Icon icon = m_CargoGrid.GetIcon( item );
399 if( icon && w && w.FindAnyWidget(
"Selected") )
415 if( !item.GetInventory().CanRemoveEntity() || !player.CanManipulateInventory() )
418 float stackable = item_base.GetTargetQuantityMax();
420 if( stackable == 0 || stackable >= item_base.GetQuantity() )
422 player.PredictiveTakeEntityToHands( item );
424 else if( stackable != 0 && stackable < item_base.GetQuantity() )
426 item_base.SplitIntoStackMaxHandsClient( player );
444 if( item.GetInventory().CanRemoveEntity() && player.CanManipulateInventory() &&
m_Entity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ) && !
m_Entity.GetInventory().HasEntityInCargo( item ) )
474 if(
GetEntity() && item.GetInventory().GetCurrentInventoryLocation(src))
479 player.PredictiveTakeToDst(src, dst);
482 bool can_add =
m_Entity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() );
483 bool in_cargo = !player.GetInventory().HasEntityInInventory( item ) || !
m_Entity.GetInventory().HasEntityInCargo( item );
484 if( can_add && in_cargo )
FindInventoryLocationType
flags for searching locations in inventory
class PluginItemDiagnosticEventHandler extends ScriptedWidgetEventHandler m_Entity
protected Widget m_Parent
represents base for cargo storage for entities
proto native int GetHeight()
proto native int GetItemCount()
proto native int GetWidth()
override void UnfocusAll()
override void DraggingOver(Widget w, int x, int y, Widget receiver)
void DropReceived(Widget w, int x, int y)
override bool IsItemActive()
override EntityAI GetFocusedContainerEntity()
override bool InspectItem()
void SetEntity(EntityAI entity, int cargo_index=0, bool immedUpdate=true)
override void UpdateInterval()
override bool IsLastContainerFocused()
override bool TransferItem()
override bool TransferItemToVicinity()
override void OnDropReceivedFromHeader(Widget w, int x, int y, Widget receiver)
override bool CanCombine()
EntityAI GetItemPreviewItem(Widget w)
override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
override bool CanCombineAmmo()
override bool EquipItem()
override bool IsFirstContainerFocused()
protected ref CargoContainer m_CargoGrid
override bool IsItemWithQuantityActive()
void LockCargo(bool value)
void ContainerWithCargo(Container parent, int sort=-1)
override void SetDefaultFocus(bool while_micromanagment_mode=false)
bool DraggingOverGrid(Widget w, int x, int y, Widget reciever)
void TakeIntoHands(notnull PlayerBase player, notnull EntityAI item)
override bool IsDisplayable()
override bool SplitItem()
static ColorManager GetInstance()
void SetColor(Widget w, int color)
proto native bool IsValid()
verify current set inventory location
proto native void SetCargoAuto(notnull CargoBase cargo, EntityAI e, int row, int col, bool flip)
based on Cargo.IsProxyCargo uses SetProxyCargo or SetCargo respectively
proto native bool CompareLocationOnly(notnull InventoryLocation other)
proto native bool GetFlip()
returns flip status of cargo
void ShowSourceDropzone(EntityAI item)
void SetDefaultOpenState(string type, bool is_opened)
Widget GetRightDropzone()
void SetIsDragging(bool is_dragging)
static ItemManager GetInstance()
EntityAI GetDraggedItem()
static void TakeOrSplitToInventory(notnull PlayerBase player, notnull EntityAI target, notnull EntityAI item)
static void TakeOrSplitToInventoryLocation(notnull PlayerBase player, notnull InventoryLocation dst)
proto native CGame GetGame()
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.