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

◆ OnRightClick()

override void InventoryItem::OnRightClick ( )
inlineprotected

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

2099 {
2100 super.OnRightClick();
2101
2102 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
2103 {
2104 if (GetGame().IsClient())
2105 {
2106 if (ScriptInputUserData.CanStoreInputUserData())
2107 {
2108 EntityAI root = GetHierarchyRoot();
2109 Man playerOwner = GetHierarchyRootPlayer();
2110 InventoryLocation dst = new InventoryLocation;
2111
2112 // 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
2113 if (!playerOwner && root && root == this)
2114 {
2116 }
2117 else
2118 {
2119 // 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
2120 GetInventory().GetCurrentInventoryLocation(dst);
2121 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
2122 {
2123 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
2124 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
2125 {
2127 }
2128 else
2129 {
2130 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
2131 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
2132 this shouldnt cause issues within this scope*/
2133 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
2134 {
2136 }
2137 else
2138 {
2139 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
2140 }
2141 }
2142 }
2143 }
2144
2145 ScriptInputUserData ctx = new ScriptInputUserData;
2147 ctx.Write(4);
2148 ItemBase thiz = this; // @NOTE: workaround for correct serialization
2149 ctx.Write(thiz);
2150 dst.WriteToContext(ctx);
2151 ctx.Write(true); // dummy
2152 ctx.Send();
2153 }
2154 }
2155 else if (!GetGame().IsMultiplayer())
2156 {
2157 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
2158 }
2159 }
2160 }
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
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:1991
override bool CanBeSplit()
Определения ItemBase.c:1580
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:2162
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: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(), INPUT_UDT_ITEM_MANIPULATION, ItemBase(), ScriptInputUserData::Send(), InventoryLocation::SetCargo(), SetInventoryLocationToVicinityOrCurrent(), SplitItem(), Serializer::Write() и InventoryLocation::WriteToContext().

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