45 bool m_IsJuncture =
false;
46 bool m_IsRemote =
false;
55 return !m_IsJuncture && !m_IsRemote;
65enum FindInventoryReservationMode
99 proto native
void DumpInventoryDebug();
105 static proto native
void DumpStaticInventoryDebug();
157 proto native
bool TestAddEntityInCargoEx(notnull
EntityAI e,
int idx,
int row,
int col,
bool flip,
bool do_resevation_check,
bool do_item_check,
bool do_lock_check,
bool do_occupancy_test,
bool do_script_check,
bool do_script_load_check);
191 for (
int i = 0; i < count; i++)
360 static proto native
bool LocationTestAddEntity(notnull
InventoryLocation inv_loc,
bool do_resevation_check,
bool do_item_check,
bool do_lock_check,
bool do_occupancy_test,
bool do_script_check,
bool do_script_load_check);
429 if (ent.GetInventory().GetCurrentInventoryLocation(lcn) && lcn.IsValid())
435 ent = ent.GetHierarchyParent();
446 return ent.AreChildrenAccessible();
449 ErrorEx(
"no inventory owner found!");
464 slot_id = lcn.GetSlot();
487 src.ReadFromContext(ctx);
488 dst.ReadFromContext(ctx);
491 if (!src.GetItem() || !dst.GetItem())
493 Error(
"[syncinv] ServerInventoryCommand (cmd=SYNC_MOVE) dropped, item not in bubble");
506 if (!e.GetSrcEntity())
508 Error(
"[syncinv] ServerInventoryCommand (cmd=HAND_EVENT) dropped, item not in bubble");
511 e.m_Player.GetHumanInventory().ProcessHandEvent(e);
522 src1.ReadFromContext(ctx);
523 src2.ReadFromContext(ctx);
524 dst1.ReadFromContext(ctx);
525 dst2.ReadFromContext(ctx);
527 if (src1.IsValid() && src2.IsValid() && dst1.IsValid() && dst2.IsValid())
636 item2.GetInventory().GetCurrentInventoryLocation(il2);
637 slot = il2.GetSlot();
639 if (item1.CanBeSplit() && item1.GetQuantity() > item1.GetTargetQuantityMax(slot))
642 item1.GetInventory().GetCurrentInventoryLocation(il1);
643 slot = il1.GetSlot();
645 if (item2.CanBeSplit() && item2.GetQuantity() > item2.GetTargetQuantityMax(slot))
648 if (!item1.CanSwapEntities(item2, il2, il1) || !item2.CanSwapEntities(item1, il1, il2))
674 if (!item1.CanBeFSwaped())
677 if ( item1_dst == null)
679 item2.GetInventory().GetCurrentInventoryLocation(il);
684 slot = item1_dst.GetSlot();
687 if ( item1.GetQuantity() > item1.GetTargetQuantityMax(slot) )
690 if ( item2_dst == null)
692 item1.GetInventory().GetCurrentInventoryLocation(il);
697 slot = item2_dst.GetSlot();
700 if (!item1.CanSwapEntities(item2, item2_dst, item1_dst) || !item2.CanSwapEntities(item1, item1_dst, item2_dst))
705 if ( item2.GetQuantity() > item2.GetTargetQuantityMax(slot) )
724 #ifdef ENABLE_LOGGING
725 if (
LogManager.IsInventoryReservationLogEnable() )
731 Debug.InventoryReservationLog(
"Reservation result: " + ret_val +
" - STS = " + player.GetSimulationTimeStamp() +
" / " + item.ToString() +
" / " +
InventoryLocation.DumpToStringNullSafe(dst),
"n/a" ,
"n/a",
"AddInventoryReservation", player.ToString() );
733 Debug.InventoryReservationLog(
"Reservation result: " + ret_val +
" - STS = " + player.GetSimulationTimeStamp() +
" / null / " +
InventoryLocation.DumpToStringNullSafe(dst),
"n/a" ,
"n/a",
"AddInventoryReservation", player.ToString() );
747 #ifdef ENABLE_LOGGING
748 if (
LogManager.IsInventoryReservationLogEnable() )
754 Debug.InventoryReservationLog(
"Reservation result: " + ret_val +
" - STS = " + player.GetSimulationTimeStamp() +
" / " + item.ToString() +
" / " +
InventoryLocation.DumpToStringNullSafe(dst),
"n/a" ,
"n/a",
"ExtendInventoryReservation", player.ToString() );
756 Debug.InventoryReservationLog(
"Reservation result: " + ret_val +
" - STS = " + player.GetSimulationTimeStamp() +
" / null / " +
InventoryLocation.DumpToStringNullSafe(dst),
"n/a" ,
"n/a",
"ExtendInventoryReservation", player.ToString() );
770 #ifdef ENABLE_LOGGING
771 if (
LogManager.IsInventoryReservationLogEnable() )
777 Debug.InventoryReservationLog(
"Reservation cleared result: " + ret_val +
" - STS = " + player.GetSimulationTimeStamp() +
" / " + item.ToString() +
" / " +
InventoryLocation.DumpToStringNullSafe(dst),
"n/a" ,
"n/a",
"ClearInventoryReservation", player.ToString() );
779 Debug.InventoryReservationLog(
"Reservation cleared result: " + ret_val +
" - STS = " + player.GetSimulationTimeStamp() +
" / null / " +
InventoryLocation.DumpToStringNullSafe(dst),
"n/a" ,
"n/a",
"ClearInventoryReservation", player.ToString() );
852 Man man = Man.Cast(src.GetParent());
856 man.GetHumanInventory().OnEntityInHandsCreated(src);
865 Man player = item.GetHierarchyRootPlayer();
867 player.GetInventory().ClearInventoryReservationEx(item, null);
881 switch (loc.GetType())
884 return loc.GetParent().GetInventory().CreateAttachmentEx(type, loc.GetSlot());
886 return loc.GetParent().GetInventory().CreateEntityInCargoEx(type, loc.GetIdx(), loc.GetRow(), loc.GetCol(), loc.GetFlip());
888 Error(
"CreateInInventory: unknown location for item");
1017 if (item.GetInventory().GetCurrentInventoryLocation(src))
1026 Error(
"[inv] I::Take2Inv(" +
typename.EnumToString(
InventoryMode, mode) +
") item=" + item +
" Error - src has no inventory location");
1036 if (item.GetInventory().GetCurrentInventoryLocation(src))
1040 if (target.GetInventory().FindFreeLocationFor(item, flags, dst))
1043 if (
LogManager.IsInventoryMoveLogEnable())
inventoryDebugPrint(
"[inv] I::Take2Target(" +
typename.EnumToString(
InventoryMode, mode) +
") target=" + target +
" item=" + item +
" Warning - no room for item in target");
1046 Error(
"[inv] I::Take2Target(" +
typename.EnumToString(
InventoryMode, mode) +
") target=" + target +
" item=" + item +
" Error - src has no inventory location");
1063 if (ret && dst.IsValid())
1110 Error(
"[inv] I::Take2Cgo(" +
typename.EnumToString(
InventoryMode, mode) +
") item=" + item +
" row=" + row +
" col=" + col +
" Error - src has no inventory location");
1117 if (
LogManager.IsInventoryMoveLogEnable())
inventoryDebugPrint(
"[inv] I::Take2TargetCgoEx(" +
typename.EnumToString(
InventoryMode, mode) +
") item=" + item +
"to cargo of target=" + cargo.GetCargoOwner() +
" row=" + row +
" col=" + col);
1119 if (item.GetInventory().GetCurrentInventoryLocation(src))
1122 dst.SetCargoAuto(cargo, item, row, col, item.GetInventory().GetFlipCargo());
1126 Error(
"[inv] I::Take2TargetCgoEx(" +
typename.EnumToString(
InventoryMode, mode) +
") item=" + item +
"to cargo of target=" + cargo.GetCargoOwner() +
" row=" + row +
" col=" + col);
1139 if (
LogManager.IsInventoryMoveLogEnable())
inventoryDebugPrint(
"[inv] I::Take2TargetAttEx(" +
typename.EnumToString(
InventoryMode, mode) +
") as ATT of target=" + target +
" item=" + item +
" slot=" + slot);
1141 if (item.GetInventory().GetCurrentInventoryLocation(src))
1143 EntityAI att = target.GetInventory().FindAttachment(slot);
1148 att.CombineItemsEx(item,
true);
1152 att.CombineItemsClient(item,
true);
1156 else if (item.CanBeSplit() && item.GetTargetQuantityMax(slot) < item.GetQuantity())
1160 item.SplitIntoStackMaxEx(target, slot);
1164 item.SplitIntoStackMaxClient(target,slot);
1171 dst.SetAttachment(target, item, slot);
1175 Error(
"[inv] I::Take2AttEx(" +
typename.EnumToString(
InventoryMode, mode) +
") item=" + item +
" Error - src has no inventory location");
1198 dst1.CopyLocationFrom(src2,
false);
1199 dst1.SetFlip(src1.GetItem().GetInventory().GetFlipCargo());
1205 dst2.CopyLocationFrom(src1,
false);
1206 dst2.SetFlip(src2.GetItem().GetInventory().GetFlipCargo());
1217 if (item1.GetInventory().GetCurrentInventoryLocation(src1) && item2.GetInventory().GetCurrentInventoryLocation(src2))
1230 if (item1.GetInventory().GetCurrentInventoryLocation(src1) && item2.GetInventory().GetCurrentInventoryLocation(src2))
1237 dst1.CopyLocationFrom(src2,
false);
1238 dst1.SetFlip(dst1.GetItem().GetInventory().GetFlipCargo());
1260 Math3D.MatrixIdentity4(m4);
1262 ground.SetGround(item, m4);
1270 if (item.GetInventory().GetCurrentInventoryLocation(src))
1282 Error(
"DropEntity - No inventory location");
1289 ground.SetGround(item, transform);
1297 if (item.GetInventory().GetCurrentInventoryLocation(src))
1305 Error(
"DropEntityWithTransform - No inventory location");
1312 owner.GetTransform(m4);
1314 vector randomPos =
Vector(
Math.RandomFloat(-halfExtents[0], halfExtents[0]), 0,
Math.RandomFloat(-halfExtents[2], halfExtents[2]));
1315 randomPos =
vector.RotateAroundZero(randomPos,
vector.Up, cosAngle, sinAngle);
1317 float dist = randomPos[0] * m4[1][0] + randomPos[1] * m4[1][1] + randomPos[2] * m4[1][2];
1319 m4[3][0] = m4[3][0] + randomPos[0];
1320 m4[3][1] = m4[3][1] - dist + halfExtents[1];
1321 m4[3][2] = m4[3][2] + randomPos[2];
1323 item.PlaceOnSurfaceRotated(m4,
Vector(m4[3][0], m4[3][1], m4[3][2]));
1325 ground.SetGround(item, m4);
1333 if (item.GetInventory().GetCurrentInventoryLocation(src))
1342 Error(
"DropEntityInBounds - No inventory location");
1350 if (item.GetInventory().GetCurrentInventoryLocation(src))
1353 Error(
"[inv] Source location == HANDS, player has to handle this");
1355 g_Game.ObjectDelete(src.GetItem());
1359 Error(
"LocalDestroyEntity: No inventory location");
1366 if (lambda.m_OldItem.GetInventory().GetCurrentInventoryLocation(src))
1368 if (
LogManager.IsInventoryMoveLogEnable())
inventoryDebugPrint(
"[inv] I::ReplaceItemWithNew executing lambda=" + lambda +
"on old_item=" + lambda.m_OldItem);
1373 Error(
"[inv] I::ReplaceItemWithNew - no inventory location");
void syncDebugPrint(string s)
void inventoryDebugPrint(string s)
@ USER_RESERVATION_CANCEL
Clear user reserved inventory space.
@ SYNC_MOVE
synchronous move. action is finished immeadiately, no animations involved
@ HAND_EVENT
event for hands
enum InventoryCheckContext EQUAL
Find an exact reservation for item and dst, item and dst required.
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
@ SERVER
'Server' mode operation is required if and only if the operation runs only on server (creates and/or ...
@ PREDICTIVE
'Predictive' means that the operation uses Client-Side Prediction, i.e. the action runs the same code...
enum InventoryCheckContext DST
Find a reservation for the dst EXCLUDING the item, item and dst required.
InventoryValidationResult
@ JUNCTURE
'Juncture' operation is used whenever there is possibility of race condition, i.e....
InventoryValidationReason
enum InventoryCheckContext ITEM
Find a reservation for the item EXCLUDING the dst, item and dst required.
@ UNKNOWN
24 - Any other error. Can be returned from any call.
PlayerSpawnPreset slotName
represents base for cargo storage for entities
script counterpart to engine's class Inventory
proto native bool GetFlipCargo()
proto native int CountInventory()
almost identical to EnumerateInventory except it does not return items
static proto native bool LocationTestAddEntity(notnull InventoryLocation inv_loc, bool do_resevation_check, bool do_item_check, bool do_lock_check, bool do_occupancy_test, bool do_script_check, bool do_script_load_check)
test if the entity contained in inv_loc.m_item can be added to ground/attachment/cargo/hands/....
void OnServerInventoryCommand(ParamsReadContext ctx)
bool OnInputUserDataProcess(ParamsReadContext ctx)
synchronization
bool LocalDestroyEntity(notnull EntityAI item)
static proto native bool CheckManipulatedObjectsDistances(notnull EntityAI e0, notnull EntityAI e1, float radius)
static proto native bool AddInventoryReservation(EntityAI item, InventoryLocation dst, int timeout_ms)
proto native EntityAI CreateEntityInCargoEx(string typeName, int idx, int row, int col, bool flip)
Create Entity of specified type in cargo of entity at coordinates (row, col).
proto native int GetAnyInventoryReservationCount()
proto native int GetAttachmentSlotsCount()
void Init()
script functions
void EEDelete(EntityAI parent)
proto native EntityAI CreateEntityInCargo(string typeName)
Create Entity of specified type in cargo of entity.
proto native bool CanAddEntityInCargoExLoc(InventoryLocation loc)
static proto native bool LocationSyncMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
synchronously removes item from current inventory location and adds it to destination no anims involv...
static proto native bool ServerLocationMoveEntity(notnull EntityAI item, ParamsWriteContext ctx)
removes item from current inventory location and adds it to destination + sync via inventory command
EntityAI CreateInInventory(string type)
creates entity somewhere in inventory
proto native bool FindFirstFreeLocationForNewEntity(string item_type, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFirstFreeLocationForNewEntity.
void OnInventoryFailure(InventoryCommandType type, InventoryValidationReason reason, InventoryLocation src, InventoryLocation dst)
static proto native bool CanSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
test if ordinary swap can be performed.
bool SwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
proto native EntityAI GetAttachmentFromIndex(int index)
static proto native bool PrepareDropEntityPos(EntityAI owner, notnull EntityAI item, out vector mat[4], bool useValuesInMatrix=false, int conflictCheckDepth=-1)
Finds a transformation for the item to be dropped to If the initial transforation overlaps with anoth...
static proto native bool ServerHandEvent(notnull Man player, notnull EntityAI item, ParamsWriteContext ctx)
hand event to clients
proto native EntityAI CreateAttachment(string typeName)
Create Entity of specified type as attachment of entity.
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native EntityAI CreateAttachmentEx(string typeName, int slotId)
Create Entity of specified type as attachment of entity.
bool ExtendInventoryReservationEx(EntityAI item, InventoryLocation dst, int timeout_ms)
static void SetGroundPosByOwnerBounds(EntityAI owner, notnull EntityAI item, out InventoryLocation ground, vector halfExtents, float angle, float cosAngle, float sinAngle)
bool CanRemoveEntity()
Returns if entity can be removed from its current location.
static proto native EntityAI LocationGetEntity(notnull InventoryLocation inv_loc)
proto native bool HasAttachment(notnull EntityAI e)
brief Returns True if entity is attached to this
proto native EntityAI FindPlaceholderForSlot(int slot)
Returns placeholder entity for slot (naked arms, legs etc).
bool TakeEntityToInventory(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
Put item anywhere into this entity (as attachment or into cargo, recursively).
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
bool IsAttachment()
Returns true if this Inventory owner is an attachment of something.
proto native bool CanAddEntityInCargo(notnull EntityAI e, bool flip)
proto native bool HasAttachmentEx(notnull EntityAI e, int slot)
brief Returns True if entity is attached to this in slot
bool TakeEntityToTargetCargoEx(InventoryMode mode, notnull CargoBase cargo, notnull EntityAI item, int row, int col)
Put item into into cargo on specific cargo location of another entity.
static proto native bool CanForceSwapEntities(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
test if forced swap can be performed.
proto native CargoBase GetCargoFromIndex(int index)
bool TakeEntityToTargetInventory(InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
helper that finds location first, then moves the entity into it
bool DropEntityWithTransform(InventoryMode mode, EntityAI owner, notnull EntityAI item, vector transform[4])
proto native void LockInventory(int lockType)
bool ClearInventoryReservationEx(EntityAI item, InventoryLocation dst)
proto native bool HasInventorySlot(int slotId)
static proto native bool ServerLocationSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, ParamsWriteContext ctx)
swaps two entities
bool HasAttachmentSlot(int slotId)
static int GetInventoryCheckContext()
bool IsInCargo()
Returns true if this Inventory owner is in cargo of something.
proto native bool CanRemoveAttachmentEx(EntityAI attachment, int slot)
proto native bool HasEntityInCargo(notnull EntityAI e)
bool CanAddEntityIntoHands(notnull EntityAI item)
Test if entity can be put into hands.
const int c_InventoryReservationTimeoutShortMS
bool TakeEntityToCargoEx(InventoryMode mode, notnull EntityAI item, int idx, int row, int col)
moves item on specific cargo location
proto native bool IsInventoryLocked()
proto native void UnlockInventory(int lockType)
static bool MakeSrcAndDstForSwap(notnull EntityAI item1, notnull EntityAI item2, out InventoryLocation src1, out InventoryLocation src2, out InventoryLocation dst1, out InventoryLocation dst2)
helper function for swap
proto native bool IsInventoryUnlocked()
static proto native bool TestDropEntityPos(EntityAI owner, notnull EntityAI item, out vector mat[4], bool useValuesInMatrix=false, int conflictCheckDepth=-1)
static proto native bool ClearInventoryReservation(EntityAI item, InventoryLocation dst)
static proto native bool LocationMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
removes item from current inventory location and adds it to destination
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
proto native bool CanAddEntityInCargoEx(notnull EntityAI e, int idx, int row, int col, bool flip)
static bool MakeSrcAndDstForForceSwap(notnull EntityAI item1, notnull EntityAI item2, out InventoryLocation src1, out InventoryLocation src2, out InventoryLocation dst1, notnull InventoryLocation dst2)
helper function for ForceSwap
proto native int FindFreeLocationsFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull array< ref InventoryLocation > locs)
searches inventory for suitable location for @item
static proto native EntityAI LocationCreateLocalEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new local item directly at location @NOTE: the item is created localy, i.e....
bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
move src to dst
static proto native bool CheckTakeItemRequest(notnull Man requestingPlayer, notnull InventoryLocation src, notnull InventoryLocation dst, float radius)
proto native void LockInventoryWithKey(notnull EntityAI key)
bool TakeEntityAsTargetAttachment(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
proto native bool CanAddAttachment(notnull EntityAI e)
Check if attachment can be added to any slot.
static proto native bool GetInventoryReservationCount(EntityAI item, InventoryLocation dst)
static proto native bool ExtendInventoryReservation(EntityAI item, InventoryLocation dst, int timeout_ms)
proto native bool IsPlaceholderEntity(notnull Object e)
bool AddEntityToInventory(notnull EntityAI item)
add entity somewhere in inventory
bool CanAddEntityIntoInventory(notnull EntityAI item)
Test if entity can be put to the inventory (Cargo, ProxyCargo, Attachment).
bool OnInventoryJunctureFromServer(ParamsReadContext ctx)
proto native bool HasEntityInCargoEx(notnull EntityAI e, int idx, int row, int col)
proto native bool GetSlotLock(int slot)
proto native EntityAI GetInventoryOwner()
Engine native functions.
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
static proto native bool LocationCanMoveEntity(notnull InventoryLocation src, notnull InventoryLocation dst)
queries if the entity contained in inv_loc.m_item can be moved to another location This is a shorthan...
bool IsCargoInHiearchy()
Returns true if inventory owner or his hiearchy parents are in cargo.
bool ReplaceItemWithNew(InventoryMode mode, ReplaceItemWithNewLambdaBase lambda)
static proto native bool HasInventoryReservationCanAdd(EntityAI item, InventoryLocation dst)
Internally: !HasInventoryReservationEx(item, dst, FindInventoryReservationMode.ITEM,...
static bool SetGroundPosByOwner(EntityAI owner, notnull EntityAI item, out InventoryLocation ground)
proto native int GetSlotId(int index)
attachments
bool GetCurrentAttachmentSlotInfo(out int slot_id, out string slot_name)
Returns true if the item is currently attached and outputs attachment slot id and name.
proto native bool CanRemoveEntityInCargoEx(notnull EntityAI e, int idx, int row, int col)
const int c_InventoryReservationTimeoutMS
reservations
static int m_inventory_check_context
bool TakeEntityAsAttachment(InventoryMode mode, notnull EntityAI item)
static proto native bool LocationSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
swaps two entities
proto native bool CanRemoveEntityInCargo(notnull EntityAI e)
bool ForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
static bool LocationCanMoveEntitySyncCheck(notnull InventoryLocation src, notnull InventoryLocation dst)
static void OnServerInventoryCommandStatic(ParamsReadContext ctx)
static proto native bool HasInventoryReservation(EntityAI item, InventoryLocation dst)
Internally: HasInventoryReservationEx(item, dst, FindInventoryReservationMode.LEGACY,...
static proto native bool LocationAddEntity(notnull InventoryLocation inv_loc)
adds item to inventory location
proto native bool HasKeys()
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
const float c_MaxItemDistanceRadius
anti-cheats
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool CanLockInventoryWithKey(notnull EntityAI key)
locks
bool AddInventoryReservationEx(EntityAI item, InventoryLocation dst, int timeout_ms)
static bool SetGroundPosByTransform(EntityAI owner, notnull EntityAI item, out InventoryLocation ground, vector transform[4])
static proto native bool LocationCanRemoveEntity(notnull InventoryLocation inv_loc)
queries if the entity contained in inv_loc.m_item can be removed from ground/attachment/cargo/hands/....
static proto native bool LocationCanAddEntity(notnull InventoryLocation inv_loc)
queries if the entity contained in inv_loc.m_item can be added to ground/attachment/cargo/hands/....
void OnInventoryJunctureFailureFromServer(ParamsReadContext ctx)
static bool MakeDstForSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, out InventoryLocation dst1, out InventoryLocation dst2)
helper function for swap
proto native bool HasEntityInInventory(notnull EntityAI item)
query inventory if item is somewhere
proto native bool FindFreeLocationForEx(notnull EntityAI item, FindInventoryLocationType flags, notnull InventoryLocation exclude, out notnull InventoryLocation loc)
FindFreeLocationForEx.
bool TakeEntityToTargetCargo(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
Put item into into cargo of another entity.
bool AreChildrenAccessible()
Returns true if item is considered reachable within inventory.
static proto native bool CheckDropRequest(notnull Man requestingPlayer, notnull InventoryLocation src, float radius)
proto native void SetFlipCargo(bool flip)
proto native int GetSlotIdCount()
void OnStoreSave(ParamsWriteContext ctx)
db store hook
proto native bool TestAddEntityInCargoEx(notnull EntityAI e, int idx, int row, int col, bool flip, bool do_resevation_check, bool do_item_check, bool do_lock_check, bool do_occupancy_test, bool do_script_check, bool do_script_load_check)
static proto native bool CheckSwapItemsRequest(notnull Man requestingPlayer, notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, float radius)
proto native int GetAttachmentSlotId(int index)
proto native void ResetFlipCargo()
proto native bool SetSlotLock(int slot, bool locked)
proto native EntityAI FindAttachmentByName(string slotName)
Returns attached entity in slot (you can use EntityAI.GetActionComponentName to get slot id).
bool CanAddEntityToInventory(notnull EntityAI item, int flag=FindInventoryLocationType.ANY)
ask inventory if item could be placed somewhere in inventory
static proto native bool HasInventoryReservationEx(EntityAI item, InventoryLocation dst, FindInventoryReservationMode itemMode, FindInventoryReservationMode parentMode)
itemMode will iterate over item reservations, parentMode will iterate over parent reservations
bool TakeEntityAsAttachmentEx(InventoryMode mode, notnull EntityAI item, int slot)
proto native bool CanAddAttachmentEx(notnull EntityAI e, int slot)
Check if attachment can be added to slot @NOTE: Note that slot index IS NOT slot ID!...
static proto native bool CheckMoveToDstRequest(notnull Man requestingPlayer, notnull InventoryLocation src, notnull InventoryLocation dst, float radius)
proto native bool CanAddSwappedEntity(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
proto native void UnlockInventoryWithKey(notnull EntityAI key)
proto native bool IsInventoryLockedForLockType(int lockType)
proto native bool CanRemoveAttachment(EntityAI attachment)
proto native bool TestAddEntityInCargoExLoc(notnull InventoryLocation loc, bool do_resevation_check, bool do_item_check, bool do_lock_check, bool do_occupancy_test, bool do_script_check, bool do_script_load_check)
static proto native bool CheckRequestSrc(notnull Man requestingPlayer, notnull InventoryLocation src, float radius)
static proto native bool ServerLocationSyncMoveEntity(Man player, notnull EntityAI item, ParamsWriteContext ctx)
synchronously removes item from current inventory location and adds it to destination + sync via inve...
bool DropEntityInBounds(InventoryMode mode, EntityAI owner, notnull EntityAI item, vector halfExtents, float angle, float cosAngle, float sinAngle)
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto native int GetScriptLockCount()
bool TakeEntityToCargo(InventoryMode mode, notnull EntityAI item)
moves item to cargo of this intentory
proto native void FlipCargo()
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)...
static proto native bool LocationRemoveEntity(notnull InventoryLocation inv_loc)
removes item from inventory location
bool TakeEntityAsTargetAttachmentEx(InventoryMode mode, notnull EntityAI target, notnull EntityAI item, int slot)
put item as attachment of target
bool DropEntity(InventoryMode mode, EntityAI owner, notnull EntityAI item)
bool CanAddEntityInto(notnull EntityAI item, FindInventoryLocationType flags=FindInventoryLocationType.ANY)
Asks inventory if item could be placed in inventory, hands, etc.
static bool LocationCanAddEntityEx(notnull InventoryLocation inv_loc)
bool OnStoreLoad(ParamsReadContext ctx, int version)
db load hooks
proto native bool CanUnlockInventoryWithKey(notnull EntityAI key)
Abstracted event, not to be used, only inherited.
provides access to slot configuration
base class for transformation operations (creating one item from another)
void Execute(HumanInventoryWithFSM fsm_to_notify=null)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
enum ChatChannelType LEGACY
Legacy version, UNDER but without proxy support.
void Error(string err)
Messagebox with error message.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
@ SWAP
swapping from ground
void ClearInventoryReservation()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location