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

◆ SplitItem()

void SplitItem ( PlayerBase player)
protected

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

1954 {
1955 float quantity = GetQuantity();
1956 float split_quantity_new = Math.Floor(quantity / 2);
1957
1958 if (!ShouldSplitQuantity(split_quantity_new))
1959 return;
1960
1962 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
1963
1964 ItemBase new_item;
1965 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
1966
1967 if (new_item)
1968 {
1969 if (new_item.GetQuantityMax() < split_quantity_new)
1970 {
1971 split_quantity_new = new_item.GetQuantityMax();
1972 }
1973 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
1974 {
1975 AddQuantity(-1, false, true);
1976 new_item.SetQuantity(1, false, true);
1977 }
1978 else
1979 {
1980 AddQuantity(-split_quantity_new, false, true);
1981 new_item.SetQuantity(split_quantity_new, false, true);
1982 }
1983 }
1984 }
eBleedingSourceType GetType()
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:18
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
proto native bool IsValid()
verify current set inventory location
proto native int GetType()
returns type of InventoryLocation
InventoryLocation.
Определения InventoryLocation.c:30
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(), Math::Floor(), GetQuantity(), GetType(), InventoryLocation::GetType(), InventoryLocation::IsValid(), ItemBase::SetQuantity() и ShouldSplitQuantity().

Используется в OnRightClick().