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

◆ OnRightClick()

override void InventoryItem::OnRightClick ( )
inlineprivate

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

2079 {
2080 super.OnRightClick();
2081
2082 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
2083 {
2084 if (GetGame().IsClient())
2085 {
2086 if (ScriptInputUserData.CanStoreInputUserData())
2087 {
2088 vector m4[4];
2089 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
2090
2091 EntityAI root = GetHierarchyRoot();
2092
2093 InventoryLocation dst = new InventoryLocation;
2094 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
2095 {
2096 if (root)
2097 {
2098 root.GetTransform(m4);
2099 dst.SetGround(this, m4);
2100 }
2101 else
2102 GetInventory().GetCurrentInventoryLocation(dst);
2103 }
2104 else
2105 {
2106 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
2107 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
2108 this shouldnt cause issues within this scope*/
2109 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
2110 {
2111 if (root)
2112 {
2113 root.GetTransform(m4);
2114 dst.SetGround(this, m4);
2115 }
2116 else
2117 GetInventory().GetCurrentInventoryLocation(dst);
2118 }
2119 else
2120 {
2121 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
2122 }
2123 }
2124
2125 ScriptInputUserData ctx = new ScriptInputUserData;
2127 ctx.Write(4);
2128 ItemBase thiz = this; // @NOTE: workaround for correct serialization
2129 ctx.Write(thiz);
2130 dst.WriteToContext(ctx);
2131 ctx.Write(true); // dummy
2132 ctx.Send();
2133 }
2134 }
2135 else if (!GetGame().IsMultiplayer())
2136 {
2137 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
2138 }
2139 }
2140 }
const int INPUT_UDT_ITEM_MANIPULATION
Определения _constants.c:8
class LogManager EntityAI
eBleedingSourceType GetType()
Определения BleedingSource.c:63
DayZGame GetDayZGame()
Определения DayZGame.c:3870
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
PlayerBase GetPlayer()
Определения ModifierBase.c:51
proto native DayZPlayer GetPlayer()
void ItemBase()
Определения ItemBase.c:140
void SplitItem(PlayerBase player)
Определения ItemBase.c:1971
override bool CanBeSplit()
Определения ItemBase.c:1580
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native void Send()
proto bool Write(void value_out)
proto native CGame GetGame()

Перекрестные ссылки GameInventory::c_InventoryReservationTimeoutShortMS, ItemBase::CanBeSplit(), ScriptInputUserData::CanStoreInputUserData(), InventoryLocation::GetCol(), GetDayZGame(), InventoryLocation::GetFlip(), GetGame(), InventoryLocation::GetIdx(), InventoryLocation::GetParent(), CGame::GetPlayer(), GetPlayer(), InventoryLocation::GetRow(), GetType(), INPUT_UDT_ITEM_MANIPULATION, ItemBase(), ScriptInputUserData::Send(), InventoryLocation::SetCargo(), InventoryLocation::SetGround(), SplitItem(), Serializer::Write() и InventoryLocation::WriteToContext().

Используется в VicinitySlotsContainer::MouseClick().