1632 {
1633 float split_quantity_new;
1637 InventoryLocation loc = new InventoryLocation;
1638
1639 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
1640 {
1642 split_quantity_new = stack_max;
1643 else
1645
1647 {
1648 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
1649 if (new_item)
1650 {
1651 new_item.SetResultOfSplit(true);
1652 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1654 new_item.
SetQuantity(split_quantity_new,
false,
true);
1655 }
1656 }
1657 }
1658 else if (destination_entity && slot_id == -1)
1659 {
1660 if (quantity > stack_max)
1661 split_quantity_new = stack_max;
1662 else
1663 split_quantity_new = quantity;
1664
1666 {
1668 {
1671 }
1672
1673 if (new_item)
1674 {
1675 new_item.SetResultOfSplit(true);
1676 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1678 new_item.
SetQuantity(split_quantity_new,
false,
true);
1679 }
1680 }
1681 }
1682 else
1683 {
1684 if (stack_max != 0)
1685 {
1687 {
1689 }
1690
1691 if (split_quantity_new == 0)
1692 {
1693 if (!
GetGame().IsMultiplayer())
1694 player.PhysicalPredictiveDropItem(this);
1695 else
1696 player.ServerDropEntity(this);
1697 return;
1698 }
1699
1701 {
1703
1704 if (new_item)
1705 {
1706 new_item.SetResultOfSplit(true);
1707 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1710 new_item.PlaceOnSurface();
1711 }
1712 }
1713 }
1714 }
1715 }
eBleedingSourceType GetType()
const int ECE_PLACE_ON_SURFACE
const int ECE_IN_INVENTORY
FindInventoryLocationType
flags for searching locations in inventory
override float GetQuantity()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Set item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override int GetTargetQuantityMax(int attSlotID=-1)
bool ShouldSplitQuantity(float quantity)
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
proto native CGame GetGame()