1165 {
1167 if ( !
g_Game.IsMultiplayer() )
1169
1172 if (CastTo(entityIB, entity))
1173 {
1176
1178 {
1179 for (int l = 0; l < entityIB.GetQuantity(); ++l)
1180 {
1182
1183 if ( new_item )
1184 {
1185 MiscGameplayFunctions.TransferItemProperties(entityIB, new_item);
1186 entityIB.AddQuantity( -1 );
1188 new_item.ThrowPhysically(null, force, false);
1189 }
1190 }
1191 }
1192 else
1193 {
1194 float stackable = entityIB.GetTargetQuantityMax();
1195 if ( !(stackable == 0 || stackable >= entityIB.GetQuantity()) )
1196 {
1197 while (entityIB.GetQuantity() > stackable)
1198 {
1200 position[1] = position[1] + 0.1;
1202
1203 ItemBase splitItem = entityIB.SplitIntoStackMaxToInventoryLocationEx( spltDst );
1204 splitItem.ThrowPhysically(null, force, false);
1205 }
1206 }
1207
1210
1211 entityInventory.
TakeToDst(invMode, src, dst);
1212 entityIB.ThrowPhysically(null, force, false);
1213 }
1214 }
1215 else
1216 {
1217 entityInventory.
DropEntity(invMode, entity.GetHierarchyRoot(), entity);
1219 }
1220 }
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)