461 {
462 if( w == null )
463 {
464 return;
465 }
468 int slot_id = -1;
469
470 string name = w.GetName();
471 name.Replace(
"PanelWidget",
"Render" );
472
473 ItemPreviewWidget w_ipw = ItemPreviewWidget.Cast( w.FindAnyWidget(
name ) );
474 if( w_ipw == null )
475 {
476 w_ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
477 }
478 if( w_ipw == null )
479 {
480 return;
481 }
482
483 SlotsIcon slots_icon;
484 receiver.GetUserData(slots_icon);
485
486 if(slots_icon)
487 {
491 }
492
493
495 InventoryItem receiver_entity = InventoryItem.Cast( p.GetHumanInventory().GetEntityInHands() );
496 InventoryItem w_entity = InventoryItem.Cast( w_ipw.
GetItem() );
497 if( !w_entity )
498 {
499 return;
500 }
501
502 if( receiver_entity )
503 {
504 if( receiver_item )
505 {
508 if( receiver_itemIB && itemIB && receiver_itemIB.
CanBeCombined( itemIB ) )
509 {
510 ItemManager.GetInstance().HideDropzones();
512 {
513 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
514 }
515 else
516 {
517 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
518 }
519 ColorManager.GetInstance().SetColor( w, ColorManager.COMBINE_COLOR );
520 }
521 else
522 {
524 Magazine mag = Magazine.Cast(receiver_item);
525 Weapon_Base wpn = Weapon_Base.Cast(receiver_item.GetHierarchyParent());
526
527 if( wpn && mag )
528 {
529 if( player.GetWeaponManager().CanSwapMagazine( wpn, Magazine.Cast(w_entity) ) )
530 {
531 ColorManager.GetInstance().SetColor( w, ColorManager.SWAP_COLOR );
532 if( w_entity.GetHierarchyRootPlayer() == player )
533 {
534 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
535 }
536 else
537 {
538 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
539 }
540 }
541 else
542 {
543 ColorManager.GetInstance().SetColor( w, ColorManager.RED_COLOR );
544 ItemManager.GetInstance().ShowSourceDropzone( w_entity );
545 }
546 }
547 else
548 {
549 if( GameInventory.CanSwapEntitiesEx( receiver_item, w_entity ) )
550 {
551 ItemManager.GetInstance().HideDropzones();
553 {
554 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
555 }
556 else
557 {
558 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
559 }
560 ColorManager.GetInstance().SetColor( w, ColorManager.SWAP_COLOR );
561 }
562 else if( receiver_itemIB.GetInventory().CanAddAttachment( w_entity ) )
563 {
564 ItemManager.GetInstance().HideDropzones();
566 {
567 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
568 }
569 else
570 {
571 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
572 }
573 ColorManager.GetInstance().SetColor( w, ColorManager.GREEN_COLOR );
574 }
575 }
576 }
577 }
578 else if( slot_owner && slot_owner.GetInventory().CanAddAttachment( w_entity ) )
579 {
580 ItemManager.GetInstance().HideDropzones();
581 ItemManager.GetInstance().GetCenterDropzone().SetAlpha( 1 );
582 ColorManager.GetInstance().SetColor( w, ColorManager.GREEN_COLOR );
583 }
584 else if( receiver_entity.GetInventory().CanAddAttachment( w_entity ) )
585 {
586 ItemManager.GetInstance().HideDropzones();
588 {
589 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
590 }
591 else
592 {
593 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
594 }
595 ColorManager.GetInstance().SetColor( w, ColorManager.GREEN_COLOR );
596 }
597 else
598 {
599 ColorManager.GetInstance().SetColor( w, ColorManager.RED_COLOR );
600 ItemManager.GetInstance().ShowSourceDropzone( w_entity );
601 }
602 }
603 else
604 {
605
606
607
608
609
610
611
612
613
614 ColorManager.GetInstance().SetColor( w, ColorManager.RED_COLOR );
615 ItemManager.GetInstance().ShowSourceDropzone( w_entity );
616
617 }
618 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
class GP5GasMask extends MaskBase ItemBase
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
proto native CGame GetGame()