1744 {
1745 float split_quantity_new;
1749 InventoryLocation loc = new InventoryLocation;
1750
1751 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
1752 {
1754 split_quantity_new = stack_max;
1755 else
1757
1759 {
1760 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
1761 if (new_item)
1762 {
1763 new_item.SetResultOfSplit(true);
1764 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1766 new_item.
SetQuantity(split_quantity_new,
false,
true);
1767 }
1768 }
1769 }
1770 else if (destination_entity && slot_id == -1)
1771 {
1772 if (quantity > stack_max)
1773 split_quantity_new = stack_max;
1774 else
1775 split_quantity_new = quantity;
1776
1778 {
1779 GameInventory destinationInventory = destination_entity.GetInventory();
1781 {
1784 }
1785
1786 if (new_item)
1787 {
1788 new_item.SetResultOfSplit(true);
1789 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1791 new_item.
SetQuantity(split_quantity_new,
false,
true);
1792 }
1793 }
1794 }
1795 else
1796 {
1797 if (stack_max != 0)
1798 {
1800 {
1802 }
1803
1805 {
1807
1808 if (new_item)
1809 {
1810 new_item.SetResultOfSplit(true);
1811 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1814 new_item.PlaceOnSurface();
1815 }
1816 }
1817 }
1818 }
1819 }
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)