1585 {
1586 float split_quantity_new;
1591
1593 {
1595 split_quantity_new = stack_max;
1596 else
1598
1600 {
1601 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
1602 if (new_item)
1603 {
1604 new_item.SetResultOfSplit(true);
1605 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1607 new_item.
SetQuantity(split_quantity_new,
false,
true);
1608 }
1609 }
1610 }
1611 else if (destination_entity && slot_id == -1)
1612 {
1613 if (quantity > stack_max)
1614 split_quantity_new = stack_max;
1615 else
1616 split_quantity_new = quantity;
1617
1619 {
1620 GameInventory destinationInventory = destination_entity.GetInventory();
1622 {
1625 }
1626
1627 if (new_item)
1628 {
1629 new_item.SetResultOfSplit(true);
1630 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1632 new_item.
SetQuantity(split_quantity_new,
false,
true);
1633 }
1634 }
1635 }
1636 else
1637 {
1638 if (stack_max != 0)
1639 {
1641 {
1643 }
1644
1645 if (split_quantity_new == 0)
1646 {
1647 if (!
g_Game.IsMultiplayer())
1648 player.PhysicalPredictiveDropItem(this);
1649 else
1650 player.ServerDropEntity(this);
1651 return;
1652 }
1653
1655 {
1657
1658 if (new_item)
1659 {
1660 new_item.SetResultOfSplit(true);
1661 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1664 new_item.PlaceOnSurface();
1665 }
1666 }
1667 }
1668 }
1669 }
eBleedingSourceType GetType()
const int ECE_PLACE_ON_SURFACE
const int ECE_IN_INVENTORY
override void SetQuantity()
FindInventoryLocationType
flags for searching locations in inventory
override float GetQuantity()
bool ShouldSplitQuantity(float quantity)
override int GetTargetQuantityMax(int attSlotID=-1)
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...
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.
script counterpart to engine's class Inventory
static proto native bool IsSlotIdValid(int slotId)
verifies existence of the slot id
provides access to slot configuration
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)