DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
SplitItemUtils.c
См. документацию.
2{
3 static void TakeOrSplitToInventory ( notnull PlayerBase player, notnull EntityAI target, notnull EntityAI item)
4 {
5 ItemBase item_base = ItemBase.Cast( item );
6
7 if( !item.GetInventory().CanRemoveEntity() || !player.CanManipulateInventory() )
8 return;
9
11 if( target.GetInventory().FindFreeLocationFor( item, FindInventoryLocationType.ANY, il) )
12 {
13 if( item_base.GetTargetQuantityMax(il.GetSlot()) >= item_base.GetQuantity() )
14 {
15 if( il.GetType() == InventoryLocationType.ATTACHMENT )
16 {
17 player.PredictiveTakeEntityToTargetAttachmentEx(il.GetParent(), item, il.GetSlot());
18 }
19 else
20 {
22 if (item.GetInventory().GetCurrentInventoryLocation(src))
23 player.PredictiveTakeToDst(src, il);
24
25 }
26 }
27 else
28 {
29 item_base.SplitIntoStackMaxClient( il.GetParent(), il.GetSlot() );
30 }
31 }
32 }
33
34 static void TakeOrSplitToInventoryLocation ( notnull PlayerBase player, notnull InventoryLocation dst)
35 {
36 ItemBase item_base = ItemBase.Cast( dst.GetItem() );
37 int slot = dst.GetSlot();
38
39 if( !dst.GetItem().GetInventory().CanRemoveEntity() || !player.CanManipulateInventory() )
40 return;
41
42 float stack_max = item_base.GetTargetQuantityMax(slot);
43
44 if( stack_max >= item_base.GetQuantity() )
45 {
47 if (dst.GetItem().GetInventory().GetCurrentInventoryLocation(src))
48 {
49 player.PredictiveTakeToDst(src, dst);
50 }
51 else
52 Error("TakeIntoCargoEx cannot get src for dst=" + dst.DumpToString());
53 }
54 else
55 {
56 item_base.SplitIntoStackMaxToInventoryLocationClient( dst );
57 }
58 }
59}
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
Определения Building.c:6
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetType()
returns type of InventoryLocation
InventoryLocation.
Определения InventoryLocation.c:29
Определения InventoryItem.c:731
Определения PlayerBaseClient.c:2
static void TakeOrSplitToInventoryLocation(notnull PlayerBase player, notnull InventoryLocation dst)
Определения SplitItemUtils.c:34
static void TakeOrSplitToInventory(notnull PlayerBase player, notnull EntityAI target, notnull EntityAI item)
Определения SplitItemUtils.c:3
Определения SplitItemUtils.c:2
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90