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

◆ OnRightClick()

override void InventoryItem::OnRightClick ( )
inlineprotected

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

2125 {
2126 super.OnRightClick();
2127
2128 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !g_Game.GetPlayer().GetInventory().HasInventoryReservation(this,null))
2129 {
2130 if (g_Game.IsClient())
2131 {
2132 if (ScriptInputUserData.CanStoreInputUserData())
2133 {
2134 EntityAI root = GetHierarchyRoot();
2135 Man playerOwner = GetHierarchyRootPlayer();
2136 InventoryLocation dst = new InventoryLocation;
2137
2138 // If we have no hierarchy root player and the root is the same as this item the source item is in the vicinity so we want to create the new split item there also
2139 if (!playerOwner && root && root == this)
2140 {
2142 }
2143 else
2144 {
2145 // Check if we can place the new split item in the same parent where the source item is placed in or otherwise drop it in vicinity
2146 GetInventory().GetCurrentInventoryLocation(dst);
2147 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
2148 {
2149 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
2150 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
2151 {
2153 }
2154 else
2155 {
2156 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
2157 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
2158 this shouldnt cause issues within this scope*/
2159 if (g_Game.GetPlayer().GetInventory().HasInventoryReservation(this, dst))
2160 {
2162 }
2163 else
2164 {
2165 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
2166 }
2167 }
2168 }
2169 }
2170
2171 ScriptInputUserData ctx = new ScriptInputUserData;
2173 ctx.Write(4);
2174 ItemBase thiz = this; // @NOTE: workaround for correct serialization
2175 ctx.Write(thiz);
2176 dst.WriteToContext(ctx);
2177 ctx.Write(true); // dummy
2178 ctx.Send();
2179 }
2180 }
2181 else if (!g_Game.IsMultiplayer())
2182 {
2183 SplitItem(PlayerBase.Cast(g_Game.GetPlayer()));
2184 }
2185 }
2186 }
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
DayZGame g_Game
Определения DayZGame.c:3942
DayZGame GetDayZGame()
Определения DayZGame.c:3944
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:18
void ItemBase()
Определения ItemBase.c:148
void SplitItem(PlayerBase player)
Определения ItemBase.c:2018
override bool CanBeSplit()
Определения ItemBase.c:1605
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:2188
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
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:507
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)

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

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