978 {
980 EntityAI item_in_hands = player.GetHumanInventory().GetEntityInHands();
981
983 if( !item )
984 {
985 return;
986 }
987
988 int idx = 0;
989 int c_x, c_y;
990
992 CargoBase target_cargo;
993
995 {
997 target_cargo =
m_Entity.GetInventory().GetCargo();
998 #ifdef PLATFORM_CONSOLE
1000 {
1001 return;
1002 }
1003 #endif
1004 }
1005 else
1006 {
1008 if( target_entity )
1009 {
1010 target_cargo = target_entity.GetInventory().GetCargo();
1011 #ifdef PLATFORM_CONSOLE
1012 if( cargo.HasItem( item ) )
1013 {
1014 return;
1015 }
1016 #endif
1017 }
1018 else
1019 return;
1020 }
1021
1022 if( target_cargo && target_entity )
1023 {
1026 }
1027 else
1028 return;
1029
1030 InventoryLocation dst = new InventoryLocation;
1031 #ifdef PLATFORM_CONSOLE
1035 #else
1036 dst.
SetCargoAuto(target_cargo, item,
x,
y, item.GetInventory().GetFlipCargo());
1037 #endif
1038
1039 InventoryLocation src = new InventoryLocation;
1040 item.GetInventory().GetCurrentInventoryLocation(src);
1042 return;
1043
1044 #ifdef PLATFORM_CONSOLE
1045 if(dst.
IsValid() && target_entity.GetInventory().LocationCanAddEntity(dst))
1046 #else
1047 if( c_x >
x && c_y >
y && target_entity.GetInventory().LocationCanAddEntity(dst))
1048 #endif
1049 {
1050 SplitItemUtils.TakeOrSplitToInventoryLocation( player, dst );
1051
1052 Icon icon = cargo.GetIcon( item );
1053
1054 if( icon )
1055 {
1056 if( w && w.FindAnyWidget("Cursor") )
1057 w.FindAnyWidget("Cursor").SetColor( ColorManager.BASE_COLOR );
1060 }
1061 }
1062 ItemManager.GetInstance().HideDropzones();
1063 ItemManager.GetInstance().SetIsDragging( false );
1064 }
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()