300 {
301 ItemManager.GetInstance().HideDropzones();
302 ItemManager.GetInstance().SetIsDragging(false);
303 SlotsIcon slots_icon;
305 int slot_id = -1;
306 bool is_reserved = false;
308 receiver.GetUserData(slots_icon);
309 float stackable = 0.0;
310 InventoryLocation il = new InventoryLocation;
311
312 if (slots_icon)
313 {
318 }
319
321 if (!item)
322 {
323 return;
324 }
326
327 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer() );
328 if (!item.GetInventory().CanRemoveEntity() || !player.CanManipulateInventory())
329 return;
330
332 Weapon_Base wpn;
333 Magazine mag;
334 if (Class.CastTo(wpn,
m_Entity) && Class.CastTo(mag, item))
335 {
336 if (player.GetWeaponManager().CanAttachMagazine(wpn, mag))
337 {
338 player.GetWeaponManager().AttachMagazine(mag);
339 }
340 }
341 else if (receiver_item && !is_reserved)
342 {
344 {
346 }
347 else if (GameInventory.CanSwapEntitiesEx(receiver_item, item))
348 {
349 if (!receiver_item.GetInventory().CanRemoveEntity())
350 return;
351 g_Game.GetPlayer().PredictiveSwapEntities( receiver_item, item );
352 }
353 else if (receiver_item.GetInventory().CanAddAttachment(item))
354 {
355 player.PredictiveTakeEntityToTargetAttachment(receiver_item, item);
356 }
357 }
358 else if (attached_entity && slot_id != -1 && attached_entity.GetInventory().CanAddAttachmentEx(item, slot_id))
359 {
361 stackable = item_base.GetTargetQuantityMax(slot_id);
362
363 if (stackable == 0 || stackable >= item_base.GetQuantity())
364 {
365 player.PredictiveTakeEntityToTargetAttachmentEx(attached_entity, item, slot_id);
366 }
367 else if (stackable != 0 && stackable < item_base.GetQuantity())
368 {
369 item_base.SplitIntoStackMaxClient(
m_Entity, slot_id);
370 }
371 }
372 else if (attached_entity && slot_id == -1 && attached_entity.GetInventory().FindFreeLocationFor(item,
FindInventoryLocationType.ATTACHMENT,il))
373 {
375 stackable = item_base.GetTargetQuantityMax(il.
GetSlot());
376
377 if (stackable == 0 || stackable >= item_base.GetQuantity())
378 {
379 player.PredictiveTakeEntityToTargetAttachmentEx(attached_entity, item, il.
GetSlot());
380 }
381 else if (stackable != 0 && stackable < item_base.GetQuantity())
382 {
384 }
385 }
386
387
388
389
390 }
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
EntityAI GetItemPreviewItem(Widget w)
proto native int GetSlot()
returns slot id if current type is Attachment