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