536 {
538 {
539 if( w == null )
540 {
541 return;
542 }
543 ItemPreviewWidget iw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
544 if( !iw )
545 {
546 string name = w.GetName();
547 name.Replace(
"PanelWidget",
"Render" );
548 iw = ItemPreviewWidget.Cast( w.FindAnyWidget(
name ) );
549 }
550
551 if( !iw )
552 {
553 iw = ItemPreviewWidget.Cast( w );
554 }
555
557 if( !item )
558 {
559 return;
560 }
561
562 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer() );
563
564 if( player.GetInventory().HasInventoryReservation( item, null ) || player.IsItemsToDelete() )
565 {
566 return;
567 }
568
569 if( !item.GetInventory().CanRemoveEntity() )
570 return;
571
572 if ( player.GetInventory().HasEntityInInventory( item ) &&
g_Game.GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
573 {
574 player.PredictiveTakeEntityToHands( item );
575 }
576 else
577 {
578 InventoryLocation il = new InventoryLocation;
580 {
581 if( item.GetTargetQuantityMax(il.
GetSlot()) < item.GetQuantity() )
582 item.SplitIntoStackMaxToInventoryLocationClient( il );
583 else
585 }
586 else if(
g_Game.GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
587 {
588 if( item.GetTargetQuantityMax() < item.GetQuantity() )
589 item.SplitIntoStackMaxHandsClient( player );
590 else
591 player.PredictiveTakeEntityToHands( item );
592 }
593 }
594
595 HideOwnedTooltip();
597 if( menu )
598 {
599 menu.RefreshQuickbar();
600 }
601 }
602 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
proto native int GetSlot()
returns slot id if current type is Attachment