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

◆ Select()

bool Attachments::Select ( )
inlineprotected

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

138 {
139 SlotsIcon selected_slot = ItemManager.GetInstance().GetSelectedIcon();
140 EntityAI selected_item = ItemManager.GetInstance().GetSelectedItem();
141 SlotsIcon focused_slot = GetFocusedSlotsIcon();
142 EntityAI focused_item = GetFocusedItem();
143 Man player = GetGame().GetPlayer();
144
145 if( focused_slot.IsReserved() || focused_item != selected_item && !(selected_slot && selected_slot.IsOutOfReach() ) )
146 {
147 if( selected_item )
148 {
149 if( selected_item.GetInventory().CanRemoveEntity() )
150 {
151 if( m_Entity.GetInventory().CanAddAttachmentEx( selected_item, focused_slot.GetSlotID() ) )
152 {
153 player.PredictiveTakeEntityToTargetAttachmentEx( m_Entity, selected_item, focused_slot.GetSlotID() );
154 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
155 return true;
156
157 }
158 else if( m_Entity.GetInventory().CanAddAttachment( selected_item ) )
159 {
160 player.PredictiveTakeEntityToTargetAttachment(m_Entity, selected_item);
161 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
162 return true;
163 }
164 }
165 }
166 else
167 {
168 if ( focused_item && !focused_slot.IsOutOfReach() )
169 {
170 EntityAI item_in_hands = GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
171 InventoryLocation il = new InventoryLocation;
172 focused_item.GetInventory().GetCurrentInventoryLocation( il );
173 bool reachable = AttachmentsOutOfReach.IsAttachmentReachable( m_Entity, "", il.GetSlot() );
174 if( reachable && focused_item.GetInventory().CanRemoveEntity() )
175 {
176 if( item_in_hands && item_in_hands.GetInventory().CanRemoveEntity() )
177 {
178 if( GameInventory.CanSwapEntitiesEx( item_in_hands, focused_item ) )
179 {
180 player.PredictiveSwapEntities( item_in_hands, focused_item );
181 return true;
182 }
183 }
184 else
185 {
186 if( player.GetHumanInventory().CanAddEntityInHands( focused_item ) )
187 {
188 player.PredictiveTakeEntityToHands( focused_item );
189 return true;
190 }
191 }
192 }
193 }
194 }
195 }
196 return false;
197 }
class LogManager EntityAI
SlotsIcon GetFocusedSlotsIcon()
Определения Attachments.c:99
EntityAI m_Entity
Определения Attachments.c:6
EntityAI GetFocusedItem()
Определения Attachments.c:104
proto native DayZPlayer GetPlayer()
proto native int GetSlot()
returns slot id if current type is Attachment
bool IsOutOfReach()
Определения SlotsIcon.c:729
bool IsReserved()
Определения SlotsIcon.c:200
int GetSlotID()
Определения SlotsIcon.c:190
proto native CGame GetGame()

Перекрестные ссылки GameInventory::CanSwapEntitiesEx(), GetFocusedItem(), GetFocusedSlotsIcon(), GetGame(), ItemManager::GetInstance(), CGame::GetPlayer(), ItemManager::GetSelectedIcon(), ItemManager::GetSelectedItem(), InventoryLocation::GetSlot(), SlotsIcon::GetSlotID(), AttachmentsOutOfReach::IsAttachmentReachable(), SlotsIcon::IsOutOfReach(), SlotsIcon::IsReserved(), m_Entity и ItemManager::SetSelectedItemEx().