1657 {
1658 float split_quantity_new;
1662 InventoryLocation loc = new InventoryLocation;
1663
1664 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
1665 {
1667 split_quantity_new = stack_max;
1668 else
1670
1672 {
1673 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
1674 if (new_item)
1675 {
1676 new_item.SetResultOfSplit(true);
1677 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1679 new_item.
SetQuantity(split_quantity_new,
false,
true);
1680 }
1681 }
1682 }
1683 else if (destination_entity && slot_id == -1)
1684 {
1685 if (quantity > stack_max)
1686 split_quantity_new = stack_max;
1687 else
1688 split_quantity_new = quantity;
1689
1691 {
1692 GameInventory destinationInventory = destination_entity.GetInventory();
1694 {
1697 }
1698
1699 if (new_item)
1700 {
1701 new_item.SetResultOfSplit(true);
1702 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1704 new_item.
SetQuantity(split_quantity_new,
false,
true);
1705 }
1706 }
1707 }
1708 else
1709 {
1710 if (stack_max != 0)
1711 {
1713 {
1715 }
1716
1717 if (split_quantity_new == 0)
1718 {
1719 if (!
g_Game.IsMultiplayer())
1720 player.PhysicalPredictiveDropItem(this);
1721 else
1722 player.ServerDropEntity(this);
1723 return;
1724 }
1725
1727 {
1729
1730 if (new_item)
1731 {
1732 new_item.SetResultOfSplit(true);
1733 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1736 new_item.PlaceOnSurface();
1737 }
1738 }
1739 }
1740 }
1741 }
eBleedingSourceType GetType()
const int ECE_PLACE_ON_SURFACE
const int ECE_IN_INVENTORY
FindInventoryLocationType
flags for searching locations in inventory
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
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)