DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ThrowEntityFromInventory()

static void ThrowEntityFromInventory ( notnull EntityAI entity,
vector position,
float direction[4],
vector force,
int flags )
staticprotected

См. определение в файле MiscGameplayFunctions.c строка 1297

1298 {
1299 InventoryMode invMode = InventoryMode.SERVER;
1300 if ( !g_Game.IsMultiplayer() )
1301 invMode = InventoryMode.LOCAL;
1302
1303 ItemBase entityIB;
1304 GameInventory entityInventory = entity.GetInventory();
1305 if (CastTo(entityIB, entity))
1306 {
1308 dst.SetGroundEx(entity, position, direction);
1309
1310 if ( (flags & ThrowEntityFlags.SPLIT) && entityIB.CanBeSplit() )
1311 {
1312 for (int l = 0; l < entityIB.GetQuantity(); ++l)
1313 {
1314 ItemBase new_item = ItemBase.Cast( GameInventory.LocationCreateEntity( dst, entityIB.GetType(), ECE_NONE, RF_DEFAULT ) );
1315
1316 if ( new_item )
1317 {
1318 MiscGameplayFunctions.TransferItemProperties(entityIB, new_item);
1319 entityIB.AddQuantity( -1 );
1320 new_item.SetQuantity( 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 {
1333 position[1] = position[1] + 0.1;
1334 spltDst.SetGroundEx(entity, position, direction);
1335
1336 ItemBase splitItem = entityIB.SplitIntoStackMaxToInventoryLocationEx( spltDst );
1337 splitItem.ThrowPhysically(null, force, false);
1338 }
1339 }
1340
1342 entityInventory.GetCurrentInventoryLocation(src);
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);
1351 dBodyApplyImpulse(entity, force);
1352 }
1353 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
const int ECE_NONE
Определения CentralEconomy.c:7
const int RF_DEFAULT
Определения CentralEconomy.c:66
DayZGame g_Game
Определения DayZGame.c:4074
vector position
Определения DustKickupEffects.c:20
ThrowEntityFlags
Определения MiscGameplayFunctions.c:208
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
InventoryLocation.
Определения InventoryLocation.c:30
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfBricks.c:64
override bool CanBeSplit()
Определения Rag.c:34
proto void dBodyApplyImpulse(notnull IEntity body, vector impulse)
Applies impuls on a rigidbody (origin)

Перекрестные ссылки ItemBase::CanBeSplit(), dBodyApplyImpulse(), GameInventory::DropEntity(), ECE_NONE, g_Game, GameInventory::GetCurrentInventoryLocation(), GameInventory::LocationCreateEntity(), position, RF_DEFAULT, InventoryLocation::SetGroundEx(), ItemBase::SetQuantity() и GameInventory::TakeToDst().

Используется в ThrowAllItemsInInventoryEx().