1155 {
1157 if ( !
GetGame().IsMultiplayer() )
1159
1161 if (CastTo(entityIB, entity))
1162 {
1165
1167 {
1168 for (int l = 0; l < entityIB.GetQuantity(); ++l)
1169 {
1171
1172 if ( new_item )
1173 {
1174 MiscGameplayFunctions.TransferItemProperties(entityIB, new_item);
1175 entityIB.AddQuantity( -1 );
1177 new_item.ThrowPhysically(null, force, false);
1178 }
1179 }
1180 }
1181 else
1182 {
1183 float stackable = entityIB.GetTargetQuantityMax();
1184 if ( !(stackable == 0 || stackable >= entityIB.GetQuantity()) )
1185 {
1186 while (entityIB.GetQuantity() > stackable)
1187 {
1189 position[1] = position[1] + 0.1;
1191
1192 ItemBase splitItem = entityIB.SplitIntoStackMaxToInventoryLocationEx( spltDst );
1193 splitItem.ThrowPhysically(null, force, false);
1194 }
1195 }
1196
1198 entity.GetInventory().GetCurrentInventoryLocation(src);
1199
1200 entity.GetInventory().TakeToDst(invMode, src, dst);
1201 entityIB.ThrowPhysically(null, force, false);
1202 }
1203 }
1204 else
1205 {
1206 entity.GetInventory().DropEntity(invMode, entity.GetHierarchyRoot(), entity);
1208 }
1209 }
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)