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

◆ Select()

override bool AttachmentCategoriesRow::Select ( )
inlineprotected

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

39 {
40 Man player = GetGame().GetPlayer();
41 SlotsIcon focused_icon = GetFocusedSlotsIcon();
42 EntityAI focused_item = GetFocusedItem();
43 Container focused_cont = GetFocusedContainer();
44 ItemBase selected_item = ItemBase.Cast( ItemManager.GetInstance().GetSelectedItem() ); // == dragged item
45
46 if( selected_item && focused_item != selected_item)//dropping from micromanagement
47 {
48 if( selected_item.GetInventory().CanRemoveEntity() )
49 {
50 int stack_max;
51
52 if (!focused_icon)
53 {
54 if (focused_cont)
55 {
56 focused_cont.Select();
57 }
58 }
59 else if( !focused_item && m_Entity && m_Entity.GetInventory().CanAddAttachmentEx( selected_item, focused_icon.GetSlotID() ) )
60 {
61 stack_max = InventorySlots.GetStackMaxForSlotId( focused_icon.GetSlotID() );
62 float quantity = selected_item.GetQuantity();
63 if( stack_max == 0 || stack_max >= quantity || !selected_item.CanBeSplit() )
64 {
65 player.PredictiveTakeEntityToTargetAttachmentEx( m_Entity, selected_item, focused_icon.GetSlotID() );
66 return true;
67 }
68 else
69 {
70 selected_item.SplitIntoStackMaxClient( m_Entity, focused_icon.GetSlotID() );
71 return true;
72 }
73 }
74 else if (focused_icon.GetSlotID() != -1)
75 {
76 if (focused_item && focused_item.GetHierarchyParent() && focused_item.GetHierarchyParent().GetInventory().CanAddAttachment(selected_item))
77 {
78 InventoryLocation inv_loc = new InventoryLocation;
79 focused_item.GetInventory().GetCurrentInventoryLocation( inv_loc );
80 stack_max = InventorySlots.GetStackMaxForSlotId( inv_loc.GetSlot() );
81 quantity = focused_item.GetQuantity();
82 if( focused_item.CanBeCombined( ItemBase.Cast( selected_item ) ) )
83 {
84 focused_item.CombineItemsClient( selected_item, true );
85 return true;
86 }
87 else if( stack_max == 0 && GameInventory.CanSwapEntitiesEx( focused_item, selected_item ) )
88 {
89 player.PredictiveSwapEntities( selected_item, focused_item );
90 return true;
91 }
92 else if( m_AttachmentCargos.Contains( inv_loc.GetSlot() ) )
93 {
94 if( focused_item.GetInventory().CanAddEntityInCargo( selected_item, selected_item.GetInventory().GetFlipCargo() ) )
95 {
96 SplitItemUtils.TakeOrSplitToInventory( PlayerBase.Cast( player ), focused_item, selected_item );
97 return true;
98 }
99 }
100 }
101 }
102 }
103 }
104 else //clicking
105 {
106 if( focused_item && focused_item.GetInventory().CanRemoveEntity() && (!focused_icon || !focused_icon.IsOutOfReach()) )
107 {
108 EntityAI item_in_hands = GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
109 if( item_in_hands && item_in_hands.GetInventory().CanRemoveEntity() )
110 {
111 if( GameInventory.CanSwapEntitiesEx( item_in_hands, focused_item ) )
112 {
113 player.PredictiveSwapEntities( item_in_hands, focused_item );
114 return true;
115 }
116 }
117 else
118 {
119 if( player.GetHumanInventory().CanAddEntityInHands( focused_item ) )
120 {
121 player.PredictiveTakeEntityToHands( focused_item );
122 return true;
123 }
124 }
125 }
126 }
127
128 return false;
129 }
class LogManager EntityAI
EntityAI m_Entity
Определения ActionDebug.c:11
const string Container
Определения CentralEconomy.c:6
class GP5GasMask extends MaskBase ItemBase
ref map< int, ref ContainerWithCargo > m_AttachmentCargos
Определения AttachmentCategoriesRow.c:8
proto native DayZPlayer GetPlayer()
override bool Select()
Определения CargoContainer.c:852
proto native int GetSlot()
returns slot id if current type is Attachment
override bool CanBeSplit()
Определения Rag.c:34
bool IsOutOfReach()
Определения SlotsIcon.c:729
int GetSlotID()
Определения SlotsIcon.c:190
proto native CGame GetGame()

Перекрестные ссылки ItemBase::CanBeSplit(), GameInventory::CanSwapEntitiesEx(), GetGame(), ItemManager::GetInstance(), CGame::GetPlayer(), ItemManager::GetSelectedItem(), InventoryLocation::GetSlot(), SlotsIcon::GetSlotID(), InventorySlots::GetStackMaxForSlotId(), SlotsIcon::IsOutOfReach(), m_AttachmentCargos, m_Entity, Container::Select() и SplitItemUtils::TakeOrSplitToInventory().