398 {
399 if (!item_name)
400 {
401 return;
402 }
404 {
405 float rowDist = 0;
406 float columnDist = 0;
407
408 vector playerPos;
409 vector camDirForward;
410
412
413 vector camDirRight = camDirForward.
Perpend() * -1;
414 int countLoop = 0;
415 for (int i = 0; i < rows; i++)
416 {
417 vector posRow = playerPos + camDirForward * rowDist;
418 vector offsetSide;
419 columnDist = 0;
420 for (int j = 0; j < columns; j++)
421 {
422 offsetSide = camDirRight * columnDist;
423 vector placement = posRow + offsetSide;
424 float hlth = health * MiscGameplayFunctions.GetTypeMaxGlobalHealth( item_name );
426 ent.PlaceOnSurface();
427
428 InventoryItem item;
429 if (Class.CastTo(item, ent) && withPhysics)
430 item.ThrowPhysically(null, "0 0 0");
431
432 countLoop++;
433 if (countLoop == count)
434 {
435 return;
436 }
437 columnDist += gapColumn;
438 }
439 rowDist += gapRow;
440 }
441 }
442 else
443 {
444 auto params = new Param10<string, int, float, float, int, int, float, float, bool, bool>(item_name, count, health, quantity, rows, columns, gapRow, gapColumn, special, withPhysics);
445 player.RPCSingleParam(
ERPCs.DEV_RPC_SPAWN_ITEM_ON_GROUND_PATTERN_GRID, params,
true);
446 }
447 }
EntityAI SpawnEntityOnGroundPos(PlayerBase player, string object_name, vector pos)
void GetCameraDirections(Man player, bool allowFreeflight, out vector position, out vector direction)
vector Perpend()
Returns perpendicular vector. Perpendicular vector is computed as cross product between input vector ...