1298 {
1300 if ( !
g_Game.IsMultiplayer() )
1302
1305 if (CastTo(entityIB, entity))
1306 {
1309
1311 {
1312 for (int l = 0; l < entityIB.GetQuantity(); ++l)
1313 {
1315
1316 if ( new_item )
1317 {
1318 MiscGameplayFunctions.TransferItemProperties(entityIB, new_item);
1319 entityIB.AddQuantity( -1 );
1321 new_item.ThrowPhysically(null, force, false);
1322 }
1323 }
1324 }
1325 else
1326 {
1327 float stackable = entityIB.GetTargetQuantityMax();
1328 if ( !(stackable == 0 || stackable >= entityIB.GetQuantity()) )
1329 {
1330 while (entityIB.GetQuantity() > stackable)
1331 {
1335
1336 ItemBase splitItem = entityIB.SplitIntoStackMaxToInventoryLocationEx( spltDst );
1337 splitItem.ThrowPhysically(null, force, false);
1338 }
1339 }
1340
1343
1344 entityInventory.
TakeToDst(invMode, src, dst);
1345 entityIB.ThrowPhysically(null, force, false);
1346 }
1347 }
1348 else
1349 {
1350 entityInventory.
DropEntity(invMode, entity.GetHierarchyRoot(), entity);
1352 }
1353 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
move src to dst
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
bool DropEntity(InventoryMode mode, EntityAI owner, notnull EntityAI item)
script counterpart to engine's class Inventory
proto native void SetGroundEx(EntityAI e, vector pos, float dir[4])
sets current inventory location type to Ground with transformation mat
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override bool CanBeSplit()
proto void dBodyApplyImpulse(notnull IEntity body, vector impulse)
Applies impuls on a rigidbody (origin)