1162 {
1164 if ( !
GetGame().IsMultiplayer() )
1166
1168 if (CastTo(entityIB, entity))
1169 {
1172
1174 {
1175 for (int l = 0; l < entityIB.GetQuantity(); ++l)
1176 {
1178
1179 if ( new_item )
1180 {
1181 MiscGameplayFunctions.TransferItemProperties(entityIB, new_item);
1182 entityIB.AddQuantity( -1 );
1184 new_item.ThrowPhysically(null, force, false);
1185 }
1186 }
1187 }
1188 else
1189 {
1190 float stackable = entityIB.GetTargetQuantityMax();
1191 if ( !(stackable == 0 || stackable >= entityIB.GetQuantity()) )
1192 {
1193 while (entityIB.GetQuantity() > stackable)
1194 {
1196 position[1] = position[1] + 0.1;
1198
1199 ItemBase splitItem = entityIB.SplitIntoStackMaxToInventoryLocationEx( spltDst );
1200 splitItem.ThrowPhysically(null, force, false);
1201 }
1202 }
1203
1205 entity.GetInventory().GetCurrentInventoryLocation(src);
1206
1207 entity.GetInventory().TakeToDst(invMode, src, dst);
1208 entityIB.ThrowPhysically(null, force, false);
1209 }
1210 }
1211 else
1212 {
1213 entity.GetInventory().DropEntity(invMode, entity.GetHierarchyRoot(), entity);
1215 }
1216 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
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 native CGame GetGame()
proto void dBodyApplyImpulse(notnull IEntity body, vector impulse)
Applies impuls on a rigidbody (origin)