977 {
979 EntityAI item_in_hands = player.GetHumanInventory().GetEntityInHands();
980
982 if( !item )
983 {
984 return;
985 }
986
987 int idx = 0;
988 int c_x, c_y;
989
991 CargoBase target_cargo;
992
994 {
996 target_cargo =
m_Entity.GetInventory().GetCargo();
997 #ifdef PLATFORM_CONSOLE
999 {
1000 return;
1001 }
1002 #endif
1003 }
1004 else
1005 {
1007 if( target_entity )
1008 {
1009 target_cargo = target_entity.GetInventory().GetCargo();
1010 #ifdef PLATFORM_CONSOLE
1011 if( cargo.HasItem( item ) )
1012 {
1013 return;
1014 }
1015 #endif
1016 }
1017 else
1018 return;
1019 }
1020
1021 if( target_cargo && target_entity )
1022 {
1025 }
1026 else
1027 return;
1028
1029 InventoryLocation dst = new InventoryLocation;
1030 #ifdef PLATFORM_CONSOLE
1034 #else
1035 dst.
SetCargoAuto(target_cargo, item,
x,
y, item.GetInventory().GetFlipCargo());
1036 #endif
1037
1038 InventoryLocation src = new InventoryLocation;
1039 item.GetInventory().GetCurrentInventoryLocation(src);
1041 return;
1042
1043 #ifdef PLATFORM_CONSOLE
1044 if(dst.
IsValid() && target_entity.GetInventory().LocationCanAddEntity(dst))
1045 #else
1046 if( c_x >
x && c_y >
y && target_entity.GetInventory().LocationCanAddEntity(dst))
1047 #endif
1048 {
1049 SplitItemUtils.TakeOrSplitToInventoryLocation( player, dst );
1050
1051 Icon icon = cargo.GetIcon( item );
1052
1053 if( icon )
1054 {
1055 if( w && w.FindAnyWidget("Cursor") )
1056 w.FindAnyWidget("Cursor").SetColor( ColorManager.BASE_COLOR );
1059 }
1060 }
1061 ItemManager.GetInstance().HideDropzones();
1062 ItemManager.GetInstance().SetIsDragging( false );
1063 }
FindInventoryLocationType
flags for searching locations in inventory
proto native int GetItemCount()
proto native int GetWidth()
proto native int GetHeight()
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
EntityAI GetItemPreviewItem(Widget w)
ref CargoContainer m_CargoGrid
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
proto native CGame GetGame()