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

◆ OnRightClick()

override void OnRightClick ( )
protected

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

2060 {
2061 super.OnRightClick();
2062
2063 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !g_Game.GetPlayer().GetInventory().HasInventoryReservation(this,null))
2064 {
2065 if (g_Game.IsClient())
2066 {
2068 {
2069 EntityAI root = GetHierarchyRoot();
2070 Man playerOwner = GetHierarchyRootPlayer();
2072
2073 // 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
2074 if (!playerOwner && root && root == this)
2075 {
2077 }
2078 else
2079 {
2080 // 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
2081 GetInventory().GetCurrentInventoryLocation(dst);
2082 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
2083 {
2084 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
2085 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
2086 {
2087 SetInventoryLocationToVicinityOrCurrent(player, dst); //dropping on the ground next to the spliting player
2088 }
2089 else
2090 {
2091 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
2092 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
2093 this shouldnt cause issues within this scope*/
2094 if (g_Game.GetPlayer().GetInventory().HasInventoryReservation(this, dst))
2095 {
2097 }
2098 else
2099 {
2100 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
2101 }
2102 }
2103 }
2104 }
2105
2108 ctx.Write(4);
2109 ItemBase thiz = this; // @NOTE: workaround for correct serialization
2110 ctx.Write(thiz);
2111 dst.WriteToContext(ctx);
2112 ctx.Write(true); // dummy
2113 ctx.Send();
2114 }
2115 }
2116 else if (!g_Game.IsMultiplayer())
2117 {
2118 SplitItem(PlayerBase.Cast(g_Game.GetPlayer()));
2119 }
2120 }
2121 }
const int INPUT_UDT_ITEM_MANIPULATION
DayZGame g_Game
Определения DayZGame.c:4074
DayZGame GetDayZGame()
Определения DayZGame.c:4076
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:18
override bool CanBeSplit()
Определения ItemBase.c:1533
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:2123
void SplitItem(PlayerBase player)
Определения ItemBase.c:1953
const int c_InventoryReservationTimeoutShortMS
script counterpart to engine's class Inventory
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
InventoryLocation.
Определения InventoryLocation.c:30
Определения PlayerBaseClient.c:2
proto native void Send()
proto static native bool CanStoreInputUserData()
Returns true when the channel is free, AND the InputBuffer is NOT full (same as '!...
Определения gameplay.c:121
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, ScriptInputUserData::Send(), InventoryLocation::SetCargo(), SetInventoryLocationToVicinityOrCurrent(), SplitItem(), Serializer::Write() и InventoryLocation::WriteToContext().