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

◆ DropReceived()

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

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

978 {
979 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
980 EntityAI item_in_hands = player.GetHumanInventory().GetEntityInHands();
981
982 EntityAI item = GetItemPreviewItem( w );
983 if( !item )
984 {
985 return;
986 }
987
988 int idx = 0;
989 int c_x, c_y;
990
991 EntityAI target_entity;
992 CargoBase target_cargo;
993
994 if( cargo == m_CargoGrid )
995 {
996 target_entity = m_Entity;
997 target_cargo = m_Entity.GetInventory().GetCargo();
998 #ifdef PLATFORM_CONSOLE
999 if( m_CargoGrid.HasItem( item ) )
1000 {
1001 return;
1002 }
1003 #endif
1004 }
1005 else
1006 {
1007 target_entity = m_AttachmentCargos.GetKeyByValue( cargo );
1008 if( target_entity )
1009 {
1010 target_cargo = target_entity.GetInventory().GetCargo();
1011 #ifdef PLATFORM_CONSOLE
1012 if( cargo.HasItem( item ) )
1013 {
1014 return;
1015 }
1016 #endif
1017 }
1018 else
1019 return;
1020 }
1021
1022 if( target_cargo && target_entity )
1023 {
1024 c_x = target_cargo.GetHeight();
1025 c_y = target_cargo.GetWidth();
1026 }
1027 else
1028 return;
1029
1030 InventoryLocation dst = new InventoryLocation;
1031 #ifdef PLATFORM_CONSOLE
1032 x = 0;
1033 y = target_cargo.GetItemCount();
1034 target_entity.GetInventory().FindFreeLocationFor( item, FindInventoryLocationType.CARGO, dst );
1035 #else
1036 dst.SetCargoAuto(target_cargo, item, x, y, item.GetInventory().GetFlipCargo());
1037 #endif
1038
1039 InventoryLocation src = new InventoryLocation;
1040 item.GetInventory().GetCurrentInventoryLocation(src);
1041 if(src.CompareLocationOnly(dst) && src.GetFlip() == dst.GetFlip())
1042 return;
1043
1044 #ifdef PLATFORM_CONSOLE
1045 if(dst.IsValid() && target_entity.GetInventory().LocationCanAddEntity(dst))
1046 #else
1047 if( c_x > x && c_y > y && target_entity.GetInventory().LocationCanAddEntity(dst))
1048 #endif
1049 {
1050 SplitItemUtils.TakeOrSplitToInventoryLocation( player, dst );
1051
1052 Icon icon = cargo.GetIcon( item );
1053
1054 if( icon )
1055 {
1056 if( w && w.FindAnyWidget("Cursor") )
1057 w.FindAnyWidget("Cursor").SetColor( ColorManager.BASE_COLOR );
1058 icon.Refresh();
1059 Refresh();
1060 }
1061 }
1062 ItemManager.GetInstance().HideDropzones();
1063 ItemManager.GetInstance().SetIsDragging( false );
1064 }
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:437
override void Refresh()
Определения HandsContainer.c:324
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.