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

◆ DropReceived()

void HandsContainer::DropReceived ( Widget w,
int x,
int y,
CargoContainer cargo )
inlineprotected

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

977 {
978 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
979 EntityAI item_in_hands = player.GetHumanInventory().GetEntityInHands();
980
981 EntityAI item = GetItemPreviewItem( w );
982 if( !item )
983 {
984 return;
985 }
986
987 int idx = 0;
988 int c_x, c_y;
989
990 EntityAI target_entity;
991 CargoBase target_cargo;
992
993 if( cargo == m_CargoGrid )
994 {
995 target_entity = m_Entity;
996 target_cargo = m_Entity.GetInventory().GetCargo();
997 #ifdef PLATFORM_CONSOLE
998 if( m_CargoGrid.HasItem( item ) )
999 {
1000 return;
1001 }
1002 #endif
1003 }
1004 else
1005 {
1006 target_entity = m_AttachmentCargos.GetKeyByValue( cargo );
1007 if( target_entity )
1008 {
1009 target_cargo = target_entity.GetInventory().GetCargo();
1010 #ifdef PLATFORM_CONSOLE
1011 if( cargo.HasItem( item ) )
1012 {
1013 return;
1014 }
1015 #endif
1016 }
1017 else
1018 return;
1019 }
1020
1021 if( target_cargo && target_entity )
1022 {
1023 c_x = target_cargo.GetHeight();
1024 c_y = target_cargo.GetWidth();
1025 }
1026 else
1027 return;
1028
1029 InventoryLocation dst = new InventoryLocation;
1030 #ifdef PLATFORM_CONSOLE
1031 x = 0;
1032 y = target_cargo.GetItemCount();
1033 target_entity.GetInventory().FindFreeLocationFor( item, FindInventoryLocationType.CARGO, dst );
1034 #else
1035 dst.SetCargoAuto(target_cargo, item, x, y, item.GetInventory().GetFlipCargo());
1036 #endif
1037
1038 InventoryLocation src = new InventoryLocation;
1039 item.GetInventory().GetCurrentInventoryLocation(src);
1040 if(src.CompareLocationOnly(dst) && src.GetFlip() == dst.GetFlip())
1041 return;
1042
1043 #ifdef PLATFORM_CONSOLE
1044 if(dst.IsValid() && target_entity.GetInventory().LocationCanAddEntity(dst))
1045 #else
1046 if( c_x > x && c_y > y && target_entity.GetInventory().LocationCanAddEntity(dst))
1047 #endif
1048 {
1049 SplitItemUtils.TakeOrSplitToInventoryLocation( player, dst );
1050
1051 Icon icon = cargo.GetIcon( item );
1052
1053 if( icon )
1054 {
1055 if( w && w.FindAnyWidget("Cursor") )
1056 w.FindAnyWidget("Cursor").SetColor( ColorManager.BASE_COLOR );
1057 icon.Refresh();
1058 Refresh();
1059 }
1060 }
1061 ItemManager.GetInstance().HideDropzones();
1062 ItemManager.GetInstance().SetIsDragging( false );
1063 }
class LogManager EntityAI
EntityAI m_Entity
Определения ActionDebug.c:11
Icon x
Icon y
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
PlayerBase GetPlayer()
Определения ModifierBase.c:51
proto native int GetItemCount()
proto native int GetWidth()
proto native int GetHeight()
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
Определения HandsContainer.c:10
EntityAI GetItemPreviewItem(Widget w)
Определения HandsContainer.c:436
override void Refresh()
Определения HandsContainer.c:323
ref CargoContainer m_CargoGrid
Определения HandsContainer.c:8
override void Refresh()
Определения Icon.c:1216
proto native bool IsValid()
verify current set inventory location
proto native void SetCargoAuto(notnull CargoBase cargo, EntityAI e, int row, int col, bool flip)
based on Cargo.IsProxyCargo uses SetProxyCargo or SetCargo respectively
proto native bool CompareLocationOnly(notnull InventoryLocation other)
proto native bool GetFlip()
returns flip status of cargo
proto native CGame GetGame()

Перекрестные ссылки ColorManager::BASE_COLOR, Container::CargoContainer(), InventoryLocation::CompareLocationOnly(), InventoryLocation::GetFlip(), GetGame(), CargoBase::GetHeight(), ItemManager::GetInstance(), CargoBase::GetItemCount(), GetItemPreviewItem(), GetPlayer(), CargoBase::GetWidth(), ItemManager::HideDropzones(), InventoryLocation::IsValid(), m_AttachmentCargos, m_CargoGrid, m_Entity, Refresh(), Icon::Refresh(), InventoryLocation::SetCargoAuto(), ItemManager::SetIsDragging(), SplitItemUtils::TakeOrSplitToInventoryLocation(), x и y.