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

◆ Select()

override bool PlayerContainer::Select ( )
inlineprotected

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

585 {
586 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
587 {
588 return GetFocusedContainer().Select();
589 }
590 else
591 {
592 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
593 EntityAI selected_item = ItemManager.GetInstance().GetSelectedItem();
594 SlotsIcon focused_slot = GetFocusedSlotsIcon();
595 EntityAI focused_item = focused_slot.GetEntity();
596 if( focused_slot.IsReserved() || focused_item != selected_item )
597 {
598 if( selected_item )
599 {
600 if( selected_item.GetInventory().CanRemoveEntity() )
601 {
602 if (m_Player.GetInventory().CanAddAttachmentEx( selected_item, focused_slot.GetSlotID() ))
603 {
604 player.PredictiveTakeEntityToTargetAttachmentEx( m_Player, selected_item, focused_slot.GetSlotID());
605 //m_Player.PredictiveTakeEntityAsAttachmentEx( selected_item, focused_slot.GetSlotID() );
606 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
607 return true;
608
609 }
610 else if (m_Player.GetInventory().CanAddAttachment( selected_item ))
611 {
612 player.PredictiveTakeEntityToTargetAttachment( m_Player, selected_item );
613 //m_Player.PredictiveTakeEntityToInventory( FindInventoryLocationType.ATTACHMENT, selected_item );
614 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
615 return true;
616 }
617 }
618 }
619 else
620 {
621 if( focused_item && focused_item.GetInventory().CanRemoveEntity() )
622 {
623 EntityAI item_in_hands = player.GetHumanInventory().GetEntityInHands();
624 if( item_in_hands && item_in_hands.GetInventory().CanRemoveEntity() )
625 {
626 if( GameInventory.CanSwapEntitiesEx( item_in_hands, focused_item ) )
627 {
628 player.PredictiveSwapEntities( item_in_hands, focused_item );
629 return true;
630 }
631 else
632 {
633 InventoryLocation il_hands_dst = new InventoryLocation;
634 if( player.GetHumanInventory().FindFreeLocationFor( item_in_hands, FindInventoryLocationType.ANY, il_hands_dst ) )
635 {
636 InventoryMode invMode = InventoryMode.PREDICTIVE;
637
638 if ( player.NeedInventoryJunctureFromServer(item_in_hands, item_in_hands.GetHierarchyParent(), il_hands_dst.GetParent()) || GetGame().GetPlayer().NeedInventoryJunctureFromServer(focused_item, focused_item.GetHierarchyParent(), GetGame().GetPlayer()) )
639 invMode = InventoryMode.JUNCTURE;
640
641 player.GetHumanInventory().ForceSwapEntities( invMode, focused_item, item_in_hands, il_hands_dst );
642 return true;
643 }
644 }
645 }
646 else
647 {
648 if( player.GetHumanInventory().CanAddEntityInHands( focused_item ) )
649 {
650 player.PredictiveTakeEntityToHands( focused_item );
651 return true;
652 }
653 }
654 }
655 }
656 }
657 }
658 return false;
659 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
class LogManager EntityAI
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
PlayerBase GetPlayer()
Определения ModifierBase.c:51
proto native EntityAI GetParent()
returns parent of current inventory location
PlayerBase m_Player
Определения PlayerContainer.c:7
EntityAI GetEntity()
Определения SlotsIcon.c:365
bool IsReserved()
Определения SlotsIcon.c:200
int GetSlotID()
Определения SlotsIcon.c:190
proto native CGame GetGame()

Перекрестные ссылки GameInventory::CanSwapEntitiesEx(), SlotsIcon::GetEntity(), GetGame(), ItemManager::GetInstance(), InventoryLocation::GetParent(), GetPlayer(), ItemManager::GetSelectedItem(), SlotsIcon::GetSlotID(), SlotsIcon::IsReserved(), m_Player и ItemManager::SetSelectedItemEx().