1116 {
1119 int slot_id = -1;
1120
1121 SlotsIcon slots_icon;
1122 receiver.GetUserData(slots_icon);
1123 if( slots_icon )
1124 {
1128 }
1129
1131 if( !item )
1132 {
1133 return;
1134 }
1135
1137 float stack_max = item_base.GetTargetQuantityMax(slot_id);
1138
1140 if( !item.GetInventory().CanRemoveEntity() || !player.CanManipulateInventory() )
1141 return;
1142
1144 Weapon_Base wpn;
1145 Magazine mag;
1146 if( Class.CastTo(wpn, target_att_entity ) && Class.CastTo(mag, item ) )
1147 {
1148 if( player.GetWeaponManager().CanAttachMagazine( wpn, mag ) )
1149 {
1150 player.GetWeaponManager().AttachMagazine( mag );
1151 }
1152 else if(player.GetWeaponManager().CanSwapMagazine( wpn, mag ))
1153 {
1154 player.GetWeaponManager().SwapMagazine( mag );
1155 }
1156 }
1157 else if( receiver_item )
1158 {
1159 if( receiver_item != item )
1160 {
1161 if( (
ItemBase.Cast( receiver_item ) ).CanBeCombined(
ItemBase.Cast( item ) ) )
1162 {
1163 (
ItemBase.Cast( receiver_item ) ).CombineItemsClient(
ItemBase.Cast( item ) );
1164 }
1165 else if( GameInventory.CanSwapEntitiesEx( receiver_item, item ) )
1166 {
1167 if( !receiver_item.GetInventory().CanRemoveEntity() )
1168 return;
1170 }
1171 }
1172 }
1173 else if( slot_owner && slot_owner.GetInventory().CanAddAttachmentEx( item, slot_id ) )
1174 {
1175 if( stack_max == 0 || stack_max >= item_base.GetQuantity() )
1176 {
1177 player.PredictiveTakeEntityToTargetAttachmentEx(slot_owner, item, slot_id);
1178 }
1179 else if( stack_max != 0 && stack_max < item_base.GetQuantity() )
1180 {
1181 item_base.SplitIntoStackMaxClient( slot_owner, slot_id );
1182 }
1183 }
1184 else if( slot_owner && slot_owner.GetInventory().CanAddAttachment( item ) )
1185 {
1186 if( stack_max == 0 || stack_max >= item_base.GetQuantity() )
1187 {
1188 player.PredictiveTakeEntityToTargetAttachment(slot_owner, item);
1189 }
1190 else if( stack_max != 0 && stack_max < item_base.GetQuantity() )
1191 {
1192 item_base.SplitIntoStackMaxClient( slot_owner, -1 );
1193 }
1194 }
1195 else if( target_att_entity.GetInventory().CanAddAttachment( item ) )
1196 {
1197 if( stack_max == 0 || stack_max >= item_base.GetQuantity() )
1198 {
1199 player.PredictiveTakeEntityToTargetAttachment(target_att_entity, item);
1200 }
1201 else if( stack_max != 0 && stack_max < item_base.GetQuantity() )
1202 {
1203 item_base.SplitIntoStackMaxClient( target_att_entity, -1 );
1204 }
1205 }
1206 else if( ( target_att_entity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ) && ( !player.GetInventory().HasEntityInInventory( item ) || !
m_Entity.GetInventory().HasEntityInCargo( item )) ) || player.GetHumanInventory().HasEntityInHands( item ) )
1207 {
1208 SplitItemUtils.TakeOrSplitToInventory( PlayerBase.Cast(
GetGame().
GetPlayer() ), target_att_entity, item );
1209 }
1210
1211
1212
1213
1214
1215 ItemManager.GetInstance().HideDropzones();
1216 ItemManager.GetInstance().SetIsDragging( false );
1217 }
class GP5GasMask extends MaskBase ItemBase
proto native DayZPlayer GetPlayer()
EntityAI GetItemPreviewItem(Widget w)
proto native CGame GetGame()