973 {
974 ItemManager.GetInstance().HideDropzones();
975 ItemManager.GetInstance().SetIsDragging(false);
976 string name = w.GetName();
977 name.Replace(
"PanelWidget",
"Render");
978
979 ItemPreviewWidget targetIpw = ItemPreviewWidget.Cast(receiver.FindAnyWidget( "Render" ));
981 {
982 targetIpw = ItemPreviewWidget.Cast(receiver.GetParent().FindAnyWidget( "Render" ));
983 }
984
985 ItemPreviewWidget selectedIpw = ItemPreviewWidget.Cast(w.FindAnyWidget(
name ));
986 if (selectedIpw == null)
987 {
988 selectedIpw = ItemPreviewWidget.Cast(w.FindAnyWidget( "Render" ));
989 }
990 if (selectedIpw == null)
991 {
992 return;
993 }
994
995 InventoryItem targetEntity = InventoryItem.Cast(targetIpw.
GetItem());
996 InventoryItem selectedEntity = InventoryItem.Cast(selectedIpw.
GetItem());
997 if (!selectedEntity || !targetEntity)
998 {
999 return;
1000 }
1001
1002 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer() );
1003 EntityAI itemInHands = player.GetEntityInHands();
1004
1005 InventoryLocation ilDst = new InventoryLocation();
1006 InventoryLocation ilSrc = new InventoryLocation();
1007 targetEntity.GetInventory().GetCurrentInventoryLocation(ilSrc);
1008 Icon icon = ItemManager.GetInstance().GetDraggedIcon();
1009
1010 if (selectedEntity.GetHierarchyRootPlayer() == player)
1011 {
1012 int index = player.GetHumanInventory().FindUserReservedLocationIndex(targetEntity);
1013 if (index>=0)
1014 {
1015 player.GetHumanInventory().GetUserReservedLocation(index, ilDst);
1016
1017 if (GameInventory.CanForceSwapEntitiesEx( selectedEntity, ilSrc, targetEntity, ilDst ))
1018 {
1019 if (
m_HandsIcon && !player.GetInventory().HasInventoryReservation(itemInHands, null) && !player.IsItemsToDelete())
1020 {
1021 g_Game.GetPlayer().PredictiveForceSwapEntities(selectedEntity, targetEntity, ilDst);
1022 return;
1023 }
1024 }
1025 }
1026 }
1027 static int testedFlags = InventoryCombinationFlags.SWAP | InventoryCombinationFlags.FSWAP;
1028
1029 int chosenInventoryAction = ItemManager.GetChosenCombinationFlag(selectedEntity, targetEntity, testedFlags, ilDst);
1031 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
void Icon(LayoutHolder parent, bool hands_icon=false)
bool PerformCombination(EntityAI selectedEntity, EntityAI targetEntity, int combinationFlag, InventoryLocation ilSwapDst=null)