DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ SplitItemToInventoryLocation()

void SplitItemToInventoryLocation ( notnull InventoryLocation dst)
protected

См. определение в файле ItemBase.c строка 1917

1918 {
1919 float quantity = GetQuantity();
1920 float split_quantity_new = Math.Floor(quantity * 0.5);
1921
1922 if (!ShouldSplitQuantity(split_quantity_new))
1923 return;
1924
1925 int flag = ECE_IN_INVENTORY;
1926 if (dst.GetType() == InventoryLocationType.GROUND)
1927 flag = ECE_PLACE_ON_SURFACE;
1928 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), flag, RF_DEFAULT));
1929
1930 if (new_item)
1931 {
1932 if (new_item.GetQuantityMax() < split_quantity_new)
1933 {
1934 split_quantity_new = new_item.GetQuantityMax();
1935 }
1936
1937 new_item.SetResultOfSplit(true);
1938 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1939
1940 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
1941 {
1942 AddQuantity(-1, false, true);
1943 new_item.SetQuantity(1, false, true);
1944 }
1945 else
1946 {
1947 AddQuantity(-split_quantity_new, false, true);
1948 new_item.SetQuantity(split_quantity_new, false, true);
1949 }
1950 }
1951 }
eBleedingSourceType GetType()
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:38
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:37
const int RF_DEFAULT
Определения CentralEconomy.c:66
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
override float GetQuantity()
Определения ItemBase.c:3486
bool ShouldSplitQuantity(float quantity)
Определения ItemBase.c:1541
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...
Определения ItemBase.c:3389
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
script counterpart to engine's class Inventory
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfBricks.c:64
Определения EnMath.c:7
static proto float Floor(float f)
Returns floor of value.

Перекрестные ссылки AddQuantity(), ECE_IN_INVENTORY, ECE_PLACE_ON_SURFACE, Math::Floor(), GetQuantity(), GetType(), GameInventory::LocationCreateEntity(), RF_DEFAULT, ItemBase::SetQuantity() и ShouldSplitQuantity().